diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index b7c99a362e..14075ce581 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Items.Placeables.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -45,6 +46,11 @@ namespace CalamityMod.Items.Placeables.FurnitureExo recipe.AddIngredient(ModContent.ItemType(), 2); recipe.SetResult(this); recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this); + recipe.AddRecipe(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs index d37594c5f0..be4f1d5e99 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Items.Placeables.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -45,6 +46,11 @@ namespace CalamityMod.Items.Placeables.FurnitureExo recipe.AddIngredient(ModContent.ItemType(), 2); recipe.SetResult(this); recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this); + recipe.AddRecipe(); } } } diff --git a/Items/Placeables/Walls/ExoPlatingWallItem.cs b/Items/Placeables/Walls/ExoPlatingWallItem.cs new file mode 100644 index 0000000000..f78d7c7071 --- /dev/null +++ b/Items/Placeables/Walls/ExoPlatingWallItem.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ExoPlatingWallItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Plating Wall"); + } + + 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.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/ExoPlatingWallItem.png b/Items/Placeables/Walls/ExoPlatingWallItem.png new file mode 100644 index 0000000000..cfdbcc5993 Binary files /dev/null and b/Items/Placeables/Walls/ExoPlatingWallItem.png differ diff --git a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs new file mode 100644 index 0000000000..e7601ec56f --- /dev/null +++ b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ExoPrismPanelWallItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Prism Panel Wall"); + } + + 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.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/ExoPrismPanelWallItem.png b/Items/Placeables/Walls/ExoPrismPanelWallItem.png new file mode 100644 index 0000000000..62a2b83eff Binary files /dev/null and b/Items/Placeables/Walls/ExoPrismPanelWallItem.png differ diff --git a/Walls/ExoPlatingWall.cs b/Walls/ExoPlatingWall.cs new file mode 100644 index 0000000000..19f818f37e --- /dev/null +++ b/Walls/ExoPlatingWall.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.Walls; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ExoPlatingWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = ModContent.ItemType(); + AddMapEntry(new Color(41, 55, 65)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 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; + } +} diff --git a/Walls/ExoPlatingWall.png b/Walls/ExoPlatingWall.png new file mode 100644 index 0000000000..d8da19a0d5 Binary files /dev/null and b/Walls/ExoPlatingWall.png differ diff --git a/Walls/ExoPrismPanelWall.cs b/Walls/ExoPrismPanelWall.cs new file mode 100644 index 0000000000..2444afe884 --- /dev/null +++ b/Walls/ExoPrismPanelWall.cs @@ -0,0 +1,77 @@ +using CalamityMod.Items.Placeables.Walls; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ExoPrismPanelWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = ModContent.ItemType(); + AddMapEntry(new Color(41, 55, 65)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 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 = Main.wallTexture[Type]; + 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] { 0, (i + j) % 6 }; + 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/ExoPrismPanelWall.png b/Walls/ExoPrismPanelWall.png new file mode 100644 index 0000000000..40ea79558c Binary files /dev/null and b/Walls/ExoPrismPanelWall.png differ