Trait bones_framework::lib::reset::WorldExt
source · pub trait WorldExt {
// Required methods
fn handle_world_reset(&mut self, stages: &mut SystemStages);
fn reset_triggered(&self) -> bool;
fn reset_internals(&mut self, stages: &mut SystemStages);
}
Expand description
Extension of World
Required Methods§
sourcefn handle_world_reset(&mut self, stages: &mut SystemStages)
fn handle_world_reset(&mut self, stages: &mut SystemStages)
May be called by SessionRunner
before or after SystemStages::run
to allow triggering reset
of world with the ResetWorld
resource.
stages
is required, so that after reset, will immediatelly run startup tasks, instead of waiting until next step of SystemStages
.
This avoids edge cases where other sessions may read expected resources from this session before its next step.
sourcefn reset_triggered(&self) -> bool
fn reset_triggered(&self) -> bool
Check if reset has been triggered by ResetWorld
resource. If SessionRunner
needs to do anything special
for a world reset (preserve managed resources, etc) - can check this before calling handle_world_reset
to see
if a rese will occur.
sourcefn reset_internals(&mut self, stages: &mut SystemStages)
fn reset_internals(&mut self, stages: &mut SystemStages)
Provides a low-level interface for resetting entities, components, and resources.
stages
is required, so that after reset, will immediatelly run startup tasks, instead of waiting until next step of SystemStages
.
This avoids edge cases where other sessions may read expected resources from this session before its next step.
Waring: Calling this function on World in a Session
using network session runner is likely to introduce non-determinism.
It is strongly recommended to use the ResetWorld
Resource to trigger this in manner compatible with net rollback.