magicciv/.project/objectives/p2-58a-tilestate-fauna-fields.md
Natalie 2fe49402de fix(@projects/@magic-civilization): 🐛 update objective tracking stats and legend
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-13 15:30:51 -07:00

1.9 KiB

id title priority status scope owner updated_at blocked_by evidence
p2-58a TileState fauna fields — fauna_density + fauna_index for AmbientTileCtx p2 done game1 shipwright 2026-05-07
src/simulator/crates/mc-core/src/grid/mod.rs — fauna_density + fauna_index added to TileState (p2-58a section, lines ~277-290)
cargo test -p mc-core tilestate_fauna: 3/3 pass (tilestate_fauna_fields_default, tilestate_fauna_roundtrip, tilestate_fauna_density_serde_default_on_missing_field)
cargo check --workspace: clean (pre-existing solo_dominion errors only)

Summary

Adds fauna_density: f32 and fauna_index: Vec<SpeciesId> to TileState in mc-core so AmbientTileCtx (mc-ecology) can be populated from the live GameState in the per-tile-moved encounter hook (p2-58b).

SpeciesId is the existing string newtype from mc-core::ids (snake_case fauna species identifier, e.g. "grey_wolf"). No new type was created.

Acceptance

  • TileState.fauna_density: f32 field added with #[serde(default)]
  • TileState.fauna_index: Vec<SpeciesId> field added with #[serde(default)]
  • cargo test -p mc-core tilestate_fauna passes — 3/3 tests green, including backward-compat deserialization (old save files without these fields default cleanly)
  • cargo check --workspace clean of new errors (pre-existing solo_dominion MapUnit/GameState field errors are pre-existing tech debt, not introduced here)

Population note

fauna_density and fauna_index default to 0/empty. The ecology pipeline (mc-ecology::fauna_select::pick_fauna_for_tile) must be wired to write these fields back onto TileState after worldgen — tracked in p2-58b. Until then, encounter rolls will always see density=0 and skip (correct behaviour for uninitialized maps).

Out of scope

  • Wiring the ecology pipeline to populate these fields (p2-58b)
  • The actual AmbientTileCtx call site in mc-turn::movement (p2-58b)