From e06f8d2ce3a848ae041afbcb4afa2466dcdb8645 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 13 Sep 2020 23:52:23 -0400 Subject: [PATCH] compiles and loads. needs testing. --- CalamityNetcode.cs | 6 +- Items/Placeables/ChargingStationItem.cs | 2 +- .../Placeables/Furniture/AgedSecurityChest.cs | 3 +- .../Furniture/HolographicDisplayBox.cs | 2 +- Items/Placeables/Furniture/SecurityChest.cs | 3 +- Items/Placeables/PowerCellFactoryItem.cs | 2 +- .../HellLaboratorySchematic.cs | 24 +- .../IceLaboratorySchematic.cs | 46 +-- .../PlagueLaboratorySchematic.cs | 24 +- .../ResearchFacilitySchematic.cs | 22 +- .../SunkenSeaLaboratorySchematic.cs | 36 +- Schematics/TilePlacementHelpers.cs | 4 +- TileEntities/TEBaseTurret.cs | 342 ++++++++++++------ TileEntities/TEChargingStation.cs | 26 +- TileEntities/TEDraedonFieldGenerator.cs | 2 +- TileEntities/TEDraedonHologram.cs | 2 +- TileEntities/TEDraedonLabTurret.cs | 101 ++++++ TileEntities/TEDraedonTurret.cs | 21 -- TileEntities/TEPowerCellFactory.cs | 2 +- TileEntities/TileEntityTimeHandler.cs | 16 +- Tiles/CalamityGlobalTile.cs | 289 +++++++-------- .../AgedSecurityChestTile.cs | 2 +- Tiles/DraedonStructures/ChargingStation.cs | 4 +- .../DraedonFactoryFieldGenerator.cs | 2 +- Tiles/DraedonStructures/DraedonHologram.cs | 2 +- Tiles/DraedonStructures/DraedonLabTurret.cs | 102 ++++++ ...donTurretTile.png => DraedonLabTurret.png} | Bin Tiles/DraedonStructures/DraedonTurretTile.cs | 98 ----- .../InactivePowerCellFactory.cs | 2 +- Tiles/DraedonStructures/PowerCellFactory.cs | 2 +- Tiles/DraedonStructures/SecurityChestTile.cs | 2 +- UI/ChargingStationUI.cs | 3 +- UI/PowerCellFactoryUI.cs | 2 +- 33 files changed, 701 insertions(+), 495 deletions(-) create mode 100644 TileEntities/TEDraedonLabTurret.cs delete mode 100644 TileEntities/TEDraedonTurret.cs create mode 100644 Tiles/DraedonStructures/DraedonLabTurret.cs rename Tiles/DraedonStructures/{DraedonTurretTile.png => DraedonLabTurret.png} (100%) delete mode 100644 Tiles/DraedonStructures/DraedonTurretTile.cs diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 1a36c0c4e3..b50544d0af 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -159,6 +159,9 @@ namespace CalamityMod case CalamityModMessageType.ChargingStationItemChange: TEChargingStation.ReadItemSyncPacket(mod, reader); break; + case CalamityModMessageType.Turret: + TEBaseTurret.ReadSyncPacket(mod, reader); + break; case CalamityModMessageType.DraedonFieldGeneratorSync: @@ -251,6 +254,7 @@ namespace CalamityMod // These message types were written by Ozz. They are Ozz's working tile entity netcode. Do not touch them. PowerCellFactory, ChargingStationStandard, - ChargingStationItemChange + ChargingStationItemChange, + Turret } } diff --git a/Items/Placeables/ChargingStationItem.cs b/Items/Placeables/ChargingStationItem.cs index 8594ac7fff..7c396c7a4a 100644 --- a/Items/Placeables/ChargingStationItem.cs +++ b/Items/Placeables/ChargingStationItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/AgedSecurityChest.cs b/Items/Placeables/Furniture/AgedSecurityChest.cs index fd85fd5c97..bc10257623 100644 --- a/Items/Placeables/Furniture/AgedSecurityChest.cs +++ b/Items/Placeables/Furniture/AgedSecurityChest.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Materials; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Placeables.Furniture { public class AgedSecurityChest : ModItem diff --git a/Items/Placeables/Furniture/HolographicDisplayBox.cs b/Items/Placeables/Furniture/HolographicDisplayBox.cs index a60ff66c4f..b2d663eb67 100644 --- a/Items/Placeables/Furniture/HolographicDisplayBox.cs +++ b/Items/Placeables/Furniture/HolographicDisplayBox.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Placeables/Furniture/SecurityChest.cs b/Items/Placeables/Furniture/SecurityChest.cs index af80f8ea28..264b1c2373 100644 --- a/Items/Placeables/Furniture/SecurityChest.cs +++ b/Items/Placeables/Furniture/SecurityChest.cs @@ -1,6 +1,7 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Placeables.Furniture { public class SecurityChest : ModItem diff --git a/Items/Placeables/PowerCellFactoryItem.cs b/Items/Placeables/PowerCellFactoryItem.cs index ebc4d0bd4d..e17acfcfa5 100644 --- a/Items/Placeables/PowerCellFactoryItem.cs +++ b/Items/Placeables/PowerCellFactoryItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Schematics/AutoGeneratedContent/HellLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/HellLaboratorySchematic.cs index f41e17152c..ad20540e32 100644 --- a/Schematics/AutoGeneratedContent/HellLaboratorySchematic.cs +++ b/Schematics/AutoGeneratedContent/HellLaboratorySchematic.cs @@ -498,8 +498,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile479 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 252, 72); var tile480 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 36, 36); var tile481 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile482 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile483 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile482 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile483 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); var tile484 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 396, 36); var tile485 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 108, 36); var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 216, 36); @@ -514,8 +514,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile495 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 396, 36); var tile496 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); var tile497 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 54); - var tile498 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile499 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile498 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile499 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); var tile500 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); var tile501 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); var tile502 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); @@ -528,8 +528,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile509 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); var tile510 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); var tile511 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile512 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile512 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile515 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); var tile516 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); @@ -956,15 +956,15 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile937 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); var tile938 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 0, 72); var tile939 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)WallID.Glass, 72, 36); - var tile940 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile941 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile940 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile941 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); var tile942 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 108, 36); var tile943 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 252, 72).MakeActuated(); var tile944 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); var tile945 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 36, 0); var tile946 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 6, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile947 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile948 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile947 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile948 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); var tile949 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 72); var tile950 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); var tile951 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); @@ -973,8 +973,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile954 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 36); var tile955 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 72, 0); var tile956 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile957 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile958 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile957 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile958 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 72); var tile959 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); var tile960 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); var tile961 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); diff --git a/Schematics/AutoGeneratedContent/IceLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/IceLaboratorySchematic.cs index 92f383db5f..13127e6cb4 100644 --- a/Schematics/AutoGeneratedContent/IceLaboratorySchematic.cs +++ b/Schematics/AutoGeneratedContent/IceLaboratorySchematic.cs @@ -502,8 +502,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile482 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 252, 36); var tile483 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 6, 1, 32).UseFrame(18, 144).UseWall((ushort)WallID.IceUnsafe, 216, 36); var tile484 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 11, 0, 32).UseFrame(18, 162).UseWall((ushort)WallID.IceUnsafe, 396, 0); - var tile485 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile485 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile487 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 360, 36); var tile488 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 360, 36); var tile489 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 36); @@ -530,8 +530,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile510 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 18); var tile511 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)WallID.SnowWallUnsafe, 360, 0); var tile512 = new TileDefinitionStructure(TileID.Torches).UseHeaders(0, 1, 1, 32).UseFrame(0, 198).UseWall((ushort)WallID.IceUnsafe, 36, 36); - var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); var tile515 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(306, 36).UseWall((ushort)ModContent.WallType(), 72, 36); var tile516 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 36); var tile517 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); @@ -552,8 +552,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile532 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 252, 72); var tile533 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 136, 2, 32).UseFrame(0, 630).UseWall((ushort)WallID.IceUnsafe, 288, 72); var tile534 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)WallID.SnowWallUnsafe, 216, 72); - var tile535 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile536 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile535 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile536 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile537 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 36); var tile538 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 72); var tile539 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); @@ -564,8 +564,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile544 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 80).UseWall((ushort)ModContent.WallType(), 396, 36); var tile545 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 96).UseWall((ushort)ModContent.WallType(), 36, 36); var tile546 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile547 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile548 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile547 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile548 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); var tile549 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 72); var tile550 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); var tile551 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); @@ -597,8 +597,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile577 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 80).UseWall((ushort)ModContent.WallType(), 108, 36); var tile578 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 96).UseWall((ushort)ModContent.WallType(), 108, 36); var tile579 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile580 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile581 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile580 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile581 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile582 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); var tile583 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 0); var tile584 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); @@ -624,8 +624,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile604 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 80).UseWall((ushort)ModContent.WallType(), 108, 36); var tile605 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(32, 96).UseWall((ushort)ModContent.WallType(), 216, 72); var tile606 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile607 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile608 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile607 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile608 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile609 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); var tile610 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0); var tile611 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); @@ -683,8 +683,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile663 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(64, 80).UseWall((ushort)ModContent.WallType(), 36, 36); var tile664 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(64, 96).UseWall((ushort)ModContent.WallType(), 108, 36); var tile665 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile666 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile667 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile666 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile667 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile668 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); var tile669 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 0); var tile670 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 0); @@ -703,8 +703,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile683 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(80, 80).UseWall((ushort)ModContent.WallType(), 72, 36); var tile684 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(80, 96).UseWall((ushort)ModContent.WallType(), 288, 72); var tile685 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile686 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile687 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile686 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile687 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile688 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); var tile689 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 72); var tile690 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 72); @@ -713,12 +713,12 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile693 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); var tile694 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); var tile695 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile696 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile696 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); var tile697 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 36); var tile698 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 36); var tile699 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile700 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile701 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile700 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile701 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); var tile702 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 180, 144); var tile703 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 288, 36); var tile704 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); @@ -728,8 +728,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile708 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 396, 72); var tile709 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 36); var tile710 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile711 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile712 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile711 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile712 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile713 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(288, 36).UseWall((ushort)ModContent.WallType(), 360, 0); var tile714 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 36); var tile715 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 72); @@ -750,8 +750,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile730 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 108, 144); var tile731 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 360, 36); var tile732 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 4, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile733 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile734 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile733 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile734 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); var tile735 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 36); var tile736 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); var tile737 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); diff --git a/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.cs index 940721ecf3..c24f23bc80 100644 --- a/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.cs +++ b/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.cs @@ -377,8 +377,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile358 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); var tile359 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); var tile360 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile361 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile362 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile361 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile362 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); var tile363 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 360, 36); var tile364 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 72); var tile365 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); @@ -400,8 +400,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile381 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 36, 36); var tile382 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); var tile383 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); var tile386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 36); var tile388 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 36); @@ -436,8 +436,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile417 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 4, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 0); var tile418 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); var tile419 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile420 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile421 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile420 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile421 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 144, 36); var tile422 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 216, 36); var tile423 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 72); var tile424 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); @@ -1097,8 +1097,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile1078 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 0, 0); var tile1079 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 64, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 0, 36); var tile1080 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 128, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile1081 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1082 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile1081 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile1082 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 36); var tile1083 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 36); var tile1084 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 396, 72); var tile1085 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); @@ -1108,8 +1108,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile1089 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 108, 36); var tile1090 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 360, 0); var tile1091 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1092 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1093 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile1092 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile1093 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile1094 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 360, 72); var tile1095 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 36); var tile1096 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 36, 36); @@ -1120,8 +1120,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile1101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseWall((ushort)ModContent.WallType(), 108, 0); var tile1102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 216, 72); var tile1103 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile1104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile1105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); var tile1106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); var tile1107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile1108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 72); diff --git a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs index 0d2e1331b7..d91f609756 100644 --- a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs +++ b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs @@ -146,18 +146,18 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile130 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 72); var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)WallID.SapphireGemspark, 36, 36); - var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); + var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)WallID.SapphireGemspark, 36, 36); + var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); var tile136 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 75, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 36); var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 288, 36); - var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); + var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 288, 36); + var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 0); var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); var tile142 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 360, 36); - var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 72, 72); + var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 360, 36); + var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 72, 72); var tile145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); var tile146 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 0); var tile147 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); @@ -221,15 +221,15 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 72); var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 108); var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)WallID.SapphireGemspark, 360, 72); - var tile209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); + var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)WallID.SapphireGemspark, 360, 72); + var tile209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); var tile210 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 36); + var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 36); var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(216, 0); var tile214 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile215 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 252, 36); - var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); + var tile215 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 252, 36); + var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); var tile217 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(162, 36); var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); var tile219 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)WallID.SapphireGemspark, 360, 0); diff --git a/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.cs index 47e0c6c46d..efcaae6586 100644 --- a/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.cs +++ b/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.cs @@ -305,8 +305,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 1056).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 360, 72); var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile289 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile289 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseWall((ushort)ModContent.WallType(), 36, 0); var tile291 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 72, 36); var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 108, 36); @@ -322,8 +322,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 36).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 288, 72); var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); var tile307 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); var tile308 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 144); var tile309 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 0); @@ -344,8 +344,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 216, 36); var tile326 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 139, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile328 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile328 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); var tile329 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); var tile330 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 108, 0); var tile331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 360, 0); @@ -390,8 +390,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile370 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); var tile371 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 396, 36); var tile372 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile373 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile374 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile373 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile374 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); var tile375 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(80, 0).UseWall((ushort)ModContent.WallType(), 72, 0); var tile376 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(80, 16).UseWall((ushort)ModContent.WallType(), 360, 0); var tile377 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(80, 32).UseWall((ushort)ModContent.WallType(), 36, 36); @@ -403,8 +403,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile383 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); var tile384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 360, 36); var tile385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile388 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 36); var tile389 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); var tile390 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); @@ -412,8 +412,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile392 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); var tile393 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); var tile394 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile395 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile396 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile395 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile396 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 72); var tile397 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); var tile398 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); var tile399 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); @@ -1076,8 +1076,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile1056 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); var tile1057 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); var tile1058 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1059 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1060 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile1059 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile1060 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); var tile1061 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); var tile1062 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); var tile1063 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); @@ -1092,8 +1092,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile1072 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); var tile1073 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); var tile1074 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1075 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1076 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile1075 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile1076 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); var tile1077 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); var tile1078 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); var tile1079 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); @@ -1108,8 +1108,8 @@ namespace CalamityMod.Schematics.AutoGeneratedContent var tile1088 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); var tile1089 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 288, 72); var tile1090 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1091 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1092 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile1091 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile1092 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); var tile1093 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 72); var tile1094 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); var tile1095 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 72); diff --git a/Schematics/TilePlacementHelpers.cs b/Schematics/TilePlacementHelpers.cs index 02ba94a6bf..f96cf3d92a 100644 --- a/Schematics/TilePlacementHelpers.cs +++ b/Schematics/TilePlacementHelpers.cs @@ -1,9 +1,7 @@ -using CalamityMod.TileEntities; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using System; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.Schematics.SchematicLoader; diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index 1bfb285ca1..e3f3330329 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -2,129 +2,237 @@ using Microsoft.Xna.Framework; using System; using System.IO; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities { - public abstract class TEBaseTurret : ModTileEntity - { - public int Time; - public int Direction; - public float Rotation; - public virtual float MaxAngleOffestShootPrompt => MathHelper.ToRadians(35f); - public abstract int ShootWaitTime { get; } - public abstract int ShootRate { get; } - public abstract int ProjectileDamage { get; } - public abstract float ShootSpeed { get; } - public abstract float ShootSpawnOffset { get; } - public abstract float ProjectileKnockback { get; } - public abstract int TileType { get; } - public abstract int ProjectileShot { get; } - public abstract Vector2 ShootCoordsOffset { get; } - public abstract float TargetDistanceCheck { get; } - public void SyncTile() - { - NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); - } - public virtual int AttemptToLocatePlayer(Vector2 shootTargetCoords) - { - int playerIndex = -1; - for (int i = 0; i < Main.player.Length; i++) - { - // Ignore dead/inactive players. They are irrelevant since we're supposed to target a player. - if (!Main.player[i].active || Main.player[i].dead) - continue; - if (Main.player[i].Distance(shootTargetCoords) < TargetDistanceCheck) - { - playerIndex = i; - break; - } - } - return playerIndex; - } - public virtual void AttemptToFireAtPlayer(int playerIndex, Vector2 shootTargetCoords) - { - Player player = Main.player[playerIndex]; - float angleToTarget = (player.Center - shootTargetCoords).ToRotation(); - float idealAngle = angleToTarget + (Direction == -1).ToInt() * MathHelper.Pi; + public abstract class TEBaseTurret : ModTileEntity + { + internal static readonly Vector2 InvalidTarget = new Vector2(float.NaN, float.NaN); - // Adjust the rotation before waiting, and then firing. - if (Time % ShootRate < ShootRate - ShootWaitTime) - { - AimTowardsPlayer(playerIndex, shootTargetCoords, angleToTarget, ref idealAngle); - SyncTile(); // The stupid rotation/direction doesn't sync otherwise. Don't ask me why. - } + // Fields specific to this instance of the turret tile entity + public int FiringTime = 0; + public int Direction = 0; + public float Angle = 0f; + public Vector2 TargetPos = InvalidTarget; - // If at the end of the shoot cycle, and the angle offset isn't too far away, fire at the player. - // Think of the angle offset as how close the turret is to aiming 100% perfectly at the player. - if (Time % ShootRate == ShootRate - 1 && Math.Abs(MathHelper.WrapAngle(idealAngle - Rotation)) < MaxAngleOffestShootPrompt) - { - ShootProjectile(shootTargetCoords); - SyncTile(); - } - } - public virtual void AimTowardsPlayer(int playerIndex, Vector2 shootTargetCoords, float angleToTarget, ref float idealAngle) - { - Player player = Main.player[playerIndex]; - int idealDirection = (player.Center.X - shootTargetCoords.X > 0).ToDirectionInt(); + // Tile which hosts this tile entity, and variables relating to it + public abstract int TileType { get; } + public abstract int HostTileWidth { get; } + public abstract int HostTileHeight { get; } - // Adjust the direction if the turret should do so, along with the angle. - if (Direction != idealDirection) - { - Direction = idealDirection; - idealAngle = angleToTarget + (Direction == -1).ToInt() * MathHelper.Pi; - Rotation = Rotation.AngleLerp(idealAngle, 0.4f); // Get a head start in rotating towards the ideal angle. - } - Rotation = Rotation.AngleLerp(idealAngle, 0.1f); - } - public virtual void ShootProjectile(Vector2 shootCoords) - { - float adjustedAngle = Rotation - (Direction == -1).ToInt() * MathHelper.Pi; - Vector2 velocity = adjustedAngle.ToRotationVector2() * ShootSpeed; - Projectile.NewProjectileDirect(shootCoords + adjustedAngle.ToRotationVector2() * ShootSpawnOffset, velocity, ProjectileShot, ProjectileDamage, ProjectileKnockback); - } - public override bool ValidTile(int i, int j) - { - Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == TileType; - } - public override void Update() - { - Vector2 positionWorldCoords = Position.ToVector2() * 16f; - Vector2 shootTargetCoords = positionWorldCoords + ShootCoordsOffset; - int playerIndex = AttemptToLocatePlayer(shootTargetCoords); - if (playerIndex != -1) - { - AttemptToFireAtPlayer(playerIndex, shootTargetCoords); - Time++; - } - else - { - Rotation = Rotation.AngleLerp(0f, 0.25f); - } - } - public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 3); - NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); - return -1; - } - return Place(i, j); - } - public override void NetSend(BinaryWriter writer, bool lightSend) - { - writer.Write(Time); - writer.Write(Direction); - writer.Write(Rotation); - } - public override void NetReceive(BinaryReader reader, bool lightReceive) - { - Time = reader.ReadInt32(); - Direction = reader.ReadInt32(); - Rotation = reader.ReadSingle(); - } - } + // Projectile variables + public abstract int ProjectileType { get; } + public abstract int ProjectileDamage { get; } + public abstract float ProjectileKnockback { get; } + public abstract float ShootSpeed { get; } + public abstract int FiringStartupDelay { get; } + public abstract int FiringUseTime { get; } + + // Projectile spawn location variables + public abstract Vector2 TurretCenterOffset { get; } + protected virtual float ShootForwardsOffset => 0f; + + // Targeting variables + + // If the target is more than this distance away, stop tracking them. + public abstract float MaxRange { get; } + // Subclasses MUST define their own targeting algorithm. + protected abstract Vector2 ChooseTarget(Vector2 targetingCenter); + // If the target is more than this angle away from the turret's current firing direction, don't fire. + protected virtual float MaxTargetAngleDeviance => MathHelper.ToRadians(30f); + protected virtual float MaxDeltaAnglePerFrame => MathHelper.ToRadians(4f); + protected virtual float CloseAimLerpFactor => 1f; + + // "Calculator" properties which are calculated on the fly for the code. + // Some of these are quite recursive, so if you do call them, store them in locals. + public Vector2 TurretPosition => Position.ToWorldCoordinates(0f, 0f) + TurretCenterOffset; + protected bool TargetIsInvalid => TargetPos.HasNaNs(); + public virtual float RestingAngle => Direction == -1 ? MathHelper.Pi : 0f; + protected float TargetAngle => TargetIsInvalid ? RestingAngle : (TargetPos - TurretPosition).ToRotation(); + + // This guarantees that Turret tile entities will not persist if not placed directly on some part of their host tile. + public override bool ValidTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + return tile.active() && tile.type == TileType; + } + + #region Update and Turret Behavior + public override void Update() + { + Vector2 turretPos = TurretPosition; + bool validTarget = !TargetIsInvalid; + + // Edge-trigger targeting logic 1: If the turret has a target but it's too far away, cancel it. + if (validTarget && Vector2.DistanceSquared(turretPos, TargetPos) >= MaxRange * MaxRange) + { + TargetPos = InvalidTarget; + validTarget = false; + } + + // Edge-trigger targeting logic 2: If the turret has no target, look for one. + // This can intentionally occur immediately after logic 1. + if (!validTarget) + TargetPos = ChooseTarget(turretPos); + + // Re-evaluate the calculator property with the new target (if one exists). + validTarget = !TargetIsInvalid; + + // If there is a defined target, then this frame is spent aiming, and maybe even firing! + if (validTarget) + { + ActiveBehavior(turretPos, TargetPos); + FiringTime++; + } + + // Otherwise, reset the running "firing timer" and exhibit passive behavior. + else + { + PassiveBehavior(turretPos); + FiringTime = 0; + } + + UpdateAngle(); + } + + // This function runs on both client and server side. Clients run it manually using Tile Entity Time Handler. + // This ensures that turrets aim at players visually in multiplayer without causing a packet storm. + public virtual void UpdateAngle() + { + float targetAngle = TargetAngle; + + // WrapAngle clamps things from -pi to pi, not from 0 to 2pi. + float deltaAngle = MathHelper.WrapAngle(Angle - targetAngle); + bool usingMaxTurnRate = Math.Abs(deltaAngle) >= MaxDeltaAnglePerFrame; + + // When not turning at max speed, the turret slowly swivels to its exact target angle. + // This is an intentional inefficiency that makes it easy to dodge shots (albeit narrowly!) without moving super quickly. + Angle = usingMaxTurnRate + ? MathHelper.WrapAngle(Angle + MaxDeltaAnglePerFrame * Math.Sign(deltaAngle)) + : Utils.AngleLerp(Angle, targetAngle, CloseAimLerpFactor); + } + + // This function does nothing by default, but turrets can use it for flavor behaviors e.g. emitting sparks or beeping. + protected virtual void PassiveBehavior(Vector2 turretPos) {} + + protected virtual void ActiveBehavior(Vector2 turretPos, Vector2 targetPos) + { + // This function won't run without a valid target, so this will always be an angle to a real target. + float targetAngle = TargetAngle; + + // If the turret is too far off its mark or hasn't been around for long enough, don't fire at all. + float deltaAngle = MathHelper.WrapAngle(Angle - targetAngle); + bool angleCloseEnough = Math.Abs(deltaAngle) <= MaxTargetAngleDeviance; + if (!angleCloseEnough || FiringTime < FiringStartupDelay) + return; + + // Don't shoot every frame, but sync up the firing cadence to the startup delay. + if ((FiringTime - FiringStartupDelay) % FiringUseTime == 0) + Shoot(turretPos); + } + + // Orders the turret to fire exactly one projectile at its current heading. + // This function also sends a sync packet. As such, it refuses to run on mutliplayer clients. + public Projectile Shoot(Vector2 turretMuzzlePos, float ai0 = 0f, float ai1 = 0f) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + return null; + + SendSyncPacket(); + + Vector2 angleVec = Angle.ToRotationVector2(); + Vector2 pos = turretMuzzlePos + angleVec * ShootForwardsOffset; + Vector2 velocity = angleVec * ShootSpeed; + return Projectile.NewProjectileDirect(pos, velocity, ProjectileType, ProjectileDamage, ProjectileKnockback, ai0: ai0, ai1: ai1); + } + #endregion + + // This code is called as a hook when the player places the host tile so that the turret tile entity may be placed. + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed tiles in whatever space the host tile occupies. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, HostTileWidth, HostTileHeight); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + + // If in single player, just place the tile entity, no problems. + int id = Place(i, j); + return id; + } + + // This code is called on dedicated servers only. It is the server-side response to MessageID.TileEntityPlacement. + // When the server receives such a message from a client, it sends a MessageID.TileEntitySharing to all clients. + // This will cause them to Place the tile entity locally at that position, all with exactly the same ID. + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + // Normally, a bunch of other TML hooks would go here, namely: + // + // void OnKill() + // TagCompound Save() + // void Load(TagCompound tag) + // + // Subclasses can override these TML hooks as they please. The base turret does not need to use them. + + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(FiringTime); + writer.Write(Direction); + writer.Write(Angle); + writer.WriteVector2(TargetPos); + } + + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + FiringTime = reader.ReadInt32(); + Direction = reader.ReadInt32(); + Angle = reader.ReadSingle(); + TargetPos = reader.ReadVector2(); + } + + protected internal void SendSyncPacket() + { + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.Turret); + packet.Write(ID); + packet.Write(FiringTime); + packet.Write(Direction); + packet.Write(Angle); + packet.WriteVector2(TargetPos); + SendExtraData(packet); + } + + protected internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) + { + int teID = reader.ReadInt32(); + bool exists = ByID.TryGetValue(teID, out TileEntity te); + + if (exists && te is TEBaseTurret turret) + { + turret.FiringTime = reader.ReadInt32(); + turret.Direction = reader.ReadInt32(); + turret.Angle = reader.ReadSingle(); + turret.TargetPos = reader.ReadVector2(); + turret.ReceiveExtraData(mod, reader); + return true; + } + // If the tile entity doesn't exist or is invalid, just destroy the packet. + else + { + reader.Close(); + reader.Dispose(); + return false; + } + } + + // Subclasses cannot override SendSyncPacket, but they can override these functions to sync their own extra data. + protected virtual void SendExtraData(BinaryWriter writer) { } + protected virtual void ReceiveExtraData(Mod mod, BinaryReader reader) { } + } } diff --git a/TileEntities/TEChargingStation.cs b/TileEntities/TEChargingStation.cs index 9f370d89b3..dec1d66951 100644 --- a/TileEntities/TEChargingStation.cs +++ b/TileEntities/TEChargingStation.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items; using CalamityMod.Items.DraedonMisc; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using System.IO; using System.Reflection; @@ -210,16 +210,16 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ChargingStationStandard); - netMessage.Write(ID); - netMessage.Write(ChargingTimer); - netMessage.Write(_stack); + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.ChargingStationStandard); + packet.Write(ID); + packet.Write(ChargingTimer); + packet.Write(_stack); // Either write the real charge or garbage data. If garbage data is written it will be ignored on the other end. CalamityGlobalItem modItem = PluggedItem.IsAir ? null : PluggedItem.Calamity(); - netMessage.Write(syncItemCharge && modItem != null ? modItem.Charge : float.NaN); - netMessage.Send(-1, -1); + packet.Write(syncItemCharge && modItem != null ? modItem.Charge : float.NaN); + packet.Send(-1, -1); // If this flag was set to true, set it to false for any further updates (until it gets set to true again). syncItemCharge = false; @@ -274,11 +274,11 @@ namespace CalamityMod.TileEntities { if (Main.netMode == NetmodeID.SinglePlayer) return; - var netMessage = mod.GetPacket(1024); - netMessage.Write((byte)CalamityModMessageType.ChargingStationItemChange); - netMessage.Write(ID); - netMessage.WriteItem(PluggedItem, true); - netMessage.Send(-1, -1); + ModPacket packet = mod.GetPacket(1024); + packet.Write((byte)CalamityModMessageType.ChargingStationItemChange); + packet.Write(ID); + packet.WriteItem(PluggedItem, true); + packet.Send(-1, -1); } internal static bool ReadItemSyncPacket(Mod mod, BinaryReader reader) diff --git a/TileEntities/TEDraedonFieldGenerator.cs b/TileEntities/TEDraedonFieldGenerator.cs index 712d292fb9..cb607f0030 100644 --- a/TileEntities/TEDraedonFieldGenerator.cs +++ b/TileEntities/TEDraedonFieldGenerator.cs @@ -1,5 +1,5 @@ using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/TileEntities/TEDraedonHologram.cs b/TileEntities/TEDraedonHologram.cs index ae6f472a68..d6624aa03b 100644 --- a/TileEntities/TEDraedonHologram.cs +++ b/TileEntities/TEDraedonHologram.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using System.IO; using Terraria; using Terraria.ID; diff --git a/TileEntities/TEDraedonLabTurret.cs b/TileEntities/TEDraedonLabTurret.cs new file mode 100644 index 0000000000..a89d1ab522 --- /dev/null +++ b/TileEntities/TEDraedonLabTurret.cs @@ -0,0 +1,101 @@ +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles.DraedonStructures; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.TileEntities +{ + public class TEDraedonLabTurret : TEBaseTurret + { + // Tile which hosts this tile entity + public override int TileType => ModContent.TileType(); + public override int HostTileWidth => DraedonLabTurret.Width; + public override int HostTileHeight => DraedonLabTurret.Height; + + // Projectile variables + public override int ProjectileType => ModContent.ProjectileType(); + public override int ProjectileDamage => Main.expertMode ? 14 : 20; + public override float ProjectileKnockback => 6.5f; + public override float ShootSpeed => 5f; + public override int FiringStartupDelay => 10; + public override int FiringUseTime => 20; + + // Projectile spawn location variables + public override Vector2 TurretCenterOffset => new Vector2(22f + 4f * Direction, -2f); + protected override float ShootForwardsOffset => 32f; + + // Targeting variables + public override float MaxRange => 600f; + protected override float CloseAimLerpFactor => 0.4f; + + // Variables specific to this turret subclass + private int _playerTargetIndex = -1; + public int PlayerTargetIndex + { + get => _playerTargetIndex; + set + { + bool sync = _playerTargetIndex != value; + _playerTargetIndex = value; + if (sync) + SendSyncPacket(); + } + } + + protected override Vector2 ChooseTarget(Vector2 targetingCenter) + { + // Store the value that will be set into PlayerTargetIndex here. + // This local is used because changing the actual field will trigger a netcode auto-sync. + int indexToSet = PlayerTargetIndex; + + // If a player is already targeted, make sure they still exist and aren't dead. + if (indexToSet != -1) + { + Player p = Main.player[PlayerTargetIndex]; + + // If they don't exist, or are dead, then unmark them as a target and search for a new one. + if (!p.active || p.dead) + indexToSet = -1; + else + { + // If the existing target player is close enough, return their position. Otherwise unmark them as a target. + Vector2 playerPos = p.Center; + float distSQ = Vector2.DistanceSquared(targetingCenter, playerPos); + if (distSQ <= MaxRange * MaxRange) + return playerPos; + else + indexToSet = -1; + } + } + + // No valid target currently exists. Loop through players (efficiently!) to look for the closest new target. + Vector2 ret = InvalidTarget; + float distSQToBeat = MaxRange * MaxRange; + + for (int i = 0; i < Main.maxPlayers; ++i) + { + Player p = Main.player[i]; + if (!p.active || p.dead) + continue; + + float distSQ = p.DistanceSQ(targetingCenter); + if (distSQ < distSQToBeat) + { + distSQToBeat = distSQ; + ret = p.Center; + indexToSet = i; + } + } + + // Set PlayerTargetIndex now that we're sure what we're targeting. This triggers a netcode sync if the value is different. + PlayerTargetIndex = indexToSet; + return ret; + } + + // This type of turret syncs extra data: its player target index. + protected override void SendExtraData(BinaryWriter writer) => writer.Write(_playerTargetIndex); + protected override void ReceiveExtraData(Mod mod, BinaryReader reader) => _playerTargetIndex = reader.ReadInt32(); + } +} diff --git a/TileEntities/TEDraedonTurret.cs b/TileEntities/TEDraedonTurret.cs deleted file mode 100644 index c00656ed1d..0000000000 --- a/TileEntities/TEDraedonTurret.cs +++ /dev/null @@ -1,21 +0,0 @@ -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.TileEntities -{ - public class TEDraedonTurret : TEBaseTurret - { - public override int ShootWaitTime => 15; - public override int ShootRate => 90; - public override int ProjectileDamage => 20; - public override float ShootSpeed => 5f; - public override float ShootSpawnOffset => 32f; - public override float ProjectileKnockback => 3f; - public override int TileType => ModContent.TileType(); - public override int ProjectileShot => ModContent.ProjectileType(); - public override Vector2 ShootCoordsOffset => new Vector2(22f + 4f * Direction, -2f); - public override float TargetDistanceCheck => 600f; - } -} diff --git a/TileEntities/TEPowerCellFactory.cs b/TileEntities/TEPowerCellFactory.cs index 4cc6033d7b..d84be90b29 100644 --- a/TileEntities/TEPowerCellFactory.cs +++ b/TileEntities/TEPowerCellFactory.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using System.IO; using System.Reflection; using Terraria; diff --git a/TileEntities/TileEntityTimeHandler.cs b/TileEntities/TileEntityTimeHandler.cs index 6262e22c74..f363b3fb11 100644 --- a/TileEntities/TileEntityTimeHandler.cs +++ b/TileEntities/TileEntityTimeHandler.cs @@ -1,4 +1,5 @@ -using Terraria; +using Steamworks; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,10 @@ namespace CalamityMod.TileEntities do { TileEntity te = enumerator.Current; - if (te != null && te.type == factoryType) + if (te == null) + continue; + + if (te.type == factoryType) { // Specifically on multiplayer clients, manually update the time variables of Power Cell Factories every frame. // This makes sure they animate. It will NOT produce cells; that code can only run server side. @@ -31,7 +35,7 @@ namespace CalamityMod.TileEntities TEPowerCellFactory factory = (TEPowerCellFactory)te; ++factory.Time; } - if (te != null && te.type == chargerType) + else if (te.type == chargerType) { // Specifically on multiplayer clients, produce charging dust when the "should dust" flag is set by the most recent sync packet. // This makes sure they produce charging dust for all clients. It will NOT actually charge items; that code can only run server side. @@ -43,6 +47,12 @@ namespace CalamityMod.TileEntities charger.SpawnChargingDust(); } } + else if (te is TEBaseTurret turret) + { + // Specifically on multiplayer clients, manually update the turret's rotation every frame. This is exactly the same code run server side. + // This makes sure they visually track players in multiplayer. It will NOT fire projectiles; that code can only run server side. + turret.UpdateAngle(); + } } while (enumerator.MoveNext()); } } diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 87ff581e75..5620a7ef83 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -7,6 +7,7 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using CalamityMod.World; @@ -21,24 +22,24 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class CalamityGlobalTile : GlobalTile - { - public static IList WaterStyles => (IList)typeof(WaterStyleLoader).GetField("waterStyles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); + public class CalamityGlobalTile : GlobalTile + { + public static IList WaterStyles => (IList)typeof(WaterStyleLoader).GetField("waterStyles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); public static ushort[] PlantTypes = new ushort[] - { - TileID.Plants, - TileID.CorruptPlants, - TileID.JunglePlants, - TileID.MushroomPlants, - TileID.Plants2, - TileID.JunglePlants2, - TileID.HallowedPlants, - TileID.HallowedPlants2, - TileID.FleshWeeds, - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType() - }; + { + TileID.Plants, + TileID.CorruptPlants, + TileID.JunglePlants, + TileID.MushroomPlants, + TileID.Plants2, + TileID.JunglePlants2, + TileID.HallowedPlants, + TileID.HallowedPlants2, + TileID.FleshWeeds, + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() + }; public static List GrowthTiles = new List { @@ -53,107 +54,107 @@ namespace CalamityMod.Tiles } public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) - { - // Custom plant framing - for (int k = 0; k < PlantTypes.Length; k++) - if (type == PlantTypes[k]) - { - TileFraming.PlantFrame(i, j); - return false; - } + { + // Custom plant framing + for (int k = 0; k < PlantTypes.Length; k++) + if (type == PlantTypes[k]) + { + TileFraming.PlantFrame(i, j); + return false; + } - // Custom vine framing - if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == ModContent.TileType()) - { - TileFraming.VineFrame(i, j); - return false; - } - return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); - } + // Custom vine framing + if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == ModContent.TileType()) + { + TileFraming.VineFrame(i, j); + return false; + } + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); + } - public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) - { - // Guaranteed not null at this point - Tile tile = Main.tile[i, j]; + public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) + { + // Guaranteed not null at this point + Tile tile = Main.tile[i, j]; - // This function is only for Astral Cactus. If the tile isn't even cactus, forget about it. - if (type != TileID.Cactus) - return; - - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - zero = Vector2.Zero; - int frameX = tile.frameX; - int frameY = tile.frameY; - - // Search down the cactus to find out whether the block it is planted in is Astral Sand. - bool astralCactus = false; - if (!Main.canDrawColorTile(i, j)) - { - int xTile = i; - if (frameX == 36) // Cactus segment which splits left - xTile--; - if (frameX == 54) // Cactus segment which splits right - xTile++; - if (frameX == 108) // Cactus segment which splits both directions - xTile += (frameY == 18) ? -1 : 1; - - int yTile = j; - bool slidingDownCactus = Main.tile[xTile, yTile] != null && Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active(); - while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[Main.tile[xTile, yTile].type] || !slidingDownCactus) - { - if (Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active()) - { - slidingDownCactus = true; - } - yTile++; - // Cacti are assumed to be no more than 20 blocks tall. - if (yTile > i + 20) - break; - } - astralCactus = Main.tile[xTile, yTile].type == (ushort)ModContent.TileType(); - } - - // If it is actually astral cactus, then draw its glowmask. - if (astralCactus) - { - spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f); - } - } - - // This function exists only to shatter adjacent Lumenyl or Sea Prism crystals when a neighboring solid tile is destroyed. - public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) - { - Tile tile = Main.tile[i, j]; - if(tile is null) + // This function is only for Astral Cactus. If the tile isn't even cactus, forget about it. + if (type != TileID.Cactus) return; - // Helper function to shatter crystals attached to neighboring solid tiles. - void CheckShatterCrystal(int xPos, int yPos) - { - if (xPos < 0 || xPos >= Main.maxTilesX || yPos < 0 || yPos >= Main.maxTilesY) - return; - Tile t = Main.tile[xPos, yPos]; - if (t != null && t.active() && (t.type == ModContent.TileType() || (t.type == ModContent.TileType() && CalamityWorld.downedDesertScourge))) - { - WorldGen.KillTile(xPos, yPos, false, false, false); - if (!Main.tile[xPos, yPos].active() && Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, xPos, yPos, 0f, 0, 0, 0); - } - } + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + zero = Vector2.Zero; + int frameX = tile.frameX; + int frameY = tile.frameY; + + // Search down the cactus to find out whether the block it is planted in is Astral Sand. + bool astralCactus = false; + if (!Main.canDrawColorTile(i, j)) + { + int xTile = i; + if (frameX == 36) // Cactus segment which splits left + xTile--; + if (frameX == 54) // Cactus segment which splits right + xTile++; + if (frameX == 108) // Cactus segment which splits both directions + xTile += (frameY == 18) ? -1 : 1; + + int yTile = j; + bool slidingDownCactus = Main.tile[xTile, yTile] != null && Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active(); + while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[Main.tile[xTile, yTile].type] || !slidingDownCactus) + { + if (Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active()) + { + slidingDownCactus = true; + } + yTile++; + // Cacti are assumed to be no more than 20 blocks tall. + if (yTile > i + 20) + break; + } + astralCactus = Main.tile[xTile, yTile].type == (ushort)ModContent.TileType(); + } + + // If it is actually astral cactus, then draw its glowmask. + if (astralCactus) + { + spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f); + } + } + + // This function exists only to shatter adjacent Lumenyl or Sea Prism crystals when a neighboring solid tile is destroyed. + public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile tile = Main.tile[i, j]; + if(tile is null) + return; + + // Helper function to shatter crystals attached to neighboring solid tiles. + void CheckShatterCrystal(int xPos, int yPos) + { + if (xPos < 0 || xPos >= Main.maxTilesX || yPos < 0 || yPos >= Main.maxTilesY) + return; + Tile t = Main.tile[xPos, yPos]; + if (t != null && t.active() && (t.type == ModContent.TileType() || (t.type == ModContent.TileType() && CalamityWorld.downedDesertScourge))) + { + WorldGen.KillTile(xPos, yPos, false, false, false); + if (!Main.tile[xPos, yPos].active() && Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, xPos, yPos, 0f, 0, 0, 0); + } + } // CONSIDER -- Lumenyl Crystals and Sea Prism Crystals aren't solid. They shouldn't need to be checked here. - if (Main.tileSolid[tile.type] && tile.type != ModContent.TileType() && tile.type != ModContent.TileType()) - { - CheckShatterCrystal(i + 1, j); - CheckShatterCrystal(i - 1, j); - CheckShatterCrystal(i, j + 1); - CheckShatterCrystal(i, j - 1); - } - } + if (Main.tileSolid[tile.type] && tile.type != ModContent.TileType() && tile.type != ModContent.TileType()) + { + CheckShatterCrystal(i + 1, j); + CheckShatterCrystal(i - 1, j); + CheckShatterCrystal(i, j + 1); + CheckShatterCrystal(i, j - 1); + } + } - // LATER -- clean up copied decompiled pot code here - public override bool Drop(int i, int j, int type) + // LATER -- clean up copied decompiled pot code here + public override bool Drop(int i, int j, int type) { if (type == ModContent.TileType()) { @@ -521,40 +522,40 @@ namespace CalamityMod.Tiles } } - public override int[] AdjTiles (int type) - { - // Ashen, Ancient and Profaned Sinks all count as a lava source instead of a water source - if (type == ModContent.TileType() || - type == ModContent.TileType() || - type == ModContent.TileType()) - { - Main.LocalPlayer.adjLava = true; - } - // Botanic Sink counts as a honey source instead of a water source - if (type == ModContent.TileType()) - { - Main.LocalPlayer.adjHoney = true; - } + public override int[] AdjTiles (int type) + { + // Ashen, Ancient and Profaned Sinks all count as a lava source instead of a water source + if (type == ModContent.TileType() || + type == ModContent.TileType() || + type == ModContent.TileType()) + { + Main.LocalPlayer.adjLava = true; + } + // Botanic Sink counts as a honey source instead of a water source + if (type == ModContent.TileType()) + { + Main.LocalPlayer.adjHoney = true; + } - return new int[0]; - } - public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged) - { - int[] indestructableTiles = new int[] - { - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType() - }; - // Prevent tiles below an astral beacon from being destroyed. - if (CalamityUtils.ParanoidTileRetrieval(i, j - 1).active() && - CalamityUtils.ParanoidTileRetrieval(i, j).type != - CalamityUtils.ParanoidTileRetrieval(i, j - 1).type && - indestructableTiles.Contains(CalamityUtils.ParanoidTileRetrieval(i, j - 1).type)) - { - return false; - } - return base.CanKillTile(i, j, type, ref blockDamaged); - } - } + return new int[0]; + } + public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged) + { + int[] indestructableTiles = new int[] + { + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType() + }; + // Prevent tiles below an astral beacon from being destroyed. + if (CalamityUtils.ParanoidTileRetrieval(i, j - 1).active() && + CalamityUtils.ParanoidTileRetrieval(i, j).type != + CalamityUtils.ParanoidTileRetrieval(i, j - 1).type && + indestructableTiles.Contains(CalamityUtils.ParanoidTileRetrieval(i, j - 1).type)) + { + return false; + } + return base.CanKillTile(i, j, type, ref blockDamaged); + } + } } diff --git a/Tiles/DraedonStructures/AgedSecurityChestTile.cs b/Tiles/DraedonStructures/AgedSecurityChestTile.cs index ae0a6493f0..80735cc25c 100644 --- a/Tiles/DraedonStructures/AgedSecurityChestTile.cs +++ b/Tiles/DraedonStructures/AgedSecurityChestTile.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class AgedSecurityChestTile : ModTile { diff --git a/Tiles/DraedonStructures/ChargingStation.cs b/Tiles/DraedonStructures/ChargingStation.cs index 6fcad24eb6..a3b0038f35 100644 --- a/Tiles/DraedonStructures/ChargingStation.cs +++ b/Tiles/DraedonStructures/ChargingStation.cs @@ -10,7 +10,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class ChargingStation : ModTile { @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles // When this tile is placed, it places the charging station tile entity. ModTileEntity te = ModContent.GetInstance(); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/DraedonStructures/DraedonFactoryFieldGenerator.cs b/Tiles/DraedonStructures/DraedonFactoryFieldGenerator.cs index 6a48a7a88b..3355065d94 100644 --- a/Tiles/DraedonStructures/DraedonFactoryFieldGenerator.cs +++ b/Tiles/DraedonStructures/DraedonFactoryFieldGenerator.cs @@ -7,7 +7,7 @@ using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class DraedonFactoryFieldGenerator : ModTile { diff --git a/Tiles/DraedonStructures/DraedonHologram.cs b/Tiles/DraedonStructures/DraedonHologram.cs index a7a24e916e..6fb6d0308b 100644 --- a/Tiles/DraedonStructures/DraedonHologram.cs +++ b/Tiles/DraedonStructures/DraedonHologram.cs @@ -9,7 +9,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class DraedonHologram : ModTile { diff --git a/Tiles/DraedonStructures/DraedonLabTurret.cs b/Tiles/DraedonStructures/DraedonLabTurret.cs new file mode 100644 index 0000000000..1a9b0ddcad --- /dev/null +++ b/Tiles/DraedonStructures/DraedonLabTurret.cs @@ -0,0 +1,102 @@ +using CalamityMod.Items.Materials; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class DraedonLabTurret : ModTile + { + public const int Width = 3; + public const int Height = 2; + public const int OriginOffsetX = 1; + public const int OriginOffsetY = 1; + public const int SheetSquare = 18; + + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + // No need to set width, height, origin, etc. here, Style3x2 is exactly what we want. + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.LavaDeath = false; + + // When this tile is placed, it places the Draedon Lab Turret tile entity. + ModTileEntity te = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); + + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Lab Turret"); + AddMapEntry(new Color(67, 72, 81), name); + soundType = SoundID.Item; + soundStyle = 14; + + // Requires a Gold Pickaxe or better to mine. Has 500% durability. + mineResist = 5.00f; + minPick = 55; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override bool HasSmartInteract() => true; + + 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) + { + // TODO -- Turrets have no items and can't be picked up and placed by players. + // Instead, drop some raw Draedon materials. + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType(), 8); + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType(), 8); + + Tile t = Main.tile[i, j]; + int left = i - t.frameX % (Width * SheetSquare) / SheetSquare; + int top = j - t.frameY % (Height * SheetSquare) / SheetSquare; + + TEDraedonLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + te?.Kill(left, top); + } + + // The turret tile draws a pulse turret on top of itself. + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile t = Main.tile[i, j]; + if (t.frameX != 36 || t.frameY != 0) + return; + + // This is done so that the turret has priority over, say, trees when drawing. + // TODO -- this is foul and should never happen ever, is there any way around this + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone); + + TEDraedonLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + int drawDirection = te?.Direction ?? 1; + Color drawColor = Lighting.GetColor(i, j); + + Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurret"); + Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; + drawOffset.Y -= 2f; + drawOffset.X += drawDirection == -1 ? -10 : 2; + SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float adjustedAngle = te.Angle; + spriteBatch.Draw(tex, drawOffset, null, drawColor, adjustedAngle, Vector2.Zero, tex.Size() * 0.5f, sfx, 0.0f); + } + } +} diff --git a/Tiles/DraedonStructures/DraedonTurretTile.png b/Tiles/DraedonStructures/DraedonLabTurret.png similarity index 100% rename from Tiles/DraedonStructures/DraedonTurretTile.png rename to Tiles/DraedonStructures/DraedonLabTurret.png diff --git a/Tiles/DraedonStructures/DraedonTurretTile.cs b/Tiles/DraedonStructures/DraedonTurretTile.cs deleted file mode 100644 index 35e2511263..0000000000 --- a/Tiles/DraedonStructures/DraedonTurretTile.cs +++ /dev/null @@ -1,98 +0,0 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.TileEntities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class DraedonTurretTile : ModTile - { - public const int Width = 3; - public const int Height = 2; - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); - TileObjectData.newTile.LavaDeath = false; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Turret"); - AddMapEntry(new Color(67, 72, 81), name); - soundType = SoundID.Item; - soundStyle = 14; - minPick = 55; - } - - public override bool CanExplode(int i, int j) => false; - - public TEDraedonTurret RetrieveTileEntity(int i, int j) - { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - int determinedID = ModContent.GetInstance().Find(left, top); - if (determinedID == -1 || !(TileEntity.ByID[determinedID] is TEDraedonTurret)) - { - ModTileEntity modTileEntity = ModTileEntity.ConstructFromType(ModContent.GetInstance().type); - modTileEntity.Position = new Point16(left, top); - modTileEntity.ID = TileEntity.AssignNewID(); - modTileEntity.type = ModContent.GetInstance().type; - TileEntity.ByID[modTileEntity.ID] = modTileEntity; - TileEntity.ByPosition[modTileEntity.Position] = modTileEntity; - determinedID = modTileEntity.ID; - } - return (TEDraedonTurret)TileEntity.ByID[determinedID]; - } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); - return false; - } - - public override bool HasSmartInteract() => true; - - 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) - { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - - RetrieveTileEntity(i, j).Kill(left, top); - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile trackTile = Main.tile[i, j]; - if (trackTile.frameX != 36 || trackTile.frameY != 0) - return; - - // This is done so that the turret has priority over, say, trees when drawing. - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone); - - TEDraedonTurret charger = RetrieveTileEntity(i, j); - Color drawColor = Lighting.GetColor(i, j); - - Texture2D drawTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurret"); - Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; - drawOffset.Y -= 2f; - drawOffset.X += charger.Direction == -1 ? -10 : 2; - float adjustedAngle = charger.Rotation; - spriteBatch.Draw(drawTexture, drawOffset, null, drawColor, adjustedAngle, drawTexture.Size() * 0.5f, 1f, charger.Direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.0f); - } - } -} diff --git a/Tiles/DraedonStructures/InactivePowerCellFactory.cs b/Tiles/DraedonStructures/InactivePowerCellFactory.cs index 33da870ad4..7200c2962c 100644 --- a/Tiles/DraedonStructures/InactivePowerCellFactory.cs +++ b/Tiles/DraedonStructures/InactivePowerCellFactory.cs @@ -6,7 +6,7 @@ using Terraria.Enums; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class InactivePowerCellFactory : ModTile { diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs index 9e4026eb07..c91b8448c0 100644 --- a/Tiles/DraedonStructures/PowerCellFactory.cs +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -11,7 +11,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class PowerCellFactory : ModTile { diff --git a/Tiles/DraedonStructures/SecurityChestTile.cs b/Tiles/DraedonStructures/SecurityChestTile.cs index 727ecb07ac..8c1d3564bc 100644 --- a/Tiles/DraedonStructures/SecurityChestTile.cs +++ b/Tiles/DraedonStructures/SecurityChestTile.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class SecurityChestTile : ModTile { diff --git a/UI/ChargingStationUI.cs b/UI/ChargingStationUI.cs index d2cb7e3db9..ecbd3c2018 100644 --- a/UI/ChargingStationUI.cs +++ b/UI/ChargingStationUI.cs @@ -1,8 +1,7 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items; using CalamityMod.Items.DraedonMisc; using CalamityMod.TileEntities; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; diff --git a/UI/PowerCellFactoryUI.cs b/UI/PowerCellFactoryUI.cs index 4b77186b69..df23d3e632 100644 --- a/UI/PowerCellFactoryUI.cs +++ b/UI/PowerCellFactoryUI.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.DraedonMisc; using CalamityMod.TileEntities; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System;