diff --git a/src/game/engine/scenes/tests/auto_play.gd b/src/game/engine/scenes/tests/auto_play.gd index 934c50fc..a267d4ee 100644 --- a/src/game/engine/scenes/tests/auto_play.gd +++ b/src/game/engine/scenes/tests/auto_play.gd @@ -148,6 +148,11 @@ func _ready() -> void: EventBus.lair_cleared.connect(_on_lair_cleared_aggregate) EventBus.weather_event_applied.connect(_on_weather_event_applied) EventBus.climate_effect_applied.connect(_on_climate_effect_applied) + # p0-34 Freepeople prologue — write chronicle events into events.jsonl so + # the batch grader can verify the tribe-founding sequence fires on every + # seed (events bullet in .project/objectives/p0-34-...). + EventBus.tribe_converged.connect(_on_tribe_converged) + EventBus.capital_founded.connect(_on_capital_founded) _improvement_manager = ImprovementManagerScript.new() @@ -211,6 +216,34 @@ func _on_city_founded(city: Variant, player_index: int) -> void: }) +func _on_tribe_converged( + player_id: int, centroid: Vector2i, ancestors_merged: int, founding_pop: int +) -> void: + # p0-34: Rust-side chronicle entry serialized into the batch log so the + # grader can assert ≥1 per seed on turn 0 — mirrors the shape emitted by + # mc_turn::chronicle::ChronicleEntry::TribeConverged. + _append_event({ + "type": "tribe_converged", + "player": player_id, + "centroid_q": centroid.x, + "centroid_r": centroid.y, + "ancestors_merged": ancestors_merged, + "founding_pop": founding_pop, + }) + + +func _on_capital_founded(player_id: int, position: Vector2i, pop: int) -> void: + # p0-34: Rust-side chronicle entry serialized into the batch log — mirrors + # mc_turn::chronicle::ChronicleEntry::CapitalFounded. + _append_event({ + "type": "capital_founded", + "player": player_id, + "pos_q": position.x, + "pos_r": position.y, + "pop": pop, + }) + + func _on_city_captured(city: Variant, old_owner: int, new_owner: int) -> void: _total_cities_captured += 1 if _turn_first_city_captured < 0: @@ -2276,8 +2309,23 @@ func _append_turn_stats(outcome: String) -> void: if int(p.index) == _victory_winner: winner_personality = str(p.get("clan_id") if p.get("clan_id") != null else "") break + # p0-34: prefer prologue.display_turn() during the -1 → 0 → 1 cold-open so + # the first lines of turn_stats.jsonl carry the prologue turn sequence + # (−1, 0, 1) rather than the legacy _turn_count which starts at 1. Once + # prologue has resolved, fall back to the normal counter. + var effective_turn: int = _turn_count + if TurnManager.get("prologue") != null: + var drv: RefCounted = TurnManager.prologue + if drv != null and drv.has_method("is_prologue") and bool(drv.call("is_prologue")): + effective_turn = int(drv.call("display_turn")) + elif drv != null and drv.has_method("display_turn"): + # Just-crossed-into-Normal case: keep showing the prologue's last + # labelled turn (1) on the transition frame so nothing regresses. + var dt: int = int(drv.call("display_turn")) + if _turn_count < dt: + effective_turn = dt var line: Dictionary = { - "turn": _turn_count, + "turn": effective_turn, "outcome": outcome, "winner_index": _victory_winner, "winner_personality": winner_personality,