IVisibleThroughWater integration
This commit is contained in:
1 parent
e7420814e3
commit
09f2adaed0
7 files changed
+20
-55
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads things which need to be instantiated later in the load order.
|
||||
/// </summary>
|
||||
public override void AddRecipes()
|
||||
{
|
||||
WallVisibleThroughWater.InitializeWaterMapEntryLookups();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unloads all IL Editing changes in the mod.
|
||||
/// </summary>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds the map entry, and further entries for being covered in water.
|
||||
/// Please use this over AddMapEntry in walls which utilize this base class.
|
||||
/// </summary>
|
||||
/// <param name="baseColor"></param>
|
||||
/// <param name="text"></param>
|
||||
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<WallVisibleThroughWater>())
|
||||
{
|
||||
int lookup = MapHelper.wallLookup[wall.Type];
|
||||
wall.WaterMapEntry = lookup + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user