diff --git a/src/ggrs_stage.rs b/src/ggrs_stage.rs index aa90e06..a311486 100644 --- a/src/ggrs_stage.rs +++ b/src/ggrs_stage.rs @@ -73,6 +73,8 @@ pub(crate) fn run(world: &mut World) { pub(crate) fn run_synctest(world: &mut World, mut sess: SyncTestSession) { maybe_init_snapshots(world, sess.max_prediction()); + world.insert_resource(LocalPlayers((0..sess.num_players()).collect())); + // read local player inputs and register them in the session world.run_schedule(ReadInputs); let local_inputs = world.remove_resource::>().expect( @@ -88,7 +90,6 @@ pub(crate) fn run_synctest(world: &mut World, mut sess: SyncTestSessi Err(e) => warn!("{}", e), } - world.insert_resource(LocalPlayers((0..sess.num_players()).collect())); world.insert_resource(Session::SyncTest(sess)); } @@ -110,6 +111,8 @@ pub(crate) fn run_spectator(world: &mut World, mut sess: SpectatorSes pub(crate) fn run_p2p(world: &mut World, mut sess: P2PSession) { maybe_init_snapshots(world, sess.max_prediction()); + world.insert_resource(LocalPlayers(sess.local_player_handles())); + if sess.current_state() == SessionState::Running { // get local player inputs world.run_schedule(ReadInputs); @@ -130,7 +133,6 @@ pub(crate) fn run_p2p(world: &mut World, mut sess: P2PSession) { }; } - world.insert_resource(LocalPlayers(sess.local_player_handles())); world.insert_resource(Session::P2P(sess)); }