fix(@projects/@magic-civilization): 🐛 handle missing player slots in auto-play test

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-18 21:35:31 -07:00
parent 6ac6b0b967
commit 9e8c928d04

View file

@ -802,7 +802,9 @@ func _apply_per_player_difficulty_overrides() -> void:
var levels: Dictionary = {}
for entry: Dictionary in diff_data.get("ai_difficulty", []):
levels[str(entry.get("id", ""))] = entry.get("ai_modifiers", {})
for p_idx: int in range(GameState.players.size()):
# Use a fixed upper bound — this runs before loading_screen.gd populates
# GameState.players, so players.size() == 0. Check all possible player slots.
for p_idx: int in range(8):
var key: String = "AI_DIFFICULTY_P%d" % p_idx
var tier: String = EnvConfig.get_var(key, "")
if tier.is_empty():