diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs index 1fecb1d01a..97689b96f4 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - //AddIngredient(4). - //AddTile(TileID.WorkBenches). - //Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Walls/WulfrumPlatingWall.cs b/Items/Placeables/Walls/WulfrumPlatingWall.cs new file mode 100644 index 0000000000..aae4c868da --- /dev/null +++ b/Items/Placeables/Walls/WulfrumPlatingWall.cs @@ -0,0 +1,38 @@ +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumPlatingWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumPlatingWall.png b/Items/Placeables/Walls/WulfrumPlatingWall.png new file mode 100644 index 0000000000..22d0216af5 Binary files /dev/null and b/Items/Placeables/Walls/WulfrumPlatingWall.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 894da34193..2fbd25ab91 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -289,6 +289,11 @@ EutrophicSand: { Tooltip: "" } +HardenedEutrophicSand: { + DisplayName: Hardened Eutrophic Sand + Tooltip: "" +} + AbyssTreasureChest: { DisplayName: Ancient Treasure Chest Tooltip: "" @@ -3351,8 +3356,8 @@ VoidstoneWall: { Tooltip: "" } -HardenedEutrophicSand: { - DisplayName: Hardened Eutrophic Sand +WulfrumPlatingWall: { + DisplayName: Wulfrum Plating Wall Tooltip: "" } @@ -3452,4 +3457,4 @@ WaterTurret: { Shoots high-speed water blasts at nearby enemies Cannot attack while a boss is alive ''' -} +} \ No newline at end of file diff --git a/Walls/WulfrumPlatingWall.cs b/Walls/WulfrumPlatingWall.cs new file mode 100644 index 0000000000..de6d2eee81 --- /dev/null +++ b/Walls/WulfrumPlatingWall.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumPlatingWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(83, 92, 62)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D sprite =TextureAssets.Wall[Type].Value; + Color lightColor = GetWallColour(i, j); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + zero -= new Vector2(8, 8); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + return false; + } + + private int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 2, j % 2 }; + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return sheetOffset; + } + + private Color GetWallColour(int i, int j) + { + int colType = Main.tile[i, j].WallColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + } +} diff --git a/Walls/WulfrumPlatingWall.png b/Walls/WulfrumPlatingWall.png new file mode 100644 index 0000000000..fb98b5631b Binary files /dev/null and b/Walls/WulfrumPlatingWall.png differ