From 0d312edeee375319477adbaaa7dbecaefcad65a0 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 11 Apr 2024 02:14:36 +0200 Subject: [PATCH] fix bringing space crafts along with a bus ride --- src/chat.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 020f26f..e78269a 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -302,14 +302,15 @@ pub fn handle_conversations( pub fn handle_chat_scripts( mut er_chatscript: EventReader, mut q_actor: Query<(&mut actor::Actor, &mut actor::Suit), Without>, - mut q_player: Query<(&mut actor::Actor, &mut actor::Suit, &mut Position), With>, + mut q_player: Query<(&mut actor::Actor, &mut actor::Suit), With>, + mut q_playercam: Query<&mut Position, With>, mut ew_sfx: EventWriter, mut ew_effect: EventWriter, ) { for script in er_chatscript.read() { match script.name.as_str() { "refilloxygen" => if let Ok(mut amount) = script.param.parse::() { - for (mut _actor, mut suit, _) in q_player.iter_mut() { + for (mut _actor, mut suit) in q_player.iter_mut() { if script.param2.is_empty() { suit.oxygen = (suit.oxygen + amount).clamp(0.0, suit.oxygen_max); } @@ -343,7 +344,7 @@ pub fn handle_chat_scripts( error!("Chat script cryotrip needs a parameter"); } else { - if let Ok((_, mut suit, mut pos)) = q_player.get_single_mut() { + if let Ok(mut pos) = q_playercam.get_single_mut() { if script.param == "oscillation".to_string() { *pos = Position(DVec3::new(147e6, 165e6, 336e6)); } @@ -356,6 +357,8 @@ pub fn handle_chat_scripts( else { error!("Invalid destination for cryotrip chat script: '{}'", script.param); } + } + if let Ok((_, mut suit)) = q_player.get_single_mut() { suit.oxygen = suit.oxygen_max; } ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));