keep avatar on death/respawn

This commit is contained in:
yuni 2024-05-23 05:34:56 +02:00
parent cc3213788e
commit 28cf269907
2 changed files with 3 additions and 3 deletions

View file

@ -541,6 +541,7 @@ fn spawn_entities(
mut materials_jupiter: ResMut<Assets<load::JupitersRing>>, mut materials_jupiter: ResMut<Assets<load::JupitersRing>>,
mut id2pos: ResMut<game::Id2Pos>, mut id2pos: ResMut<game::Id2Pos>,
mut achievement_tracker: ResMut<var::AchievementTracker>, mut achievement_tracker: ResMut<var::AchievementTracker>,
mut ew_updateavatar: EventWriter<hud::UpdateAvatarEvent>,
settings: Res<var::Settings>, settings: Res<var::Settings>,
) { ) {
for state_wrapper in er_spawn.read() { for state_wrapper in er_spawn.read() {
@ -675,6 +676,7 @@ fn spawn_entities(
actor.insert(actor::Player); actor.insert(actor::Player);
actor.insert(actor::PlayerCamera); actor.insert(actor::PlayerCamera);
actor.insert(hud::AugmentedRealityOverlayBroadcaster); actor.insert(hud::AugmentedRealityOverlayBroadcaster);
ew_updateavatar.send(hud::UpdateAvatarEvent);
} }
if state.is_sun { if state.is_sun {
let (r, g, b) = nature::star_color_index_to_rgb(0.656); let (r, g, b) = nature::star_color_index_to_rgb(0.656);

View file

@ -357,12 +357,10 @@ fn handle_despawn(
} }
} }
fn handle_respawn( pub fn handle_respawn(
ew_spawn: EventWriter<cmd::SpawnEvent>, ew_spawn: EventWriter<cmd::SpawnEvent>,
mut ew_updateavatar: EventWriter<hud::UpdateAvatarEvent>,
mut achievement_tracker: ResMut<var::AchievementTracker>, mut achievement_tracker: ResMut<var::AchievementTracker>,
) { ) {
*achievement_tracker = var::AchievementTracker::default(); *achievement_tracker = var::AchievementTracker::default();
cmd::load_defs(ew_spawn); cmd::load_defs(ew_spawn);
ew_updateavatar.send(hud::UpdateAvatarEvent);
} }