Update viewshed in distinct stage to ensure that data is synced.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3994fef9d0
commit
a1cfc448db
|
@ -385,10 +385,7 @@ impl<D: 'static + Clone + Default + Send + Sync> Plugin for MapPlugin<D> {
|
||||||
}
|
}
|
||||||
let config = app.world.get_resource::<MapConfig>().unwrap().clone();
|
let config = app.world.get_resource::<MapConfig>().unwrap().clone();
|
||||||
app.register_type::<Portal>()
|
app.register_type::<Portal>()
|
||||||
.add_system_to_stage(
|
.add_system_to_stage(CoreStage::PreUpdate, spawn_colliders::<D>)
|
||||||
CoreStage::PreUpdate,
|
|
||||||
spawn_colliders::<D>.before(crate::visibility::UPDATE_VIEWSHED_LABEL),
|
|
||||||
)
|
|
||||||
.add_system_to_stage(CoreStage::PreUpdate, spawn_portals::<D>)
|
.add_system_to_stage(CoreStage::PreUpdate, spawn_portals::<D>)
|
||||||
.add_system_to_stage(CoreStage::PreUpdate, spawn_portal_colliders::<D>);
|
.add_system_to_stage(CoreStage::PreUpdate, spawn_portal_colliders::<D>);
|
||||||
if config.speak_area_descriptions {
|
if config.speak_area_descriptions {
|
||||||
|
|
|
@ -433,10 +433,16 @@ pub const UPDATE_VIEWSHED_LABEL: &str = "UPDATE_VIEWSHED";
|
||||||
|
|
||||||
impl<D: 'static + Clone + Default + Send + Sync> Plugin for VisibilityPlugin<D> {
|
impl<D: 'static + Clone + Default + Send + Sync> Plugin for VisibilityPlugin<D> {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
|
const UPDATE_VIEWSHED_STAGE: &str = "UPDATE_VIEWSHED_STAGE";
|
||||||
app.add_event::<VisibilityChanged>()
|
app.add_event::<VisibilityChanged>()
|
||||||
|
.add_stage_after(
|
||||||
|
CoreStage::PreUpdate,
|
||||||
|
UPDATE_VIEWSHED_STAGE,
|
||||||
|
SystemStage::parallel(),
|
||||||
|
)
|
||||||
.add_system_to_stage(CoreStage::PreUpdate, add_visibility_indices::<D>)
|
.add_system_to_stage(CoreStage::PreUpdate, add_visibility_indices::<D>)
|
||||||
.add_system_set_to_stage(
|
.add_system_set_to_stage(
|
||||||
CoreStage::PreUpdate,
|
UPDATE_VIEWSHED_STAGE,
|
||||||
SystemSet::new()
|
SystemSet::new()
|
||||||
.with_run_criteria(FixedTimestep::step(0.05))
|
.with_run_criteria(FixedTimestep::step(0.05))
|
||||||
.with_system(update_viewshed::<D>)
|
.with_system(update_viewshed::<D>)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user