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
+7 -3
View File
@@ -8,13 +8,17 @@ use bevy_ecs::schedule::IntoScheduleConfigs;
use crate::tick_phases::TickPhase;
pub struct EconomyPlugin;
pub struct EconomyPlugin {
/// World seed from `StartupMessage` (#826). Passed to `try_load_economy` so the
/// tâtonnement simulation is seeded deterministically from the client's world seed.
pub seed: u64,
}
impl Plugin for EconomyPlugin {
fn build(&self, app: &mut App) {
// Economy simulation (#821, D-031) — loaded once at startup, no-op when DB absent.
// Uses seed 0 for now; will be threaded through StartupMessage world seed (#826).
if let Some((econ_sim, econ_state)) = super::economy::try_load_economy(0) {
// Seed comes from StartupMessage.world_seed, threaded via SimulationPlugin (#826).
if let Some((econ_sim, econ_state)) = super::economy::try_load_economy(self.seed) {
app.insert_resource(econ_sim).insert_resource(econ_state);
}
// EconQueryBuffer: always registered so EconStateQuery PlayerActions are accepted