diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index d448d79d77..52366027c3 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -3,7 +3,6 @@ using System.Reflection; using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.FurnitureExo; -using CalamityMod.Walls; using Terraria; using Terraria.DataStructures; using Terraria.GameContent; @@ -173,14 +172,6 @@ namespace CalamityMod.ILEditing //HeldOnlyItem detours Player.dropItemCheck, ItemSlot.Draw (Sb, itemarray, int, int, vector2, color) and ItemSlot.LeftClick_ItemArray to make its stuff work } - /// - /// Loads things which need to be instantiated later in the load order. - /// - public override void AddRecipes() - { - WallVisibleThroughWater.InitializeWaterMapEntryLookups(); - } - /// /// Unloads all IL Editing changes in the mod. /// diff --git a/Walls/DriftwoodWall.cs b/Walls/DriftwoodWall.cs index 247dc7e021..2ad3095d1d 100644 --- a/Walls/DriftwoodWall.cs +++ b/Walls/DriftwoodWall.cs @@ -4,13 +4,15 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class DriftwoodWall : WallVisibleThroughWater + public class DriftwoodWall : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; - AddEntries(new Color(69, 56, 58)); + this.AddMapEntryWithWaterVisibility(new Color(69, 56, 58)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/LimestoneWall.cs b/Walls/LimestoneWall.cs index 1f57ec5c49..2061ef7c8a 100644 --- a/Walls/LimestoneWall.cs +++ b/Walls/LimestoneWall.cs @@ -5,12 +5,14 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class LimestoneWall : WallVisibleThroughWater + public class LimestoneWall : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { DustType = 22; - AddEntries(new Color(147, 92, 63)); + this.AddMapEntryWithWaterVisibility(new Color(147, 92, 63)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/RunestoneWall.cs b/Walls/RunestoneWall.cs index 84d11681f3..edf0ea6b50 100644 --- a/Walls/RunestoneWall.cs +++ b/Walls/RunestoneWall.cs @@ -5,13 +5,15 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class RunestoneWall : WallVisibleThroughWater + public class RunestoneWall : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; - AddEntries(new Color(122, 59, 48)); + this.AddMapEntryWithWaterVisibility(new Color(122, 59, 48)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/ShellstoneSlabWall.cs b/Walls/ShellstoneSlabWall.cs index 2b28e7dec8..fdc7a59163 100644 --- a/Walls/ShellstoneSlabWall.cs +++ b/Walls/ShellstoneSlabWall.cs @@ -4,14 +4,16 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ShellstoneSlabWall : WallVisibleThroughWater + public class ShellstoneSlabWall : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; DustType = 24; - AddEntries(new Color(100, 127, 137)); + this.AddMapEntryWithWaterVisibility(new Color(100, 127, 137)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/ShellstoneWall.cs b/Walls/ShellstoneWall.cs index 57edd3df61..89cde319b8 100644 --- a/Walls/ShellstoneWall.cs +++ b/Walls/ShellstoneWall.cs @@ -4,14 +4,16 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ShellstoneWall : WallVisibleThroughWater + public class ShellstoneWall : ModWall, IVisibleThroughWater { + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { Main.wallHouse[Type] = false; DustType = 24; - AddEntries(new Color(74, 71, 84)); + this.AddMapEntryWithWaterVisibility(new Color(74, 71, 84)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/WallVisibleThroughWater.cs b/Walls/WallVisibleThroughWater.cs deleted file mode 100644 index 839304cf49..0000000000 --- a/Walls/WallVisibleThroughWater.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria.Localization; -using Terraria.Map; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public abstract class WallVisibleThroughWater : ModWall - { - public const float WaterTransparency = 0.5f; - public static readonly Color WaterColor = new Color(9, 61, 191); - - public int WaterMapEntry { get; private set; } - - /// - /// Adds the map entry, and further entries for being covered in water. - /// Please use this over AddMapEntry in walls which utilize this base class. - /// - /// - /// - public void AddEntries(Color baseColor, LocalizedText text = null) - { - AddMapEntry(baseColor, text); - AddMapEntry(Color.Lerp(baseColor, WaterColor, WaterTransparency), text); - } - - public static void InitializeWaterMapEntryLookups() - { - foreach (var wall in CalamityMod.Instance.GetContent()) - { - int lookup = MapHelper.wallLookup[wall.Type]; - wall.WaterMapEntry = lookup + 1; - } - } - } -}