diff --git a/Items/Placeables/BrimstoneSlab.cs b/Items/Placeables/BrimstoneSlab.cs new file mode 100644 index 0000000000..aa4e9ddb99 --- /dev/null +++ b/Items/Placeables/BrimstoneSlab.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables +{ + public class BrimstoneSlab : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(ModContent.ItemType()). + AddTile(TileID.HeavyWorkBench). + Register(); + } + + } +} diff --git a/Items/Placeables/BrimstoneSlab.png b/Items/Placeables/BrimstoneSlab.png new file mode 100644 index 0000000000..589e97e933 Binary files /dev/null and b/Items/Placeables/BrimstoneSlab.png differ diff --git a/Items/Placeables/Walls/BrimstoneSlabWall.cs b/Items/Placeables/Walls/BrimstoneSlabWall.cs new file mode 100644 index 0000000000..c5a3a6538f --- /dev/null +++ b/Items/Placeables/Walls/BrimstoneSlabWall.cs @@ -0,0 +1,33 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class BrimstoneSlabWall : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 400; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + 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(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + } + } +} diff --git a/Items/Placeables/Walls/BrimstoneSlabWall.png b/Items/Placeables/Walls/BrimstoneSlabWall.png new file mode 100644 index 0000000000..f96b4fa29f Binary files /dev/null and b/Items/Placeables/Walls/BrimstoneSlabWall.png differ diff --git a/Tiles/Crags/BrimstoneSlab.cs b/Tiles/Crags/BrimstoneSlab.cs new file mode 100644 index 0000000000..40cf6823dc --- /dev/null +++ b/Tiles/Crags/BrimstoneSlab.cs @@ -0,0 +1,53 @@ +using CalamityMod.Tiles.Crags; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Crags +{ + public class BrimstoneSlab : ModTile + { + private int sheetWidth = 450; + private int sheetHeight = 270; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithHell(Type); + + ItemDrop = ModContent.ItemType(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Brimstone Slab"); + AddMapEntry(new Color(79, 55, 70), name); + MineResist = 3f; + MinPick = 100; + HitSound = SoundID.Tink; + DustType = 235; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = i % 2 * sheetWidth; + frameYOffset = j % 2 * sheetHeight; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BrimstoneFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/Crags/BrimstoneSlab.png b/Tiles/Crags/BrimstoneSlab.png new file mode 100644 index 0000000000..50ce6be237 Binary files /dev/null and b/Tiles/Crags/BrimstoneSlab.png differ diff --git a/Walls/BrimstoneSlabWall.cs b/Walls/BrimstoneSlabWall.cs new file mode 100644 index 0000000000..aac2e7237a --- /dev/null +++ b/Walls/BrimstoneSlabWall.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class BrimstoneSlabWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(24, 16, 29)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 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 = ModContent.Request("CalamityMod/Walls/BrimstoneSlabWall").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/BrimstoneSlabWall.png b/Walls/BrimstoneSlabWall.png new file mode 100644 index 0000000000..b98efa2860 Binary files /dev/null and b/Walls/BrimstoneSlabWall.png differ