From a4ee4a60ef522e51c5b472f041e9704d9af5b94f Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 2 May 2024 01:42:41 +0200 Subject: [PATCH] allow teleporting to other stars, though this kinda breaks the game but seeing the night sky from so far away is truly magical --- src/actor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 9917d6b..543b293 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -562,7 +562,7 @@ fn handle_cheats( key_input: Res>, mut q_player: Query<(&Transform, &mut Position, &mut LinearVelocity), With>, mut q_life: Query<(&mut actor::LifeForm, &mut actor::ExperiencesGForce), With>, - q_target: Query<(&Transform, &Position, &LinearVelocity), (With, Without)>, + q_target: Query<(&Transform, &Position, Option<&LinearVelocity>), (With, Without)>, mut ew_playerdies: EventWriter, mut settings: ResMut, id2pos: Res, @@ -604,7 +604,9 @@ fn handle_cheats( if let Ok((transform, target_pos, target_v)) = q_target.get_single() { let offset: DVec3 = 4.0 * (**pos - **target_pos).normalize() * transform.scale.as_dvec3(); pos.0 = **target_pos + offset; - *v = target_v.clone(); + if let Some(target_v) = target_v { + *v = target_v.clone(); + } } }