From 14ef21ce702c537ed1e565fcee77e7fbe2a95b91 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 16 Jan 2023 19:12:37 -0500 Subject: [PATCH] Fix lava schematics having water instead. Minor schematic gen improvements. --- Schematics/CalamitySchematicIO.cs | 18 +++++++++--------- Schematics/SchematicManager.cs | 4 ++-- World/DraedonStructures.cs | 16 ---------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/Schematics/CalamitySchematicIO.cs b/Schematics/CalamitySchematicIO.cs index e20262d8f9..c79d1fdb8b 100644 --- a/Schematics/CalamitySchematicIO.cs +++ b/Schematics/CalamitySchematicIO.cs @@ -69,10 +69,10 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = WallType; Main.tile[x, y].LiquidAmount = LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); + ref var targetLiquidState = ref (Main.tile[x, y].Get()); targetLiquidState.LiquidType = LiquidType; - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, miscState.NonFrameBits); targetMiscState.TileFrameX = miscState.TileFrameX; targetMiscState.TileFrameY = miscState.TileFrameY; @@ -83,10 +83,10 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = original.WallType; Main.tile[x, y].LiquidAmount = original.LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); - targetLiquidState.LiquidType = LiquidType; + ref var targetLiquidState = ref (Main.tile[x, y].Get()); + targetLiquidState.LiquidType = original.LiquidType; // this line caused the lava->water transmutation bug - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, original.miscState.NonFrameBits); targetMiscState.TileFrameX = original.miscState.TileFrameX; targetMiscState.TileFrameY = original.miscState.TileFrameY; @@ -97,10 +97,10 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = original.WallType; Main.tile[x, y].LiquidAmount = LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); + ref var targetLiquidState = ref (Main.tile[x, y].Get()); targetLiquidState.LiquidType = LiquidType; - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, miscState.NonFrameBits); targetMiscState.TileFrameX = miscState.TileFrameX; targetMiscState.TileFrameY = miscState.TileFrameY; @@ -118,10 +118,10 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = WallType; Main.tile[x, y].LiquidAmount = original.LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); + ref var targetLiquidState = ref (Main.tile[x, y].Get()); targetLiquidState.LiquidType = LiquidType; - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, original.miscState.NonFrameBits); targetMiscState.TileFrameX = original.miscState.TileFrameX; targetMiscState.TileFrameY = original.miscState.TileFrameY; diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index cc442fe462..b2297b3f2c 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -210,7 +210,7 @@ namespace CalamityMod.Schematics { Tile t = Main.tile[x + cornerX, y + cornerY]; if (t.TileType == TileID.Trees || t.TileType == TileID.PineTree || t.TileType == TileID.Cactus) - WorldGen.KillTile(x + cornerX, y + cornerY); + WorldGen.KillTile(x + cornerX, y + cornerY, noItem: true); } for (int x = 0; x < width; ++x) @@ -223,7 +223,7 @@ namespace CalamityMod.Schematics for (int x = 0; x < width; ++x) for (int y = 0; y < height; ++y) if (originalTiles[x, y].TileType != TileID.Containers) - WorldGen.KillTile(x + cornerX, y + cornerY); + WorldGen.KillTile(x + cornerX, y + cornerY, noItem: true); // Lay down the schematic. If the schematic calls for it, bring back tiles that are stored in the old tiles array. for (int x = 0; x < width; ++x) diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index ec53b825f5..cec3358c8a 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -293,22 +293,6 @@ namespace CalamityMod.World PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedMurasama, new Action(FillHellLaboratoryChest)); structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); CalamityWorld.HellLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; - - //for now just manually check the area around the lab and replace water with lava, may not be the best permanent fix but it works for now - for (int killWaterX = placementPoint.X - 150; killWaterX <= placementPoint.X + 150; killWaterX++) - { - for (int killWaterY = underworldTop; killWaterY <= Main.maxTilesY - 5; killWaterY++) - { - Tile tile = Framing.GetTileSafely(killWaterX, killWaterY); - - if (tile.LiquidType == LiquidID.Water && tile.LiquidAmount > 0) - { - tile.LiquidType = LiquidID.Lava; - tile.LiquidAmount = 255; - } - } - } - break; } }