diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs index afc9a07ad7..1582ce06a5 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/MiscWorldStateSystem.cs @@ -133,6 +133,7 @@ namespace CalamityMod tag["downed"] = downed; tag["abyssChasmBottom"] = Abyss.AbyssChasmBottom; tag["SulphSeaYStart"] = SulphurousSea.YStart; + tag["AstralYStart"] = AstralBiome.YStart; tag["acidRainPoints"] = AcidRainEvent.AccumulatedKillPoints; tag["Reforges"] = Reforges; tag["MoneyStolenByBandit"] = MoneyStolenByBandit; @@ -181,6 +182,7 @@ namespace CalamityMod Abyss.AbyssChasmBottom = tag.GetInt("abyssChasmBottom"); SulphurousSea.YStart = tag.GetInt("SulphSeaYStart"); + AstralBiome.YStart = tag.GetInt("AstralYStart"); AcidRainEvent.AccumulatedKillPoints = tag.GetInt("acidRainPoints"); Reforges = tag.GetInt("Reforges"); MoneyStolenByBandit = tag.GetInt("MoneyStolenByBandit"); diff --git a/Systems/WorldSyncingSystem.cs b/Systems/WorldSyncingSystem.cs index a533be050c..9a13579388 100644 --- a/Systems/WorldSyncingSystem.cs +++ b/Systems/WorldSyncingSystem.cs @@ -148,6 +148,7 @@ namespace CalamityMod.Systems writer.Write(Abyss.AbyssChasmBottom); writer.Write(SulphurousSea.YStart); + writer.Write(AstralBiome.YStart); writer.Write(AcidRainEvent.AccumulatedKillPoints); writer.Write(Reforges); writer.Write(MoneyStolenByBandit); @@ -287,6 +288,7 @@ namespace CalamityMod.Systems Abyss.AbyssChasmBottom = reader.ReadInt32(); SulphurousSea.YStart = reader.ReadInt32(); + AstralBiome.YStart = reader.ReadInt32(); AcidRainEvent.AccumulatedKillPoints = reader.ReadInt32(); Reforges = reader.ReadInt32(); MoneyStolenByBandit = reader.ReadInt32(); diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 5ef2b1d868..7df9788887 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -20,6 +20,8 @@ namespace CalamityMod.World { public class AstralBiome { + public static int YStart { get; set; } = (int)Main.worldSurface; + public static readonly SoundStyle MeteorSound = new("CalamityMod/Sounds/Custom/AstralStarFall"); public static bool CanAstralMeteorSpawn() { @@ -404,6 +406,8 @@ namespace CalamityMod.World if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) SoundEngine.PlaySound(MeteorSound, Main.player[Main.myPlayer].position); + // Immediately prior to mass-converting blocks to Astral, write down the Y position of this event. + YStart = j; DoAstralConversion(new Point(i, j)); // Upward checks go up 180 tiles. If for whatever reason the placement Y position diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index 036c09c16e..d0aa2b8a41 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -1062,8 +1062,11 @@ namespace CalamityMod.World Tile down = CalamityUtils.ParanoidTileRetrieval(chestPoint.X, chestPoint.Y + digDepth); Tile downRight = CalamityUtils.ParanoidTileRetrieval(chestPoint.X + 1, chestPoint.Y + digDepth); - // Stop if far down enough and either the tile to the left or right is open water. - if (((!down.HasTile && down.LiquidAmount >= 127) || (!downRight.HasTile && downRight.LiquidAmount >= 127)) && digDepth >= minDepth) + // Continue digging straight down as long as you're going through standard solid tiles. + // As soon as either tile you find is not a standard solid tile, stop immediately. + bool downSolidAndValid = down.HasTile && down.IsTileSolid(); + bool downRightSolidAndValid = downRight.HasTile && downRight.IsTileSolid(); + if (digDepth >= minDepth && (!downSolidAndValid || !downRightSolidAndValid)) break; digDepth++;