Use run condition for scene downloader

This commit is contained in:
Danny McGee
2023-11-15 22:14:46 -05:00
parent aec433803e
commit c50a6246a9
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -44,7 +44,9 @@ impl Plugin for ScenePlugin {
PostUpdate,
(
wasm::notify_entity_spawn_changes.pipe(error),
wasm::save_scene_system.pipe(error),
wasm::save_scene_system
.pipe(error)
.run_if(wasm::scene_download_requested),
),
);
}
+4 -4
View File
@@ -17,11 +17,11 @@ pub fn save_scene() {
wasm::write_message!(SCENE_REQUEST, ());
}
pub(super) fn save_scene_system(world: &mut World) -> Result<(), String> {
if wasm::read_buffer!(SCENE_REQUEST).is_none() {
return Ok(());
}
pub(super) fn scene_download_requested() -> bool {
wasm::read_buffer!(SCENE_REQUEST).is_some()
}
pub(super) fn save_scene_system(world: &mut World) -> Result<(), String> {
let mut scene = DynamicScene::from_world(world);
let type_registry = world.resource::<AppTypeRegistry>();