diff --git a/CalamityMod.cs b/CalamityMod.cs index 5806606698..221c974b64 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1567,66 +1567,66 @@ namespace CalamityMod calamity.TileType("AshenTable"), calamity.TileType("AshenWorkbench"), calamity.TileType("BotanicBathtub"), - calamity.TileType("CosmiliteBath"), - calamity.TileType("EutrophicBathtub"), - calamity.TileType("OccultBathtub"), - calamity.TileType("PlaguedPlateBathtub"), - calamity.TileType("ProfanedBath"), - calamity.TileType("SilvaBathtub"), - calamity.TileType("StatigelBath"), - calamity.TileType("StratusBathtub"), - calamity.TileType("VoidBath"), - calamity.TileType("VoidBookcase"), + calamity.TileType("BotanicBookcase"), + calamity.TileType("BotanicDresser"), + calamity.TileType("BotanicPiano"), + calamity.TileType("BotanicTable"), + calamity.TileType("BotanicWorkBench"), + calamity.TileType("CosmiliteBath"), + calamity.TileType("CosmiliteBookcase"), + calamity.TileType("CosmiliteDresser"), + calamity.TileType("CosmilitePiano"), + calamity.TileType("CosmiliteTable"), + calamity.TileType("CosmiliteWorkbench"), + calamity.TileType("EutrophicBathtub"), + calamity.TileType("EutrophicBookcase"), + calamity.TileType("EutrophicDresser"), + calamity.TileType("EutrophicPiano"), + calamity.TileType("EutrophicTable"), + calamity.TileType("EutrophicWorkBench"), + calamity.TileType("OccultBathtub"), + calamity.TileType("OccultBookcase"), + calamity.TileType("OccultDresser"), + calamity.TileType("OccultPiano"), + calamity.TileType("OccultTable"), + calamity.TileType("OccultWorkBench"), + calamity.TileType("PlaguedPlateBathtub"), + calamity.TileType("PlaguedPlateBookcase"), + calamity.TileType("PlaguedPlateDresser"), + calamity.TileType("PlaguedPlatePiano"), + calamity.TileType("PlaguedPlateTable"), + calamity.TileType("PlaguedPlateWorkbench"), + calamity.TileType("ProfanedBath"), + calamity.TileType("ProfanedBookcase"), + calamity.TileType("ProfanedDresser"), + calamity.TileType("ProfanedPiano"), + calamity.TileType("ProfanedTable"), + calamity.TileType("ProfanedWorkbench"), + calamity.TileType("SilvaBathtub"), + calamity.TileType("SilvaBookcase"), + calamity.TileType("SilvaDresser"), + calamity.TileType("SilvaPiano"), + calamity.TileType("SilvaTable"), + calamity.TileType("SilvaWorkBench"), + calamity.TileType("StatigelBath"), + calamity.TileType("StatigelBookcase"), + calamity.TileType("StatigelDresser"), + calamity.TileType("StatigelPiano"), + calamity.TileType("StatigelTable"), + calamity.TileType("StatigelWorkbench"), + calamity.TileType("StratusBathtub"), calamity.TileType("StratusBookcase"), - calamity.TileType("StatigelBookcase"), - calamity.TileType("SilvaBookcase"), - calamity.TileType("ProfanedBookcase"), - calamity.TileType("PlaguedPlateBookcase"), - calamity.TileType("OccultBookcase"), - calamity.TileType("EutrophicBookcase"), - calamity.TileType("CosmiliteBookcase"), - calamity.TileType("BotanicBookcase"), - calamity.TileType("VoidDresser"), calamity.TileType("StratusDresser"), - calamity.TileType("StatigelDresser"), - calamity.TileType("SilvaDresser"), - calamity.TileType("ProfanedDresser"), - calamity.TileType("PlaguedPlateDresser"), - calamity.TileType("OccultDresser"), - calamity.TileType("EutrophicDresser"), - calamity.TileType("CosmiliteDresser"), - calamity.TileType("BotanicDresser"), - calamity.TileType("VoidPiano"), calamity.TileType("StratusPiano"), - calamity.TileType("StatigelPiano"), - calamity.TileType("SilvaPiano"), - calamity.TileType("ProfanedPiano"), - calamity.TileType("PlaguedPlatePiano"), - calamity.TileType("OccultPiano"), - calamity.TileType("EutrophicPiano"), - calamity.TileType("CosmilitePiano"), - calamity.TileType("BotanicPiano"), - calamity.TileType("VoidTable"), calamity.TileType("StratusTable"), - calamity.TileType("StatigelTable"), - calamity.TileType("SilvaTable"), - calamity.TileType("ProfanedTable"), - calamity.TileType("PlaguedPlateTable"), - calamity.TileType("OccultTable"), - calamity.TileType("EutrophicTable"), - calamity.TileType("CosmiliteTable"), - calamity.TileType("BotanicTable"), - calamity.TileType("VoidWorkbench"), calamity.TileType("StratusWorkbench"), - calamity.TileType("StatigelWorkbench"), - calamity.TileType("SilvaWorkBench"), - calamity.TileType("ProfanedWorkbench"), - calamity.TileType("PlaguedPlateWorkbench"), - calamity.TileType("OccultWorkbench"), - calamity.TileType("EutrophicWorkBench"), - calamity.TileType("CosmiliteWorkbench"), - calamity.TileType("BotanicWorkBench") - }; + calamity.TileType("VoidBath"), + calamity.TileType("VoidBookcase"), + calamity.TileType("VoidDresser"), + calamity.TileType("VoidPiano"), + calamity.TileType("VoidTable"), + calamity.TileType("VoidWorkbench") + }; chairList = new List() { @@ -1639,36 +1639,37 @@ namespace CalamityMod calamity.TileType("AshenBed"), calamity.TileType("AshenChair"), calamity.TileType("AshenSofa"), - calamity.TileType("StratusBed"), - calamity.TileType("VoidBed"), - calamity.TileType("StatigelBed"), - calamity.TileType("SilvaBed"), - calamity.TileType("ProfanedBed"), - calamity.TileType("PlaguedPlateBed"), - calamity.TileType("OccultBed"), - calamity.TileType("EutrophicBed"), - calamity.TileType("CosmiliteBed"), - calamity.TileType("VoidChair"), - calamity.TileType("StatusChair"), - calamity.TileType("StatigelChair"), - calamity.TileType("SilvaChair"), - calamity.TileType("ProfanedChair"), - calamity.TileType("PlaguedPlateChair"), - calamity.TileType("OccultChair"), - calamity.TileType("EutrophicChair"), - calamity.TileType("CosmiliteChair"), - calamity.TileType("BotanicChair"), - calamity.TileType("VoidSofa"), - calamity.TileType("StatusSofa"), - calamity.TileType("StatigelSofa"), - calamity.TileType("PlaguedPlateSofa"), - calamity.TileType("OccultSofa"), - calamity.TileType("CosmiliteSofa"), - calamity.TileType("SilvaBench"), - calamity.TileType("ProfanedBench"), - calamity.TileType("EutrophicBench"), - calamity.TileType("BotanicBench") - }; + calamity.TileType("BotanicBed"), + calamity.TileType("BotanicBench"), + calamity.TileType("BotanicChair"), + calamity.TileType("CosmiliteBed"), + calamity.TileType("CosmiliteChair"), + calamity.TileType("CosmiliteSofa"), + calamity.TileType("EutrophicBed"), + calamity.TileType("EutrophicBench"), + calamity.TileType("EutrophicChair"), + calamity.TileType("OccultBed"), + calamity.TileType("OccultChair"), + calamity.TileType("OccultSofa"), + calamity.TileType("PlaguedPlateBed"), + calamity.TileType("PlaguedPlateChair"), + calamity.TileType("PlaguedPlateSofa"), + calamity.TileType("ProfanedBed"), + calamity.TileType("ProfanedChair"), + calamity.TileType("ProfanedBench"), + calamity.TileType("SilvaBed"), + calamity.TileType("SilvaChair"), + calamity.TileType("SilvaBench"), + calamity.TileType("StatigelBed"), + calamity.TileType("StatigelChair"), + calamity.TileType("StatigelSofa"), + calamity.TileType("StratusBed"), + calamity.TileType("StratusChair"), + calamity.TileType("StratusSofa"), + calamity.TileType("VoidBed"), + calamity.TileType("VoidChair"), + calamity.TileType("VoidSofa") + }; lightList = new List() { @@ -1680,6 +1681,7 @@ namespace CalamityMod calamity.TileType("TranquilityCandle"), calamity.TileType("YellowCandle"), calamity.TileType("SeaPrismCrystals"), + calamity.TileType("AbyssCandelabra"), calamity.TileType("AbyssCandle"), calamity.TileType("AbyssChandelier"), @@ -1697,103 +1699,102 @@ namespace CalamityMod calamity.TileType("AshenCandle"), calamity.TileType("AshenCandelabra"), calamity.TileType("AshenLamp"), - calamity.TileType("AshenLantern"), - calamity.TileType("PlaguedPlateBasin"), - calamity.TileType("ProfanedBasin"), - calamity.TileType("SilvaBasin"), - calamity.TileType("CosmiliteBasin"), - calamity.TileType("VoidChandelier"), - calamity.TileType("StratusChandelier"), - calamity.TileType("StatigelChandelier"), - calamity.TileType("SilvaChandelier"), - calamity.TileType("ProfanedChandelier"), - calamity.TileType("PlaguedPlateChandelier"), - calamity.TileType("OccultChandelier"), - calamity.TileType("EutrophicChandelier"), - calamity.TileType("CosmiliteChandelier"), - calamity.TileType("BotanicChandelier"), - calamity.TileType("VoidCandle"), - calamity.TileType("StratusCandle"), + calamity.TileType("AshenLantern"), + calamity.TileType("BotanicCandle"), + calamity.TileType("BotanicCandelabra"), + calamity.TileType("BotanicChandelier"), + calamity.TileType("BotanicLamp"), + calamity.TileType("BotanicLantern"), + calamity.TileType("CosmiliteCandle"), + calamity.TileType("CosmiliteCandelabra"), + calamity.TileType("CosmiliteChandelier"), + calamity.TileType("CosmiliteLamp"), + calamity.TileType("CosmiliteLantern"), + calamity.TileType("CosmiliteSconce"), + calamity.TileType("EutrophicCandle"), + calamity.TileType("EutrophicCandelabra"), + calamity.TileType("EutrophicChandelier"), + calamity.TileType("EutrophicLamp"), + calamity.TileType("EutrophicLantern"), + calamity.TileType("PlaguedPlateBasin"), + calamity.TileType("PlaguedPlateCandle"), + calamity.TileType("PlaguedPlateCandelabra"), + calamity.TileType("PlaguedPlateChandelier"), + calamity.TileType("PlaguedPlateLamp"), + calamity.TileType("PlaguedPlateLantern"), + calamity.TileType("OccultCandle"), + calamity.TileType("OccultCandelabra"), + calamity.TileType("OccultChandelier"), + calamity.TileType("OccultLamp"), + calamity.TileType("OccultLantern"), + calamity.TileType("ProfanedBasin"), + calamity.TileType("ProfanedCandle"), + calamity.TileType("ProfanedCandelabra"), + calamity.TileType("ProfanedChandelier"), + calamity.TileType("ProfanedLamp"), + calamity.TileType("ProfanedLantern"), + calamity.TileType("SilvaBasin"), + calamity.TileType("SilvaCandle"), + calamity.TileType("SilvaCandelabra"), + calamity.TileType("SilvaChandelier"), + calamity.TileType("SilvaLamp"), + calamity.TileType("SilvaLantern"), + calamity.TileType("StatigelChandelier"), calamity.TileType("StatigelCandle"), - calamity.TileType("SilvaCandle"), - calamity.TileType("ProfanedCandle"), - calamity.TileType("PlaguedPlateCandle"), - calamity.TileType("OccultCandle"), - calamity.TileType("EutrophicCandle"), - calamity.TileType("CosmiliteCandle"), - calamity.TileType("BotanicCandle"), - calamity.TileType("VoidCandelabra"), - calamity.TileType("StratusCandelabra"), calamity.TileType("StatigelCandelabra"), - calamity.TileType("SilvaCandelabra"), - calamity.TileType("ProfanedCandelabra"), - calamity.TileType("PlaguedPlateCandelabra"), - calamity.TileType("OccultCandelabra"), - calamity.TileType("EutrophicCandelabra"), - calamity.TileType("CosmiliteCandelabra"), - calamity.TileType("BotanicCandelabra"), - calamity.TileType("VoidLamp"), - calamity.TileType("StratusLamp"), calamity.TileType("StatigelLamp"), - calamity.TileType("SilvaLamp"), - calamity.TileType("ProfanedLamp"), - calamity.TileType("PlaguedPlateLamp"), - calamity.TileType("OccultLamp"), - calamity.TileType("EutrophicLamp"), - calamity.TileType("CosmiliteLamp"), - calamity.TileType("BotanicLamp"), - calamity.TileType("VoidLantern"), - calamity.TileType("StratusLantern"), calamity.TileType("StatigelLantern"), - calamity.TileType("SilvaLantern"), - calamity.TileType("ProfanedLantern"), - calamity.TileType("PlaguedPlateLantern"), - calamity.TileType("OccultLantern"), - calamity.TileType("EutrophicLantern"), - calamity.TileType("CosmiliteLantern"), - calamity.TileType("BotanicLantern"), - calamity.TileType("CosmiliteSconce") - }; + calamity.TileType("StratusCandle"), + calamity.TileType("StratusCandelabra"), + calamity.TileType("StratusChandelier"), + calamity.TileType("StratusLantern"), + calamity.TileType("StratusLamp"), + calamity.TileType("VoidCandle"), + calamity.TileType("VoidCandelabra"), + calamity.TileType("VoidChandelier"), + calamity.TileType("VoidLamp"), + calamity.TileType("VoidLantern") + }; doorList = new List() - { - calamity.TileType("SmoothVoidstonePlatform"), + { + calamity.TileType("AbyssDoorOpen"), + calamity.TileType("AbyssDoorClosed"), + calamity.TileType("AncientDoorOpen"), + calamity.TileType("AncientDoorClosed"), + calamity.TileType("AshenDoorClosed"), + calamity.TileType("AshenDoorOpen"), + calamity.TileType("AshenPlatform"), + calamity.TileType("BotanicDoorOpen"), + calamity.TileType("BotanicDoorClosed"), + calamity.TileType("BotanicPlatform"), + calamity.TileType("CosmiliteDoorOpen"), + calamity.TileType("CosmiliteDoorClosed"), + calamity.TileType("CosmilitePlatform"), + calamity.TileType("EutrophicDoorOpen"), + calamity.TileType("EutrophicDoorClosed"), + calamity.TileType("EutrophicPlatform"), + calamity.TileType("OccultDoorOpen"), + calamity.TileType("OccultDoorClosed"), + calamity.TileType("OccultPlatform"), + calamity.TileType("PlaguedPlateDoorOpen"), + calamity.TileType("PlaguedPlateDoorClosed"), + calamity.TileType("PlaguedPlatePlatform"), + calamity.TileType("ProfanedDoorOpen"), + calamity.TileType("ProfanedDoorClosed"), + calamity.TileType("ProfanedPlatform"), + calamity.TileType("SilvaDoorOpen"), + calamity.TileType("SilvaDoorClosed"), + calamity.TileType("SilvaPlatform"), + calamity.TileType("SmoothAbyssGravelPlatform"), + calamity.TileType("SmoothVoidstonePlatform"), + calamity.TileType("StratusDoorOpen"), + calamity.TileType("StratusDoorClosed"), + calamity.TileType("StatigelPlatform"), calamity.TileType("StratusPlatform"), - calamity.TileType("StatigelPlatform"), - calamity.TileType("SilvaPlatform"), - calamity.TileType("ProfanedPlatform"), - calamity.TileType("PlaguedPlatePlatform"), - calamity.TileType("OccultPlatform"), - calamity.TileType("EutrophicPlatform"), - calamity.TileType("CosmilitePlatform"), - calamity.TileType("BotanicPlatform"), - calamity.TileType("AshenPlatform"), - calamity.TileType("SmoothAbyssGravelPlatform"), - calamity.TileType("VoidDoorOpen"), - calamity.TileType("VoidDoorClosed"), - calamity.TileType("StratusDoorOpen"), - calamity.TileType("StratusDoorClosed"), - calamity.TileType("SilvaDoorOpen"), - calamity.TileType("SilvaDoorClosed"), - calamity.TileType("ProfanedDoorOpen"), - calamity.TileType("ProfanedDoorClosed"), - calamity.TileType("PlaguedPlateDoorOpen"), - calamity.TileType("PlaguedPlateDoorClosed"), - calamity.TileType("OccultDoorOpen"), - calamity.TileType("OccultDoorClosed"), - calamity.TileType("EutrophicDoorOpen"), - calamity.TileType("EutrophicDoorClosed"), - calamity.TileType("CosmiliteDoorOpen"), - calamity.TileType("CosmiliteDoorClosed"), - calamity.TileType("BotanicDoorOpen"), - calamity.TileType("BotanicDoorClosed"), - calamity.TileType("AshenDoorClosed"), - calamity.TileType("AshenDoorOpen"), - calamity.TileType("AncientDoorOpen"), - calamity.TileType("AncientDoorClosed"), - calamity.TileType("AbyssDoorOpen"), - calamity.TileType("AbyssDoorClosed") - }; + calamity.TileType("VoidDoorOpen"), + calamity.TileType("VoidDoorClosed") + }; zombieList = new List() { diff --git a/Items/AshenKey.cs b/Items/AshenKey.cs deleted file mode 100644 index 19c070e2e1..0000000000 --- a/Items/AshenKey.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class AshenKey : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Used in crafting to lock/unlock ashen chests"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 99; - item.value = 100; - item.rare = 1; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldenKey); - recipe.SetResult(this, 1); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} diff --git a/Items/AshenKey.png b/Items/AshenKey.png deleted file mode 100644 index 22332b8bbb..0000000000 Binary files a/Items/AshenKey.png and /dev/null differ diff --git a/Items/BrimstoneKey.cs b/Items/BrimstoneKey.cs index a49310ece4..12f426bfbc 100644 --- a/Items/BrimstoneKey.cs +++ b/Items/BrimstoneKey.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Items { public override void SetStaticDefaults() { - Tooltip.SetDefault("Grants access to Locked Ashen Chests"); + Tooltip.SetDefault("Opens locked ashen chests"); } public override void SetDefaults() @@ -18,14 +18,5 @@ namespace CalamityMod.Items item.value = 100; item.rare = 1; } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShadowKey); - recipe.SetResult(this, 1); - recipe.AddTile(18); - recipe.AddRecipe(); - } } } diff --git a/Items/Placeables/AerialiteBrick.png b/Items/Placeables/AerialiteBrick.png index c90f370195..2ba281c6b7 100644 Binary files a/Items/Placeables/AerialiteBrick.png and b/Items/Placeables/AerialiteBrick.png differ diff --git a/Items/Placeables/AerialiteBrickWall.png b/Items/Placeables/AerialiteBrickWall.png index 1dd61827e3..4a823c9232 100644 Binary files a/Items/Placeables/AerialiteBrickWall.png and b/Items/Placeables/AerialiteBrickWall.png differ diff --git a/Items/Placeables/AstralDirt.png b/Items/Placeables/AstralDirt.png index f8c3da4d73..e52e90eb26 100644 Binary files a/Items/Placeables/AstralDirt.png and b/Items/Placeables/AstralDirt.png differ diff --git a/Items/Placeables/AstralDirtWall.png b/Items/Placeables/AstralDirtWall.png index ce1e33e02b..3a5624028a 100644 Binary files a/Items/Placeables/AstralDirtWall.png and b/Items/Placeables/AstralDirtWall.png differ diff --git a/Items/Placeables/AstralIce.png b/Items/Placeables/AstralIce.png index 4bb1c4ead4..bdf945c1c6 100644 Binary files a/Items/Placeables/AstralIce.png and b/Items/Placeables/AstralIce.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenChest.cs b/Items/Placeables/FurnitureAshen/AshenChest.cs index e140ac90db..0bef3ff2ea 100644 --- a/Items/Placeables/FurnitureAshen/AshenChest.cs +++ b/Items/Placeables/FurnitureAshen/AshenChest.cs @@ -34,13 +34,6 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.SetResult(this, 1); recipe.AddTile(null, "AshenAltar"); recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("LockedAshenChest"), 1); - recipe.AddIngredient(mod.GetItem("AshenKey"), 1); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); } } } diff --git a/Items/Placeables/FurnitureAshen/LockedAshenChest.cs b/Items/Placeables/FurnitureAshen/LockedAshenChest.cs deleted file mode 100644 index a2d472c245..0000000000 --- a/Items/Placeables/FurnitureAshen/LockedAshenChest.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.FurnitureAshen -{ - public class LockedAshenChest : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 3; - item.value = 0; - item.createTile = mod.TileType("AshenChestLocked"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SmoothBrimstoneSlag", 8); - recipe.AddIngredient(ItemID.IronBar, 2); - recipe.AddIngredient(mod.GetItem("AshenKey"), 1); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("AshenChest"), 1); - recipe.AddIngredient(mod.GetItem("AshenKey"), 1); - recipe.anyIronBar = true; - recipe.SetResult(this, 1); - recipe.AddTile(null, "AshenAltar"); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Placeables/FurnitureAshen/LockedAshenChest.png b/Items/Placeables/FurnitureAshen/LockedAshenChest.png deleted file mode 100644 index 36ef060a8a..0000000000 Binary files a/Items/Placeables/FurnitureAshen/LockedAshenChest.png and /dev/null differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBath.png b/Items/Placeables/FurnitureProfaned/ProfanedBath.png index 3456120821..35c2fb8eb4 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedBath.png and b/Items/Placeables/FurnitureProfaned/ProfanedBath.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBed.png b/Items/Placeables/FurnitureProfaned/ProfanedBed.png index c24b7b394c..e1ca238fbd 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedBed.png and b/Items/Placeables/FurnitureProfaned/ProfanedBed.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBench.png b/Items/Placeables/FurnitureProfaned/ProfanedBench.png index a9e78d38a3..8836e4c6d0 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedBench.png and b/Items/Placeables/FurnitureProfaned/ProfanedBench.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.png b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.png index ab629b038c..a661e42d42 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.png and b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.png b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.png index d4938e6d8a..5da353e615 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.png and b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandle.png b/Items/Placeables/FurnitureProfaned/ProfanedCandle.png index 90a3441da2..2c0445e34a 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedCandle.png and b/Items/Placeables/FurnitureProfaned/ProfanedCandle.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChair.png b/Items/Placeables/FurnitureProfaned/ProfanedChair.png index 2e4cb1f12a..5a4b7a81c3 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedChair.png and b/Items/Placeables/FurnitureProfaned/ProfanedChair.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.png b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.png index 45aec26ba9..2818b9bafb 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.png and b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChest.png b/Items/Placeables/FurnitureProfaned/ProfanedChest.png index ba4e9da5b6..3957398a4d 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedChest.png and b/Items/Placeables/FurnitureProfaned/ProfanedChest.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedClock.png b/Items/Placeables/FurnitureProfaned/ProfanedClock.png index cdd74e5b97..084b58438b 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedClock.png and b/Items/Placeables/FurnitureProfaned/ProfanedClock.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDoor.png b/Items/Placeables/FurnitureProfaned/ProfanedDoor.png index 76a73747df..3e4e7cec6d 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedDoor.png and b/Items/Placeables/FurnitureProfaned/ProfanedDoor.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDresser.png b/Items/Placeables/FurnitureProfaned/ProfanedDresser.png index 7af1b295c0..f4fd5edbd5 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedDresser.png and b/Items/Placeables/FurnitureProfaned/ProfanedDresser.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLamp.png b/Items/Placeables/FurnitureProfaned/ProfanedLamp.png index 73fd8cb549..bcfaa7f7bf 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedLamp.png and b/Items/Placeables/FurnitureProfaned/ProfanedLamp.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLantern.png b/Items/Placeables/FurnitureProfaned/ProfanedLantern.png index aa62b3234d..76d19a300a 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedLantern.png and b/Items/Placeables/FurnitureProfaned/ProfanedLantern.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPiano.png b/Items/Placeables/FurnitureProfaned/ProfanedPiano.png index 0819ea37a6..4a31fc57a6 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedPiano.png and b/Items/Placeables/FurnitureProfaned/ProfanedPiano.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSink.png b/Items/Placeables/FurnitureProfaned/ProfanedSink.png index 426985961d..61f904bbf0 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedSink.png and b/Items/Placeables/FurnitureProfaned/ProfanedSink.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedTable.png b/Items/Placeables/FurnitureProfaned/ProfanedTable.png index 4f44df5866..6371e83855 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedTable.png and b/Items/Placeables/FurnitureProfaned/ProfanedTable.png differ diff --git a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.png b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.png index ec9ce7fc8a..2e51c89205 100644 Binary files a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.png and b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.png differ diff --git a/Items/Placeables/UelibloomBrick.png b/Items/Placeables/UelibloomBrick.png index cac6c89774..150c78e7b8 100644 Binary files a/Items/Placeables/UelibloomBrick.png and b/Items/Placeables/UelibloomBrick.png differ diff --git a/Items/Placeables/UelibloomBrickWall.png b/Items/Placeables/UelibloomBrickWall.png index 277e62a8df..2109b2197c 100644 Binary files a/Items/Placeables/UelibloomBrickWall.png and b/Items/Placeables/UelibloomBrickWall.png differ diff --git a/Tiles/AbyssGravel.cs b/Tiles/AbyssGravel.cs index 2152e512a0..7e5d9f9f7a 100644 --- a/Tiles/AbyssGravel.cs +++ b/Tiles/AbyssGravel.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -9,8 +10,12 @@ namespace CalamityMod.Tiles public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileMergeDirt[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAbyssTiles(Type); + drop = mod.ItemType("AbyssGravel"); AddMapEntry(new Color(0, 0, 0)); mineResist = 10f; diff --git a/Tiles/AbyssGravel.png b/Tiles/AbyssGravel.png index 4257b79674..1ce3ac3347 100644 Binary files a/Tiles/AbyssGravel.png and b/Tiles/AbyssGravel.png differ diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index 891a3b4594..3b28560682 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using Terraria.ID; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,7 +12,6 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; minPick = 50; drop = mod.ItemType("AerialiteBrick"); @@ -25,5 +24,10 @@ namespace CalamityMod.Tiles Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BetterGemsparkFraming(i, j, resetFrame); + } } } diff --git a/Tiles/AerialiteBrick.png b/Tiles/AerialiteBrick.png index 857d80dcfb..be4fb7a02e 100644 Binary files a/Tiles/AerialiteBrick.png and b/Tiles/AerialiteBrick.png differ diff --git a/Tiles/AerialiteOre.cs b/Tiles/AerialiteOre.cs index df2cab932e..6636b4b7dc 100644 --- a/Tiles/AerialiteOre.cs +++ b/Tiles/AerialiteOre.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,7 +13,10 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - dustType = mod.DustType("AHSparkle"); + + TileMerge.MergeGeneralTiles(Type); + + dustType = mod.DustType("AHSparkle"); drop = mod.ItemType("AerialiteOre"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Aerialite Ore"); diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index 9cbaa95e43..0fbb0f4457 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles @@ -34,7 +33,7 @@ namespace CalamityMod.Tiles if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) { WorldGen.KillTile(i, j, false, false, false); - if (!Main.tile[i, j].active() && Main.netMode != NetmodeID.SinglePlayer) + if (!Main.tile[i, j].active() && Main.netMode != 0) { NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); } diff --git a/Tiles/ArenaTile.png b/Tiles/ArenaTile.png index fc46459872..9843ac8e7b 100644 Binary files a/Tiles/ArenaTile.png and b/Tiles/ArenaTile.png differ diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index cdeca85a8f..bc5f6559a2 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -12,8 +12,10 @@ namespace CalamityMod.Tiles.Astral { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileMerge[Type][mod.TileType("AstralGrass")] = true; - Main.tileMerge[TileID.Dirt][Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAstralTiles(Type); + TileMerge.MergeOreTiles(Type); dustType = mod.DustType("AstralBasic"); drop = mod.ItemType("AstralDirt"); @@ -26,63 +28,18 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - bool forceSameUp = false; - bool forceSameDown = false; - bool forceSameLeft = false; - bool forceSameRight = false; - - Tile up = Main.tile[i, j - 1]; - Tile down = Main.tile[i, j + 1]; - Tile left = Main.tile[i - 1, j]; - Tile right = Main.tile[i + 1, j]; - - bool tmp; - - if (up.active() && CustomTileFraming.tileMergeAstralDirt[up.type]) - { - bool mergedDown; - CustomTileFraming.FrameTileForCustomMerge(i, j - 1, up.type, Type, out tmp, out tmp, out tmp, out mergedDown, false, false, false, false, false); - if (mergedDown) - { - forceSameUp = true; - } - } - if (left.active() && CustomTileFraming.tileMergeAstralDirt[left.type]) - { - bool mergedRight; - CustomTileFraming.FrameTileForCustomMerge(i - 1, j, left.type, Type, out tmp, out tmp, out mergedRight, out tmp, false, false, false, false, false); - if (mergedRight) - { - forceSameLeft = true; - } - } - if (right.active() && CustomTileFraming.tileMergeAstralDirt[right.type]) - { - bool mergedLeft; - CustomTileFraming.FrameTileForCustomMerge(i + 1, j, right.type, Type, out tmp, out mergedLeft, out tmp, out tmp, false, false, false, false, false); - if (mergedLeft) - { - forceSameRight = true; - } - } - if (down.active() && CustomTileFraming.tileMergeAstralDirt[down.type]) - { - bool mergedUp; - CustomTileFraming.FrameTileForCustomMerge(i, j + 1, down.type, Type, out mergedUp, out tmp, out tmp, out tmp, false, false, false, false, false); - if (mergedUp) - { - forceSameDown = true; - } - } - - CustomTileFraming.FrameTileForCustomMerge(i, j, Type, TileID.Dirt, forceSameDown, forceSameUp, forceSameLeft, forceSameRight); - + CustomTileFraming.FrameTileForCustomMergeFrom(i, j, Type); return false; } public override void RandomUpdate(int i, int j) { - if (WorldGen.genRand.Next(3) == 0) + //Make sure that astral grass only spreads to adjacent tiles, as opposed to appearing out of thin air + Tile up = Main.tile[i, j - 1]; + Tile down = Main.tile[i, j + 1]; + Tile left = Main.tile[i - 1, j]; + Tile right = Main.tile[i + 1, j]; + if (WorldGen.genRand.Next(3) == 0 && (up.type == mod.TileType("AstralGrass") || down.type == mod.TileType("AstralGrass") || left.type == mod.TileType("AstralGrass") || right.type == mod.TileType("AstralGrass"))) { WorldGen.SpreadGrass(i, j, Type, mod.TileType("AstralGrass"), false); } diff --git a/Tiles/Astral/AstralDirt.png b/Tiles/Astral/AstralDirt.png index 23651f4ce5..5231ec13e2 100644 Binary files a/Tiles/Astral/AstralDirt.png and b/Tiles/Astral/AstralDirt.png differ diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index 67b9b3188a..eb89c8f717 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.Astral { @@ -13,12 +14,14 @@ namespace CalamityMod.Tiles.Astral Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAstralTiles(Type); + TileMerge.MergeOreTiles(Type); + dustType = mod.DustType("AstralBasic"); drop = mod.ItemType("AstralDirt"); - SetModTree(new AstralTree()); - - AddMapEntry(new Color(133, 109, 140)); + AddMapEntry(new Color(133, 109, 140)); TileID.Sets.Grass[Type] = true; TileID.Sets.Conversion.Grass[Type] = true; @@ -26,6 +29,8 @@ namespace CalamityMod.Tiles.Astral //Grass framing (<3 terraria devs) TileID.Sets.NeedsGrassFraming[Type] = true; TileID.Sets.NeedsGrassFramingDirt[Type] = mod.TileType("AstralDirt"); + + SetModTree(new AstralTree()); } public override void NumDust(int i, int j, bool fail, ref int Type) @@ -40,5 +45,11 @@ namespace CalamityMod.Tiles.Astral Main.tile[i, j].type = (ushort)mod.TileType("AstralDirt"); } } + + public override int SaplingGrowthType(ref int style) + { + style = 0; + return mod.TileType("AstralTreeSapling"); + } } } diff --git a/Tiles/Astral/AstralGrass.png b/Tiles/Astral/AstralGrass.png index 1d227d6f61..184726e16c 100644 Binary files a/Tiles/Astral/AstralGrass.png and b/Tiles/Astral/AstralGrass.png differ diff --git a/Tiles/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs similarity index 63% rename from Tiles/AstralMonolith.cs rename to Tiles/Astral/AstralMonolith.cs index 232a2acc83..e030e3668a 100644 --- a/Tiles/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -1,17 +1,26 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.Astral { public class AstralMonolith : ModTile { public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAstralTiles(Type); + TileMerge.MergeTile(Type, TileID.LeafBlock); + TileMerge.MergeTile(Type, TileID.LivingMahoganyLeaves); + TileMerge.MergeTile(Type, TileID.LivingWood); + TileMerge.MergeTile(Type, TileID.LivingMahogany); + drop = mod.ItemType("AstralMonolith"); AddMapEntry(new Color(45, 36, 63)); animationFrameHeight = 270; @@ -42,10 +51,10 @@ namespace CalamityMod.Tiles yOffset = yOffset * 270; xPos += xOffset; yPos += yOffset; - Texture2D glowmask = mod.GetTexture("Tiles/AstralMonolith_Glowmask"); + Texture2D glowmask = mod.GetTexture("Tiles/Astral/AstralMonolith_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(50, 50, 50, 50); + Color drawColour = GetDrawColour (i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; Texture2D texture3 = glowmask; double num6 = Main.time * 0.08; @@ -58,5 +67,24 @@ namespace CalamityMod.Tiles Main.spriteBatch.Draw(texture3, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AstralDirt"), false, false, false, false, resetFrame); + return false; + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/Astral/AstralMonolith.png b/Tiles/Astral/AstralMonolith.png new file mode 100644 index 0000000000..744b285b19 Binary files /dev/null and b/Tiles/Astral/AstralMonolith.png differ diff --git a/Tiles/AstralMonolith_Glowmask.png b/Tiles/Astral/AstralMonolith_Glowmask.png similarity index 100% rename from Tiles/AstralMonolith_Glowmask.png rename to Tiles/Astral/AstralMonolith_Glowmask.png diff --git a/Tiles/Astral/AstralOre.cs b/Tiles/Astral/AstralOre.cs index 05bc3e10bf..f9ac26828b 100644 --- a/Tiles/Astral/AstralOre.cs +++ b/Tiles/Astral/AstralOre.cs @@ -19,6 +19,9 @@ namespace CalamityMod.Tiles.Astral Main.tileSpelunker[Type] = true; Main.tileShine2[Type] = true; + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAstralTiles(Type); + minPick = 200; dustType = 173; drop = mod.ItemType("AstralOre"); @@ -67,6 +70,12 @@ namespace CalamityMod.Tiles.Astral Lighting.AddLight(new Vector2(i * 16 + 8f, j * 16 + 8f), r * strength, g * strength, b * strength); } + public override void FloorVisuals(Player player) + { + player.AddBuff(mod.BuffType("AstralInfectionDebuff"), 1); + base.FloorVisuals(player); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AstralDirt"), false, false, false, false, resetFrame); diff --git a/Tiles/Astral/AstralOre.png b/Tiles/Astral/AstralOre.png index a18cb2987c..0aca9d80b6 100644 Binary files a/Tiles/Astral/AstralOre.png and b/Tiles/Astral/AstralOre.png differ diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 9e32933848..63513b1ddb 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -14,6 +14,10 @@ namespace CalamityMod.Tiles.Astral Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAstralTiles(Type); + TileMerge.MergeOreTiles(Type); + dustType = mod.DustType("AstralBasic"); drop = mod.ItemType("AstralStone"); diff --git a/Tiles/Astral/AstralStone.png b/Tiles/Astral/AstralStone.png index ca9d2ef334..ba1fb51b84 100644 Binary files a/Tiles/Astral/AstralStone.png and b/Tiles/Astral/AstralStone.png differ diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 609137d96e..ef7a9e01c2 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -1,5 +1,4 @@ - -using Terraria.ModLoader; +using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles diff --git a/Tiles/Astral/AstralTreeSapling.cs b/Tiles/Astral/AstralTreeSapling.cs index 0b3de75046..ad644227fa 100644 --- a/Tiles/Astral/AstralTreeSapling.cs +++ b/Tiles/Astral/AstralTreeSapling.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Tiles.Astral TileObjectData.newTile.Origin = new Point16(0, 1); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.AnchorValidTiles = new int[] { mod.TileType("AstralGrass") }; + TileObjectData.newTile.AnchorValidTiles = new[] { mod.TileType("AstralGrass") }; TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.DrawFlipHorizontal = true; TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed; diff --git a/Tiles/Astral/AstralTreeSapling.png b/Tiles/Astral/AstralTreeSapling.png index b23d88731e..dfdefe8f79 100644 Binary files a/Tiles/Astral/AstralTreeSapling.png and b/Tiles/Astral/AstralTreeSapling.png differ diff --git a/Tiles/AstralBar.cs b/Tiles/AstralBar.cs index ab2a0305f5..78a2a1bab5 100644 --- a/Tiles/AstralBar.cs +++ b/Tiles/AstralBar.cs @@ -1,6 +1,4 @@ - -using Microsoft.Xna.Framework; - +using Microsoft.Xna.Framework; using Terraria.ModLoader; using Terraria; using Terraria.ObjectData; diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index d9da0efb36..b3dc9592f7 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -2,24 +2,24 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -using Terraria.ID; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class AstralBrick : ModTile - { - public override void SetDefaults() + { + private const short subsheetWidth = 324; + private const short subsheetHeight = 90; + + public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; minPick = 150; drop = mod.ItemType("AstralBrick"); AddMapEntry(new Color(128, 128, 158)); } - int animationFrameWidth = 288; public override bool CreateDust(int i, int j, ref int type) { @@ -27,83 +27,33 @@ namespace CalamityMod.Tiles return false; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int xPos = i % 2; int yPos = j % 2; - int uniqueAnimationFrameX = 0; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 3; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; - int xOffset = 0; - int relativeXPos = i % 2; - int relativeYPos = j % 2; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 1; - break; - default: - xOffset = 0; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 3; - break; - default: - xOffset = 0; - break; - } - break; - } - xOffset = xOffset * 288; + int xOffset = i % 2; + int yOffset = j % 2; + xOffset = xOffset * subsheetWidth; + yOffset = yOffset * subsheetHeight; xPos += xOffset; + yPos += yOffset; Texture2D glowmask = mod.GetTexture("Tiles/AstralBrick_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(50, 50, 50, 50); + Color drawColour = GetDrawColour (i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -115,5 +65,18 @@ namespace CalamityMod.Tiles Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/AstralBrick.png b/Tiles/AstralBrick.png index 62d6159e40..ee020dffcc 100644 Binary files a/Tiles/AstralBrick.png and b/Tiles/AstralBrick.png differ diff --git a/Tiles/AstralBrick_Glowmask.png b/Tiles/AstralBrick_Glowmask.png index fd81f8d7db..e5b991449b 100644 Binary files a/Tiles/AstralBrick_Glowmask.png and b/Tiles/AstralBrick_Glowmask.png differ diff --git a/Tiles/AstralDesert/AstralPalmSapling.cs b/Tiles/AstralDesert/AstralPalmSapling.cs new file mode 100644 index 0000000000..2027f842a8 --- /dev/null +++ b/Tiles/AstralDesert/AstralPalmSapling.cs @@ -0,0 +1,71 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.AstralDesert +{ + public class AstralPalmSapling : ModTile + { + //All of this code is taken directly from Example Mod. + //Cheers Blushie + + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.AnchorValidTiles = new[] { mod.TileType("AstralSand") }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.DrawFlipHorizontal = true; + TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.addTile(Type); + sapling = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sapling"); + AddMapEntry(new Color(200, 200, 200), name); + dustType = mod.DustType("AstralBasic"); + adjTiles = new int[] { TileID.Saplings }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void RandomUpdate(int i, int j) + { + if (WorldGen.genRand.Next(20) == 0) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + bool success = WorldGen.GrowTree(i, j); + if (success && isPlayerNear) + { + WorldGen.TreeGrowFXCheck(i, j); + } + } + } + + public override void SetSpriteEffects(int i, int j, ref SpriteEffects effects) + { + if (i % 2 == 1) + { + effects = SpriteEffects.FlipHorizontally; + } + } + } +} diff --git a/Tiles/AstralDesert/AstralPalmSapling.png b/Tiles/AstralDesert/AstralPalmSapling.png new file mode 100644 index 0000000000..2eb8524b89 Binary files /dev/null and b/Tiles/AstralDesert/AstralPalmSapling.png differ diff --git a/Tiles/Astral/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs similarity index 89% rename from Tiles/Astral/AstralPalmTree.cs rename to Tiles/AstralDesert/AstralPalmTree.cs index 97efc28cd4..3e2e93b6b1 100644 --- a/Tiles/Astral/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -1,5 +1,4 @@ - -using Terraria.ModLoader; +using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles @@ -8,12 +7,12 @@ namespace CalamityMod.Tiles { public override Texture2D GetTexture() { - return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralPalmTree"); + return CalamityMod.Instance.GetTexture("Tiles/AstralDesert/AstralPalmTree"); } public override Texture2D GetTopTextures() { - return CalamityMod.Instance.GetTexture("Tiles/Astral/AstralPalmTree_Tops"); + return CalamityMod.Instance.GetTexture("Tiles/AstralDesert/AstralPalmTree_Tops"); } public override int DropWood() diff --git a/Tiles/Astral/AstralPalmTree.png b/Tiles/AstralDesert/AstralPalmTree.png similarity index 100% rename from Tiles/Astral/AstralPalmTree.png rename to Tiles/AstralDesert/AstralPalmTree.png diff --git a/Tiles/Astral/AstralPalmTree_Tops.png b/Tiles/AstralDesert/AstralPalmTree_Tops.png similarity index 100% rename from Tiles/Astral/AstralPalmTree_Tops.png rename to Tiles/AstralDesert/AstralPalmTree_Tops.png diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 1838348006..5933801526 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -16,6 +16,10 @@ namespace CalamityMod.Tiles.AstralDesert Main.tileSand[Type] = true; Main.tileBrick[Type] = true; + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDesertTiles(Type); + TileMerge.MergeAstralTiles(Type); + dustType = 108; drop = mod.ItemType("AstralSand"); @@ -25,6 +29,8 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.Conversion.Sand[Type] = true; SetModCactus(new AstralCactus()); + + SetModPalmTree(new AstralPalmTree()); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -47,13 +53,19 @@ namespace CalamityMod.Tiles.AstralDesert public override bool HasWalkDust() { - return Main.rand.NextBool(3); + return Main.rand.Next(3) == 0; } public override void WalkDust(ref int dustType, ref bool makeDust, ref Color color) { dustType = 108; } + + public override int SaplingGrowthType(ref int style) + { + style = 0; + return mod.TileType("AstralPalmSapling"); + } } public class AstralCactus : ModCactus diff --git a/Tiles/AstralDesert/AstralSand.png b/Tiles/AstralDesert/AstralSand.png index 67a7ab9aed..fcfaf5ab9c 100644 Binary files a/Tiles/AstralDesert/AstralSand.png and b/Tiles/AstralDesert/AstralSand.png differ diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index 7d59e29d7b..c71998870a 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -12,7 +12,10 @@ namespace CalamityMod.Tiles.AstralDesert { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileBrick[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDesertTiles(Type); + TileMerge.MergeAstralTiles(Type); dustType = mod.DustType("AstralBasic"); drop = mod.ItemType("AstralSandstone"); diff --git a/Tiles/AstralDesert/AstralSandstone.png b/Tiles/AstralDesert/AstralSandstone.png index f7963a9400..88b58bd4f3 100644 Binary files a/Tiles/AstralDesert/AstralSandstone.png and b/Tiles/AstralDesert/AstralSandstone.png differ diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 9b5145000f..85a27c2341 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -12,7 +12,11 @@ namespace CalamityMod.Tiles.AstralDesert { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileMerge[mod.TileType("AstralSand")][Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDesertTiles(Type); + TileMerge.MergeAstralTiles(Type); + dustType = 108; drop = mod.ItemType("HardenedAstralSand"); diff --git a/Tiles/AstralDesert/HardenedAstralSand.png b/Tiles/AstralDesert/HardenedAstralSand.png index 8e88c8dc9c..6e9e3afdaf 100644 Binary files a/Tiles/AstralDesert/HardenedAstralSand.png and b/Tiles/AstralDesert/HardenedAstralSand.png differ diff --git a/Tiles/AstralMonolith.png b/Tiles/AstralMonolith.png deleted file mode 100644 index 6942d37d12..0000000000 Binary files a/Tiles/AstralMonolith.png and /dev/null differ diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index 2ab211c5a9..d9b9b1f278 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.AstralSnow { @@ -12,9 +13,10 @@ namespace CalamityMod.Tiles.AstralSnow Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; - Main.tileShine2[Type] = true; - //Main.tileMerge[Type][TileID.SnowBlock] = true; - //Main.tileMerge[TileID.SnowBlock][Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeSnowTiles(Type); + TileMerge.MergeAstralTiles(Type); dustType = 173; drop = mod.ItemType("AstralIce"); @@ -42,5 +44,11 @@ namespace CalamityMod.Tiles.AstralSnow player.slippy = true; base.FloorVisuals(player); } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AstralDirt"), false, false, false, false, resetFrame); + return false; + } } } diff --git a/Tiles/AstralSnow/AstralIce.png b/Tiles/AstralSnow/AstralIce.png index 20cad6cec1..4cd467e205 100644 Binary files a/Tiles/AstralSnow/AstralIce.png and b/Tiles/AstralSnow/AstralIce.png differ diff --git a/Tiles/AuricOre.cs b/Tiles/AuricOre.cs index 2e0a7035ea..1f40eb2aa4 100644 --- a/Tiles/AuricOre.cs +++ b/Tiles/AuricOre.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -15,6 +16,9 @@ namespace CalamityMod.Tiles Main.tileBlockLight[Type] = true; Main.tileSpelunker[Type] = true; Main.tileValue[Type] = 810; + + TileMerge.MergeGeneralTiles(Type); + dustType = 55; drop = mod.ItemType("AuricOre"); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/BrimstoneSlag.cs b/Tiles/BrimstoneSlag.cs index caa93ca546..4f9670aaa5 100644 --- a/Tiles/BrimstoneSlag.cs +++ b/Tiles/BrimstoneSlag.cs @@ -1,22 +1,25 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class BrimstoneSlag : ModTile { - private const short subsheetWidth = 288; - private const short subsheetHeight = 396; + private const short subsheetWidth = 450; + private const short subsheetHeight = 198; public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeHellTiles(Type); + TileMerge.MergeTile(Type, mod.TileType("CharredOre")); + soundType = 21; mineResist = 3f; minPick = 180; @@ -36,6 +39,11 @@ namespace CalamityMod.Tiles frameYOffset = (j % 2) * subsheetHeight; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BrimstoneFraming(i, j, resetFrame); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Main.tile[i, j]; @@ -43,15 +51,16 @@ namespace CalamityMod.Tiles int frameXOffset = (i % 2) * subsheetWidth; int frameYOffset = (j % 2) * subsheetHeight; Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); if (Main.drawToScreen) { zero = Vector2.Zero; } if (tile.slope() == (byte)0 && !tile.halfBrick()) - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 16), new Color(50, 50, 50, 50), 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 16), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); else if (tile.halfBrick()) { - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y + 10) + 8) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 8), new Color(50, 50, 50, 50), 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y + 10) + 8) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else { @@ -76,9 +85,22 @@ namespace CalamityMod.Tiles num10 = width2 + 2; break; } - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X) + (float)num10, (float)(j * 16 - (int)Main.screenPosition.Y + index4 * 2)) + zero, drawRectangle, new Color(50, 50, 50, 50), 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X) + (float)num10, (float)(j * 16 - (int)Main.screenPosition.Y + index4 * 2)) + zero, drawRectangle, drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/BrimstoneSlag.png b/Tiles/BrimstoneSlag.png index 369172ea69..b5f042995d 100644 Binary files a/Tiles/BrimstoneSlag.png and b/Tiles/BrimstoneSlag.png differ diff --git a/Tiles/BrimstoneSlag_Glowmask.png b/Tiles/BrimstoneSlag_Glowmask.png index 3931573929..2e04620d55 100644 Binary files a/Tiles/BrimstoneSlag_Glowmask.png and b/Tiles/BrimstoneSlag_Glowmask.png differ diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 50757a0efb..9aad281418 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -30,21 +30,39 @@ namespace CalamityMod.Tiles (ushort)CalamityMod.Instance.TileType("AstralTallPlants") }; - /*#region SetDefaults //it's not working aaaaa - public virtual void SetDefaults(Tile tile) - { - if (CalamityMod.tableList.Contains(tile.type)) - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - else if (CalamityMod.chairList.Contains(tile.type)) - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - else if (CalamityMod.lightList.Contains(tile.type)) - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - else if (CalamityMod.doorList.Contains(tile.type)) - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - } - #endregion*/ + public override void SetDefaults() + { + if (CalamityMod.chairList != null) + { + foreach (int i in CalamityMod.chairList) + { + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair, i); + } + } + if (CalamityMod.doorList != null) + { + foreach (int i in CalamityMod.doorList) + { + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor, i); + } + } + if (CalamityMod.lightList != null) + { + foreach (int i in CalamityMod.lightList) + { + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch, i); + } + } + if (CalamityMod.tableList != null) + { + foreach (int i in CalamityMod.tableList) + { + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable, i); + } + } + } - public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) + public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) { for (int k = 0; k < PlantTypes.Length; k++) { diff --git a/Tiles/ChaoticBrick.cs b/Tiles/ChaoticBrick.cs index cad536b3b1..634edaaf95 100644 --- a/Tiles/ChaoticBrick.cs +++ b/Tiles/ChaoticBrick.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Tiles { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileBlendAll[this.Type] = true; Main.tileBlockLight[Type] = true; dustType = 105; drop = mod.ItemType("ChaoticBrick"); diff --git a/Tiles/ChaoticBrickWall.png b/Tiles/ChaoticBrickWall.png deleted file mode 100644 index 359d068c30..0000000000 Binary files a/Tiles/ChaoticBrickWall.png and /dev/null differ diff --git a/Tiles/ChaoticOre.cs b/Tiles/ChaoticOre.cs index adc6c891f6..44e6168573 100644 --- a/Tiles/ChaoticOre.cs +++ b/Tiles/ChaoticOre.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -11,10 +11,13 @@ namespace CalamityMod.Tiles { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileValue[Type] = 750; - dustType = 105; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAbyssTiles(Type); + + dustType = 105; drop = mod.ItemType("ChaoticOre"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Chaotic Ore"); @@ -38,14 +41,14 @@ namespace CalamityMod.Tiles { return; } - if (closer && Main.rand.NextBool(300)) + if (closer && Main.rand.Next(300) == 0) { int tileLocationY = j + 1; if (Main.tile[i, tileLocationY] != null) { if (!Main.tile[i, tileLocationY].active()) { - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != 1) { Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, 0.1f, mod.ProjectileType("LavaChunk"), 25, 2f, Main.myPlayer, 0f, 0f); } @@ -70,5 +73,11 @@ namespace CalamityMod.Tiles g = 0.00f; b = 0.00f; } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AbyssGravel"), false, false, false, false, resetFrame); + return false; + } } } diff --git a/Tiles/CharredOre.cs b/Tiles/CharredOre.cs index 5c9fda2b3c..30876bce64 100644 --- a/Tiles/CharredOre.cs +++ b/Tiles/CharredOre.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,10 +13,13 @@ namespace CalamityMod.Tiles public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileLighted[Type] = true; Main.tileValue[Type] = 710; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeHellTiles(Type); + drop = mod.ItemType("CharredOre"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Charred Ore"); @@ -49,5 +53,11 @@ namespace CalamityMod.Tiles g = 0.00f; b = 0.00f; } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("BrimstoneSlag"), false, false, false, false, resetFrame); + return false; + } } -} +} \ No newline at end of file diff --git a/Tiles/CharredOre.png b/Tiles/CharredOre.png index cf5ecdac32..618fe30303 100644 Binary files a/Tiles/CharredOre.png and b/Tiles/CharredOre.png differ diff --git a/Tiles/Cinderplate.cs b/Tiles/Cinderplate.cs index 2c2d4ef317..84e2011624 100644 --- a/Tiles/Cinderplate.cs +++ b/Tiles/Cinderplate.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,6 +13,9 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + soundType = 21; mineResist = 1f; minPick = 180; @@ -33,7 +37,7 @@ namespace CalamityMod.Tiles Texture2D glowmask = mod.GetTexture("Tiles/Cinderplate_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(50, 50, 50, 50); + Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -45,5 +49,18 @@ namespace CalamityMod.Tiles Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/Cinderplate.png b/Tiles/Cinderplate.png index 2d9c88899b..60f5cc7b5a 100644 Binary files a/Tiles/Cinderplate.png and b/Tiles/Cinderplate.png differ diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs index 991655f1e0..ace3a65d25 100644 --- a/Tiles/CryonicBrick.cs +++ b/Tiles/CryonicBrick.cs @@ -1,21 +1,26 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class CryonicBrick : ModTile { - public override void SetDefaults() + int subsheetHeight = 90; + int subsheetWidth = 234; + public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - soundType = 21; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + + soundType = 21; minPick = 100; drop = mod.ItemType("CryonicBrick"); AddMapEntry(new Color(99, 131, 199)); - animationFrameHeight = 270; } public override bool CreateDust(int i, int j, ref int type) @@ -28,8 +33,9 @@ namespace CalamityMod.Tiles { int xPos = i % 2; int yPos = j % 4; - frameXOffset = xPos * 288; - frameYOffset = yPos * animationFrameHeight; - } + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; + ; + } } } diff --git a/Tiles/CryonicBrick.png b/Tiles/CryonicBrick.png index ef88945d15..a70eb0781b 100644 Binary files a/Tiles/CryonicBrick.png and b/Tiles/CryonicBrick.png differ diff --git a/Tiles/CryonicOre.cs b/Tiles/CryonicOre.cs index f2195a39a5..8daebcffc2 100644 --- a/Tiles/CryonicOre.cs +++ b/Tiles/CryonicOre.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -11,10 +13,13 @@ namespace CalamityMod.Tiles { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileValue[Type] = 675; - dustType = mod.DustType("MSparkle"); + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeSnowTiles(Type); + + dustType = mod.DustType("MSparkle"); drop = mod.ItemType("CryonicOre"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cryonic Ore"); @@ -35,6 +40,12 @@ namespace CalamityMod.Tiles num = fail ? 1 : 3; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, TileID.SnowBlock); + return false; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.02f; diff --git a/Tiles/ExodiumOre.cs b/Tiles/ExodiumOre.cs index 71df8246c9..8a04c0d9f9 100644 --- a/Tiles/ExodiumOre.cs +++ b/Tiles/ExodiumOre.cs @@ -1,8 +1,7 @@ - -using Microsoft.Xna.Framework; - +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,6 +11,9 @@ namespace CalamityMod.Tiles { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Exodium Ore"); AddMapEntry(new Color(51, 48, 68), name); diff --git a/Tiles/FurnitureAbyss/AbyssBath.cs b/Tiles/FurnitureAbyss/AbyssBath.cs index 196075f4a7..6e22dae75e 100644 --- a/Tiles/FurnitureAbyss/AbyssBath.cs +++ b/Tiles/FurnitureAbyss/AbyssBath.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); name.SetDefault("Abyss Bathtub"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index 398663b0fc..e12f9b402f 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssBookcase.cs b/Tiles/FurnitureAbyss/AbyssBookcase.cs index 2b9e82044b..e69f3aa311 100644 --- a/Tiles/FurnitureAbyss/AbyssBookcase.cs +++ b/Tiles/FurnitureAbyss/AbyssBookcase.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssCandelabra.cs b/Tiles/FurnitureAbyss/AbyssCandelabra.cs index 31466e26b2..0c7ce77b7f 100644 --- a/Tiles/FurnitureAbyss/AbyssCandelabra.cs +++ b/Tiles/FurnitureAbyss/AbyssCandelabra.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAbyss/AbyssCandle.cs b/Tiles/FurnitureAbyss/AbyssCandle.cs index 8e340cf6e6..e9f94ea8db 100644 --- a/Tiles/FurnitureAbyss/AbyssCandle.cs +++ b/Tiles/FurnitureAbyss/AbyssCandle.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("AbyssCandle"); diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index d7534d8e09..1065a2a256 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index 6a2eeddbfd..ab9ad9f664 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs index 5c2a17e18b..8bdbda57cf 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs index f036ba9171..03f12db579 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAbyss/AbyssDresser.cs b/Tiles/FurnitureAbyss/AbyssDresser.cs index 3575dfe171..a7273806c9 100644 --- a/Tiles/FurnitureAbyss/AbyssDresser.cs +++ b/Tiles/FurnitureAbyss/AbyssDresser.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssLamp.cs b/Tiles/FurnitureAbyss/AbyssLamp.cs index e60e685706..bec23487a5 100644 --- a/Tiles/FurnitureAbyss/AbyssLamp.cs +++ b/Tiles/FurnitureAbyss/AbyssLamp.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss name.SetDefault("Abyss Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index 18776ffe58..0d532b911e 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss name.SetDefault("Abyss Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAbyss/AbyssPiano.cs b/Tiles/FurnitureAbyss/AbyssPiano.cs index 15b2234f5f..c3531d9de6 100644 --- a/Tiles/FurnitureAbyss/AbyssPiano.cs +++ b/Tiles/FurnitureAbyss/AbyssPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Synth"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssSofa.cs b/Tiles/FurnitureAbyss/AbyssSofa.cs index ff0f6e23ec..40e55e79cb 100644 --- a/Tiles/FurnitureAbyss/AbyssSofa.cs +++ b/Tiles/FurnitureAbyss/AbyssSofa.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssTable.cs b/Tiles/FurnitureAbyss/AbyssTable.cs index 42870cee69..380139bce1 100644 --- a/Tiles/FurnitureAbyss/AbyssTable.cs +++ b/Tiles/FurnitureAbyss/AbyssTable.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/FurnitureAbyss/AbyssTorch.cs index 645b09140c..30728667b9 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/FurnitureAbyss/AbyssTorch.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newAlternate.AnchorWall = true; TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Torch"); AddMapEntry(new Color(253, 221, 3), name); diff --git a/Tiles/FurnitureAbyss/AbyssWorkbench.cs b/Tiles/FurnitureAbyss/AbyssWorkbench.cs index 27180da965..0a7b7c480c 100644 --- a/Tiles/FurnitureAbyss/AbyssWorkbench.cs +++ b/Tiles/FurnitureAbyss/AbyssWorkbench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs index a125706de1..0addde5685 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureAbyss { @@ -11,6 +12,12 @@ namespace CalamityMod.Tiles.FurnitureAbyss Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeSmoothTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeAbyssTiles(Type); + soundType = 21; mineResist = 2f; minPick = 65; diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravel.png b/Tiles/FurnitureAbyss/SmoothAbyssGravel.png index 50d6cd3051..657ef5a32b 100644 Binary files a/Tiles/FurnitureAbyss/SmoothAbyssGravel.png and b/Tiles/FurnitureAbyss/SmoothAbyssGravel.png differ diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index 074e281934..bce50df238 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); drop = mod.ItemType("SmoothAbyssGravelPlatform"); disableSmartCursor = true; diff --git a/Tiles/FurnitureAncient/AncientAltar.cs b/Tiles/FurnitureAncient/AncientAltar.cs index 0185dc0a97..641c149101 100644 --- a/Tiles/FurnitureAncient/AncientAltar.cs +++ b/Tiles/FurnitureAncient/AncientAltar.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAncient name.SetDefault("Ancient Altar"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAncient/AncientBasin.cs b/Tiles/FurnitureAncient/AncientBasin.cs index 3c063150ab..8cecbe5f5a 100644 --- a/Tiles/FurnitureAncient/AncientBasin.cs +++ b/Tiles/FurnitureAncient/AncientBasin.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureAncient name.SetDefault("Ancient Basin"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAncient/AncientBath.cs b/Tiles/FurnitureAncient/AncientBath.cs index 859e692507..54d0e4f358 100644 --- a/Tiles/FurnitureAncient/AncientBath.cs +++ b/Tiles/FurnitureAncient/AncientBath.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index 060c162052..b60a669db1 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAncient/AncientBookcase.cs b/Tiles/FurnitureAncient/AncientBookcase.cs index b79452395a..22ddbd79a7 100644 --- a/Tiles/FurnitureAncient/AncientBookcase.cs +++ b/Tiles/FurnitureAncient/AncientBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAncient/AncientChair.cs b/Tiles/FurnitureAncient/AncientChair.cs index 6627d1cdf2..14be3a1170 100644 --- a/Tiles/FurnitureAncient/AncientChair.cs +++ b/Tiles/FurnitureAncient/AncientChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAncient/AncientDoorClosed.cs b/Tiles/FurnitureAncient/AncientDoorClosed.cs index 6e31b33063..d133c393d5 100644 --- a/Tiles/FurnitureAncient/AncientDoorClosed.cs +++ b/Tiles/FurnitureAncient/AncientDoorClosed.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAncient/AncientDoorOpen.cs b/Tiles/FurnitureAncient/AncientDoorOpen.cs index 97ca227c7a..f6231fdc67 100644 --- a/Tiles/FurnitureAncient/AncientDoorOpen.cs +++ b/Tiles/FurnitureAncient/AncientDoorOpen.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAncient/AncientDresser.cs b/Tiles/FurnitureAncient/AncientDresser.cs index 2ed5a21089..accf90126b 100644 --- a/Tiles/FurnitureAncient/AncientDresser.cs +++ b/Tiles/FurnitureAncient/AncientDresser.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAncient/AncientLamp.cs b/Tiles/FurnitureAncient/AncientLamp.cs index fb75040b31..cf730b28e3 100644 --- a/Tiles/FurnitureAncient/AncientLamp.cs +++ b/Tiles/FurnitureAncient/AncientLamp.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAncient name.SetDefault("Ancient Lamp"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index d7ea8cbcf2..4c4ac40fc2 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAncient name.SetDefault("Ancient Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAncient/AncientPiano.cs b/Tiles/FurnitureAncient/AncientPiano.cs index 13b9dc6596..7636e8065f 100644 --- a/Tiles/FurnitureAncient/AncientPiano.cs +++ b/Tiles/FurnitureAncient/AncientPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Pipe Organ"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAncient/AncientSofa.cs b/Tiles/FurnitureAncient/AncientSofa.cs index 1beba7dfd4..29844e0d22 100644 --- a/Tiles/FurnitureAncient/AncientSofa.cs +++ b/Tiles/FurnitureAncient/AncientSofa.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ancient Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAncient/AncientTable.cs b/Tiles/FurnitureAncient/AncientTable.cs index 8bc91ab7d2..1f62eaba32 100644 --- a/Tiles/FurnitureAncient/AncientTable.cs +++ b/Tiles/FurnitureAncient/AncientTable.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAncient Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); diff --git a/Tiles/FurnitureAncient/AncientWorkbench.cs b/Tiles/FurnitureAncient/AncientWorkbench.cs index 8b4a316af1..c24994c6a7 100644 --- a/Tiles/FurnitureAncient/AncientWorkbench.cs +++ b/Tiles/FurnitureAncient/AncientWorkbench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureAncient TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenAltar.cs b/Tiles/FurnitureAshen/AshenAltar.cs index 24128eeb75..ed5f80ad00 100644 --- a/Tiles/FurnitureAshen/AshenAltar.cs +++ b/Tiles/FurnitureAshen/AshenAltar.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAshen name.SetDefault("Ashen Altar"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAshen/AshenBasin.cs b/Tiles/FurnitureAshen/AshenBasin.cs index d4a83a16d1..193fd73f6e 100644 --- a/Tiles/FurnitureAshen/AshenBasin.cs +++ b/Tiles/FurnitureAshen/AshenBasin.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureAshen name.SetDefault("Ashen Basin"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAshen/AshenBath.cs b/Tiles/FurnitureAshen/AshenBath.cs index c2a95c1a3c..2905b8a9f6 100644 --- a/Tiles/FurnitureAshen/AshenBath.cs +++ b/Tiles/FurnitureAshen/AshenBath.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index 4fe2122bd4..0a3b42024b 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenBookcase.cs b/Tiles/FurnitureAshen/AshenBookcase.cs index faa1e2d1d4..2714013770 100644 --- a/Tiles/FurnitureAshen/AshenBookcase.cs +++ b/Tiles/FurnitureAshen/AshenBookcase.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenCandelabra.cs b/Tiles/FurnitureAshen/AshenCandelabra.cs index 86315250ea..cf74a2aa90 100644 --- a/Tiles/FurnitureAshen/AshenCandelabra.cs +++ b/Tiles/FurnitureAshen/AshenCandelabra.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureAshen name.SetDefault("Ashen Candelabra"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 36; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAshen/AshenCandle.cs b/Tiles/FurnitureAshen/AshenCandle.cs index e5983026f0..d95ee0ff08 100644 --- a/Tiles/FurnitureAshen/AshenCandle.cs +++ b/Tiles/FurnitureAshen/AshenCandle.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Tiles.FurnitureAshen name.SetDefault("Ashen Candle"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 22; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("AshenCandle"); diff --git a/Tiles/FurnitureAshen/AshenChair.cs b/Tiles/FurnitureAshen/AshenChair.cs index 64125c9525..731c842be4 100644 --- a/Tiles/FurnitureAshen/AshenChair.cs +++ b/Tiles/FurnitureAshen/AshenChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index 60074438d7..40b7d66683 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index d2b9276dc3..d99ed2344f 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; + TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.newTile.Origin = new Point16(0, 1); TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; @@ -35,7 +35,10 @@ namespace CalamityMod.Tiles.FurnitureAshen ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; + name = CreateMapEntryName(Name + "_Locked"); // With multiple map entries, you need unique translation keys. + name.SetDefault("Locked Ashen Chest"); + AddMapEntry(new Color(174, 129, 92), name, MapChestName); + disableSmartCursor = true; adjTiles = new int[] { TileID.Containers }; chest = "Ashen Chest"; chestDrop = mod.ItemType("AshenChest"); @@ -48,160 +51,192 @@ namespace CalamityMod.Tiles.FurnitureAshen return false; } - public override bool HasSmartInteract() - { - return true; - } + public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].frameX / 36); - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } + public override bool HasSmartInteract() => true; + + public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; + + public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) + { + dustType = this.dustType; + return true; + } + + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + { + return name; + } + else + { + return name + ": " + Main.chest[chest].name; + } } public override void NumDust(int i, int j, bool fail, ref int num) { - num = fail ? 1 : 3; + num = 1; } public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + bool isLocked = IsLockedChest(left, top); + if (Main.netMode == 1 && !isLocked) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + if (isLocked) + { + int key = mod.ItemType("BrimstoneKey"); + if (Chest.Unlock(left, top)) + { + if (Main.netMode == 1) + { + NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, (float)left, (float)top); + } + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + } + } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Ashen Chest"; - if (player.showItemIconText == "Ashen Chest") - { - player.showItemIcon2 = mod.ItemType("AshenChest"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Ashen Chest"; + if (player.showItemIconText == "Ashen Chest") + { + player.showItemIcon2 = mod.ItemType("AshenChest"); + if (Main.tile[left, top].frameX / 36 == 1) + player.showItemIcon2 = mod.ItemType("BrimstoneKey"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + //public override void PlaceInWorld(int i, int j, Item item) + //{ + // Main.tile[i, j].frameX += 36; + // Main.tile[i + 1, j].frameX += 36; + // Main.tile[i, j - 1].frameX += 36; + // Main.tile[i + 1, j - 1].frameX += 36; + //} + } } diff --git a/Tiles/FurnitureAshen/AshenChest.png b/Tiles/FurnitureAshen/AshenChest.png index 4f114cfc5a..488d99208f 100644 Binary files a/Tiles/FurnitureAshen/AshenChest.png and b/Tiles/FurnitureAshen/AshenChest.png differ diff --git a/Tiles/FurnitureAshen/AshenChestLocked.cs b/Tiles/FurnitureAshen/AshenChestLocked.cs deleted file mode 100644 index 3a2aab4883..0000000000 --- a/Tiles/FurnitureAshen/AshenChestLocked.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles.FurnitureAshen -{ - public class AshenChestLocked : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Locked Ashen Chest"); - AddMapEntry(new Color(191, 142, 111), name, MapChestName); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Locked Ashen Chest"; - chestDrop = mod.ItemType("LockedAshenChest"); - } - - 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 bool HasSmartInteract() - { - return true; - } - - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } - - public override void RightClick(int i, int j) - { - if (Main.player[Main.myPlayer].HasItem(mod.ItemType("BrimstoneKey"))) { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Locked Ashen Chest"; - if (player.showItemIconText == "Locked Ashen Chest") - { - player.showItemIcon2 = mod.ItemType("BrimstoneKey"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } - - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } -} diff --git a/Tiles/FurnitureAshen/AshenChestLocked.png b/Tiles/FurnitureAshen/AshenChestLocked.png deleted file mode 100644 index 2f8ff114e4..0000000000 Binary files a/Tiles/FurnitureAshen/AshenChestLocked.png and /dev/null differ diff --git a/Tiles/FurnitureAshen/AshenChestLocked_Highlight.png b/Tiles/FurnitureAshen/AshenChestLocked_Highlight.png deleted file mode 100644 index 13fa03f85b..0000000000 Binary files a/Tiles/FurnitureAshen/AshenChestLocked_Highlight.png and /dev/null differ diff --git a/Tiles/FurnitureAshen/AshenChest_Highlight.png b/Tiles/FurnitureAshen/AshenChest_Highlight.png index 764a5c54ae..c5db79e908 100644 Binary files a/Tiles/FurnitureAshen/AshenChest_Highlight.png and b/Tiles/FurnitureAshen/AshenChest_Highlight.png differ diff --git a/Tiles/FurnitureAshen/AshenDoorClosed.cs b/Tiles/FurnitureAshen/AshenDoorClosed.cs index b1742c4e05..8bca30f27f 100644 --- a/Tiles/FurnitureAshen/AshenDoorClosed.cs +++ b/Tiles/FurnitureAshen/AshenDoorClosed.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenDoorOpen.cs b/Tiles/FurnitureAshen/AshenDoorOpen.cs index 6a427a77c7..18cbcfe2fd 100644 --- a/Tiles/FurnitureAshen/AshenDoorOpen.cs +++ b/Tiles/FurnitureAshen/AshenDoorOpen.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureAshen/AshenDresser.cs b/Tiles/FurnitureAshen/AshenDresser.cs index d9a3380a65..32ad2faaeb 100644 --- a/Tiles/FurnitureAshen/AshenDresser.cs +++ b/Tiles/FurnitureAshen/AshenDresser.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenLamp.cs b/Tiles/FurnitureAshen/AshenLamp.cs index ca66f10f59..bcdec1a333 100644 --- a/Tiles/FurnitureAshen/AshenLamp.cs +++ b/Tiles/FurnitureAshen/AshenLamp.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Tiles.FurnitureAshen AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index 353001648f..f86283d60d 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Tiles.FurnitureAshen AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 36; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureAshen/AshenPiano.cs b/Tiles/FurnitureAshen/AshenPiano.cs index f0653cd6b7..56e244bc62 100644 --- a/Tiles/FurnitureAshen/AshenPiano.cs +++ b/Tiles/FurnitureAshen/AshenPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Pipe Organ"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenPlatform.cs b/Tiles/FurnitureAshen/AshenPlatform.cs index 04b800029a..c7353adaa1 100644 --- a/Tiles/FurnitureAshen/AshenPlatform.cs +++ b/Tiles/FurnitureAshen/AshenPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("AshenPlatform"); diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 3736064b0e..6ecda07da7 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureAshen { @@ -218,7 +219,10 @@ namespace CalamityMod.Tiles.FurnitureAshen { if (xOffset != -1) { - uniqueAnimationFrameX = GetTileVariant(i, j); + if (j % 3 < 2) + { + uniqueAnimationFrameX = Main.tile[i - (i % 2), j - (j % 3)].frameNumber(); + } if (uniqueAnimationFrameX != 0) { uniqueAnimationFrameX += xOffset; @@ -454,7 +458,10 @@ namespace CalamityMod.Tiles.FurnitureAshen { if (xOffset != -1) { - uniqueAnimationFrameX = GetTileVariant(i, j); + if (j % 3 < 2) + { + uniqueAnimationFrameX = Main.tile[i - (i % 2), j - (j % 3)].frameNumber(); + } if (uniqueAnimationFrameX != 0) { uniqueAnimationFrameX += xOffset; @@ -504,7 +511,7 @@ namespace CalamityMod.Tiles.FurnitureAshen Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Texture2D glowmask = mod.GetTexture("Tiles/FurnitureAshen/AshenSlab_Glowmask"); - Color drawColour = new Color(64, 64, 64, 64); + Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -517,6 +524,20 @@ namespace CalamityMod.Tiles.FurnitureAshen } } + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } + + /* /// /// Gets the tile variant to use. Returns -1 by default /// @@ -631,5 +652,6 @@ namespace CalamityMod.Tiles.FurnitureAshen } return (variant); } + */ } } diff --git a/Tiles/FurnitureAshen/AshenSofa.cs b/Tiles/FurnitureAshen/AshenSofa.cs index 678ab8ed56..c9a0f0b0b5 100644 --- a/Tiles/FurnitureAshen/AshenSofa.cs +++ b/Tiles/FurnitureAshen/AshenSofa.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/AshenTable.cs b/Tiles/FurnitureAshen/AshenTable.cs index 26764a3840..5438eb1ead 100644 --- a/Tiles/FurnitureAshen/AshenTable.cs +++ b/Tiles/FurnitureAshen/AshenTable.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); diff --git a/Tiles/FurnitureAshen/AshenWorkbench.cs b/Tiles/FurnitureAshen/AshenWorkbench.cs index bd65fcf655..3850aace4e 100644 --- a/Tiles/FurnitureAshen/AshenWorkbench.cs +++ b/Tiles/FurnitureAshen/AshenWorkbench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureAshen TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Ashen Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index 96025a4978..fdc92d3bfa 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureAshen { @@ -12,6 +13,12 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeSmoothTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeHellTiles(Type); + soundType = 21; mineResist = 5f; minPick = 180; @@ -33,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureAshen Texture2D glowmask = mod.GetTexture("Tiles/FurnitureAshen/SmoothBrimstoneSlag_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(25, 25, 25, 25); + Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -45,5 +52,18 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.png b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.png index 090b581e42..0b742c43bc 100644 Binary files a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.png and b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.png differ diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag_Glowmask.png b/Tiles/FurnitureAshen/SmoothBrimstoneSlag_Glowmask.png index ccff03aa0e..73f06d8646 100644 Binary files a/Tiles/FurnitureAshen/SmoothBrimstoneSlag_Glowmask.png and b/Tiles/FurnitureAshen/SmoothBrimstoneSlag_Glowmask.png differ diff --git a/Tiles/FurnitureBotanic/BotanicBathtub.cs b/Tiles/FurnitureBotanic/BotanicBathtub.cs index dd975055f9..08a4389478 100644 --- a/Tiles/FurnitureBotanic/BotanicBathtub.cs +++ b/Tiles/FurnitureBotanic/BotanicBathtub.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index b929f795ac..52177c9aa9 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicBench.cs b/Tiles/FurnitureBotanic/BotanicBench.cs index 567c12a600..7d8ae7ccdb 100644 --- a/Tiles/FurnitureBotanic/BotanicBench.cs +++ b/Tiles/FurnitureBotanic/BotanicBench.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicBookcase.cs b/Tiles/FurnitureBotanic/BotanicBookcase.cs index f1ea7377c3..a1ae8e919a 100644 --- a/Tiles/FurnitureBotanic/BotanicBookcase.cs +++ b/Tiles/FurnitureBotanic/BotanicBookcase.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicCandelabra.cs b/Tiles/FurnitureBotanic/BotanicCandelabra.cs index d62f62b1fc..2869cca13c 100644 --- a/Tiles/FurnitureBotanic/BotanicCandelabra.cs +++ b/Tiles/FurnitureBotanic/BotanicCandelabra.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureBotanic/BotanicCandle.cs b/Tiles/FurnitureBotanic/BotanicCandle.cs index a4d92ea3b8..6d0298dff3 100644 --- a/Tiles/FurnitureBotanic/BotanicCandle.cs +++ b/Tiles/FurnitureBotanic/BotanicCandle.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("BotanicCandle"); diff --git a/Tiles/FurnitureBotanic/BotanicChair.cs b/Tiles/FurnitureBotanic/BotanicChair.cs index f7460ea307..e827d388d2 100644 --- a/Tiles/FurnitureBotanic/BotanicChair.cs +++ b/Tiles/FurnitureBotanic/BotanicChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicChandelier.cs b/Tiles/FurnitureBotanic/BotanicChandelier.cs index a48bd9a810..9185f04d60 100644 --- a/Tiles/FurnitureBotanic/BotanicChandelier.cs +++ b/Tiles/FurnitureBotanic/BotanicChandelier.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 3, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs index 633e27e495..6ec8876198 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs index f74cdf4c88..9f3d57d459 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureBotanic/BotanicDresser.cs b/Tiles/FurnitureBotanic/BotanicDresser.cs index 4501b7e03b..57e3e39915 100644 --- a/Tiles/FurnitureBotanic/BotanicDresser.cs +++ b/Tiles/FurnitureBotanic/BotanicDresser.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicLamp.cs b/Tiles/FurnitureBotanic/BotanicLamp.cs index 6873f27919..59313f578a 100644 --- a/Tiles/FurnitureBotanic/BotanicLamp.cs +++ b/Tiles/FurnitureBotanic/BotanicLamp.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic name.SetDefault("Botanic Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureBotanic/BotanicLantern.cs b/Tiles/FurnitureBotanic/BotanicLantern.cs index 0968fd342c..17d4ae8631 100644 --- a/Tiles/FurnitureBotanic/BotanicLantern.cs +++ b/Tiles/FurnitureBotanic/BotanicLantern.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic name.SetDefault("Botanic Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureBotanic/BotanicPiano.cs b/Tiles/FurnitureBotanic/BotanicPiano.cs index 9e7ccb7b8e..f8f16b4523 100644 --- a/Tiles/FurnitureBotanic/BotanicPiano.cs +++ b/Tiles/FurnitureBotanic/BotanicPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicPlanter.cs b/Tiles/FurnitureBotanic/BotanicPlanter.cs index a9571b8b03..7f1cce9a8f 100644 --- a/Tiles/FurnitureBotanic/BotanicPlanter.cs +++ b/Tiles/FurnitureBotanic/BotanicPlanter.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic name.SetDefault("Botanic Planter"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureBotanic/BotanicPlatform.cs b/Tiles/FurnitureBotanic/BotanicPlatform.cs index 46bb0c94f4..12fa5bc8dc 100644 --- a/Tiles/FurnitureBotanic/BotanicPlatform.cs +++ b/Tiles/FurnitureBotanic/BotanicPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("BotanicPlatform"); diff --git a/Tiles/FurnitureBotanic/BotanicSink.cs b/Tiles/FurnitureBotanic/BotanicSink.cs index 1dcc2bb949..d11ff43f03 100644 --- a/Tiles/FurnitureBotanic/BotanicSink.cs +++ b/Tiles/FurnitureBotanic/BotanicSink.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Sink"); diff --git a/Tiles/FurnitureBotanic/BotanicTable.cs b/Tiles/FurnitureBotanic/BotanicTable.cs index 23b6c6cc78..f0e781f647 100644 --- a/Tiles/FurnitureBotanic/BotanicTable.cs +++ b/Tiles/FurnitureBotanic/BotanicTable.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureBotanic/BotanicWorkBench.cs b/Tiles/FurnitureBotanic/BotanicWorkBench.cs index d5e93c13dc..4bd2a5a882 100644 --- a/Tiles/FurnitureBotanic/BotanicWorkBench.cs +++ b/Tiles/FurnitureBotanic/BotanicWorkBench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBath.cs b/Tiles/FurnitureCosmilite/CosmiliteBath.cs index fc0c2ab40c..e4e38eb228 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBath.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBath.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index ba79460d2d..a496aff125 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs index 9cf0fb9f0f..7d541d6352 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Main.tileTable[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index 339160b690..82cf818c18 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureCosmilite { @@ -11,9 +12,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; mineResist = 5f; minPick = 275; @@ -28,6 +27,11 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return false; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BrimstoneFraming(i, j, resetFrame); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].frameX; @@ -35,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Texture2D glowmask = mod.GetTexture("Tiles/FurnitureCosmilite/CosmiliteBrick_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = Color.White; + Color drawColour = GetDrawColour(i, j, Color.White); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -47,5 +51,18 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.png b/Tiles/FurnitureCosmilite/CosmiliteBrick.png index ab55d04cc6..b2c51767b9 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteBrick.png and b/Tiles/FurnitureCosmilite/CosmiliteBrick.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick_Glowmask.png b/Tiles/FurnitureCosmilite/CosmiliteBrick_Glowmask.png index 6f5e9ea696..fcdac0945d 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteBrick_Glowmask.png and b/Tiles/FurnitureCosmilite/CosmiliteBrick_Glowmask.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs index 253bb6a82f..6a5782d4dd 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs index a8709bf520..0b81bc2980 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("CosmiliteCandle"); diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index f920a50a40..af5992f52c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index c2fd3243d4..5266e4225d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs index 4f7cf0552d..a9830e99a3 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs index 34f9878729..667138d575 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs index b904ee8d4c..fa1b87681d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs index 8135f4ad24..9af8031693 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite name.SetDefault("Cosmilite Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index 0c21a9745d..97ab66f97a 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite name.SetDefault("Cosmilite Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureCosmilite/CosmilitePiano.cs b/Tiles/FurnitureCosmilite/CosmilitePiano.cs index 1befc31050..3c6bb6362b 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePiano.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePiano.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs index 46f7b4898b..8fa2182b31 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("CosmilitePlatform"); diff --git a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs index 1e9241e745..2afc8ce26e 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite name.SetDefault("Cosmilite Sconce"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs index 5df100b6d7..cdbcb44222 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteTable.cs b/Tiles/FurnitureCosmilite/CosmiliteTable.cs index 71684787f7..af9349f0ef 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteTable.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteTable.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = true; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs index 74fa62ff18..d3459ee834 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs index 437927d945..40348cc160 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBathtub.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index 340c023a20..721ae687a1 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicBench.cs b/Tiles/FurnitureEutrophic/EutrophicBench.cs index 9be8bd6a10..fec0e2120c 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBench.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs b/Tiles/FurnitureEutrophic/EutrophicBookcase.cs index 65d0407768..0d15b9e40b 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBookcase.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs b/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs index cabf3b17ee..c893dc6159 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureEutrophic/EutrophicCandle.cs b/Tiles/FurnitureEutrophic/EutrophicCandle.cs index 92230670ff..eabefb18c1 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandle.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCandle.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("EutrophicCandle"); diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.cs b/Tiles/FurnitureEutrophic/EutrophicChair.cs index 13e4a121be..3141c9a77b 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChair.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs index 1ea8af2e2d..877000c5b4 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicCrafting.cs b/Tiles/FurnitureEutrophic/EutrophicCrafting.cs index 2c33966469..36f36c8658 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCrafting.cs +++ b/Tiles/FurnitureEutrophic/EutrophicCrafting.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic name.SetDefault("Eutrophic Shelf"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs index 4f7dc9ac09..fd92268511 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs index 050a64b12d..af96fd133d 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser.cs b/Tiles/FurnitureEutrophic/EutrophicDresser.cs index 41454aa99b..d023e2db12 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDresser.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDresser.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicLamp.cs b/Tiles/FurnitureEutrophic/EutrophicLamp.cs index 2312206980..d38b0b26fb 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLamp.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLamp.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic name.SetDefault("Eutrophic Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.cs b/Tiles/FurnitureEutrophic/EutrophicLantern.cs index 28acbe26f1..e7f6e012e1 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLantern.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLantern.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic name.SetDefault("Eutrophic Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureEutrophic/EutrophicPiano.cs b/Tiles/FurnitureEutrophic/EutrophicPiano.cs index 00b4d755ef..eb52a1f167 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPiano.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs index f0bdd23bfe..aac1cd4ae3 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("EutrophicPlatform"); diff --git a/Tiles/FurnitureEutrophic/EutrophicTable.cs b/Tiles/FurnitureEutrophic/EutrophicTable.cs index 8f0cb4987f..c3d40195f3 100644 --- a/Tiles/FurnitureEutrophic/EutrophicTable.cs +++ b/Tiles/FurnitureEutrophic/EutrophicTable.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs index a66ed9741a..566bcf6344 100644 --- a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.cs b/Tiles/FurnitureEutrophic/SmoothNavystone.cs index 1b569fd782..0c24936498 100644 --- a/Tiles/FurnitureEutrophic/SmoothNavystone.cs +++ b/Tiles/FurnitureEutrophic/SmoothNavystone.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureEutrophic { @@ -11,6 +13,13 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeSmoothTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeDesertTiles(Type); + + TileID.Sets.ChecksForMerge[Type] = true; soundType = 21; minPick = 55; drop = mod.ItemType("SmoothNavystone"); diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.png b/Tiles/FurnitureEutrophic/SmoothNavystone.png index d3b848f97f..7d498f636a 100644 Binary files a/Tiles/FurnitureEutrophic/SmoothNavystone.png and b/Tiles/FurnitureEutrophic/SmoothNavystone.png differ diff --git a/Tiles/FurnitureOccult/OccultBathtub.cs b/Tiles/FurnitureOccult/OccultBathtub.cs index 2f1e525953..e3138f7b04 100644 --- a/Tiles/FurnitureOccult/OccultBathtub.cs +++ b/Tiles/FurnitureOccult/OccultBathtub.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureOccult/OccultBed.cs b/Tiles/FurnitureOccult/OccultBed.cs index 415a6ea3f8..b98e55edec 100644 --- a/Tiles/FurnitureOccult/OccultBed.cs +++ b/Tiles/FurnitureOccult/OccultBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultBookcase.cs b/Tiles/FurnitureOccult/OccultBookcase.cs index a298eb2f36..742ac173b2 100644 --- a/Tiles/FurnitureOccult/OccultBookcase.cs +++ b/Tiles/FurnitureOccult/OccultBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultCandelabra.cs b/Tiles/FurnitureOccult/OccultCandelabra.cs index c4b86a76a6..0118ec673c 100644 --- a/Tiles/FurnitureOccult/OccultCandelabra.cs +++ b/Tiles/FurnitureOccult/OccultCandelabra.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureOccult ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureOccult/OccultCandle.cs b/Tiles/FurnitureOccult/OccultCandle.cs index d410a131d1..fa9dd4d3e8 100644 --- a/Tiles/FurnitureOccult/OccultCandle.cs +++ b/Tiles/FurnitureOccult/OccultCandle.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureOccult ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("OccultCandle"); diff --git a/Tiles/FurnitureOccult/OccultChair.cs b/Tiles/FurnitureOccult/OccultChair.cs index 1a395238cf..9f81b48004 100644 --- a/Tiles/FurnitureOccult/OccultChair.cs +++ b/Tiles/FurnitureOccult/OccultChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultChandelier.cs b/Tiles/FurnitureOccult/OccultChandelier.cs index 5279e02d5a..23f6c37399 100644 --- a/Tiles/FurnitureOccult/OccultChandelier.cs +++ b/Tiles/FurnitureOccult/OccultChandelier.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultDoorClosed.cs b/Tiles/FurnitureOccult/OccultDoorClosed.cs index 43750ddf4e..43c25a17d4 100644 --- a/Tiles/FurnitureOccult/OccultDoorClosed.cs +++ b/Tiles/FurnitureOccult/OccultDoorClosed.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultDoorOpen.cs b/Tiles/FurnitureOccult/OccultDoorOpen.cs index c6b71dc4f4..c479bab406 100644 --- a/Tiles/FurnitureOccult/OccultDoorOpen.cs +++ b/Tiles/FurnitureOccult/OccultDoorOpen.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureOccult/OccultDresser.cs b/Tiles/FurnitureOccult/OccultDresser.cs index 86050a2f1d..4d26a265d7 100644 --- a/Tiles/FurnitureOccult/OccultDresser.cs +++ b/Tiles/FurnitureOccult/OccultDresser.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultLamp.cs b/Tiles/FurnitureOccult/OccultLamp.cs index 4f860389f1..767c42d834 100644 --- a/Tiles/FurnitureOccult/OccultLamp.cs +++ b/Tiles/FurnitureOccult/OccultLamp.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureOccult name.SetDefault("Otherworldly Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureOccult/OccultLantern.cs b/Tiles/FurnitureOccult/OccultLantern.cs index 97b597c337..de6a34be79 100644 --- a/Tiles/FurnitureOccult/OccultLantern.cs +++ b/Tiles/FurnitureOccult/OccultLantern.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureOccult name.SetDefault("Otherworldly Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureOccult/OccultPiano.cs b/Tiles/FurnitureOccult/OccultPiano.cs index 22a6b79870..55937a20d1 100644 --- a/Tiles/FurnitureOccult/OccultPiano.cs +++ b/Tiles/FurnitureOccult/OccultPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultPlatform.cs b/Tiles/FurnitureOccult/OccultPlatform.cs index d59370f6f5..199ed3a999 100644 --- a/Tiles/FurnitureOccult/OccultPlatform.cs +++ b/Tiles/FurnitureOccult/OccultPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("OccultPlatform"); diff --git a/Tiles/FurnitureOccult/OccultSofa.cs b/Tiles/FurnitureOccult/OccultSofa.cs index b5059c3cfe..c2b9f3cf4e 100644 --- a/Tiles/FurnitureOccult/OccultSofa.cs +++ b/Tiles/FurnitureOccult/OccultSofa.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultStone.cs b/Tiles/FurnitureOccult/OccultStone.cs index c216ab778d..71ac71a725 100644 --- a/Tiles/FurnitureOccult/OccultStone.cs +++ b/Tiles/FurnitureOccult/OccultStone.cs @@ -2,542 +2,341 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureOccult { public class OccultStone : ModTile { + private int extraFrameHeight = 36; + private int extraFrameWidth = 90; + public override void SetDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeSmoothTiles(Type); + soundType = 21; mineResist = 10f; minPick = 200; drop = mod.ItemType("OccultStone"); AddMapEntry(new Color(60, 42, 61)); - animationFrameHeight = 90; } - int animationFrameWidth = 234; public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(125, 94, 128), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("OccultTileCloth"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("OccultTileExtra"), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - Main.tile[i, j].color(0); - return true; - } - - public override bool Slope(int i, int j) - { - return false; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - //I'm so sorry about this section - //This selects the particular pattern to draw, instead of based on just position also being based on relation to an edge. - int uniqueAnimationFrameX = i % 3; - int uniqueAnimationFrameY = Main.tileFrame[Type] + j; - if (Main.tile[i, j - 1].type != mod.TileType("OccultStone")) - { - //Row 1 and Row 10 - if ((Main.tile[i, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 2].type != mod.TileType("OccultStone")) || - (Main.tile[i, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 2].type == mod.TileType("OccultStone") && - Main.tile[i - 2, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 2, j - 2].type != mod.TileType("OccultStone"))) - { - //Row 10 - uniqueAnimationFrameY = 9; - } - else - { - //Row 1 - uniqueAnimationFrameY = 0; - } - } - else if ((Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone")) || - (Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j].type == mod.TileType("OccultStone")) || - (Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone"))) - { - //Row 1 and Row 7 - if (Main.tile[i, j - 1].type != mod.TileType("OccultStone") || - ((Main.tile[i - 1, j].type == mod.TileType("OccultStone") || - Main.tile[i + 1, j].type == mod.TileType("OccultStone")) && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i, j - 2].type == mod.TileType("OccultStone") && - !(Main.tile[i - 1, j - 2].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone"))) || - ((Main.tile[i - 1, j].type == mod.TileType("OccultStone") || - Main.tile[i + 1, j].type == mod.TileType("OccultStone")) && - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i, j - 2].type == mod.TileType("OccultStone") && - !(Main.tile[i + 1, j - 2].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type == mod.TileType("OccultStone")))) - { - //Row 1 - uniqueAnimationFrameY = 0; - } - else - { - //Row 7 - uniqueAnimationFrameY = 6; - } - } - else if ((Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone"))) - { - //Row 3 and Row 8 - if (Main.tile[i, j - 2].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 2].type == mod.TileType("OccultStone")) - { - //Row 3 - uniqueAnimationFrameY = 2; - } - else - { - //Row 8 - uniqueAnimationFrameY = 7; - } - } - else if ((Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone"))) - { - //Row 5 and Row 9 - if (Main.tile[i, j - 2].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 2].type == mod.TileType("OccultStone")) - { - //Row 5 - uniqueAnimationFrameY = 4; - } - else - { - //Row 9 - uniqueAnimationFrameY = 8; - } - } - else if ((Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i, j - 2].type != mod.TileType("OccultStone")) || - - (((Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 2].type != mod.TileType("OccultStone") && - (Main.tile[i + 1, j - 2].type != mod.TileType("OccultStone") || - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone"))) || - (Main.tile[i + 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 2].type != mod.TileType("OccultStone")) && - (Main.tile[i - 1, j - 2].type != mod.TileType("OccultStone") || - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone")))) || - - (Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 2].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j - 2].type != mod.TileType("OccultStone"))) - { - //Row 2 - uniqueAnimationFrameY = 1; - } - else if ((Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 2].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i, j - 2].type == mod.TileType("OccultStone"))) - { - //Row 4 - uniqueAnimationFrameY = 3; - } - else if ((Main.tile[i + 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 2].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i, j - 2].type == mod.TileType("OccultStone"))) - { - //Row 6 - uniqueAnimationFrameY = 5; - } - else - { - uniqueAnimationFrameX = 1; - uniqueAnimationFrameY = 1; - } - - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; - frameYOffset = uniqueAnimationFrameY * animationFrameHeight; - } - public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - Main.specX[nextSpecialDrawIndex] = i; - Main.specY[nextSpecialDrawIndex] = j; - nextSpecialDrawIndex++; + if (Main.tile[i - 1, j - 1].type != Type || Main.tile[i, j - 1].type != Type || Main.tile[i + 1, j - 1].type != Type || + Main.tile[i - 1, j - 2].type != Type || Main.tile[i, j - 2].type != Type || Main.tile[i + 1, j - 2].type != Type) + { + Main.specX[nextSpecialDrawIndex] = i; + Main.specY[nextSpecialDrawIndex] = j; + nextSpecialDrawIndex++; + } } public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j); Texture2D cloth = mod.GetTexture("Tiles/FurnitureOccult/OccultStone_Cloth"); - //Left - if ((Main.tile[i - 1, j].type != mod.TileType("OccultStone") && - Main.tile[i, j - 1].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone"))) + DrawExtraTop(i, j, cloth, drawOffset, drawColour); + DrawExtraWallEnds(i, j, cloth, drawOffset, drawColour); + DrawExtraDrapes(i, j, cloth, drawOffset, drawColour); + } + + #region 'Extra Drapes' Drawing + private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface + */ + if ( + CheckTile(Type, false, 0, 1, i, j) || + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) + ) { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 0, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 36, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 72, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + DrawExtraOverhang(i, j, extras, drawOffset, drawColour); + } + } + + private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Ending the Extra when a wall is reached + */ + + //Left + if ( + CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } //Right - if ((Main.tile[i + 1, j].type != mod.TileType("OccultStone") && - Main.tile[i, j - 1].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone"))) + if ( + CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j)) + ) { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 0, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 36, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 72, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - //Bottom Left - if ((Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i - 2, j].type == mod.TileType("OccultStone") && - Main.tile[i - 2, j - 1].type == mod.TileType("OccultStone"))) + } + + private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached + */ + + //Left + if ( + CheckTile(Type, false, -1, 0, i, j) + ) { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - //Bottom Right - if ((Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i + 1, j].type == mod.TileType("OccultStone") && - Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 2, j].type == mod.TileType("OccultStone") && - Main.tile[i + 2, j - 1].type == mod.TileType("OccultStone"))) + //Right + if ( + CheckTile(Type, false, 1, 0, i, j) + ) { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - //Bottom - if ((Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - Main.tile[i - 1, j].type == mod.TileType("OccultStone") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type == mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("OccultStone") && - Main.tile[i, j - 1].type == mod.TileType("OccultStone") && - (Main.tile[i - 1, j].type == mod.TileType("OccultStone") || - Main.tile[i + 1, j].type == mod.TileType("OccultStone")) && - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone"))) + } + + private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Hanging 'drapes' of the extra element + */ + + //Base + if ( + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) || + (CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j)) + ) { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } + //Left Wall + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Wall + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Left Overhang + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Overhang + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + #endregion + + #region Tile Data + private bool CheckTile(int type, bool equal, int x, int y, int i, int j) + { + //Subtract y so that y is vertical for ease of readability + return (Main.tile[i + x, j - y].type == type) == equal; } private Color GetDrawColour(int i, int j) { - Color lightColour = Lighting.GetColor(i, j); - //Color paintColour = WorldGen.paintColor(Main.tile[i, j].color()); - //Color drawColour = Color.White; - //drawColour = lightColour; - //drawColour.R = (byte)((paintColour.R / 255) * lightColour.R); - //drawColour.G = (byte)((paintColour.G / 255) * lightColour.G); - //drawColour.B = (byte)((paintColour.B / 255) * lightColour.B); - return (lightColour); + int colType = Main.tile[i, j].color(); + 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; } + + private int GetExtraState(string type) + { + switch (type) + { + case "middle": + return 36; + case "overhangLeft": + return 18; + case "overhangRight": + return 54; + case "wallEndLeft": + return 0; + case "wallEndRight": + return 72; + default: + Main.NewText(type.ToString() + " is not a valid Extra sheet state"); + return 0; + } + } + + private int GetExtraPattern(int i) + { + return (i % 3) * extraFrameHeight; + } + + private int GetExtraVariant(int i, int j) + { + return Main.tile[i, j].frameNumber() * extraFrameWidth; + } + + /* + private int GetTileVariant(int i, int j) + { + int variant = 0; //Default to using variant 1 + Tile sourceTile = Main.tile[i, j]; + //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using + int frameX = sourceTile.frameX / 18; + int frameY = sourceTile.frameY / 18; + if (frameY < 3 && !(frameX >= 6 && frameX < 9)) + { + int group = 0; + int[] group1XPos = new int[] { 1, 2, 3 }; + int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; + foreach (int k in group1XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 1; + } + } + foreach (int k in group2XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 2; + } + } + if (group == 1) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 3) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (group == 2) + { + if (frameY < 1) + { + variant = 0; + } + else if (frameY < 2) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + else if (frameX < 6 && frameY >= 3) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 4) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 6 && frameX < 9) + { + if (frameX < 7) + { + variant = 0; + } + else if (frameX < 8) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 9 && frameY >= 3) + { + if (frameX < 10) + { + variant = 0; + } + else if (frameX < 11) + { + variant = 1; + } + else + { + variant = 2; + } + } + return (variant); + } + */ + #endregion } } diff --git a/Tiles/FurnitureOccult/OccultStone.png b/Tiles/FurnitureOccult/OccultStone.png index cdd8b7399e..83b4f6d8f6 100644 Binary files a/Tiles/FurnitureOccult/OccultStone.png and b/Tiles/FurnitureOccult/OccultStone.png differ diff --git a/Tiles/FurnitureOccult/OccultStone_Cloth.png b/Tiles/FurnitureOccult/OccultStone_Cloth.png index dbcc0e12fb..f7d3f2e8e3 100644 Binary files a/Tiles/FurnitureOccult/OccultStone_Cloth.png and b/Tiles/FurnitureOccult/OccultStone_Cloth.png differ diff --git a/Tiles/FurnitureOccult/OccultTable.cs b/Tiles/FurnitureOccult/OccultTable.cs index 6d17864620..6544b31ab6 100644 --- a/Tiles/FurnitureOccult/OccultTable.cs +++ b/Tiles/FurnitureOccult/OccultTable.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureOccult Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureOccult/OccultWorkbench.cs b/Tiles/FurnitureOccult/OccultWorkbench.cs index 18f49f41a9..0b9a4ecf31 100644 --- a/Tiles/FurnitureOccult/OccultWorkbench.cs +++ b/Tiles/FurnitureOccult/OccultWorkbench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureOccult TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 179ec73e01..6f24a63e06 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurniturePlaguedPlate { @@ -11,9 +12,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; mineResist = 3f; minPick = 210; @@ -31,6 +30,12 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { num = fail ? 1 : 3; } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BrimstoneFraming(i, j, resetFrame); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].frameX; @@ -38,7 +43,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Texture2D glowmask = mod.GetTexture("Tiles/FurniturePlaguedPlate/PlaguedPlate_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(128, 128, 128, 128); + Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -50,5 +55,18 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.png b/Tiles/FurniturePlaguedPlate/PlaguedPlate.png index 206433d2b9..fabd68d237 100644 Binary files a/Tiles/FurniturePlaguedPlate/PlaguedPlate.png and b/Tiles/FurniturePlaguedPlate/PlaguedPlate.png differ diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs index 4bb61c1bff..d0ebb6fe61 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate name.SetDefault("Plagued Plate Basin"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 89120c440b..4514c6c773 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index bad9d81b68..fd3cdca19d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Main.tileTable[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index a7f19b93cb..ea6b82db04 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs index b56e09a4fc..bd60fc7533 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("PlaguedPlateCandle"); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index 1b95693d1a..184e6b5223 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index e8c28d93d3..55c169526d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs index dde6c97b2e..f44e51ad3c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs index fc9a511495..9d534919a9 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 511b584e8b..eff14dc3f6 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs index ce0dc52450..36c6580b7b 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate name.SetDefault("Plagued Plate Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 06d6413ddb..624a488f8f 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate name.SetDefault("Plagued Plate Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs index 49bdd20735..8928eda078 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index 276c271903..06cd6c11d5 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("PlaguedPlatePlatform"); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs index d85bfed655..894a80d832 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = true; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index a26e30cfe8..6380435008 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Plate Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate_Glowmask.png b/Tiles/FurniturePlaguedPlate/PlaguedPlate_Glowmask.png index a910097f31..a23ea5d843 100644 Binary files a/Tiles/FurniturePlaguedPlate/PlaguedPlate_Glowmask.png and b/Tiles/FurniturePlaguedPlate/PlaguedPlate_Glowmask.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedBasin.cs b/Tiles/FurnitureProfaned/ProfanedBasin.cs index 3b60d85785..4bdf136965 100644 --- a/Tiles/FurnitureProfaned/ProfanedBasin.cs +++ b/Tiles/FurnitureProfaned/ProfanedBasin.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned name.SetDefault("Profaned Crucible"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureProfaned/ProfanedBath.cs b/Tiles/FurnitureProfaned/ProfanedBath.cs index 37120d4c6f..da74bb852c 100644 --- a/Tiles/FurnitureProfaned/ProfanedBath.cs +++ b/Tiles/FurnitureProfaned/ProfanedBath.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureProfaned/ProfanedBath.png b/Tiles/FurnitureProfaned/ProfanedBath.png index a0556a768d..50581701b0 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedBath.png and b/Tiles/FurnitureProfaned/ProfanedBath.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index d62170d741..46de90c888 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedBed.png b/Tiles/FurnitureProfaned/ProfanedBed.png index fbca11e14e..c04ba321a7 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedBed.png and b/Tiles/FurnitureProfaned/ProfanedBed.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedBed_Highlight.png b/Tiles/FurnitureProfaned/ProfanedBed_Highlight.png index 2506b6f412..53641dc473 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedBed_Highlight.png and b/Tiles/FurnitureProfaned/ProfanedBed_Highlight.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedBench.cs b/Tiles/FurnitureProfaned/ProfanedBench.cs index d3998683d8..1f623e4eac 100644 --- a/Tiles/FurnitureProfaned/ProfanedBench.cs +++ b/Tiles/FurnitureProfaned/ProfanedBench.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedBench.png b/Tiles/FurnitureProfaned/ProfanedBench.png index a68d7df692..2d16239eba 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedBench.png and b/Tiles/FurnitureProfaned/ProfanedBench.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedBookcase.cs b/Tiles/FurnitureProfaned/ProfanedBookcase.cs index 9ad5745faf..e5cfa9bf8a 100644 --- a/Tiles/FurnitureProfaned/ProfanedBookcase.cs +++ b/Tiles/FurnitureProfaned/ProfanedBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.tileTable[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedBookcase.png b/Tiles/FurnitureProfaned/ProfanedBookcase.png index 34fdc5342e..37f4ad449f 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedBookcase.png and b/Tiles/FurnitureProfaned/ProfanedBookcase.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs index a356bc5faf..b5cd4b1bc4 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureProfaned/ProfanedCandelabra.png b/Tiles/FurnitureProfaned/ProfanedCandelabra.png index 0c489b6faa..3613b0a4c2 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedCandelabra.png and b/Tiles/FurnitureProfaned/ProfanedCandelabra.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedCandle.cs b/Tiles/FurnitureProfaned/ProfanedCandle.cs index 21a3677afd..a9a2c85976 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandle.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandle.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("ProfanedCandle"); diff --git a/Tiles/FurnitureProfaned/ProfanedCandle.png b/Tiles/FurnitureProfaned/ProfanedCandle.png index a6ef62cb04..049c646b0b 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedCandle.png and b/Tiles/FurnitureProfaned/ProfanedCandle.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index 49c98f91bb..5f6e82d742 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedChair.png b/Tiles/FurnitureProfaned/ProfanedChair.png index db114d0eb4..1f33813d04 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedChair.png and b/Tiles/FurnitureProfaned/ProfanedChair.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index 433e582beb..f4c1e2ac81 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.png b/Tiles/FurnitureProfaned/ProfanedChandelier.png index b90c59d4d4..94b3a12493 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedChandelier.png and b/Tiles/FurnitureProfaned/ProfanedChandelier.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedChest.png b/Tiles/FurnitureProfaned/ProfanedChest.png index 9b6d61f7fa..840ad62cbc 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedChest.png and b/Tiles/FurnitureProfaned/ProfanedChest.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedChest_Highlight.png b/Tiles/FurnitureProfaned/ProfanedChest_Highlight.png index 8c4e6f91ea..58faee3504 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedChest_Highlight.png and b/Tiles/FurnitureProfaned/ProfanedChest_Highlight.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedClock.png b/Tiles/FurnitureProfaned/ProfanedClock.png index 8f5c0098eb..67a497c300 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedClock.png and b/Tiles/FurnitureProfaned/ProfanedClock.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedClock_Highlight.png b/Tiles/FurnitureProfaned/ProfanedClock_Highlight.png index 933bb8599a..b0b8a9d15e 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedClock_Highlight.png and b/Tiles/FurnitureProfaned/ProfanedClock_Highlight.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedCrystal.cs b/Tiles/FurnitureProfaned/ProfanedCrystal.cs index 0fab7bc63b..669c628b25 100644 --- a/Tiles/FurnitureProfaned/ProfanedCrystal.cs +++ b/Tiles/FurnitureProfaned/ProfanedCrystal.cs @@ -1,24 +1,35 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedCrystal : ModTile - { - public override void SetDefaults() + { + int subsheetWidth = 324; + int subsheetHeight = 90; + public override void SetDefaults() { Main.tileSolid[Type] = true; Main.tileNoAttach[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeSmoothTiles(Type); + soundType = 13; mineResist = 1f; minPick = 225; drop = mod.ItemType("ProfanedCrystal"); AddMapEntry(new Color(181, 136, 177)); - animationFrameHeight = 90; } - int animationFrameWidth = 234; + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BetterGemsparkFraming(i, j, resetFrame); + } public override bool CreateDust(int i, int j, ref int type) { @@ -28,8 +39,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - frameXOffset = i % 2 * animationFrameWidth; - frameYOffset = j % 2 * animationFrameHeight; + frameXOffset = i % 2 * subsheetWidth; + frameYOffset = j % 2 * subsheetHeight; } } } diff --git a/Tiles/FurnitureProfaned/ProfanedCrystal.png b/Tiles/FurnitureProfaned/ProfanedCrystal.png index ecfeaf0438..494cfdd0de 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedCrystal.png and b/Tiles/FurnitureProfaned/ProfanedCrystal.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs index e5ff62f9a2..c23790a1dc 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed.png b/Tiles/FurnitureProfaned/ProfanedDoorClosed.png index db729a1e60..150fbe26b9 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedDoorClosed.png and b/Tiles/FurnitureProfaned/ProfanedDoorClosed.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed_Highlight.png b/Tiles/FurnitureProfaned/ProfanedDoorClosed_Highlight.png index 9dcd402c0b..6112fcbd7f 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedDoorClosed_Highlight.png and b/Tiles/FurnitureProfaned/ProfanedDoorClosed_Highlight.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs index f31abeb618..9ca417bc1a 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen.png b/Tiles/FurnitureProfaned/ProfanedDoorOpen.png index 72ce481a57..3506429d9c 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedDoorOpen.png and b/Tiles/FurnitureProfaned/ProfanedDoorOpen.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen_Highlight.png b/Tiles/FurnitureProfaned/ProfanedDoorOpen_Highlight.png index 1f725efb92..cff7020d6e 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedDoorOpen_Highlight.png and b/Tiles/FurnitureProfaned/ProfanedDoorOpen_Highlight.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedDresser.cs b/Tiles/FurnitureProfaned/ProfanedDresser.cs index 6f7074c242..8258bd1deb 100644 --- a/Tiles/FurnitureProfaned/ProfanedDresser.cs +++ b/Tiles/FurnitureProfaned/ProfanedDresser.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedDresser.png b/Tiles/FurnitureProfaned/ProfanedDresser.png index 7c614e3c17..f4ccc29293 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedDresser.png and b/Tiles/FurnitureProfaned/ProfanedDresser.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedLamp.cs b/Tiles/FurnitureProfaned/ProfanedLamp.cs index e8071a0b4a..9deea0f5e7 100644 --- a/Tiles/FurnitureProfaned/ProfanedLamp.cs +++ b/Tiles/FurnitureProfaned/ProfanedLamp.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned name.SetDefault("Profaned Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureProfaned/ProfanedLamp.png b/Tiles/FurnitureProfaned/ProfanedLamp.png index 92cf7b627b..ff352629ad 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedLamp.png and b/Tiles/FurnitureProfaned/ProfanedLamp.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index a3ddf82ff1..ed41597c7b 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned name.SetDefault("Profaned Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.png b/Tiles/FurnitureProfaned/ProfanedLantern.png index fae6a6e98a..ee28432a2e 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedLantern.png and b/Tiles/FurnitureProfaned/ProfanedLantern.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedPiano.cs b/Tiles/FurnitureProfaned/ProfanedPiano.cs index 8f20ce9a08..af5b9d7f9f 100644 --- a/Tiles/FurnitureProfaned/ProfanedPiano.cs +++ b/Tiles/FurnitureProfaned/ProfanedPiano.cs @@ -1,5 +1,7 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -14,9 +16,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedPiano.png b/Tiles/FurnitureProfaned/ProfanedPiano.png index 69d08405a1..e0a24c7064 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedPiano.png and b/Tiles/FurnitureProfaned/ProfanedPiano.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedPlatform.cs b/Tiles/FurnitureProfaned/ProfanedPlatform.cs index cd255b4161..f385b177dd 100644 --- a/Tiles/FurnitureProfaned/ProfanedPlatform.cs +++ b/Tiles/FurnitureProfaned/ProfanedPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("ProfanedPlatform"); diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 243ba1d3c6..058f87a628 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { @@ -10,8 +11,13 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; + Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeSmoothTiles(Type); + soundType = 21; mineResist = 15f; minPick = 225; @@ -213,7 +219,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Texture2D glowmask = mod.GetTexture("Tiles/FurnitureProfaned/ProfanedRock_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(25, 25, 25, 25); + Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -225,5 +231,18 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/FurnitureProfaned/ProfanedRock.png b/Tiles/FurnitureProfaned/ProfanedRock.png index b79d463276..4bffca535a 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedRock.png and b/Tiles/FurnitureProfaned/ProfanedRock.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedSink.png b/Tiles/FurnitureProfaned/ProfanedSink.png index 7008f9ec75..f59117d1e6 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedSink.png and b/Tiles/FurnitureProfaned/ProfanedSink.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedSlab.cs b/Tiles/FurnitureProfaned/ProfanedSlab.cs index 5af372e7ef..6cbbe9e3ca 100644 --- a/Tiles/FurnitureProfaned/ProfanedSlab.cs +++ b/Tiles/FurnitureProfaned/ProfanedSlab.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { @@ -9,8 +10,13 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileNoAttach[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeSmoothTiles(Type); + TileMerge.MergeTile(Type, mod.TileType("ProfanedRock")); + soundType = 21; mineResist = 10f; minPick = 225; diff --git a/Tiles/FurnitureProfaned/ProfanedTable.cs b/Tiles/FurnitureProfaned/ProfanedTable.cs index fdb2bc81a8..b52b93b93f 100644 --- a/Tiles/FurnitureProfaned/ProfanedTable.cs +++ b/Tiles/FurnitureProfaned/ProfanedTable.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = true; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureProfaned/ProfanedTable.png b/Tiles/FurnitureProfaned/ProfanedTable.png index bf7875403b..970efafa35 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedTable.png and b/Tiles/FurnitureProfaned/ProfanedTable.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs index 37621cc5a1..8106e30da8 100644 --- a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedWorkbench.png b/Tiles/FurnitureProfaned/ProfanedWorkbench.png index e0ae9df84f..d7f3bd9bdb 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedWorkbench.png and b/Tiles/FurnitureProfaned/ProfanedWorkbench.png differ diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index 9355f8915e..06b91a8c22 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureProfaned { @@ -10,8 +11,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeSmoothTiles(Type); + soundType = 21; mineResist = 10f; minPick = 225; @@ -47,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Texture2D glowmask = mod.GetTexture("Tiles/FurnitureProfaned/RunicProfanedBrick_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(128, 128, 128, 128); + Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -59,5 +64,18 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/FurnitureSilva/SilvaBasin.cs b/Tiles/FurnitureSilva/SilvaBasin.cs index 19d065f6cc..d4f01a41be 100644 --- a/Tiles/FurnitureSilva/SilvaBasin.cs +++ b/Tiles/FurnitureSilva/SilvaBasin.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureSilva name.SetDefault("Effulgent Manipulator"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureSilva/SilvaBathtub.cs b/Tiles/FurnitureSilva/SilvaBathtub.cs index 56d78a0ac1..3db0ad29c7 100644 --- a/Tiles/FurnitureSilva/SilvaBathtub.cs +++ b/Tiles/FurnitureSilva/SilvaBathtub.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index c2c1963bc6..8b62969fec 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaBench.cs b/Tiles/FurnitureSilva/SilvaBench.cs index 0325ef0fdc..fea111a7de 100644 --- a/Tiles/FurnitureSilva/SilvaBench.cs +++ b/Tiles/FurnitureSilva/SilvaBench.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaBookcase.cs b/Tiles/FurnitureSilva/SilvaBookcase.cs index 76349f3894..2aefb34090 100644 --- a/Tiles/FurnitureSilva/SilvaBookcase.cs +++ b/Tiles/FurnitureSilva/SilvaBookcase.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaCandelabra.cs b/Tiles/FurnitureSilva/SilvaCandelabra.cs index 9cecad276f..2498077836 100644 --- a/Tiles/FurnitureSilva/SilvaCandelabra.cs +++ b/Tiles/FurnitureSilva/SilvaCandelabra.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureSilva ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureSilva/SilvaCandle.cs b/Tiles/FurnitureSilva/SilvaCandle.cs index 11e7a47aff..a3e4d49790 100644 --- a/Tiles/FurnitureSilva/SilvaCandle.cs +++ b/Tiles/FurnitureSilva/SilvaCandle.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureSilva ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("SilvaCandle"); diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index 8115ce8ad9..41447e37c8 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index 347c311b90..a1cac5f2dd 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaCrystal.cs b/Tiles/FurnitureSilva/SilvaCrystal.cs index 4b078828a3..e2deec66c5 100644 --- a/Tiles/FurnitureSilva/SilvaCrystal.cs +++ b/Tiles/FurnitureSilva/SilvaCrystal.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureSilva { @@ -12,7 +13,6 @@ namespace CalamityMod.Tiles.FurnitureSilva Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; mineResist = 2f; minPick = 275; @@ -26,5 +26,10 @@ namespace CalamityMod.Tiles.FurnitureSilva Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 157, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BetterGemsparkFraming(i, j, resetFrame); + } } } diff --git a/Tiles/FurnitureSilva/SilvaCrystal.png b/Tiles/FurnitureSilva/SilvaCrystal.png index 8eaf0d742a..24fa4e7c1d 100644 Binary files a/Tiles/FurnitureSilva/SilvaCrystal.png and b/Tiles/FurnitureSilva/SilvaCrystal.png differ diff --git a/Tiles/FurnitureSilva/SilvaDoorClosed.cs b/Tiles/FurnitureSilva/SilvaDoorClosed.cs index c9a3f1186f..e021c36fea 100644 --- a/Tiles/FurnitureSilva/SilvaDoorClosed.cs +++ b/Tiles/FurnitureSilva/SilvaDoorClosed.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaDoorOpen.cs b/Tiles/FurnitureSilva/SilvaDoorOpen.cs index 5cb6721a06..fefab8e57a 100644 --- a/Tiles/FurnitureSilva/SilvaDoorOpen.cs +++ b/Tiles/FurnitureSilva/SilvaDoorOpen.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureSilva/SilvaDresser.cs b/Tiles/FurnitureSilva/SilvaDresser.cs index 4c056f10d1..50df3ef6cf 100644 --- a/Tiles/FurnitureSilva/SilvaDresser.cs +++ b/Tiles/FurnitureSilva/SilvaDresser.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaLamp.cs b/Tiles/FurnitureSilva/SilvaLamp.cs index 00d744470d..4a57d6496b 100644 --- a/Tiles/FurnitureSilva/SilvaLamp.cs +++ b/Tiles/FurnitureSilva/SilvaLamp.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureSilva name.SetDefault("Silva Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index 56a6a995fd..6c2f6a9b63 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureSilva name.SetDefault("Silva Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureSilva/SilvaPiano.cs b/Tiles/FurnitureSilva/SilvaPiano.cs index 2bc0bb6f60..641f903ca0 100644 --- a/Tiles/FurnitureSilva/SilvaPiano.cs +++ b/Tiles/FurnitureSilva/SilvaPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaPlatform.cs b/Tiles/FurnitureSilva/SilvaPlatform.cs index 73dc37a770..3b4ffcfc4b 100644 --- a/Tiles/FurnitureSilva/SilvaPlatform.cs +++ b/Tiles/FurnitureSilva/SilvaPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("SilvaPlatform"); diff --git a/Tiles/FurnitureSilva/SilvaTable.cs b/Tiles/FurnitureSilva/SilvaTable.cs index 69805aae72..80f6846847 100644 --- a/Tiles/FurnitureSilva/SilvaTable.cs +++ b/Tiles/FurnitureSilva/SilvaTable.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureSilva Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureSilva/SilvaWorkBench.cs b/Tiles/FurnitureSilva/SilvaWorkBench.cs index 332682dfdf..0619f87b9d 100644 --- a/Tiles/FurnitureSilva/SilvaWorkBench.cs +++ b/Tiles/FurnitureSilva/SilvaWorkBench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureSilva TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelBath.cs b/Tiles/FurnitureStatigel/StatigelBath.cs index 7689a54de9..b85c2f49f0 100644 --- a/Tiles/FurnitureStatigel/StatigelBath.cs +++ b/Tiles/FurnitureStatigel/StatigelBath.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index 45596c5bc2..83038e2e91 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelBlock.cs b/Tiles/FurnitureStatigel/StatigelBlock.cs index a2809c16bf..3bfc83f575 100644 --- a/Tiles/FurnitureStatigel/StatigelBlock.cs +++ b/Tiles/FurnitureStatigel/StatigelBlock.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureStatigel { @@ -11,7 +12,12 @@ namespace CalamityMod.Tiles.FurnitureStatigel Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - drop = mod.ItemType("StatigelBlock"); + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeSmoothTiles(Type); + + drop = mod.ItemType("StatigelBlock"); AddMapEntry(new Color(215, 74, 121)); } diff --git a/Tiles/FurnitureStatigel/StatigelBookcase.cs b/Tiles/FurnitureStatigel/StatigelBookcase.cs index cbe436fea8..1e532df68b 100644 --- a/Tiles/FurnitureStatigel/StatigelBookcase.cs +++ b/Tiles/FurnitureStatigel/StatigelBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel Main.tileTable[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelCandelabra.cs b/Tiles/FurnitureStatigel/StatigelCandelabra.cs index 89fea09f80..264de2a873 100644 --- a/Tiles/FurnitureStatigel/StatigelCandelabra.cs +++ b/Tiles/FurnitureStatigel/StatigelCandelabra.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureStatigel/StatigelCandle.cs b/Tiles/FurnitureStatigel/StatigelCandle.cs index f77e1af84d..4b5076a82f 100644 --- a/Tiles/FurnitureStatigel/StatigelCandle.cs +++ b/Tiles/FurnitureStatigel/StatigelCandle.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("StatigelCandle"); diff --git a/Tiles/FurnitureStatigel/StatigelChair.cs b/Tiles/FurnitureStatigel/StatigelChair.cs index c11ce43b3e..c5c268b552 100644 --- a/Tiles/FurnitureStatigel/StatigelChair.cs +++ b/Tiles/FurnitureStatigel/StatigelChair.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelChandelier.cs b/Tiles/FurnitureStatigel/StatigelChandelier.cs index c72e2eaf72..fc52e957d4 100644 --- a/Tiles/FurnitureStatigel/StatigelChandelier.cs +++ b/Tiles/FurnitureStatigel/StatigelChandelier.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs index f295d17c6e..2c410204d8 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs index 37dea2d8eb..bac0a6b97f 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStatigel/StatigelDresser.cs b/Tiles/FurnitureStatigel/StatigelDresser.cs index 1da20d6bd7..3ba10c7bb9 100644 --- a/Tiles/FurnitureStatigel/StatigelDresser.cs +++ b/Tiles/FurnitureStatigel/StatigelDresser.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelLamp.cs b/Tiles/FurnitureStatigel/StatigelLamp.cs index 04b1d0e589..fba175e444 100644 --- a/Tiles/FurnitureStatigel/StatigelLamp.cs +++ b/Tiles/FurnitureStatigel/StatigelLamp.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel name.SetDefault("Statigel Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index 9e47206ebe..d0b42ebf70 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel name.SetDefault("Statigel Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureStatigel/StatigelPiano.cs b/Tiles/FurnitureStatigel/StatigelPiano.cs index ebb27c1041..63f446dbf4 100644 --- a/Tiles/FurnitureStatigel/StatigelPiano.cs +++ b/Tiles/FurnitureStatigel/StatigelPiano.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelPlatform.cs b/Tiles/FurnitureStatigel/StatigelPlatform.cs index a987ddb0dd..f91f10d545 100644 --- a/Tiles/FurnitureStatigel/StatigelPlatform.cs +++ b/Tiles/FurnitureStatigel/StatigelPlatform.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("StatigelPlatform"); diff --git a/Tiles/FurnitureStatigel/StatigelSofa.cs b/Tiles/FurnitureStatigel/StatigelSofa.cs index bb61eadb98..8bb974d2f9 100644 --- a/Tiles/FurnitureStatigel/StatigelSofa.cs +++ b/Tiles/FurnitureStatigel/StatigelSofa.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelTable.cs b/Tiles/FurnitureStatigel/StatigelTable.cs index 2755115e5f..92a5c902d0 100644 --- a/Tiles/FurnitureStatigel/StatigelTable.cs +++ b/Tiles/FurnitureStatigel/StatigelTable.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = true; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStatigel/StatigelWorkbench.cs b/Tiles/FurnitureStatigel/StatigelWorkbench.cs index 87ee9502fe..22c1bfcd29 100644 --- a/Tiles/FurnitureStatigel/StatigelWorkbench.cs +++ b/Tiles/FurnitureStatigel/StatigelWorkbench.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Statigel Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusBathtub.cs b/Tiles/FurnitureStratus/StratusBathtub.cs index c69bd50de1..d98b2b1971 100644 --- a/Tiles/FurnitureStratus/StratusBathtub.cs +++ b/Tiles/FurnitureStratus/StratusBathtub.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index 2d969c52f7..50eee25444 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Bed"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[]{ TileID.Beds }; diff --git a/Tiles/FurnitureStratus/StratusBookcase.cs b/Tiles/FurnitureStratus/StratusBookcase.cs index 630a9683f0..b65067501f 100644 --- a/Tiles/FurnitureStratus/StratusBookcase.cs +++ b/Tiles/FurnitureStratus/StratusBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureStratus Main.tileTable[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 66a9f0de95..4f4ae1b266 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureStratus { @@ -11,12 +12,11 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileBrick[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; TileID.Sets.HasSlopeFrames[Type] = true; - //TileID.Sets.GemsparkFramingTypes[Type] = 258; + + TileMerge.MergeGeneralTiles(Type); + soundType = 21; mineResist = 5f; minPick = 250; @@ -31,12 +31,17 @@ namespace CalamityMod.Tiles.FurnitureStratus return false; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; Texture2D glowmask = mod.GetTexture("Tiles/FurnitureStratus/StratusBricks_Glowmask"); - Color drawColour = new Color(100, 100, 100, 100); + Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Tile trackTile = Main.tile[i, j]; @@ -50,5 +55,18 @@ namespace CalamityMod.Tiles.FurnitureStratus Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/FurnitureStratus/StratusBricks.png b/Tiles/FurnitureStratus/StratusBricks.png index e430d1ae2d..eb240d4d74 100644 Binary files a/Tiles/FurnitureStratus/StratusBricks.png and b/Tiles/FurnitureStratus/StratusBricks.png differ diff --git a/Tiles/FurnitureStratus/StratusBricks_Glowmask.png b/Tiles/FurnitureStratus/StratusBricks_Glowmask.png index 49ab32f44f..78f0155d0a 100644 Binary files a/Tiles/FurnitureStratus/StratusBricks_Glowmask.png and b/Tiles/FurnitureStratus/StratusBricks_Glowmask.png differ diff --git a/Tiles/FurnitureStratus/StratusCandelabra.cs b/Tiles/FurnitureStratus/StratusCandelabra.cs index 8b15cabaef..7969de68b6 100644 --- a/Tiles/FurnitureStratus/StratusCandelabra.cs +++ b/Tiles/FurnitureStratus/StratusCandelabra.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureStratus ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureStratus/StratusCandle.cs b/Tiles/FurnitureStratus/StratusCandle.cs index f08bf11904..bff1762e83 100644 --- a/Tiles/FurnitureStratus/StratusCandle.cs +++ b/Tiles/FurnitureStratus/StratusCandle.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureStratus ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("StratusCandle"); diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index 2784776140..faf4012b86 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index 6ea8efc778..76d0ed62e1 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index 18eeddc1ef..8cfae048b4 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureStratus Main.tileLavaDeath[Type] = true; animationFrameHeight = 90; TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.Height = 5; TileObjectData.newTile.CoordinateHeights = new int[] { diff --git a/Tiles/FurnitureStratus/StratusDoorClosed.cs b/Tiles/FurnitureStratus/StratusDoorClosed.cs index 9f2aaffd39..7811c86de4 100644 --- a/Tiles/FurnitureStratus/StratusDoorClosed.cs +++ b/Tiles/FurnitureStratus/StratusDoorClosed.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusDoorOpen.cs b/Tiles/FurnitureStratus/StratusDoorOpen.cs index 4e935518a0..57f5cefd03 100644 --- a/Tiles/FurnitureStratus/StratusDoorOpen.cs +++ b/Tiles/FurnitureStratus/StratusDoorOpen.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStratus/StratusDresser.cs b/Tiles/FurnitureStratus/StratusDresser.cs index 56965ec2f0..722731c3fa 100644 --- a/Tiles/FurnitureStratus/StratusDresser.cs +++ b/Tiles/FurnitureStratus/StratusDresser.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusLamp.cs b/Tiles/FurnitureStratus/StratusLamp.cs index b8b601b462..758be5ecee 100644 --- a/Tiles/FurnitureStratus/StratusLamp.cs +++ b/Tiles/FurnitureStratus/StratusLamp.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureStratus name.SetDefault("Stratus Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index 94fb2df145..0ffcdb6e35 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureStratus name.SetDefault("Stratus Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureStratus/StratusPiano.cs b/Tiles/FurnitureStratus/StratusPiano.cs index 8a2822a4ef..866966e5e7 100644 --- a/Tiles/FurnitureStratus/StratusPiano.cs +++ b/Tiles/FurnitureStratus/StratusPiano.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index 2bc3d1f3ca..6e8a2313f9 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("StratusPlatform"); diff --git a/Tiles/FurnitureStratus/StratusTable.cs b/Tiles/FurnitureStratus/StratusTable.cs index 7f54093eba..69dabcbff9 100644 --- a/Tiles/FurnitureStratus/StratusTable.cs +++ b/Tiles/FurnitureStratus/StratusTable.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureStratus Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = true; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureStratus/StratusWorkbench.cs b/Tiles/FurnitureStratus/StratusWorkbench.cs index ac9025e9cc..4c615a5f9c 100644 --- a/Tiles/FurnitureStratus/StratusWorkbench.cs +++ b/Tiles/FurnitureStratus/StratusWorkbench.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureStratus TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index eb5972931a..296f888365 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureVoid { @@ -12,6 +13,12 @@ namespace CalamityMod.Tiles.FurnitureVoid Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeSmoothTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + TileMerge.MergeAbyssTiles(Type); + soundType = 21; mineResist = 7f; minPick = 190; @@ -212,7 +219,7 @@ namespace CalamityMod.Tiles.FurnitureVoid Texture2D glowmask = mod.GetTexture("Tiles/FurnitureVoid/SmoothVoidstone_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(50, 50, 50, 50); + Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -224,5 +231,18 @@ namespace CalamityMod.Tiles.FurnitureVoid Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.png b/Tiles/FurnitureVoid/SmoothVoidstone.png index 47f5844086..4e8173565f 100644 Binary files a/Tiles/FurnitureVoid/SmoothVoidstone.png and b/Tiles/FurnitureVoid/SmoothVoidstone.png differ diff --git a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs index 629f7dc825..89e7e74802 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newTile.UsesCustomCanPlace = false; TileObjectData.newTile.LavaDeath = true; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); AddMapEntry(new Color(191, 142, 111)); dustType = mod.DustType("Sparkle"); drop = mod.ItemType("SmoothVoidstonePlatform"); diff --git a/Tiles/FurnitureVoid/VoidBath.cs b/Tiles/FurnitureVoid/VoidBath.cs index f5d8189236..c86e89612e 100644 --- a/Tiles/FurnitureVoid/VoidBath.cs +++ b/Tiles/FurnitureVoid/VoidBath.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Bathtub"); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index 27eb51a7a7..da3eb48d56 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //this style already takes care of direction for us TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidBookcase.cs b/Tiles/FurnitureVoid/VoidBookcase.cs index 495e3fcc34..4526cf2c23 100644 --- a/Tiles/FurnitureVoid/VoidBookcase.cs +++ b/Tiles/FurnitureVoid/VoidBookcase.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureVoid Main.tileTable[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidCandelabra.cs b/Tiles/FurnitureVoid/VoidCandelabra.cs index 5a9dc76689..e44847bae0 100644 --- a/Tiles/FurnitureVoid/VoidCandelabra.cs +++ b/Tiles/FurnitureVoid/VoidCandelabra.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.FurnitureVoid ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Candelabra"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureVoid/VoidCandle.cs b/Tiles/FurnitureVoid/VoidCandle.cs index 04962aadaa..2e7815eb2f 100644 --- a/Tiles/FurnitureVoid/VoidCandle.cs +++ b/Tiles/FurnitureVoid/VoidCandle.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureVoid ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Candle"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; drop = mod.ItemType("VoidCandle"); diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index 09eff605db..3693cadc91 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; //allows me to place example chairs facing the same way as the player TileObjectData.addAlternate(1); //facing right will use the second texture style TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index e9af0152bb..013610f348 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidDoorClosed.cs b/Tiles/FurnitureVoid/VoidDoorClosed.cs index 600d714d7c..cef0ca7df0 100644 --- a/Tiles/FurnitureVoid/VoidDoorClosed.cs +++ b/Tiles/FurnitureVoid/VoidDoorClosed.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newAlternate.Origin = new Point16(0, 2); TileObjectData.addAlternate(0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidDoorOpen.cs b/Tiles/FurnitureVoid/VoidDoorOpen.cs index 4d4cfe625a..e39adf6378 100644 --- a/Tiles/FurnitureVoid/VoidDoorOpen.cs +++ b/Tiles/FurnitureVoid/VoidDoorOpen.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); TileID.Sets.HousingWalls[Type] = true; //needed for non-solid blocks to count as walls TileID.Sets.HasOutlines[Type] = true; ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/VoidDresser.cs b/Tiles/FurnitureVoid/VoidDresser.cs index bcdebb9c1b..72666f3a6e 100644 --- a/Tiles/FurnitureVoid/VoidDresser.cs +++ b/Tiles/FurnitureVoid/VoidDresser.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Dresser"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidLamp.cs b/Tiles/FurnitureVoid/VoidLamp.cs index 8b6113dab1..20e29c0c9f 100644 --- a/Tiles/FurnitureVoid/VoidLamp.cs +++ b/Tiles/FurnitureVoid/VoidLamp.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureVoid name.SetDefault("Void Lamp"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index dca997878b..6437af3a67 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Tiles.FurnitureVoid name.SetDefault("Void Lantern"); AddMapEntry(new Color(191, 142, 111), name); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurnitureVoid/VoidPiano.cs b/Tiles/FurnitureVoid/VoidPiano.cs index cf8df20f8f..1a9b07309e 100644 --- a/Tiles/FurnitureVoid/VoidPiano.cs +++ b/Tiles/FurnitureVoid/VoidPiano.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidSofa.cs b/Tiles/FurnitureVoid/VoidSofa.cs index f107fed8d1..9df1f71097 100644 --- a/Tiles/FurnitureVoid/VoidSofa.cs +++ b/Tiles/FurnitureVoid/VoidSofa.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidTable.cs b/Tiles/FurnitureVoid/VoidTable.cs index 8c0759669c..3bce39a77a 100644 --- a/Tiles/FurnitureVoid/VoidTable.cs +++ b/Tiles/FurnitureVoid/VoidTable.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureVoid Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurnitureVoid/VoidWorkbench.cs b/Tiles/FurnitureVoid/VoidWorkbench.cs index a1203c3a50..8984924998 100644 --- a/Tiles/FurnitureVoid/VoidWorkbench.cs +++ b/Tiles/FurnitureVoid/VoidWorkbench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureVoid TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); TileObjectData.newTile.CoordinateHeights = new int[]{ 18 }; TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index e804303665..35094a782e 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.FurnitureVoid { @@ -157,7 +158,7 @@ namespace CalamityMod.Tiles.FurnitureVoid Texture2D glowmask = mod.GetTexture("Tiles/FurnitureVoid/VoidstoneSlab_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(75, 75, 75, 75); + Color drawColour = GetDrawColour(i, j, new Color(75, 75, 75, 75)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -170,5 +171,18 @@ namespace CalamityMod.Tiles.FurnitureVoid } } } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs index 4cf484a4e4..c2d0e6e6db 100644 --- a/Tiles/PerennialBrick.cs +++ b/Tiles/PerennialBrick.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -11,7 +12,11 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; - drop = mod.ItemType("PerennialBrick"); + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + + drop = mod.ItemType("PerennialBrick"); soundType = 21; minPick = 150; AddMapEntry(new Color(17, 133, 46)); diff --git a/Tiles/PerennialOre.cs b/Tiles/PerennialOre.cs index 98f0889ec6..36e27ce0a4 100644 --- a/Tiles/PerennialOre.cs +++ b/Tiles/PerennialOre.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -13,7 +14,10 @@ namespace CalamityMod.Tiles Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileValue[Type] = 690; - dustType = mod.DustType("CESparkle"); + + TileMerge.MergeGeneralTiles(Type); + + dustType = mod.DustType("CESparkle"); drop = mod.ItemType("PerennialOre"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Perennial Ore"); diff --git a/Tiles/PlantyMush.cs b/Tiles/PlantyMush.cs index 81e551463f..e758b230d4 100644 --- a/Tiles/PlantyMush.cs +++ b/Tiles/PlantyMush.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,7 +13,11 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - dustType = 2; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAbyssTiles(Type); + + dustType = 2; drop = mod.ItemType("PlantyMush"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Planty Mush"); @@ -71,7 +76,7 @@ namespace CalamityMod.Tiles Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); Main.tile[num53, num54].active(true); WorldGen.SquareTileFrame(num53, num54, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); } @@ -79,6 +84,12 @@ namespace CalamityMod.Tiles } } } - } - } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AbyssGravel"), false, false, false, false, resetFrame); + return false; + } + } } diff --git a/Tiles/SulphurousSand.cs b/Tiles/SulphurousSand.cs index 4f6317c551..d4dd07bdeb 100644 --- a/Tiles/SulphurousSand.cs +++ b/Tiles/SulphurousSand.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -12,7 +13,11 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - dustType = 32; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAbyssTiles(Type); + + dustType = 32; drop = mod.ItemType("SulphurousSand"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Sulphurous Sand"); @@ -117,13 +122,13 @@ namespace CalamityMod.Tiles if (!Main.tile[i, tileLocationY].active()) { if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && - Main.tile[i, tileLocationY - 2].liquid == 255 && Main.netMode != NetmodeID.MultiplayerClient) + Main.tile[i, tileLocationY - 2].liquid == 255 && Main.netMode != 1) { Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("SulphuricAcidCannon"), 0, 2f, Main.myPlayer, 0f, 0f); } if (i < 250 || i > Main.maxTilesX - 250) { - if (Main.rand.NextBool(400)) + if (Main.rand.Next(400) == 0) { if (Main.tile[i, tileLocationY].liquid == 255) { @@ -145,7 +150,7 @@ namespace CalamityMod.Tiles Main.tile[i, tileLocationY - 4].liquid == 255) { WorldGen.PlaceTile(i, tileLocationY, 81, true, false, -1, 0); - if (Main.netMode == NetmodeID.Server && Main.tile[i, tileLocationY].active()) + if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) { NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); } @@ -169,7 +174,7 @@ namespace CalamityMod.Tiles if (num15 < num14) { WorldGen.PlaceTile(i, tileLocationY, 324, true, false, -1, Main.rand.Next(2)); - if (Main.netMode == NetmodeID.Server && Main.tile[i, tileLocationY].active()) + if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) { NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); } @@ -179,6 +184,12 @@ namespace CalamityMod.Tiles } } } - } - } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AbyssGravel"), false, false, false, false, resetFrame); + return false; + } + } } diff --git a/Tiles/SulphurousSand.png b/Tiles/SulphurousSand.png index 68581b302a..adef70cc82 100644 Binary files a/Tiles/SulphurousSand.png and b/Tiles/SulphurousSand.png differ diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index c263c9b18c..ff6be5514e 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.SunkenSea { @@ -10,9 +12,13 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - dustType = 108; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDesertTiles(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + dustType = 108; drop = mod.ItemType("EutrophicSand"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Sand"); @@ -33,6 +39,12 @@ namespace CalamityMod.Tiles.SunkenSea public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; - } - } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, TileID.Sandstone, false, false, false, false, resetFrame); + return false; + } + } } diff --git a/Tiles/SunkenSea/EutrophicSand.png b/Tiles/SunkenSea/EutrophicSand.png index 04c9f26a5a..7743c95a6e 100644 Binary files a/Tiles/SunkenSea/EutrophicSand.png and b/Tiles/SunkenSea/EutrophicSand.png differ diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index a408dd4671..35aafeb18d 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.SunkenSea { @@ -11,9 +12,13 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - dustType = 96; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDesertTiles(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + dustType = 96; drop = mod.ItemType("Navystone"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Navystone"); @@ -40,7 +45,7 @@ namespace CalamityMod.Tiles.SunkenSea public override void RandomUpdate(int i, int j) { - if (Main.rand.NextBool(150)) + if (Main.rand.Next(100) == 0) { int random = WorldGen.genRand.Next(4); if (random == 0) @@ -85,7 +90,7 @@ namespace CalamityMod.Tiles.SunkenSea } Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); } @@ -93,6 +98,12 @@ namespace CalamityMod.Tiles.SunkenSea } } } - } - } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("EutrophicSand"), false, false, false, false, resetFrame); + return false; + } + } } diff --git a/Tiles/SunkenSea/Navystone.png b/Tiles/SunkenSea/Navystone.png index 35103a30e0..c8d67b12a2 100644 Binary files a/Tiles/SunkenSea/Navystone.png and b/Tiles/SunkenSea/Navystone.png differ diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 7bbe77eda7..1e7f402493 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Utilities; namespace CalamityMod.Tiles.SunkenSea { @@ -11,9 +12,13 @@ namespace CalamityMod.Tiles.SunkenSea public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - dustType = 33; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDesertTiles(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + dustType = 33; drop = mod.ItemType("SeaPrism"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Sea Prism"); @@ -41,7 +46,7 @@ namespace CalamityMod.Tiles.SunkenSea public override void RandomUpdate(int i, int j) { - if (Main.rand.NextBool(50)) + if (Main.rand.Next(25) == 0) { int random = WorldGen.genRand.Next(4); if (random == 0) @@ -86,7 +91,7 @@ namespace CalamityMod.Tiles.SunkenSea } Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); } @@ -94,6 +99,12 @@ namespace CalamityMod.Tiles.SunkenSea } } } - } - } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("Navystone"), false, false, false, false, resetFrame); + return false; + } + } } diff --git a/Tiles/SunkenSea/SeaPrism.png b/Tiles/SunkenSea/SeaPrism.png index 8a1548d781..aea69ab4af 100644 Binary files a/Tiles/SunkenSea/SeaPrism.png and b/Tiles/SunkenSea/SeaPrism.png differ diff --git a/Tiles/Tenebris.cs b/Tiles/Tenebris.cs index 9cdc2710a0..27f444dfaf 100644 --- a/Tiles/Tenebris.cs +++ b/Tiles/Tenebris.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -13,7 +14,11 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; - dustType = 44; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAbyssTiles(Type); + + dustType = 44; drop = mod.ItemType("Tenebris"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Tenebris"); @@ -74,7 +79,7 @@ namespace CalamityMod.Tiles { Main.tile[i, j].type = (ushort)mod.TileType("Tenebris"); WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == NetmodeID.Server) + if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); } @@ -83,5 +88,11 @@ namespace CalamityMod.Tiles } } } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AbyssGravel"), false, false, false, false, resetFrame); + return false; + } } } diff --git a/Tiles/Tenebris.png b/Tiles/Tenebris.png index 99e60a282d..a5c43e1d84 100644 Binary files a/Tiles/Tenebris.png and b/Tiles/Tenebris.png differ diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index 775f0ff371..495fd9dead 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -2,23 +2,29 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { public class UelibloomBrick : ModTile { + private int extraFrameHeight = 36; + private int extraFrameWidth = 90; + public override void SetDefaults() { Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeDecorativeTiles(Type); + soundType = 21; minPick = 200; drop = mod.ItemType("UelibloomBrick"); AddMapEntry(new Color(174, 108, 46)); - animationFrameHeight = 90; } - int animationFrameWidth = 234; public override bool CreateDust(int i, int j, ref int type) { @@ -27,520 +33,313 @@ namespace CalamityMod.Tiles return false; } - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - Main.tile[i, j].color(0); - return true; - } - - public override bool Slope(int i, int j) - { - return false; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - //I'm so sorry about this section - //This selects the particular pattern to draw, instead of based on just position also being based on relation to an edge. - int uniqueAnimationFrameX = i % 3; - int uniqueAnimationFrameY = Main.tileFrame[Type] + j; - if (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick")) - { - //Row 1 and Row 10 - if ((Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j - 2].type != mod.TileType("UelibloomBrick"))) - { - //Row 10 - uniqueAnimationFrameY = 9; - } - else - { - //Row 1 - uniqueAnimationFrameY = 0; - } - } - else if ((Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick"))) - { - //Row 1 and Row 7 - if (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") || - ((Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - !(Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick"))) || - ((Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - !(Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick")))) - { - //Row 1 - uniqueAnimationFrameY = 0; - } - else - { - //Row 7 - uniqueAnimationFrameY = 6; - } - } - else if ((Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick"))) - { - //Row 3 and Row 8 - if (Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type == mod.TileType("UelibloomBrick")) - { - //Row 3 - uniqueAnimationFrameY = 2; - } - else - { - //Row 8 - uniqueAnimationFrameY = 7; - } - } - else if ((Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick"))) - { - //Row 5 and Row 9 - if (Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type == mod.TileType("UelibloomBrick")) - { - //Row 5 - uniqueAnimationFrameY = 4; - } - else - { - //Row 9 - uniqueAnimationFrameY = 8; - } - } - else if ((Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type != mod.TileType("UelibloomBrick")) || - - (((Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - (Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) || - (Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick")) && - (Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") || - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick")))) || - - (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick"))) - { - //Row 2 - uniqueAnimationFrameY = 1; - } - else if ((Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick"))) - { - //Row 4 - uniqueAnimationFrameY = 3; - } - else if ((Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick"))) - { - //Row 6 - uniqueAnimationFrameY = 5; - } - else - { - uniqueAnimationFrameX = 1; - uniqueAnimationFrameY = 1; - } - - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; - frameYOffset = uniqueAnimationFrameY * animationFrameHeight; - } - public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { - Main.specX[nextSpecialDrawIndex] = i; - Main.specY[nextSpecialDrawIndex] = j; - nextSpecialDrawIndex++; + if (Main.tile[i - 1, j - 1].type != Type || Main.tile[i, j - 1].type != Type || Main.tile[i + 1, j - 1].type != Type || + Main.tile[i - 1, j - 2].type != Type || Main.tile[i, j - 2].type != Type || Main.tile[i + 1, j - 2].type != Type) + { + Main.specX[nextSpecialDrawIndex] = i; + Main.specY[nextSpecialDrawIndex] = j; + nextSpecialDrawIndex++; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return CustomTileFraming.BrimstoneFraming(i, j, resetFrame); } public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Texture2D cloth = mod.GetTexture("Tiles/UelibloomBrick_Leaves"); - //Left - if ((Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) + Color drawColour = GetDrawColour(i, j); + Texture2D leaves = mod.GetTexture("Tiles/UelibloomBrick_Leaves"); + + DrawExtraTop(i, j, leaves, drawOffset, drawColour); + DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); + DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); + } + + #region 'Extra Drapes' Drawing + private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface + */ + if ( + CheckTile(Type, false, 0, 1, i, j) || + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) + ) { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 0, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 36, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 72, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + DrawExtraOverhang(i, j, extras, drawOffset, drawColour); + } + } + + private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Ending the Extra when a wall is reached + */ + + //Left + if ( + CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } //Right - if ((Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick"))) + if ( + CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j)) + ) { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 0, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 36, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 72, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - //Bottom Left - if (((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j - 1].type == mod.TileType("UelibloomBrick"))) && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone")) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - //Bottom Right - if (((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 2, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 2, j - 1].type == mod.TileType("UelibloomBrick"))) && - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone")) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - //Bottom - if ((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached + */ + + //Left + if ( + CheckTile(Type, false, -1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right + if ( + CheckTile(Type, false, 1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Hanging 'drapes' of the extra element + */ + + //Base + if ( + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) || + (CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Left Wall + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Wall + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Left Overhang + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Overhang + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + #endregion + + #region Tile Data + private bool CheckTile(int type, bool equal, int x, int y, int i, int j) + { + //Subtract y so that y is vertical for ease of readability + return (Main.tile[i + x, j - y].type == type) == equal; + } + private Color GetDrawColour(int i, int j) { - Color lightColour = Lighting.GetColor(i, j); - //Color paintColour = WorldGen.paintColor(Main.tile[i, j].color()); - //Color drawColour = Color.White; - //drawColour = lightColour; - //drawColour.R = (byte)((paintColour.R / 255) * lightColour.R); - //drawColour.G = (byte)((paintColour.G / 255) * lightColour.G); - //drawColour.B = (byte)((paintColour.B / 255) * lightColour.B); - return (lightColour); + int colType = Main.tile[i, j].color(); + 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; } + + private int GetExtraState(string type) + { + switch (type) + { + case "middle": + return 36; + case "overhangLeft": + return 18; + case "overhangRight": + return 54; + case "wallEndLeft": + return 0; + case "wallEndRight": + return 72; + default: + Main.NewText(type.ToString() + " is not a valid Extra sheet state"); + return 0; + } + } + + private int GetExtraPattern(int i) + { + return (i % 3) * extraFrameHeight; + } + + private int GetExtraVariant(int i, int j) + { + return Main.tile[i, j].frameNumber() * extraFrameWidth; + } + + /* + private int GetTileVariant(int i, int j) + { + int variant = 0; //Default to using variant 1 + Tile sourceTile = Main.tile[i, j]; + //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using + int frameX = sourceTile.frameX / 18; + int frameY = sourceTile.frameY / 18; + if (frameY < 3 && !(frameX >= 6 && frameX < 9)) + { + int group = 0; + int[] group1XPos = new int[] { 1, 2, 3 }; + int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; + foreach (int k in group1XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 1; + } + } + foreach (int k in group2XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 2; + } + } + if (group == 1) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 3) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (group == 2) + { + if (frameY < 1) + { + variant = 0; + } + else if (frameY < 2) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + else if (frameX < 6 && frameY >= 3) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 4) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 6 && frameX < 9) + { + if (frameX < 7) + { + variant = 0; + } + else if (frameX < 8) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 9 && frameY >= 3) + { + if (frameX < 10) + { + variant = 0; + } + else if (frameX < 11) + { + variant = 1; + } + else + { + variant = 2; + } + } + return (variant); + } + */ + #endregion } } diff --git a/Tiles/UelibloomBrick.png b/Tiles/UelibloomBrick.png index 28302f185a..0e15babd74 100644 Binary files a/Tiles/UelibloomBrick.png and b/Tiles/UelibloomBrick.png differ diff --git a/Tiles/UelibloomBrick_Leaves.png b/Tiles/UelibloomBrick_Leaves.png index 52485c4fee..39c23b9d69 100644 Binary files a/Tiles/UelibloomBrick_Leaves.png and b/Tiles/UelibloomBrick_Leaves.png differ diff --git a/Tiles/UelibloomOre.cs b/Tiles/UelibloomOre.cs index 2882776348..af645d017f 100644 --- a/Tiles/UelibloomOre.cs +++ b/Tiles/UelibloomOre.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -9,10 +11,12 @@ namespace CalamityMod.Tiles public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileValue[Type] = 805; - dustType = mod.DustType("TCESparkle"); + + TileMerge.MergeGeneralTiles(Type); + + dustType = mod.DustType("TCESparkle"); drop = mod.ItemType("UelibloomOre"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Uelibloom Ore"); @@ -31,6 +35,12 @@ namespace CalamityMod.Tiles public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; - } - } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, TileID.Mud, false, false, false, false, resetFrame); + return false; + } + } } diff --git a/Tiles/Voidstone.cs b/Tiles/Voidstone.cs index 907986cc7a..f08a7a1db4 100644 --- a/Tiles/Voidstone.cs +++ b/Tiles/Voidstone.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Utilities; namespace CalamityMod.Tiles { @@ -10,8 +12,13 @@ namespace CalamityMod.Tiles public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + + TileMerge.MergeGeneralTiles(Type); + TileMerge.MergeAbyssTiles(Type); + + TileID.Sets.ChecksForMerge[Type] = true; soundType = 21; mineResist = 10f; minPick = 190; @@ -212,7 +219,7 @@ namespace CalamityMod.Tiles Texture2D glowmask = mod.GetTexture("Tiles/Voidstone_Glowmask"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = new Color(25, 25, 25, 25); + Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) @@ -224,5 +231,24 @@ namespace CalamityMod.Tiles Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + CustomTileFraming.FrameTileForCustomMerge(i, j, Type, mod.TileType("AbyssGravel"), false, false, false, false, resetFrame); + return false; + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)((paintCol.R / 255f) * colour.R); + colour.G = (byte)((paintCol.G / 255f) * colour.G); + colour.B = (byte)((paintCol.B / 255f) * colour.B); + } + return colour; + } } } diff --git a/Tiles/Voidstone.png b/Tiles/Voidstone.png index f70ab3aebd..5f4f37b630 100644 Binary files a/Tiles/Voidstone.png and b/Tiles/Voidstone.png differ diff --git a/Utilities/CustomTileFraming.cs b/Utilities/CustomTileFraming.cs index e09235247e..78f950150f 100644 --- a/Utilities/CustomTileFraming.cs +++ b/Utilities/CustomTileFraming.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Linq; - using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,948 +9,1578 @@ using CalamityMod.Tiles; namespace CalamityMod.Utilities { public static class CustomTileFraming - { - private static int[][] PlantCheckAgainst; - private static Dictionary VineToGrass; - public static bool[] tileMergeAstralDirt; + { + private static int[][] PlantCheckAgainst; + private static Dictionary VineToGrass; + public static bool[][] tileMergeTypes; - static CustomTileFraming() - { - Setup(); - } + static CustomTileFraming() + { + Setup(); + } - private static void Setup() - { - Mod mod = CalamityMod.Instance; + private static void Setup() + { + Mod mod = CalamityMod.Instance; - int size = CalamityGlobalTile.PlantTypes.Length; - PlantCheckAgainst = new int[TileLoader.TileCount][]; + int size = CalamityGlobalTile.PlantTypes.Length; + PlantCheckAgainst = new int[TileLoader.TileCount][]; - PlantCheckAgainst[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; - PlantCheckAgainst[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass }; - PlantCheckAgainst[TileID.JunglePlants] = new int[1] { TileID.JungleGrass }; - PlantCheckAgainst[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass }; - PlantCheckAgainst[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; - PlantCheckAgainst[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass }; - PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass }; - PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass }; - PlantCheckAgainst[TileID.FleshWeeds] = new int[1] { TileID.FleshWeeds }; - PlantCheckAgainst[CalamityMod.Instance.TileType("AstralShortPlants")] = new int[1] { mod.TileType("AstralGrass") }; - PlantCheckAgainst[CalamityMod.Instance.TileType("AstralTallPlants")] = new int[1] { mod.TileType("AstralGrass") }; + PlantCheckAgainst[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; + PlantCheckAgainst[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass }; + PlantCheckAgainst[TileID.JunglePlants] = new int[1] { TileID.JungleGrass }; + PlantCheckAgainst[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass }; + PlantCheckAgainst[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; + PlantCheckAgainst[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass }; + PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass }; + PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass }; + PlantCheckAgainst[TileID.FleshWeeds] = new int[1] { TileID.FleshWeeds }; + PlantCheckAgainst[CalamityMod.Instance.TileType("AstralShortPlants")] = new int[1] { mod.TileType("AstralGrass") }; + PlantCheckAgainst[CalamityMod.Instance.TileType("AstralTallPlants")] = new int[1] { mod.TileType("AstralGrass") }; - VineToGrass = new Dictionary(); - VineToGrass[TileID.Vines] = TileID.Grass; - VineToGrass[TileID.CrimsonVines] = TileID.FleshGrass; - VineToGrass[TileID.HallowedVines] = TileID.HallowedGrass; - VineToGrass[(ushort)mod.TileType("AstralVines")] = (ushort)mod.TileType("AstralGrass"); + VineToGrass = new Dictionary(); + VineToGrass[TileID.Vines] = TileID.Grass; + VineToGrass[TileID.CrimsonVines] = TileID.FleshGrass; + VineToGrass[TileID.HallowedVines] = TileID.HallowedGrass; + VineToGrass[(ushort)mod.TileType("AstralVines")] = (ushort)mod.TileType("AstralGrass"); - tileMergeAstralDirt = new bool[TileLoader.TileCount]; - //TODO: REST OF THESE - tileMergeAstralDirt[mod.TileType("AstralOre")] = true; - tileMergeAstralDirt[mod.TileType("AstralStone")] = true; - tileMergeAstralDirt[mod.TileType("AstralSand")] = true; - } - - private static bool PlantNeedsUpdate(int plantType, int checkType) - { - if (PlantCheckAgainst[plantType] == null) return false; - int size = PlantCheckAgainst[plantType].Length; - for (int i = 0; i < size; i++) - { - if (PlantCheckAgainst[plantType][i] == checkType) - { - return false; - } - } - return true; - } - - public static void CheckPlants(int x, int y) - { - int checkType = -1; - int plantType = Main.tile[x, y].type; - - if (y + 1 >= Main.maxTilesY) - checkType = plantType; - - Tile tile = Main.tile[x, y]; - Tile below = Main.tile[x, y + 1]; - if (y + 1 < Main.maxTilesY && below != null && below.nactive() && !below.halfBrick() && below.slope() == 0) - checkType = below.type; - - if (checkType == -1) return; - - //Check if this plant needs an update - if (PlantNeedsUpdate(plantType, checkType)) - { - if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.frameX >= 162) - { - Main.tile[x, y].frameX = 126; - } - if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.frameX >= 162) - { - Main.tile[x, y].frameX = 126; - } - - if (checkType == TileID.CorruptGrass) - { - plantType = TileID.CorruptPlants; - if (tile.frameX >= 162) - { - Main.tile[x, y].frameX = 126; - } - } - else if (checkType == TileID.Grass) - { - if (plantType == TileID.HallowedPlants2) - { - plantType = TileID.Plants2; - } - else - { - plantType = TileID.Plants; - } - } - else if (checkType == TileID.HallowedGrass) - { - if (plantType == TileID.Plants2) - { - plantType = TileID.HallowedPlants2; - } - else - { - plantType = TileID.HallowedPlants; - } - } - else if (checkType == TileID.FleshGrass) - { - plantType = TileID.FleshWeeds; - } - else if (checkType == TileID.MushroomGrass) - { - plantType = TileID.MushroomPlants; - while (Main.tile[x, y].frameX > 72) - { - Main.tile[x, y].frameX -= 72; - } - } - else if (checkType == CalamityMod.Instance.TileType("AstralGrass")) //ASTRAL - { - if (plantType == TileID.Plants || plantType == TileID.CorruptPlants || - plantType == TileID.FleshWeeds || plantType == TileID.HallowedPlants || - plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants) - { - plantType = CalamityMod.Instance.TileType("AstralShortPlants"); - } - else - { - plantType = CalamityMod.Instance.TileType("AstralTallPlants"); - } - } - if (plantType != Main.tile[x, y].type) - { - Main.tile[x, y].type = (ushort)plantType; - return; - } - WorldGen.KillTile(x, y, false, false, false); - } - } - - public static void VineFrame(int x, int y) - { - Tile tile = Main.tile[x, y]; - int myType = tile.type; - Tile tile2 = Main.tile[x, y - 1]; - Tile tile3 = Main.tile[x, y + 1]; - Tile tile4 = Main.tile[x - 1, y]; - Tile tile5 = Main.tile[x + 1, y]; - Tile tile6 = Main.tile[x - 1, y + 1]; - Tile tile7 = Main.tile[x + 1, y + 1]; - Tile tile8 = Main.tile[x - 1, y - 1]; - Tile tile9 = Main.tile[x + 1, y - 1]; - int num52 = -1; - int num53 = -1; - int num54 = -1; - int num55 = -1; - int num56 = -1; - int num57 = -1; - int num58 = -1; - int num59 = -1; - if (tile4 != null && tile4.active()) - { - if (Main.tileStone[(int)tile4.type]) - { - num55 = 1; - } - else - { - num55 = (int)tile4.type; - } - if (tile4.slope() == 1 || tile4.slope() == 3) - { - num55 = -1; - } - } - if (tile5 != null && tile5.active()) - { - if (Main.tileStone[(int)tile5.type]) - { - num56 = 1; - } - else - { - num56 = (int)tile5.type; - } - if (tile5.slope() == 2 || tile5.slope() == 4) - { - num56 = -1; - } - } - if (tile2 != null && tile2.active()) - { - if (Main.tileStone[(int)tile2.type]) - { - num53 = 1; - } - else - { - num53 = (int)tile2.type; - } - if (tile2.slope() == 3 || tile2.slope() == 4) - { - num53 = -1; - } - } - if (tile3 != null && tile3.active()) - { - if (Main.tileStone[(int)tile3.type]) - { - num58 = 1; - } - else - { - num58 = (int)tile3.type; - } - if (tile3.slope() == 1 || tile3.slope() == 2) - { - num58 = -1; - } - } - if (tile8 != null && tile8.active()) - { - if (Main.tileStone[(int)tile8.type]) - { - num52 = 1; - } - else - { - num52 = (int)tile8.type; - } - } - if (tile9 != null && tile9.active()) - { - if (Main.tileStone[(int)tile9.type]) - { - num54 = 1; - } - else - { - num54 = (int)tile9.type; - } - } - if (tile6 != null && tile6.active()) - { - if (Main.tileStone[(int)tile6.type]) - { - num57 = 1; - } - else - { - num57 = (int)tile6.type; - } - } - if (tile7 != null && tile7.active()) - { - if (Main.tileStone[(int)tile7.type]) - { - num59 = 1; - } - else - { - num59 = (int)tile7.type; - } - } - if (tile.slope() == 2) - { - num53 = -1; - num55 = -1; - } - if (tile.slope() == 1) - { - num53 = -1; - num56 = -1; - } - if (tile.slope() == 4) - { - num58 = -1; - num55 = -1; - } - if (tile.slope() == 3) - { - num58 = -1; - num56 = -1; - } - - if (tile2 != null) - { - if (!tile2.active()) - { - num53 = -1; - } - else if (tile2.bottomSlope()) - { - num53 = -1; - } - else - { - num53 = (int)tile2.type; - } - } - else - { - num53 = myType; - } - - ushort[] vines = VineToGrass.Keys.ToArray(); - - for (int i = 0; i < vines.Length; i++) - { - ushort myGrassType = VineToGrass[(ushort)vines[i]]; - if (myType != vines[i] && (num53 == myGrassType || num53 == vines[i])) - { - Main.tile[x, y].type = vines[i]; - WorldGen.SquareTileFrame(x, y, true); - return; - } - } - - if (num53 != myType) - { - bool flag17 = false; - if (num53 == -1) - { - flag17 = true; - } - else - { - for (int i = 0; i < vines.Length; i++) - { - if (myType != TileID.Vines) - { - if (myType == vines[i] && num53 != VineToGrass[vines[i]]) - { - flag17 = true; - } - } - else if (num53 != TileID.Grass && num53 != TileID.LeafBlock) - { - flag17 = true; - } - } - } - if (flag17) - { - WorldGen.KillTile(x, y, false, false, false); - } - } - return; - } - - enum Similarity - { - Same, - MergeLink, - None - } - - public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) - { - bool tmp; - FrameTileForCustomMerge(x, y, myType, mergeType, out tmp, out tmp, out tmp, out tmp, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, resetFrame); - } - - public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, out bool mergedUp, out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) - { - Tile tileLeft = Main.tile[x - 1, y]; - Tile tileRight = Main.tile[x + 1, y]; - Tile tileUp = Main.tile[x, y - 1]; - Tile tileDown = Main.tile[x, y + 1]; - Tile tileTopLeft = Main.tile[x - 1, y - 1]; - Tile tileTopRight = Main.tile[x + 1, y - 1]; - Tile tileBottomLeft = Main.tile[x - 1, y + 1]; - Tile tileBottomRight = Main.tile[x + 1, y + 1]; - - //CARDINAL - Similarity leftSim = GetSimilarity(tileLeft, myType, mergeType); - if (forceSameLeft) leftSim = Similarity.Same; - Similarity rightSim = GetSimilarity(tileRight, myType, mergeType); - if (forceSameRight) rightSim = Similarity.Same; - Similarity upSim = GetSimilarity(tileUp, myType, mergeType); - if (forceSameUp) upSim = Similarity.Same; - Similarity downSim = GetSimilarity(tileDown, myType, mergeType); - if (forceSameDown) downSim = Similarity.Same; - - //DIAGONAL - Similarity topLeftSim = GetSimilarity(tileTopLeft, myType, mergeType); - Similarity topRightSim = GetSimilarity(tileTopRight, myType, mergeType); - Similarity bottomLeftSim = GetSimilarity(tileBottomLeft, myType, mergeType); - Similarity bottomRightSim = GetSimilarity(tileBottomRight, myType, mergeType); - - int randomFrame; - if (resetFrame) - { - randomFrame = WorldGen.genRand.Next(3); - Main.tile[x, y].frameNumber((byte)randomFrame); - } - else - { - randomFrame = Main.tile[x, y].frameNumber(); - } - - /* DEBUGGING - if (Player.tileTargetX == x && Player.tileTargetY == y) + tileMergeTypes = new bool[TileLoader.TileCount][]; + for (int i = 0; i < tileMergeTypes.Length; i++) { - Main.NewText(StringWriter(leftSim, rightSim, upSim, downSim, topLeftSim, topRightSim, bottomLeftSim, bottomRightSim, forceSameDown, forceSameUp, forceSameLeft, forceSameRight)); - }*/ + tileMergeTypes[i] = new bool[TileLoader.TileCount]; + } - mergedDown = mergedLeft = mergedRight = mergedUp = false; + tileMergeTypes[mod.TileType("AstralDirt")][mod.TileType("AstralOre")] = true; + tileMergeTypes[mod.TileType("AstralDirt")][mod.TileType("AstralStone")] = true; + tileMergeTypes[mod.TileType("AstralDirt")][mod.TileType("AstralSand")] = true; + //tileMergeTypes[mod.TileType("AstralDirt")][mod.TileType("AstralSnow")] = true; + tileMergeTypes[mod.TileType("AstralDirt")][mod.TileType("AstralMonolith")] = true; + tileMergeTypes[mod.TileType("AstralDirt")][mod.TileType("AstralIce")] = true; + //tileMergeTypes[mod.TileType("AstralSnow")][mod.TileType("AstralIce")] = true; + tileMergeTypes[mod.TileType("AstralSand")][mod.TileType("HardenedAstralSand")] = true; + tileMergeTypes[mod.TileType("HardenedAstralSand")][mod.TileType("AstralSandstone")] = true; - if (leftSim == Similarity.None) - { - if (upSim == Similarity.Same) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 0, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 36); - return; - } - SetFrameAt(x, y, 90, 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedDown = true; - SetFrameAt(x, y, 72, 90 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - mergedDown = true; - SetFrameAt(x, y, 126, 90 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 36 * randomFrame, 72); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - else if (upSim == Similarity.MergeLink) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedUp = true; - SetFrameAt(x, y, 72, 144 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - mergedUp = true; - SetFrameAt(x, y, 126, 144 + 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - mergedUp = true; - mergedDown = true; - SetFrameAt(x, y, 108, 216 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - mergedUp = true; - SetFrameAt(x, y, 108, 144 + 18 * randomFrame); - return; - } - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 36 * randomFrame, 54); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - mergedDown = true; - SetFrameAt(x, y, 108, 90 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 234); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - else if (leftSim == Similarity.MergeLink) - { - if (upSim == Similarity.Same) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 162, 126 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedLeft = true; - mergedRight = true; - SetFrameAt(x, y, 180, 126 + 18 * randomFrame); - return; - } - mergedLeft = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 54); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedLeft = mergedDown = true; - SetFrameAt(x, y, 36, 108 + 36 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedLeft = mergedRight = mergedDown = true; - SetFrameAt(x, y, 198, 144 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 216); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - else if (upSim == Similarity.MergeLink) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedUp = mergedLeft = true; - SetFrameAt(x, y, 36, 90 + 36 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedLeft = mergedRight = mergedUp = true; - SetFrameAt(x, y, 198, 90 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedUp = mergedLeft = mergedDown = true; - SetFrameAt(x, y, 216, 90 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedDown = mergedLeft = mergedRight = mergedUp = true; - SetFrameAt(x, y, 108 + 18 * randomFrame, 198); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 198); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 252); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = mergedLeft = true; - SetFrameAt(x, y, 162 + 18 * randomFrame, 198); - return; - } - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 234); - return; - } - if (upSim == Similarity.Same) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - #region FULL TILE STUFF - if (topLeftSim == Similarity.MergeLink || topRightSim == Similarity.MergeLink || bottomLeftSim == Similarity.MergeLink || bottomRightSim == Similarity.MergeLink) - { - if (bottomRightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 0, 90 + 36 * randomFrame); - return; - } - else if (bottomLeftSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 18, 90 + 36 * randomFrame); - return; - } - else if (topRightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 0, 108 + 36 * randomFrame); - return; - } - SetFrameAt(x, y, 18, 108 + 36 * randomFrame); - return; - } - if (topLeftSim == Similarity.Same) - { - if (topRightSim == Similarity.Same) - { - if (bottomLeftSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - if (bottomRightSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 36); - return; - } - if (bottomLeftSim == Similarity.Same) - { - if (bottomRightSim == Similarity.Same) - { - if (topRightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 0, 108 + 36 * randomFrame); - return; - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 198, 18 * randomFrame); - return; - } - } - else if (topLeftSim == Similarity.None) - { - if (topRightSim == Similarity.Same) - { - if (bottomRightSim == Similarity.Same) - { - if (bottomLeftSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - if (bottomLeftSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - #endregion - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 144, 126 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 72, 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedDown = true; - SetFrameAt(x, y, 144 + 18 * randomFrame, 90); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedDown = mergedRight = true; - SetFrameAt(x, y, 54, 108 + 36 * randomFrame); - return; - } - mergedDown = true; - SetFrameAt(x, y, 90, 90 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 36); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 216); - return; - } - SetFrameAt(x, y, 18 + 36 * randomFrame, 72); - return; - } - else if (upSim == Similarity.MergeLink) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedUp = true; - SetFrameAt(x, y, 144 + 18 * randomFrame, 108); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = mergedUp = true; - SetFrameAt(x, y, 54, 90 + 36 * randomFrame); - return; - } - mergedUp = true; - SetFrameAt(x, y, 90, 144 + 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedUp = mergedDown = true; - SetFrameAt(x, y, 144 + 18 * randomFrame, 180); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedUp = mergedRight = mergedDown = true; - SetFrameAt(x, y, 216, 144 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - mergedUp = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 0); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 198); - return; - } - SetFrameAt(x, y, 18 + 36 * randomFrame, 54); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedDown = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 0); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 72); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 252); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } + tileMergeTypes[mod.TileType("BrimstoneSlag")][mod.TileType("CharredOre")] = true; - private static void SetFrameAt(int x, int y, int frameX, int frameY) - { - Main.tile[x, y].frameX = (short)frameX; - Main.tile[x, y].frameY = (short)frameY; - } + tileMergeTypes[TileID.Sandstone][mod.TileType("EutrophicSand")] = true; + tileMergeTypes[mod.TileType("EutrophicSand")][mod.TileType("NavyStone")] = true; + tileMergeTypes[mod.TileType("NavyStone")][mod.TileType("SeaPrism")] = true; - private static Similarity GetSimilarity(Tile check, int myType, int mergeType) - { - if (!check.active()) return Similarity.None; + tileMergeTypes[mod.TileType("AbyssGravel")][mod.TileType("ChaoticOre")] = true; + tileMergeTypes[mod.TileType("AbyssGravel")][mod.TileType("PlantyMush")] = true; + tileMergeTypes[mod.TileType("AbyssGravel")][mod.TileType("Voidstone")] = true; + tileMergeTypes[mod.TileType("AbyssGravel")][mod.TileType("SulphurousSand")] = true; + tileMergeTypes[mod.TileType("PlantyMush")][mod.TileType("Tenebris")] = true; - if (check.type == myType || Main.tileMerge[myType][check.type]) - return Similarity.Same; - else if (check.type == mergeType) - return Similarity.MergeLink; + } - return Similarity.None; - } + private static bool PlantNeedsUpdate(int plantType, int checkType) + { + if (PlantCheckAgainst[plantType] == null) return false; + int size = PlantCheckAgainst[plantType].Length; + for (int i = 0; i < size; i++) + { + if (PlantCheckAgainst[plantType][i] == checkType) + { + return false; + } + } + return true; + } - private static string StringWriter(params object[] strings) - { - string s = ""; - for (int i = 0; i < strings.Length; i++) - { - s += strings[i].ToString(); - if (i != strings.Length - 1) - { - s += ", "; - } - } - return s; - } - } + public static void CheckPlants(int x, int y) + { + int checkType = -1; + int plantType = Main.tile[x, y].type; + + if (y + 1 >= Main.maxTilesY) + checkType = plantType; + + Tile tile = Main.tile[x, y]; + Tile below = Main.tile[x, y + 1]; + if (y + 1 < Main.maxTilesY && below != null && below.nactive() && !below.halfBrick() && below.slope() == 0) + checkType = below.type; + + if (checkType == -1) return; + + //Check if this plant needs an update + if (PlantNeedsUpdate(plantType, checkType)) + { + if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.frameX >= 162) + { + Main.tile[x, y].frameX = 126; + } + if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.frameX >= 162) + { + Main.tile[x, y].frameX = 126; + } + + if (checkType == TileID.CorruptGrass) + { + plantType = TileID.CorruptPlants; + if (tile.frameX >= 162) + { + Main.tile[x, y].frameX = 126; + } + } + else if (checkType == TileID.Grass) + { + if (plantType == TileID.HallowedPlants2) + { + plantType = TileID.Plants2; + } + else + { + plantType = TileID.Plants; + } + } + else if (checkType == TileID.HallowedGrass) + { + if (plantType == TileID.Plants2) + { + plantType = TileID.HallowedPlants2; + } + else + { + plantType = TileID.HallowedPlants; + } + } + else if (checkType == TileID.FleshGrass) + { + plantType = TileID.FleshWeeds; + } + else if (checkType == TileID.MushroomGrass) + { + plantType = TileID.MushroomPlants; + while (Main.tile[x, y].frameX > 72) + { + Main.tile[x, y].frameX -= 72; + } + } + else if (checkType == CalamityMod.Instance.TileType("AstralGrass")) //ASTRAL + { + if (plantType == TileID.Plants || plantType == TileID.CorruptPlants || + plantType == TileID.FleshWeeds || plantType == TileID.HallowedPlants || + plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants) + { + plantType = CalamityMod.Instance.TileType("AstralShortPlants"); + } + else + { + plantType = CalamityMod.Instance.TileType("AstralTallPlants"); + } + } + if (plantType != Main.tile[x, y].type) + { + Main.tile[x, y].type = (ushort)plantType; + return; + } + WorldGen.KillTile(x, y, false, false, false); + } + } + + public static void VineFrame(int x, int y) + { + Tile tile = Main.tile[x, y]; + int myType = tile.type; + Tile tile2 = Main.tile[x, y - 1]; + Tile tile3 = Main.tile[x, y + 1]; + Tile tile4 = Main.tile[x - 1, y]; + Tile tile5 = Main.tile[x + 1, y]; + Tile tile6 = Main.tile[x - 1, y + 1]; + Tile tile7 = Main.tile[x + 1, y + 1]; + Tile tile8 = Main.tile[x - 1, y - 1]; + Tile tile9 = Main.tile[x + 1, y - 1]; + int num52 = -1; + int num53 = -1; + int num54 = -1; + int num55 = -1; + int num56 = -1; + int num57 = -1; + int num58 = -1; + int num59 = -1; + if (tile4 != null && tile4.active()) + { + if (Main.tileStone[(int)tile4.type]) + { + num55 = 1; + } + else + { + num55 = (int)tile4.type; + } + if (tile4.slope() == 1 || tile4.slope() == 3) + { + num55 = -1; + } + } + if (tile5 != null && tile5.active()) + { + if (Main.tileStone[(int)tile5.type]) + { + num56 = 1; + } + else + { + num56 = (int)tile5.type; + } + if (tile5.slope() == 2 || tile5.slope() == 4) + { + num56 = -1; + } + } + if (tile2 != null && tile2.active()) + { + if (Main.tileStone[(int)tile2.type]) + { + num53 = 1; + } + else + { + num53 = (int)tile2.type; + } + if (tile2.slope() == 3 || tile2.slope() == 4) + { + num53 = -1; + } + } + if (tile3 != null && tile3.active()) + { + if (Main.tileStone[(int)tile3.type]) + { + num58 = 1; + } + else + { + num58 = (int)tile3.type; + } + if (tile3.slope() == 1 || tile3.slope() == 2) + { + num58 = -1; + } + } + if (tile8 != null && tile8.active()) + { + if (Main.tileStone[(int)tile8.type]) + { + num52 = 1; + } + else + { + num52 = (int)tile8.type; + } + } + if (tile9 != null && tile9.active()) + { + if (Main.tileStone[(int)tile9.type]) + { + num54 = 1; + } + else + { + num54 = (int)tile9.type; + } + } + if (tile6 != null && tile6.active()) + { + if (Main.tileStone[(int)tile6.type]) + { + num57 = 1; + } + else + { + num57 = (int)tile6.type; + } + } + if (tile7 != null && tile7.active()) + { + if (Main.tileStone[(int)tile7.type]) + { + num59 = 1; + } + else + { + num59 = (int)tile7.type; + } + } + if (tile.slope() == 2) + { + num53 = -1; + num55 = -1; + } + if (tile.slope() == 1) + { + num53 = -1; + num56 = -1; + } + if (tile.slope() == 4) + { + num58 = -1; + num55 = -1; + } + if (tile.slope() == 3) + { + num58 = -1; + num56 = -1; + } + + if (tile2 != null) + { + if (!tile2.active()) + { + num53 = -1; + } + else if (tile2.bottomSlope()) + { + num53 = -1; + } + else + { + num53 = (int)tile2.type; + } + } + else + { + num53 = myType; + } + + ushort[] vines = VineToGrass.Keys.ToArray(); + + for (int i = 0; i < vines.Length; i++) + { + ushort myGrassType = VineToGrass[(ushort)vines[i]]; + if (myType != vines[i] && (num53 == myGrassType || num53 == vines[i])) + { + Main.tile[x, y].type = vines[i]; + WorldGen.SquareTileFrame(x, y, true); + return; + } + } + + if (num53 != myType) + { + bool flag17 = false; + if (num53 == -1) + { + flag17 = true; + } + else + { + for (int i = 0; i < vines.Length; i++) + { + if (myType != TileID.Vines) + { + if (myType == vines[i] && num53 != VineToGrass[vines[i]]) + { + flag17 = true; + } + } + else if (num53 != TileID.Grass && num53 != TileID.LeafBlock) + { + flag17 = true; + } + } + } + if (flag17) + { + WorldGen.KillTile(x, y, false, false, false); + } + } + return; + } + + public static bool BetterGemsparkFraming(int x, int y, bool resetFrame) + { + Tile tile = Main.tile[x, y]; + + if (tile.slope() > 0 || tile.halfBrick()) + { + return true; + } + + Tile tile2 = Main.tile[x, y - 1]; + Tile tile3 = Main.tile[x, y + 1]; + Tile tile4 = Main.tile[x - 1, y]; + Tile tile5 = Main.tile[x + 1, y]; + Tile tile6 = Main.tile[x - 1, y + 1]; + Tile tile7 = Main.tile[x + 1, y + 1]; + Tile tile8 = Main.tile[x - 1, y - 1]; + Tile tile9 = Main.tile[x + 1, y - 1]; + + int myType = tile.type; + + bool left = false; + bool right = false; + bool up = false; + bool down = false; + bool upLeft = false; + bool upRight = false; + bool downLeft = false; + bool downRight = false; + + if (tile2.type == myType && (tile2.slope() == 0 || tile2.slope() == 1 || tile2.slope() == 2)) + up = true; + if (tile3.type == myType && (tile3.slope() == 0 || tile3.slope() == 3 || tile3.slope() == 4)) + down = true; + if (tile4.type == myType && (tile4.slope() == 0 || tile4.slope() == 2 || tile4.slope() == 4)) + left = true; + if (tile5.type == myType && (tile5.slope() == 0 || tile5.slope() == 1 || tile5.slope() == 3)) + right = true; + if (tile2.type == myType && tile4.type == myType && tile8.type == myType && (tile8.slope() == 0 || tile8.slope() == 2) && (tile2.slope() == 0 || tile2.slope() == 1 || tile2.slope() == 3) && (tile4.slope() == 0 || tile4.slope() == 3 || tile4.slope() == 4)) + upLeft = true; + if (tile2.type == myType && tile5.type == myType && tile9.type == myType && (tile9.slope() == 0 || tile9.slope() == 1) && (tile2.slope() == 0 || tile2.slope() == 2 || tile2.slope() == 4) && (tile5.slope() == 0 || tile5.slope() == 3 || tile5.slope() == 4)) + upRight = true; + if (tile3.type == myType && tile4.type == myType && tile6.type == myType && (tile6.slope() == 0 || tile6.slope() == 4) && (tile3.slope() == 0 || tile3.slope() == 1 || tile3.slope() == 3) && (tile4.slope() == 0 || tile4.slope() == 1 || tile4.slope() == 2)) + downLeft = true; + if (tile3.type == myType && tile5.type == myType && tile7.type == myType && (tile7.slope() == 0 || tile7.slope() == 3) && (tile3.slope() == 0 || tile3.slope() == 2 || tile3.slope() == 4) && (tile5.slope() == 0 || tile5.slope() == 1 || tile5.slope() == 2)) + downRight = true; + + int randomFrame; + if (resetFrame) + { + randomFrame = WorldGen.genRand.Next(3); + Main.tile[x, y].frameNumber((byte)randomFrame); + } + else + { + randomFrame = Main.tile[x, y].frameNumber(); + } + + /* + 8 2 9 + 4 - 5 + 6 3 7 + */ + + #region L States + if (!up && down && !left && right && !downRight) + { + tile.frameX = 13 * 18; + tile.frameY = 0; + return false; + } + if (!up && down && left && !right && !downLeft) + { + tile.frameX = 15 * 18; + tile.frameY = 0; + return false; + } + if (up && !down && !left && right && !upRight) + { + tile.frameX = 13 * 18; + tile.frameY = 2 * 18; + return false; + } + if (up && !down && left && !right && !upLeft) + { + tile.frameX = 15 * 18; + tile.frameY = 2 * 18; + return false; + } + #endregion + + #region T States + if (!up && down && left && right && !downLeft && !downRight) + { + tile.frameX = 14 * 18; + tile.frameY = 0; + return false; + } + if (up && !down && left && right && !upLeft && !upRight) + { + tile.frameX = 14 * 18; + tile.frameY = 2 * 18; + return false; + } + if (up && down && !left && right && !downRight && !upRight) + { + tile.frameX = 13 * 18; + tile.frameY = 18; + return false; + } + if (up && down && left && !right && !downLeft && !upLeft) + { + tile.frameX = 15 * 18; + tile.frameY = 18; + return false; + } + #endregion + + #region X State + if (up && down && left && right && !downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = 14 * 18; + tile.frameY = 18; + return false; + } + #endregion + + #region Inner Corner x1 + if (up && down && left && right && !downLeft && downRight && upLeft && upRight) + { + tile.frameX = 15 * 18; + tile.frameY = 3 * 18; + return false; + } + if (up && down && left && right && downLeft && !downRight && upLeft && upRight) + { + tile.frameX = 14 * 18; + tile.frameY = 3 * 18; + return false; + } + if (up && down && left && right && downLeft && downRight && !upLeft && upRight) + { + tile.frameX = 15 * 18; + tile.frameY = 4 * 18; + return false; + } + if (up && down && left && right && downLeft && downRight && upLeft && !upRight) + { + tile.frameX = 14 * 18; + tile.frameY = 4 * 18; + return false; + } + #endregion + + #region Inner Corner x2 (same side) + if (up && down && left && right && !downLeft && !downRight && upLeft && upRight) + { + tile.frameX = (short)((6 * 18) + (randomFrame * 18)); + tile.frameY = 2 * 18; + return false; + } + if (up && down && left && right && downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = (short)((6 * 18) + (randomFrame * 18)); + tile.frameY = 1 * 18; + return false; + } + if (up && down && left && right && !downLeft && downRight && !upLeft && upRight) + { + tile.frameX = 10 * 18; + tile.frameY = (short)(randomFrame * 18); + return false; + } + if (up && down && left && right && downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = 11 * 18; + tile.frameY = (short)(randomFrame * 18); + return false; + } + #endregion + + #region Inner Corner x2 (opposite corners) + if (up && down && left && right && !downLeft && downRight && upLeft && !upRight) + { + tile.frameX = 16 * 18; + tile.frameY = 4 * 18; + return false; + } + if (up && down && left && right && downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = 17 * 18; + tile.frameY = 4 * 18; + return false; + } + #endregion + + #region Inner Corner x3 + if (up && down && left && right && !downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = 12 * 18; + tile.frameY = 4 * 18; + return false; + } + if (up && down && left && right && !downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = 12 * 18; + tile.frameY = 3 * 18; + return false; + } + if (up && down && left && right && !downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = 13 * 18; + tile.frameY = 4 * 18; + return false; + } + if (up && down && left && right && downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = 13 * 18; + tile.frameY = 3 * 18; + return false; + } + #endregion + + #region Corner and Side + if (!up && down && left && right && !downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = 17 * 18; + tile.frameY = 2 * 18; + return false; + } + if (!up && down && left && right && downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = 16 * 18; + tile.frameY = 2 * 18; + return false; + } + if (up && !down && left && right && !downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = 17 * 18; + tile.frameY = 3 * 18; + return false; + } + if (up && !down && left && right && !downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = 16 * 18; + tile.frameY = 3 * 18; + return false; + } + if (up && down && !left && right && !downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = 16 * 18; + tile.frameY = 0; + return false; + } + if (up && down && !left && right && !downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = 16 * 18; + tile.frameY = 18; + return false; + } + if (up && down && left && !right && !downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = 17 * 18; + tile.frameY = 0; + return false; + } + if (up && down && left && !right && downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = 17 * 18; + tile.frameY = 18; + return false; + } + #endregion + + return true; + } + + public static bool BrimstoneFraming(int x, int y, bool resetFrame) + { + Tile tile = Main.tile[x, y]; + + //if (tile.slope() > 0 || tile.halfBrick()) + //{ + // return true; + //} + + Tile tile2 = Main.tile[x, y - 1]; + Tile tile3 = Main.tile[x, y + 1]; + Tile tile4 = Main.tile[x - 1, y]; + Tile tile5 = Main.tile[x + 1, y]; + Tile tile6 = Main.tile[x - 1, y + 1]; + Tile tile7 = Main.tile[x + 1, y + 1]; + Tile tile8 = Main.tile[x - 1, y - 1]; + Tile tile9 = Main.tile[x + 1, y - 1]; + + int myType = tile.type; + + bool left = false; + bool right = false; + bool up = false; + bool down = false; + bool upLeft = false; + bool upRight = false; + bool downLeft = false; + bool downRight = false; + + if (tile2.type == myType && (tile2.slope() == 0 || tile2.slope() == 1 || tile2.slope() == 2)) + up = true; + if (tile3.type == myType && (tile3.slope() == 0 || tile3.slope() == 3 || tile3.slope() == 4)) + down = true; + if (tile4.type == myType && (tile4.slope() == 0 || tile4.slope() == 2 || tile4.slope() == 4)) + left = true; + if (tile5.type == myType && (tile5.slope() == 0 || tile5.slope() == 1 || tile5.slope() == 3)) + right = true; + if (tile2.type == myType && tile4.type == myType && tile8.type == myType && (tile8.slope() == 0 || tile8.slope() == 2) && (tile2.slope() == 0 || tile2.slope() == 1 || tile2.slope() == 3) && (tile4.slope() == 0 || tile4.slope() == 3 || tile4.slope() == 4)) + upLeft = true; + if (tile2.type == myType && tile5.type == myType && tile9.type == myType && (tile9.slope() == 0 || tile9.slope() == 1) && (tile2.slope() == 0 || tile2.slope() == 2 || tile2.slope() == 4) && (tile5.slope() == 0 || tile5.slope() == 3 || tile5.slope() == 4)) + upRight = true; + if (tile3.type == myType && tile4.type == myType && tile6.type == myType && (tile6.slope() == 0 || tile6.slope() == 4) && (tile3.slope() == 0 || tile3.slope() == 1 || tile3.slope() == 3) && (tile4.slope() == 0 || tile4.slope() == 1 || tile4.slope() == 2)) + downLeft = true; + if (tile3.type == myType && tile5.type == myType && tile7.type == myType && (tile7.slope() == 0 || tile7.slope() == 3) && (tile3.slope() == 0 || tile3.slope() == 2 || tile3.slope() == 4) && (tile5.slope() == 0 || tile5.slope() == 1 || tile5.slope() == 2)) + downRight = true; + + int randomFrame; + if (resetFrame) + { + randomFrame = WorldGen.genRand.Next(3); + Main.tile[x, y].frameNumber((byte)randomFrame); + } + else + { + randomFrame = Main.tile[x, y].frameNumber(); + } + + /* + 8 2 9 + 4 - 5 + 6 3 7 + */ + + #region L States + if (!up && down && !left && right && !downRight) + { + tile.frameX = (short)((16 * 18) + (randomFrame * 54)); + tile.frameY = 0; + return false; + } + if (!up && down && left && !right && !downLeft) + { + tile.frameX = (short)((18 * 18) + (randomFrame * 54)); + tile.frameY = 0; + return false; + } + if (up && !down && !left && right && !upRight) + { + tile.frameX = (short)((16 * 18) + (randomFrame * 54)); + tile.frameY = 2 * 18; + return false; + } + if (up && !down && left && !right && !upLeft) + { + tile.frameX = (short)((18 * 18) + (randomFrame * 54)); + tile.frameY = 2 * 18; + return false; + } + #endregion + + #region T States + if (!up && down && left && right && !downLeft && !downRight) + { + tile.frameX = (short)((17 * 18) + (randomFrame * 54)); + tile.frameY = 0; + return false; + } + if (up && !down && left && right && !upLeft && !upRight) + { + tile.frameX = (short)((17 * 18) + (randomFrame * 54)); + tile.frameY = 2 * 18; + return false; + } + if (up && down && !left && right && !downRight && !upRight) + { + tile.frameX = (short)((16 * 18) + (randomFrame * 54)); + tile.frameY = 18; + return false; + } + if (up && down && left && !right && !downLeft && !upLeft) + { + tile.frameX = (short)((18 * 18) + (randomFrame * 54)); + tile.frameY = 18; + return false; + } + #endregion + + #region X State + if (up && down && left && right && !downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = (short)((17 * 18) + (randomFrame * 54)); + tile.frameY = 18; + return false; + } + #endregion + + #region Inner Corner x1 + if (up && down && left && right && !downLeft && downRight && upLeft && upRight) + { + tile.frameX = 14 * 18; + tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && right && downLeft && !downRight && upLeft && upRight) + { + tile.frameX = 13 * 18; + tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && right && downLeft && downRight && !upLeft && upRight) + { + tile.frameX = 14 * 18; + tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && right && downLeft && downRight && upLeft && !upRight) + { + tile.frameX = 13 * 18; + tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + return false; + } + #endregion + + #region Inner Corner x2 (same side) + if (up && down && left && right && !downLeft && !downRight && upLeft && upRight) + { + tile.frameX = (short)((6 * 18) + (randomFrame * 18)); + tile.frameY = 2 * 18; + return false; + } + if (up && down && left && right && downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = (short)((6 * 18) + (randomFrame * 18)); + tile.frameY = 1 * 18; + return false; + } + if (up && down && left && right && !downLeft && downRight && !upLeft && upRight) + { + tile.frameX = 10 * 18; + tile.frameY = (short)(randomFrame * 18); + return false; + } + if (up && down && left && right && downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = 11 * 18; + tile.frameY = (short)(randomFrame * 18); + return false; + } + #endregion + + #region Inner Corner x2 (opposite corners) + if (up && down && left && right && !downLeft && downRight && upLeft && !upRight) + { + tile.frameX = (short)((10 * 18) + (randomFrame * 18)); + tile.frameY = 4 * 18; + return false; + } + if (up && down && left && right && downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = (short)((13 * 18) + (randomFrame * 18)); + tile.frameY = 4 * 18; + return false; + } + #endregion + + #region Inner Corner x3 + if (up && down && left && right && !downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = 15 * 18; + tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && right && !downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = 15 * 18; + tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && right && !downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = 16 * 18; + tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && right && downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = 16 * 18; + tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + return false; + } + #endregion + + #region Corner and Side + if (!up && down && left && right && !downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = (short)((17 * 18) + (randomFrame * 36)); + tile.frameY = 3 * 18; + return false; + } + if (!up && down && left && right && downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = (short)((16 * 18) + (randomFrame * 36)); + tile.frameY = 3 * 18; + return false; + } + if (up && !down && left && right && !downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = (short)((17 * 18) + (randomFrame * 36)); + tile.frameY = 4 * 18; + return false; + } + if (up && !down && left && right && !downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = (short)((16 * 18) + (randomFrame * 36)); + tile.frameY = 4 * 18; + return false; + } + if (up && down && !left && right && !downLeft && !downRight && !upLeft && upRight) + { + tile.frameX = 17 * 18; + tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && !left && right && !downLeft && downRight && !upLeft && !upRight) + { + tile.frameX = 17 * 18; + tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && !right && !downLeft && !downRight && upLeft && !upRight) + { + tile.frameX = 18 * 18; + tile.frameY = (short)((5 * 18) + (randomFrame * 36)); + return false; + } + if (up && down && left && !right && downLeft && !downRight && !upLeft && !upRight) + { + tile.frameX = 18 * 18; + tile.frameY = (short)((6 * 18) + (randomFrame * 36)); + return false; + } + #endregion + + return true; + } + + enum Similarity + { + Same, + MergeLink, + None + } + public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) + { + bool tmp; + FrameTileForCustomMerge(x, y, myType, mergeType, out tmp, out tmp, out tmp, out tmp, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, resetFrame); + } + + public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, out bool mergedUp, out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) + { + Tile tileLeft = Main.tile[x - 1, y]; + Tile tileRight = Main.tile[x + 1, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; + Tile tileTopLeft = Main.tile[x - 1, y - 1]; + Tile tileTopRight = Main.tile[x + 1, y - 1]; + Tile tileBottomLeft = Main.tile[x - 1, y + 1]; + Tile tileBottomRight = Main.tile[x + 1, y + 1]; + + Main.tileMerge[myType][mergeType] = false; + + //CARDINAL + Similarity leftSim = GetSimilarity(tileLeft, myType, mergeType); + if (forceSameLeft) leftSim = Similarity.Same; + Similarity rightSim = GetSimilarity(tileRight, myType, mergeType); + if (forceSameRight) rightSim = Similarity.Same; + Similarity upSim = GetSimilarity(tileUp, myType, mergeType); + if (forceSameUp) upSim = Similarity.Same; + Similarity downSim = GetSimilarity(tileDown, myType, mergeType); + if (forceSameDown) downSim = Similarity.Same; + + //DIAGONAL + Similarity topLeftSim = GetSimilarity(tileTopLeft, myType, mergeType); + Similarity topRightSim = GetSimilarity(tileTopRight, myType, mergeType); + Similarity bottomLeftSim = GetSimilarity(tileBottomLeft, myType, mergeType); + Similarity bottomRightSim = GetSimilarity(tileBottomRight, myType, mergeType); + + int randomFrame; + if (resetFrame) + { + randomFrame = WorldGen.genRand.Next(3); + Main.tile[x, y].frameNumber((byte)randomFrame); + } + else + { + randomFrame = Main.tile[x, y].frameNumber(); + } + + /* DEBUGGING + if (Player.tileTargetX == x && Player.tileTargetY == y) + { + Main.NewText(StringWriter(leftSim, rightSim, upSim, downSim, topLeftSim, topRightSim, bottomLeftSim, bottomRightSim, forceSameDown, forceSameUp, forceSameLeft, forceSameRight)); + }*/ + + mergedDown = mergedLeft = mergedRight = mergedUp = false; + + if (leftSim == Similarity.None) + { + if (upSim == Similarity.Same) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 0, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 36); + return; + } + SetFrameAt(x, y, 90, 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedDown = true; + SetFrameAt(x, y, 72, 90 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + mergedDown = true; + SetFrameAt(x, y, 126, 90 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 36 * randomFrame, 72); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + else if (upSim == Similarity.MergeLink) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedUp = true; + SetFrameAt(x, y, 72, 144 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + mergedUp = true; + SetFrameAt(x, y, 126, 144 + 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + mergedUp = true; + mergedDown = true; + SetFrameAt(x, y, 108, 216 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + mergedUp = true; + SetFrameAt(x, y, 108, 144 + 18 * randomFrame); + return; + } + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 36 * randomFrame, 54); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + mergedDown = true; + SetFrameAt(x, y, 108, 90 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 234); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + else if (leftSim == Similarity.MergeLink) + { + if (upSim == Similarity.Same) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 162, 126 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedLeft = true; + mergedRight = true; + SetFrameAt(x, y, 180, 126 + 18 * randomFrame); + return; + } + mergedLeft = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 54); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedLeft = mergedDown = true; + SetFrameAt(x, y, 36, 108 + 36 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedLeft = mergedRight = mergedDown = true; + SetFrameAt(x, y, 198, 144 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 216); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + else if (upSim == Similarity.MergeLink) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedUp = mergedLeft = true; + SetFrameAt(x, y, 36, 90 + 36 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedLeft = mergedRight = mergedUp = true; + SetFrameAt(x, y, 198, 90 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedUp = mergedLeft = mergedDown = true; + SetFrameAt(x, y, 216, 90 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedDown = mergedLeft = mergedRight = mergedUp = true; + SetFrameAt(x, y, 108 + 18 * randomFrame, 198); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 198); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 252); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = mergedLeft = true; + SetFrameAt(x, y, 162 + 18 * randomFrame, 198); + return; + } + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 234); + return; + } + if (upSim == Similarity.Same) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + #region FULL TILE STUFF + if (topLeftSim == Similarity.MergeLink || topRightSim == Similarity.MergeLink || bottomLeftSim == Similarity.MergeLink || bottomRightSim == Similarity.MergeLink) + { + if (bottomRightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 0, 90 + 36 * randomFrame); + return; + } + else if (bottomLeftSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 18, 90 + 36 * randomFrame); + return; + } + else if (topRightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 0, 108 + 36 * randomFrame); + return; + } + SetFrameAt(x, y, 18, 108 + 36 * randomFrame); + return; + } + if (topLeftSim == Similarity.Same) + { + if (topRightSim == Similarity.Same) + { + if (bottomLeftSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + if (bottomRightSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 36); + return; + } + if (bottomLeftSim == Similarity.Same) + { + if (bottomRightSim == Similarity.Same) + { + if (topRightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 0, 108 + 36 * randomFrame); + return; + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 198, 18 * randomFrame); + return; + } + } + else if (topLeftSim == Similarity.None) + { + if (topRightSim == Similarity.Same) + { + if (bottomRightSim == Similarity.Same) + { + if (bottomLeftSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + if (bottomLeftSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + #endregion + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 144, 126 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 72, 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedDown = true; + SetFrameAt(x, y, 144 + 18 * randomFrame, 90); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedDown = mergedRight = true; + SetFrameAt(x, y, 54, 108 + 36 * randomFrame); + return; + } + mergedDown = true; + SetFrameAt(x, y, 90, 90 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 36); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 216); + return; + } + SetFrameAt(x, y, 18 + 36 * randomFrame, 72); + return; + } + else if (upSim == Similarity.MergeLink) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedUp = true; + SetFrameAt(x, y, 144 + 18 * randomFrame, 108); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = mergedUp = true; + SetFrameAt(x, y, 54, 90 + 36 * randomFrame); + return; + } + mergedUp = true; + SetFrameAt(x, y, 90, 144 + 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedUp = mergedDown = true; + SetFrameAt(x, y, 144 + 18 * randomFrame, 180); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedUp = mergedRight = mergedDown = true; + SetFrameAt(x, y, 216, 144 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + mergedUp = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 0); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 198); + return; + } + SetFrameAt(x, y, 18 + 36 * randomFrame, 54); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedDown = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 0); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 72); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 252); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + + public static void FrameTileForCustomMergeFrom(int x, int y, int myType) + { + bool forceSameUp = false; + bool forceSameDown = false; + bool forceSameLeft = false; + bool forceSameRight = false; + + Tile up = Main.tile[x, y - 1]; + Tile down = Main.tile[x, y + 1]; + Tile left = Main.tile[x - 1, y]; + Tile right = Main.tile[x + 1, y]; + + bool tmp; + + if (up.active() && tileMergeTypes[myType][up.type]) + { + bool mergedDown; + FrameTileForCustomMerge(x, y - 1, up.type, myType, out tmp, out tmp, out tmp, out mergedDown, false, false, false, false, false); + if (mergedDown) + { + forceSameUp = true; + } + } + if (left.active() && tileMergeTypes[myType][left.type]) + { + bool mergedRight; + FrameTileForCustomMerge(x - 1, y, left.type, myType, out tmp, out tmp, out mergedRight, out tmp, false, false, false, false, false); + if (mergedRight) + { + forceSameLeft = true; + } + } + if (right.active() && tileMergeTypes[myType][right.type]) + { + bool mergedLeft; + FrameTileForCustomMerge(x + 1, y, right.type, myType, out tmp, out mergedLeft, out tmp, out tmp, false, false, false, false, false); + if (mergedLeft) + { + forceSameRight = true; + } + } + if (down.active() && tileMergeTypes[myType][down.type]) + { + bool mergedUp; + FrameTileForCustomMerge(x, y + 1, down.type, myType, out mergedUp, out tmp, out tmp, out tmp, false, false, false, false, false); + if (mergedUp) + { + forceSameDown = true; + } + } + + FrameTileForCustomMerge(x, y, myType, TileID.Dirt, forceSameDown, forceSameUp, forceSameLeft, forceSameRight); + } + + private static void SetFrameAt(int x, int y, int frameX, int frameY) + { + Main.tile[x, y].frameX = (short)frameX; + Main.tile[x, y].frameY = (short)frameY; + } + + private static Similarity GetSimilarity(Tile check, int myType, int mergeType) + { + if (!check.active()) return Similarity.None; + + if (check.type == myType || Main.tileMerge[myType][check.type]) + return Similarity.Same; + else if (check.type == mergeType) + return Similarity.MergeLink; + + return Similarity.None; + } + + private static string StringWriter(params object[] strings) + { + string s = ""; + for (int i = 0; i < strings.Length; i++) + { + s += strings[i].ToString(); + if (i != strings.Length - 1) + { + s += ", "; + } + } + return s; + } + } } diff --git a/Utilities/TileMerge.cs b/Utilities/TileMerge.cs new file mode 100644 index 0000000000..18563fb134 --- /dev/null +++ b/Utilities/TileMerge.cs @@ -0,0 +1,225 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Utilities +{ + public static class TileMerge + { + public static void MergeTile(int type, int mergeType, bool merge = true) + { + if (type != mergeType) + { + Main.tileMerge[type][mergeType] = merge; + Main.tileMerge[mergeType][type] = merge; + } + } + + /// + /// Makes the tile merge with the most common types of naturally generated tiles + /// + /// + public static void MergeGeneralTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Soils + MergeTile(type, TileID.ClayBlock); + MergeTile(type, TileID.Dirt); + MergeTile(type, TileID.Mud); + //Sands + MergeTile(type, TileID.Sand); + MergeTile(type, TileID.Ebonsand); + MergeTile(type, TileID.Crimsand); + MergeTile(type, TileID.Pearlsand); + //Snows + MergeTile(type, TileID.SnowBlock); + //Stones + MergeTile(type, TileID.Stone); + MergeTile(type, TileID.Ebonstone); + MergeTile(type, TileID.Crimstone); + MergeTile(type, TileID.Pearlstone); + //Calam general tiles + MergeTile(type, mod.TileType("AstralDirt")); + MergeTile(type, mod.TileType("AstralStone")); + MergeTile(type, mod.TileType("Navystone")); + MergeTile(type, mod.TileType("EutrophicSand")); + MergeTile(type, mod.TileType("AbyssGravel")); + MergeTile(type, mod.TileType("Voidstone")); + } + + public static void MergeOreTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Vanilla Ores + MergeTile(type, TileID.Copper); + MergeTile(type, TileID.Tin); + MergeTile(type, TileID.Iron); + MergeTile(type, TileID.Lead); + MergeTile(type, TileID.Silver); + MergeTile(type, TileID.Tungsten); + MergeTile(type, TileID.Gold); + MergeTile(type, TileID.Demonite); + MergeTile(type, TileID.Crimtane); + MergeTile(type, TileID.Cobalt); + MergeTile(type, TileID.Palladium); + MergeTile(type, TileID.Mythril); + MergeTile(type, TileID.Platinum); + MergeTile(type, TileID.Orichalcum); + MergeTile(type, TileID.Adamantite); + MergeTile(type, TileID.Titanium); + MergeTile(type, TileID.LunarOre); + //Calam Ores + MergeTile(type, mod.TileType("AerialiteOre")); + MergeTile(type, mod.TileType("CryonicOre")); + MergeTile(type, mod.TileType("PerennialOre")); + MergeTile(type, mod.TileType("CharredOre")); + MergeTile(type, mod.TileType("ChaoticOre")); + MergeTile(type, mod.TileType("AstralOre")); + MergeTile(type, mod.TileType("UelibloomOre")); + MergeTile(type, mod.TileType("AuricOre")); + } + + /// + /// Makes the tile merge with all the tile types that generate within various types of desert, sunken sea and related tiles + /// + /// + public static void MergeDesertTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Sands + MergeTile(type, TileID.Sand); + MergeTile(type, TileID.Ebonsand); + MergeTile(type, TileID.Crimsand); + MergeTile(type, TileID.Pearlsand); + //Hardened Sands + MergeTile(type, TileID.HardenedSand); + MergeTile(type, TileID.CorruptHardenedSand); + MergeTile(type, TileID.CrimsonHardenedSand); + MergeTile(type, TileID.HallowHardenedSand); + //Sandstones + MergeTile(type, TileID.Sandstone); + MergeTile(type, TileID.CorruptSandstone); + MergeTile(type, TileID.CrimsonSandstone); + MergeTile(type, TileID.HallowSandstone); + //Misc relevant desert tiles + MergeTile(type, TileID.FossilOre); + MergeTile(type, TileID.DesertFossil); + //Calam desert tiles + MergeTile(type, mod.TileType("AstralSand")); + MergeTile(type, mod.TileType("HardenedAstralSand")); + MergeTile(type, mod.TileType("AstralSandstone")); + //Sunken Sea tiles + MergeTile(type, mod.TileType("EutrophicSand")); + MergeTile(type, mod.TileType("Navystone")); + MergeTile(type, mod.TileType("SeaPrism")); + } + + /// + /// Makes the tile merge with all the tile types that generate within various types of snow or snow biome related tiles + /// + /// + public static void MergeSnowTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Snow + MergeTile(type, TileID.SnowBlock); + //Ices + MergeTile(type, TileID.IceBlock); + MergeTile(type, TileID.CorruptIce); + MergeTile(type, TileID.FleshIce); + MergeTile(type, TileID.HallowedIce); + //Calam snow tiles + MergeTile(type, mod.TileType("AstralIce")); + } + + /// + /// Makes the tile merge with all the tile types that generate within various types of hell or hell biome related tiles + /// + /// + public static void MergeHellTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Terrain + MergeTile(type, TileID.Ash); + MergeTile(type, TileID.Hellstone); + //Houses + MergeTile(type, TileID.ObsidianBrick); + MergeTile(type, TileID.HellstoneBrick); + //Crag tiles + MergeTile(type, mod.TileType("BrimstoneSlag")); + } + + /// + /// Makes the tile merge with all the tile types that generate within various types of abyss or abyss biome related tiles + /// + /// + public static void MergeAbyssTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Sulphurous Sea + MergeTile(type, mod.TileType("SulphurousSand")); + //Abyss + MergeTile(type, mod.TileType("AbyssGravel")); + MergeTile(type, mod.TileType("Voidstone")); + MergeTile(type, mod.TileType("PlantyMush")); + MergeTile(type, mod.TileType("Tenebris")); + MergeTile(type, mod.TileType("ChaoticOre")); + } + + /// + /// Makes the tile merge with all the tile types that generate within various types of astral tiles + /// + /// + public static void MergeAstralTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Astral + MergeTile(type, mod.TileType("AstralDirt")); + MergeTile(type, mod.TileType("AstralStone")); + MergeTile(type, mod.TileType("AstralMonolith")); + //Astral Desert + MergeTile(type, mod.TileType("AstralSand")); + MergeTile(type, mod.TileType("HardenedAstralSand")); + MergeTile(type, mod.TileType("AstralSandstone")); + //Astral Snow + MergeTile(type, mod.TileType("AstralIce")); + } + + /// + /// Makes the tile merge with all the decorative 'smooth' tiles + /// + /// + public static void MergeSmoothTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Vanilla + MergeTile(type, TileID.MarbleBlock); + MergeTile(type, TileID.GraniteBlock); + //Calam + MergeTile(type, mod.TileType("SmoothNavystone")); + MergeTile(type, mod.TileType("SmoothBrimstoneSlag")); + MergeTile(type, mod.TileType("SmoothAbyssGravel")); + MergeTile(type, mod.TileType("SmoothVoidstone")); + } + + /// + /// Makes the tile merge with other mergable decorative tiles + /// + /// + public static void MergeDecorativeTiles(int type) + { + Mod mod = CalamityMod.Instance; + //Vanilla decor + Main.tileBrick[type] = true; + //Calam + MergeTile(type, mod.TileType("CryonicBrick")); + MergeTile(type, mod.TileType("PerennialBrick")); + MergeTile(type, mod.TileType("UelibloomBrick")); + MergeTile(type, mod.TileType("OccultStone")); + MergeTile(type, mod.TileType("ProfanedSlab")); + MergeTile(type, mod.TileType("RunicProfanedBrick")); + MergeTile(type, mod.TileType("AshenSlab")); + MergeTile(type, mod.TileType("VoidstoneSlab")); + } + } +} diff --git a/Walls/AshenSlabWall.cs b/Walls/AshenSlabWall.cs index a726793123..3d4847512b 100644 --- a/Walls/AshenSlabWall.cs +++ b/Walls/AshenSlabWall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/AshenSlabWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -57,5 +57,26 @@ namespace CalamityMod.Walls 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/AstralDirtWall.png b/Walls/AstralDirtWall.png index defe18423c..0a8932ccc9 100644 Binary files a/Walls/AstralDirtWall.png and b/Walls/AstralDirtWall.png differ diff --git a/Walls/AstralMonolithWall.cs b/Walls/AstralMonolithWall.cs index b1b295e45c..813eb7cd59 100644 --- a/Walls/AstralMonolithWall.cs +++ b/Walls/AstralMonolithWall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/AstralMonolithWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -56,5 +56,26 @@ namespace CalamityMod.Walls 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/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index 54ed96c94a..802ed542ff 100644 --- a/Walls/BrimstoneSlagWall.cs +++ b/Walls/BrimstoneSlagWall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/BrimstoneSlagWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -57,5 +57,26 @@ namespace CalamityMod.Walls 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/ChaoticBrickWall.png b/Walls/ChaoticBrickWall.png index bd92e1da57..359d068c30 100644 Binary files a/Walls/ChaoticBrickWall.png and b/Walls/ChaoticBrickWall.png differ diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs index 5453c75a88..a4838e07a6 100644 --- a/Walls/CryonicBrickWall.cs +++ b/Walls/CryonicBrickWall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/CryonicBrickWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -95,5 +95,26 @@ namespace CalamityMod.Walls 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/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index 0d200c928b..9cef7ba2ab 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/PerennialBrickWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -57,5 +57,26 @@ namespace CalamityMod.Walls 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/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs index f75dbea747..a1b55aab15 100644 --- a/Walls/ProfanedSlabWall.cs +++ b/Walls/ProfanedSlabWall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/ProfanedSlabWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -56,5 +56,26 @@ namespace CalamityMod.Walls 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/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index 06ec8e188b..9276e5c763 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/RunicProfanedBrickWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -57,5 +57,26 @@ namespace CalamityMod.Walls 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/UelibloomBrickWall.png b/Walls/UelibloomBrickWall.png index 49d04af653..1327415381 100644 Binary files a/Walls/UelibloomBrickWall.png and b/Walls/UelibloomBrickWall.png differ diff --git a/Walls/VoidstoneSlabWall.cs b/Walls/VoidstoneSlabWall.cs index e8535aea52..23e96d7d11 100644 --- a/Walls/VoidstoneSlabWall.cs +++ b/Walls/VoidstoneSlabWall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = mod.GetTexture("Walls/VoidstoneSlabWall"); - Color lightColor = Lighting.GetColor(i, j); + 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; @@ -103,5 +103,26 @@ namespace CalamityMod.Walls 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/VoidstoneWallUnsafe.png b/Walls/VoidstoneWallUnsafe.png index 641f018c8b..59e8662408 100644 Binary files a/Walls/VoidstoneWallUnsafe.png and b/Walls/VoidstoneWallUnsafe.png differ