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:
@@ -78,7 +78,7 @@ mod gauntlet_integration {
|
||||
/// Build a minimal Gauntlet app with the given archetype and run one tick.
|
||||
fn boot_gauntlet(archetype: CharacterArchetype) -> App {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
test_world::setup_gauntlet(&mut app, archetype);
|
||||
app.update();
|
||||
app
|
||||
|
||||
@@ -221,7 +221,7 @@ fn t3_pause_mid_corridor_discards_movement_and_resumes() {
|
||||
use settled_reach_server::simulation::SimulationPlugin;
|
||||
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
// 200×200 walkability map covers the full gauntlet coordinate space.
|
||||
app.insert_resource(WalkabilityMap::new(200, 200, 1));
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ use settled_reach_server::simulation::SimulationPlugin;
|
||||
/// Snapshots are written to SnapshotBuffer for direct inspection.
|
||||
fn build_deterministic_app(seed: u64) -> App {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed });
|
||||
app.add_plugins(BridgePlugin);
|
||||
app.add_plugins(KnowledgePlugin);
|
||||
app.add_plugins(NpcPlugin);
|
||||
|
||||
@@ -46,7 +46,7 @@ fn malformed_input_produces_sim_error_and_server_continues() {
|
||||
let bridge = TcpBridge::accept_on(listener).expect("accept connection");
|
||||
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
app.add_plugins(BridgePlugin);
|
||||
app.add_plugins(KnowledgePlugin);
|
||||
app.init_resource::<TrustEventQueue>();
|
||||
@@ -177,7 +177,7 @@ fn state_hash_populated_in_snapshot() {
|
||||
let bridge = TcpBridge::accept_on(listener).expect("accept connection");
|
||||
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
app.add_plugins(BridgePlugin);
|
||||
app.add_plugins(KnowledgePlugin);
|
||||
app.init_resource::<TrustEventQueue>();
|
||||
|
||||
@@ -28,7 +28,7 @@ fn player_moves_north_through_full_pipeline() {
|
||||
|
||||
// Build app
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
app.add_plugins(BridgePlugin);
|
||||
app.add_plugins(KnowledgePlugin);
|
||||
app.init_resource::<TrustEventQueue>();
|
||||
|
||||
@@ -39,7 +39,7 @@ const FIXTURE_DIR: &str = "../tests/fixtures/gauntlet";
|
||||
/// Identical to what the server runs in --test-mode.
|
||||
fn build_gauntlet(seed: u64) -> App {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
app.add_plugins(BridgePlugin);
|
||||
app.add_plugins(KnowledgePlugin);
|
||||
app.add_plugins(NpcPlugin);
|
||||
|
||||
@@ -46,7 +46,7 @@ const NUM_TICKS: usize = 10;
|
||||
/// Mirrors the setup in determinism.rs / main.rs.
|
||||
fn build_app(seed: u64) -> App {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
app.add_plugins(BridgePlugin);
|
||||
app.add_plugins(KnowledgePlugin);
|
||||
app.add_plugins(NpcPlugin);
|
||||
|
||||
@@ -6,7 +6,7 @@ use settled_reach_server::simulation::SimulationPlugin;
|
||||
#[test]
|
||||
fn movement_validated_within_app() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
|
||||
// Insert a walkability map with one blocked tile
|
||||
let mut map = WalkabilityMap::new(10, 10, 1);
|
||||
@@ -56,7 +56,7 @@ fn movement_validated_within_app() {
|
||||
#[test]
|
||||
fn entity_collision_blocks_movement() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
app.insert_resource(WalkabilityMap::new(10, 10, 1));
|
||||
|
||||
// Stationary entity at (5,4)
|
||||
|
||||
@@ -66,7 +66,7 @@ fn perf_tick_timing() {
|
||||
let bridge = TcpBridge::accept_on(listener).expect("accept connection");
|
||||
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
app.add_plugins(BridgePlugin);
|
||||
app.add_plugins(settled_reach_server::knowledge::KnowledgePlugin);
|
||||
app.add_plugins(settled_reach_server::npc::NpcPlugin);
|
||||
|
||||
@@ -7,7 +7,7 @@ use settled_reach_server::simulation::SimulationPlugin;
|
||||
#[test]
|
||||
fn world_boots_and_ticks() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
|
||||
// Verify initial state
|
||||
let time = app.world().resource::<SimulationTime>();
|
||||
|
||||
@@ -112,7 +112,7 @@ fn build_storyteller_app() -> App {
|
||||
bridge::types::CharacterArchetype, simulation::SimulationPlugin, test_world,
|
||||
};
|
||||
let mut app = App::new();
|
||||
app.add_plugins(SimulationPlugin);
|
||||
app.add_plugins(SimulationPlugin { seed: 0 });
|
||||
test_world::setup_gauntlet(&mut app, CharacterArchetype::default());
|
||||
app
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user