From a0ddf8fdfeef06390f96923200193b2e9561ebdd Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 19 Feb 2023 18:21:38 -0500 Subject: [PATCH] Fixed Vernal Pass having incorrect schematic protection. --- World/VernalPass.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/World/VernalPass.cs b/World/VernalPass.cs index 79476c5826..93fbc7bbcb 100644 --- a/World/VernalPass.cs +++ b/World/VernalPass.cs @@ -1,13 +1,12 @@ -using CalamityMod.Schematics; -using static CalamityMod.Schematics.SchematicManager; +using System; +using System.Collections.Generic; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; -using Microsoft.Xna.Framework; -using System; -using System.Linq; -using System.Collections.Generic; +using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World { @@ -15,21 +14,22 @@ namespace CalamityMod.World { public static void PlaceVernalPass(StructureMap structures) { - int tries = 0; string mapKey = VernalKey; + var schematic = TileMaps[mapKey]; int placementPositionX = WorldGen.genRand.Next(WorldGen.tLeft, WorldGen.tRight); int placementPositionY = WorldGen.tTop < Main.rockLayer - 10 ? WorldGen.tBottom + 120 : WorldGen.tTop - 120; Point placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); + SchematicAnchor anchorType = SchematicAnchor.Center; bool firstItem = false; - SchematicManager.PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), - SchematicAnchor.Center, ref firstItem, new Action(FillVernalPassChests)); + PlaceSchematic(mapKey, placementPoint, anchorType, ref firstItem, new Action(FillVernalPassChests)); - //add it as a protected structure - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 30); + // Add the Vernal Pass as a protected structure. + Rectangle protectionArea = CalamityUtils.GetSchematicProtectionArea(schematic, placementPoint, anchorType); + structures.AddProtectedStructure(protectionArea, 30); } public static void FillVernalPassChests(Chest chest, int Type, bool firstItem)