using System; using System.Collections.Generic; using System.Reflection; using Terraria; using Terraria.Graphics; using Terraria.ModLoader; namespace CalamityMod.Systems { public abstract class CalamityModWaterStyle : ModWaterStyle { /// /// Allows water styles to manipulate what color the liquid is drawn to, this can allow waters to be see-throughable to see backgrounds (surface and underground backgrounds not walls) /// /// X position of the water /// Y position of the water /// The vertexColor of the water color, this is both used to get the current color and to set the color of the water public virtual void DrawColor(int x, int y, ref VertexColors liquidColor, bool isSlope) { } /// /// Allows you to determine how much light this water emits.
/// It can also let you light up the block in front of this water.
/// See for vanilla tile light values to use as a reference.
///
/// The x position in tile coordinates. /// The y position in tile coordinates. /// The red component of light, usually a value between 0 and 1 /// The green component of light, usually a value between 0 and 1 /// The blue component of light, usually a value between 0 and 1 public virtual void ModifyLight(ref readonly Tile tile, int i, int j, ref float r, ref float g, ref float b) { } } internal static class CalamityWaterLoader { internal static void ModifyLightSetup(ref readonly Tile tile, int i, int j, int type, ref float r, ref float g, ref float b) { CalamityModWaterStyle styles = (CalamityModWaterStyle)LoaderManager.Get().Get(type); if (styles != null) { styles?.ModifyLight(in tile, i, j, ref r, ref g, ref b); } } internal static void DrawColorSetup(int x, int y, int type, ref VertexColors liquidColor, bool isSlope = false) { CalamityModWaterStyle styles = (CalamityModWaterStyle)LoaderManager.Get().Get(type); if (styles != null) { styles?.DrawColor(x, y, ref liquidColor, isSlope); } } } }