diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-02-25 17:32:15 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-25 17:32:15 -0600 |
| commit | c1588ef66e844c067112ea880a54b4de9ec5a062 (patch) | |
| tree | 76e4f73a5f5392e1bef1f0560ed2f2c56b0d50fb /azalea-world/src/entity | |
| parent | f5a8a59467a0aac3ae2f728961559217f1e1242d (diff) | |
| download | azalea-drasl-c1588ef66e844c067112ea880a54b4de9ec5a062.tar.xz | |
Fix system order ambiguities (#74)
* start fixing stuff where systems run in the wrong order
* fix ordering ambiguity
* add debugging guide
* some fixes
* fix panic for swarms
* fix some warnings
Diffstat (limited to 'azalea-world/src/entity')
| -rw-r--r-- | azalea-world/src/entity/info.rs | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/azalea-world/src/entity/info.rs b/azalea-world/src/entity/info.rs index 48636c5b..8615ef81 100644 --- a/azalea-world/src/entity/info.rs +++ b/azalea-world/src/entity/info.rs @@ -36,52 +36,45 @@ use super::Local; pub struct EntityPlugin; impl Plugin for EntityPlugin { fn build(&self, app: &mut App) { - app.add_system_set( - SystemSet::new() - .after("tick") - .after("packet") - .with_system(update_entity_chunk_positions) - .with_system(remove_despawned_entities_from_indexes) - .with_system(update_bounding_box) - .with_system(add_dead) - .with_system( - add_updates_received - .after("deduplicate_entities") - .after("deduplicate_local_entities") - .label("add_updates_received"), - ) - .with_system( - update_uuid_index - .label("update_uuid_index") - .after("deduplicate_local_entities") - .after("deduplicate_entities"), - ) - .with_system(debug_detect_updates_received_on_local_entities) - .with_system( - update_entity_by_id_index - .label("update_entity_by_id_index") - .after("deduplicate_entities"), - ) - .with_system(debug_new_entity), + // entities get added pre-update + // added to indexes during update (done by this plugin) + // modified during update + // despawned post-update (done by this plugin) + app.add_system_set_to_stage( + CoreStage::PreUpdate, + SystemSet::new().with_system(remove_despawned_entities_from_indexes), ) .add_system_set_to_stage( CoreStage::PostUpdate, SystemSet::new() .with_system(deduplicate_entities.label("deduplicate_entities")) - .with_system( - deduplicate_local_entities - .label("deduplicate_local_entities") - .before("update_uuid_index") - .before("update_entity_by_id_index"), - ), + .with_system(deduplicate_local_entities.label("deduplicate_entities")), + ) + .add_system_set( + SystemSet::new() + .with_system(update_entity_chunk_positions) + .with_system(update_uuid_index.label("update_indexes")) + .with_system(update_entity_by_id_index.label("update_indexes")), + ) + .add_system_set( + SystemSet::new() + .with_system(add_updates_received.label("add_updates_received")) + .with_system(debug_new_entity) + .with_system(debug_detect_updates_received_on_local_entities) + .with_system(add_dead) + .with_system(update_bounding_box), ) .init_resource::<EntityInfos>(); } } -fn debug_new_entity(query: Query<Entity, Added<MinecraftEntityId>>) { - for entity in query.iter() { - debug!("new entity: {:?}", entity); +fn debug_new_entity(query: Query<(Entity, Option<&Local>), Added<MinecraftEntityId>>) { + for (entity, local) in query.iter() { + if local.is_some() { + debug!("new local entity: {:?}", entity); + } else { + debug!("new entity: {:?}", entity); + } } } |
