feat(simulation): thread world seed from StartupMessage into economy (#826)

Replaces the hardcoded seed=0 with the seed received in StartupMessage,
threading it through SimulationPlugin -> EconomyPlugin / SimRng. Integration
test fixtures updated for the new SimulationPlugin { seed } signature.
This commit is contained in:
2026-04-14 17:21:53 +02:00
parent 521c682175
commit 920ea0582f
16 changed files with 39 additions and 28 deletions
+8 -3
View File
@@ -50,7 +50,12 @@ pub mod zone;
/// Each sub-plugin owns its domain's systems, resources, and phase assignment.
/// No system registration happens here — only sub-plugin composition and
/// shared resources needed by multiple sub-plugins.
pub struct SimulationPlugin;
///
/// `seed` is threaded through to [`economy_plugin::EconomyPlugin`] so the
/// economy simulation uses the world seed from `StartupMessage` (#826).
pub struct SimulationPlugin {
pub seed: u64,
}
impl Plugin for SimulationPlugin {
fn build(&self, app: &mut App) {
@@ -59,7 +64,7 @@ impl Plugin for SimulationPlugin {
// Shared resources needed by multiple sub-plugins.
// Each sub-plugin inits its own domain-specific resources.
app.insert_resource(rng::SimRng::new(0))
app.insert_resource(rng::SimRng::new(self.seed))
.init_resource::<save_io::SaveLoadPending>()
.init_resource::<crate::knowledge::EntityRegistry>()
// Triangle escalation event queue (#250) — consumed by storyteller + npc plugins
@@ -81,7 +86,7 @@ impl Plugin for SimulationPlugin {
app.add_plugins(input_plugin::InputPlugin);
app.add_plugins(movement_plugin::MovementPlugin);
app.add_plugins(social_plugin::SocialPlugin);
app.add_plugins(economy_plugin::EconomyPlugin);
app.add_plugins(economy_plugin::EconomyPlugin { seed: self.seed });
// Background worker tick integration (#843 Part C)
app.add_systems(