refactor(@projects/@magic-civilization): 🔗 break the mc-turn↔mc-ecology dependency cycle at its root (DIP)

mc-ecology depended on the entire mc-mapgen crate solely to reach `mc_mapgen::seed::*` —
which is itself just a 13-line re-export of `mc_core::seed`. So a low-level ecology crate
pulled in the high-level map generator to use a foundational RNG utility that already lives
in mc-core (the WORLDGEN_RNG PCG64/SeedDomain/derive contract).

Repoint fauna_select.rs + flora_select.rs to `mc_core::seed` directly and drop the mc-mapgen
dependency. This cuts the mc-ecology → mc-mapgen edge, breaking the
mc-turn → mc-ecology → mc-mapgen → mc-turn cycle that forced the ecology tick out of
mc-turn::step into mc-player-api::apply_end_turn.

Proven: `cargo check -p mc-turn` with an mc-ecology dep added now compiles (no cyclic error);
reverted the probe pending the TurnPhase-registry step that will move ecology back into the
unified phase list. mc-ecology 338/0 — determinism intact (seed code is byte-identical, was
already mc-core via the re-export).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-26 18:07:58 -04:00
parent 135a0e81b9
commit 5ee312e452
3 changed files with 6 additions and 7 deletions

View file

@ -10,7 +10,6 @@ gpu = ["dep:mc-compute"]
mc-core = { path = "../mc-core" }
mc-climate = { path = "../mc-climate" }
mc-flora = { path = "../mc-flora" }
mc-mapgen = { path = "../mc-mapgen" }
mc-profiling = { path = "../mc-profiling" }
mc-compute = { path = "../mc-compute", optional = true, features = ["gpu"] }
serde.workspace = true

View file

@ -9,7 +9,7 @@ use std::collections::{HashMap, HashSet};
use serde::Deserialize;
use mc_mapgen::seed::{SeedDomain, tile_rng};
use mc_core::seed::{SeedDomain, tile_rng};
// ── Constants ─────────────────────────────────────────────────────────────────
@ -250,7 +250,7 @@ pub fn pick_fauna_for_tile(
let normalised: Vec<f32> = weights.iter().map(|w| w / total).collect();
let domain_seed = mc_mapgen::seed::derive(map_seed, SeedDomain::FaunaSelect);
let domain_seed = mc_core::seed::derive(map_seed, SeedDomain::FaunaSelect);
let mut rng = tile_rng(domain_seed, col, row);
// Draw candidates
@ -272,7 +272,7 @@ fn weighted_sample_fauna(
eligible: &[&String],
normalised: &[f32],
max_count: usize,
rng: &mut mc_mapgen::seed::Pcg64,
rng: &mut mc_core::seed::Pcg64,
specs: &HashMap<String, FaunaSpec>,
) -> Vec<SelectedFauna> {
let n = eligible.len().min(max_count);

View file

@ -12,7 +12,7 @@ use std::collections::HashMap;
use serde::Deserialize;
use mc_mapgen::seed::{SeedDomain, tile_rng};
use mc_core::seed::{SeedDomain, tile_rng};
// ── Aquatic / riparian species set ────────────────────────────────────────────
@ -448,7 +448,7 @@ pub fn pick_flora_for_tile_stress(
// Normalise by sum (never clip)
let normalised: Vec<f32> = weights.iter().map(|w| w / total).collect();
let domain_seed = mc_mapgen::seed::derive(map_seed, SeedDomain::FloraSelect);
let domain_seed = mc_core::seed::derive(map_seed, SeedDomain::FloraSelect);
let mut rng = tile_rng(domain_seed, col, row);
weighted_sample_without_replacement(
@ -465,7 +465,7 @@ fn weighted_sample_without_replacement(
candidates: &[String],
normalised: &[f32],
max_count: usize,
rng: &mut mc_mapgen::seed::Pcg64,
rng: &mut mc_core::seed::Pcg64,
specs: &HashMap<String, FloraSpec>,
) -> Vec<SelectedFlora> {
let n = candidates.len().min(max_count);