From 5adedf911dc0d934e3eba6b0e025af42d079f8d0 Mon Sep 17 00:00:00 2001 From: Natalie Date: Wed, 24 Jun 2026 04:00:51 -0400 Subject: [PATCH] =?UTF-8?q?test(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=90=9B=20load=20units=20catalog=20before=20add=5Fplayer?= =?UTF-8?q?=5Fmilitarist=20(p2=5F58b)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same p2-71c guard as turn_processor: both _make_state and the barren-tile test called add_player_militarist without set_units_runtime_catalog_json, so no player spawned. Harvest the runtime catalog first. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../tests/integration/test_p2_58b_ambient_encounter.gd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/engine/tests/integration/test_p2_58b_ambient_encounter.gd b/src/game/engine/tests/integration/test_p2_58b_ambient_encounter.gd index 68672945..5f31b565 100644 --- a/src/game/engine/tests/integration/test_p2_58b_ambient_encounter.gd +++ b/src/game/engine/tests/integration/test_p2_58b_ambient_encounter.gd @@ -78,6 +78,11 @@ func _make_state(grid: RefCounted) -> RefCounted: assert_not_null(state, "GdGameState must be registered") ## Attach the pre-seeded fauna grid. state.call("set_grid_from_gridstate", grid) + ## p2-71c — add_player_militarist refuses to spawn without the runtime units + ## catalog (MapUnit base_moves=0 otherwise). Load it before spawning. + var units_json: String = AiTurnBridge._harvest_runtime_units_json() + if not units_json.is_empty(): + state.call("set_units_runtime_catalog_json", units_json) ## Add one militarist player. Unit spawns near FAUNA_COL/ROW via ## add_player_militarist which places units close to the city. ## We use the fauna tile coordinates directly as the city so the unit @@ -130,6 +135,9 @@ func test_ambient_encounter_count_zero_on_barren_tile() -> void: if not is_instance_valid(state): return state.call("set_grid_from_gridstate", grid) + var units_json: String = AiTurnBridge._harvest_runtime_units_json() + if not units_json.is_empty(): + state.call("set_units_runtime_catalog_json", units_json) state.call("add_player_militarist", FAUNA_COL, FAUNA_ROW) state.set("seed", 42)