feat(@projects/@magic-civilization): ✨ update building script view conversion docs
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
22e1f00e5f
commit
259695fdbf
1 changed files with 12 additions and 0 deletions
|
|
@ -170,6 +170,18 @@ This is the proof that `GdPlayerApi` mutations propagate to renderers.
|
|||
- ☐ `GameState` autoload holds `_gd_state: GdGameState`.
|
||||
- ☐ `state_changed` signal emitted after every mutation.
|
||||
- ☐ `PlayerScript`, `GameMap`, `BuildingScript`, `UnitScript`, `CityScript` are thin views over `_gd_state` (option c) OR removed entirely (option b).
|
||||
- ✓ `BuildingScript` view conversion (Wave 2 Step 2, 2026-05-12, commit 08cc82b70). `building.gd` holds only `_state_ref` + `_idx`; reads via `_get` proxy onto `_gd_state.npc_building_dict(idx)`; mutators `set_visited` / `convert_type` route through Rust accessors and emit `state_changed`. Spawn paths in `village_lair_placer._create_npc_building` + the two proof scenes route through `GameState.spawn_npc_building` → `_gd_state.spawn_npc_building`. Lair→ruin mutations in `fauna._abandon_lair` + `ecological_event_handlers_b` route through `convert_type`. Deserialize path drops `BuildingScript.from_dict`, spawns directly into the Rust mirror, then `_rebuild_npc_buildings_view()` repopulates the view list. GUT baseline preserved (522 passing / 36 failing both before and after — all 36 failures pre-existing and unrelated). Apricot smoke (seed=1, 30 turns) ran to natural domination victory on turn 22 with 6 NPC buildings spawned via the new routing and no Building-related errors.
|
||||
- ☐ `PlayerScript` view conversion.
|
||||
- ☐ `GameMap` view conversion.
|
||||
- ☐ `UnitScript` view conversion.
|
||||
- ⚠ `CityScript` view conversion — **BLOCKED (2026-05-12)**, hard-stop. Sub-task aborted before code changes. The brief assumed `mc_turn::PlayerState.cities: Vec<mc_city::City>` and that a `city_dict(pi, ci)` accessor could be added matching `CityScript.to_dict()`. Audit shows this is false:
|
||||
- `mc_turn::PlayerState.cities` is `Vec<mc_city::CityState>` (`src/simulator/crates/mc-city/src/lib.rs:110-150`) — the **minimal bench struct**: `population`, `food_stored`, `production_stored`, `queue: Option<Queueable>`, `queue_cost`, `queue_tier`, `food_yield`, `prod_yield`, `worker_expertise`. That is the entire field set.
|
||||
- The **full gameplay city** `mc_city::City` lives in `src/simulator/crates/mc-city/src/city.rs:234` and is **explicitly decoupled** — comment at `lib.rs:105-108`: *"The full gameplay `City` struct (with tile ownership, culture, focus, per-building queues) lives in `city.rs` and is used by the Godot game via the `GdCity` GDExtension bridge. The two are deliberately separate so the bench harness stays decoupled from per-building queue simulation."*
|
||||
- Each GDScript `CityScript` currently instantiates its **own** `GdCity` via `ClassDB.instantiate("GdCity")` (`src/game/engine/src/entities/city.gd:96-105`). There is no shared `players[pi].cities[ci]` slot of type `City` to view onto.
|
||||
- The brief's hard-stop rule fires: *"A CityScript consumer reads a field not exposed by `city_dict()` → add it to the accessor OR document the gap. If genuinely missing from Rust `City` (new architectural axis), STOP."* Every CityScript public field (`city_name`, `position`, `buildings`, `placed_buildings`, `production_queue`, `production_progress`, `original_capital_owner`, `is_capital`, `turn_founded`, `culture_stored`, `focus`, `owned_tiles`, `worked_tiles`, `hp`/`max_hp`, etc.) lives on `mc_city::City`, **not** on `CityState`. A faked `city_dict` that reads from GDScript-side state would defeat the view-conversion premise (same trap that fired in the Wave-1 PlayerScript audit).
|
||||
- Same wall as `PlayerScript` (already documented blocked above). The BuildingScript precedent does **not** transfer: `npc_buildings: Vec<BuildingEntity>` was already a complete mirror on `GdGameState`; no equivalent exists for cities.
|
||||
- **Unblock prerequisite:** a new objective analogous to `p2-72a-save-format-migration` — *"Promote `PlayerState.cities` from `CityState` → `City`"* (or its inverse: widen `CityState` to absorb the missing fields). Either direction is a multi-day port touching `mc-turn`, `mc-economy`, `mc-score`, `mc-ai`, and every existing `PlayerState.cities` consumer. Decision required from user; not spawned unilaterally.
|
||||
- Evidence: `src/simulator/crates/mc-city/src/lib.rs:110-150` (CityState fields), `src/simulator/crates/mc-city/src/city.rs:234` (City fields), `src/simulator/api-gdext/src/lib.rs:3515,3640-3644,3721-3737,3836-3858` (PlayerState construction + only accessor is `city_count` + only mutator is `set_player_cities_from_array` from a `Vector2i` array — confirms CityState-only shape), `src/game/engine/src/entities/city.gd:96-105` (per-CityScript independent GdCity instantiation).
|
||||
- ☐ Every `GameState.players[*]` / `GameState.layers[*]` raw access in `src/game/engine/` is replaced with a typed `#[func]` accessor call.
|
||||
- ☐ `GdGameState` exposes accessors for every field the renderers consume.
|
||||
- ☐ `world_map.tscn`, `gameplay_arc_proof.tscn`, city screen, combat preview, HUD, tech tree, culture panel, diplomacy panel all still render correctly (visual regression check via existing proof scenes).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue