fix menu not updating sometimes when changing avatar from asteroid to none
This commit is contained in:
parent
20ff266cc4
commit
df7cb75666
|
@ -1290,6 +1290,7 @@ fn update_avatar(
|
||||||
asset_server: Res<AssetServer>,
|
asset_server: Res<AssetServer>,
|
||||||
q_avatar: Query<(Entity, &SceneInstance), With<PlayerAvatar>>,
|
q_avatar: Query<(Entity, &SceneInstance), With<PlayerAvatar>>,
|
||||||
q_player: Query<Entity, With<actor::Player>>,
|
q_player: Query<Entity, With<actor::Player>>,
|
||||||
|
mut ew_updatemenu: EventWriter<menu::UpdateMenuEvent>,
|
||||||
mut scene_spawner: ResMut<SceneSpawner>,
|
mut scene_spawner: ResMut<SceneSpawner>,
|
||||||
) {
|
) {
|
||||||
if settings.ar_avatar >= PLAYER_AR_AVATARS.len() {
|
if settings.ar_avatar >= PLAYER_AR_AVATARS.len() {
|
||||||
|
@ -1297,6 +1298,7 @@ fn update_avatar(
|
||||||
}
|
}
|
||||||
prefs.avatar = settings.ar_avatar;
|
prefs.avatar = settings.ar_avatar;
|
||||||
prefs.save();
|
prefs.save();
|
||||||
|
ew_updatemenu.send(menu::UpdateMenuEvent);
|
||||||
|
|
||||||
let ava = if let Some(ava) = PLAYER_AR_AVATARS.get(settings.ar_avatar) {
|
let ava = if let Some(ava) = PLAYER_AR_AVATARS.get(settings.ar_avatar) {
|
||||||
ava
|
ava
|
||||||
|
|
|
@ -630,7 +630,6 @@ pub fn handle_input(
|
||||||
MenuAction::ChangeARAvatar => {
|
MenuAction::ChangeARAvatar => {
|
||||||
settings.ar_avatar += 1;
|
settings.ar_avatar += 1;
|
||||||
ew_updateavatar.send(hud::UpdateAvatarEvent);
|
ew_updateavatar.send(hud::UpdateAvatarEvent);
|
||||||
ew_updatemenu.send(UpdateMenuEvent);
|
|
||||||
}
|
}
|
||||||
MenuAction::ModLightAmp => {
|
MenuAction::ModLightAmp => {
|
||||||
prefs.light_amp += 1;
|
prefs.light_amp += 1;
|
||||||
|
|
Loading…
Reference in a new issue