Fix lava schematics having water instead. Minor schematic gen improvements.

This commit is contained in:
Ozzatron committed 2023-01-16 19:12:37 -05:00
1 parent 36a56819e0
commit 14ef21ce70
3 files changed
+11 -27

No files matched your search

+9 -9
View File
@@ -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<LiquidData>();
ref var targetLiquidState = ref (Main.tile[x, y].Get<LiquidData>());
targetLiquidState.LiquidType = LiquidType;
ref var targetMiscState = ref Main.tile[x, y].Get<TileWallWireStateData>();
ref var targetMiscState = ref (Main.tile[x, y].Get<TileWallWireStateData>());
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<LiquidData>();
targetLiquidState.LiquidType = LiquidType;
ref var targetLiquidState = ref (Main.tile[x, y].Get<LiquidData>());
targetLiquidState.LiquidType = original.LiquidType; // this line caused the lava->water transmutation bug
ref var targetMiscState = ref Main.tile[x, y].Get<TileWallWireStateData>();
ref var targetMiscState = ref (Main.tile[x, y].Get<TileWallWireStateData>());
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<LiquidData>();
ref var targetLiquidState = ref (Main.tile[x, y].Get<LiquidData>());
targetLiquidState.LiquidType = LiquidType;
ref var targetMiscState = ref Main.tile[x, y].Get<TileWallWireStateData>();
ref var targetMiscState = ref (Main.tile[x, y].Get<TileWallWireStateData>());
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<LiquidData>();
ref var targetLiquidState = ref (Main.tile[x, y].Get<LiquidData>());
targetLiquidState.LiquidType = LiquidType;
ref var targetMiscState = ref Main.tile[x, y].Get<TileWallWireStateData>();
ref var targetMiscState = ref (Main.tile[x, y].Get<TileWallWireStateData>());
CalamitySchematicIO.AssignMiscState(ref targetMiscState, original.miscState.NonFrameBits);
targetMiscState.TileFrameX = original.miscState.TileFrameX;
targetMiscState.TileFrameY = original.miscState.TileFrameY;
+2 -2
View File
@@ -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)
-16
View File
@@ -293,22 +293,6 @@ namespace CalamityMod.World
PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedMurasama, new Action<Chest, int, bool>(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;
}
}