diff --git a/src/actor.rs b/src/actor.rs index 55be08f..9e756c1 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -2,7 +2,7 @@ use bevy::prelude::*; use bevy_xpbd_3d::prelude::*; use bevy::scene::SceneInstance; use bevy::math::DVec3; -use crate::{actor, audio, chat, commands, effects, nature, settings, world}; +use crate::{actor, audio, chat, commands, effects, hud, nature, settings, world}; pub const ENGINE_SPEED_FACTOR: f32 = 30.0; const MIN_INTERACT_DISTANCE: f32 = 30.0; @@ -386,6 +386,7 @@ fn handle_player_death( mut scene_spawner: ResMut, mut ew_sfx: EventWriter, mut ew_effect: EventWriter, + mut log: ResMut, ) { for _ in er_playerdies.read() { for entity in &q_noscenes { @@ -395,6 +396,7 @@ fn handle_player_death( cmd.entity(entity).despawn(); scene_spawner.despawn_instance(**sceneinstance); } + log.clear(); //cmd.run_system(commands::load_defs); // why is it so complicated to get SystemId? ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp)); ew_effect.send(effects::SpawnEffectEvent { diff --git a/src/hud.rs b/src/hud.rs index 9ce6ef7..66704b3 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -102,6 +102,10 @@ impl Log { } } } + + pub fn clear(&mut self) { + self.logs.clear(); + } } fn setup(