From b68469ace92cb8d00735a102e2e1f1df3219e3db Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 4 Nov 2024 15:57:27 -0500 Subject: [PATCH] Remnants compatibility for the old Sunken Sea. It will now be centered properly. --- Systems/WorldgenManagementSystem.cs | 6 ++---- World/SunkenSea.cs | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 822a6dac34..74be220776 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -124,10 +124,8 @@ namespace CalamityMod.Systems { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; - int sunkenSeaX = GenVars.UndergroundDesertLocation.Left; - int sunkenSeaY = Main.maxTilesY - 400; - - SunkenSea.Place(new Point(sunkenSeaX, sunkenSeaY)); + Point ssBottomLeft = new Point(GenVars.UndergroundDesertLocation.Left, Main.maxTilesY - 400); + SunkenSea.Place(ssBottomLeft); })); } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 20e6d1b40c..720c18113f 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -739,6 +739,13 @@ namespace CalamityMod.World // As far as I can tell, this just scales up the entire Sunken Sea to be 4x wider and 2x taller than what is listed above Vector2 arbitrary42GodVector = new Vector2(4f, 2f); + // 04NOV2024: Ozzatron: Remnants mutilates the Underground Desert beyond recognition. + // The above code assumes the size of the underground desert with arbitrary hardcoded values instead of checking it. + // To ensure the Sunken Sea is centered on an Underground Desert of any size, some adjustments are made. + // This would have been easy, but the arbitrary 4-2 God vector makes the math unnecessarily complicated. + int sunkenSeaRealWidth = (int)(sunkenSeaAreaX * arbitrary42GodVector.X); + origin.X = GenVars.UndergroundDesertLocation.Center.X - sunkenSeaRealWidth / 2; + // Place the majority of the terrain as clusters ClusterGroup clusterGroup = new ClusterGroup(); clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY);