From 4dd195e17a37487aa95ae3c8eca263d30137993f Mon Sep 17 00:00:00 2001 From: yuni Date: Tue, 11 Jun 2024 02:54:13 +0200 Subject: [PATCH] fix velocity after traveling with busses --- src/chat.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 6dc0506..3bd56d4 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -827,6 +827,7 @@ pub fn handle_chat_scripts( mut ew_effect: EventWriter, mut ew_achievement: EventWriter, id2pos: Res, + id2v: Res, ) { for script in er_chatscript.read() { // Parse the script string @@ -892,15 +893,22 @@ pub fn handle_chat_scripts( _ => None, }; if let Some(station) = busstop { - if let Some(target) = id2pos.0.get(&station.to_string()) { - pos.0 = *target + DVec3::new(0.0, -1000.0, 0.0); - v.0 = DVec3::ZERO; + if let Some(target_pos) = id2pos.0.get(&station.to_string()) { + pos.0 = *target_pos + DVec3::new(0.0, -1000.0, 0.0); } else { error!( "Could not determine position of actor with ID: '{}'", station ); } + if let Some(target_v) = id2v.0.get(&station.to_string()) { + v.0 = *target_v; + } else { + error!( + "Could not determine velocity of actor with ID: '{}'", + station + ); + } } else { error!("Invalid destination for cryotrip chat script: '{}'", param1); }