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) <noreply@anthropic.com>
This commit is contained in:
Acentech Dev
2026-07-21 01:53:58 +03:00
parent 583df657fb
commit a174c1a29f

View File

@@ -233,11 +233,19 @@ public class HeykelSavasiContext : MiniGameContext
/// </remarks>
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];
}
/// <summary>