From a174c1a29f42a822da86e6f50a31efb701a0e8d5 Mon Sep 17 00:00:00 2001 From: Acentech Dev Date: Tue, 21 Jul 2026 01:53:58 +0300 Subject: [PATCH] fix(hs): robust team-base gate selection by Y-position (not exact coords) GetTeamSpawnGate matched gates by exact X1/Y1 anchors, which threw 'Sequence contains no matching element' when the DB gate coords drifted a tile from the code anchors. Now selects the two spawn gates by Y-order (red=top, blue=bottom) so it works regardless of exact coordinates. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/GameLogic/MiniGames/HeykelSavasiContext.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/GameLogic/MiniGames/HeykelSavasiContext.cs b/src/GameLogic/MiniGames/HeykelSavasiContext.cs index f432802..88c1b4a 100644 --- a/src/GameLogic/MiniGames/HeykelSavasiContext.cs +++ b/src/GameLogic/MiniGames/HeykelSavasiContext.cs @@ -233,11 +233,19 @@ public class HeykelSavasiContext : MiniGameContext /// public ExitGate GetTeamSpawnGate(HeykelSavasiTeam team) { - var (anchorX1, anchorY1) = team == HeykelSavasiTeam.Blue - ? (BlueBaseAnchorX1, BlueBaseAnchorY1) - : (RedBaseAnchorX1, RedBaseAnchorY1); + // Robust selection: the map has exactly two spawn gates (one per base). The red base sits at + // the top of the arena (smaller Y), the blue base at the bottom (larger Y). Selecting by Y-order + // avoids brittle exact-coordinate matching (gate coords can drift by a tile between data paths). + var spawnGates = this.Definition.Entrance!.Map!.ExitGates + .Where(g => g.IsSpawnGate) + .OrderBy(g => g.Y1) + .ToList(); + if (spawnGates.Count == 0) + { + return this.Definition.Entrance!; + } - return this.Definition.Entrance!.Map!.ExitGates.First(g => g.X1 == anchorX1 && g.Y1 == anchorY1); + return team == HeykelSavasiTeam.Blue ? spawnGates[^1] : spawnGates[0]; } ///