allow teleporting to other stars, though this kinda breaks the game

but seeing the night sky from so far away is truly magical
This commit is contained in:
yuni 2024-05-02 01:42:41 +02:00
parent d2970d0ffb
commit a4ee4a60ef

View file

@ -562,7 +562,7 @@ fn handle_cheats(
key_input: Res<ButtonInput<KeyCode>>, key_input: Res<ButtonInput<KeyCode>>,
mut q_player: Query<(&Transform, &mut Position, &mut LinearVelocity), With<actor::PlayerCamera>>, mut q_player: Query<(&Transform, &mut Position, &mut LinearVelocity), With<actor::PlayerCamera>>,
mut q_life: Query<(&mut actor::LifeForm, &mut actor::ExperiencesGForce), With<actor::Player>>, mut q_life: Query<(&mut actor::LifeForm, &mut actor::ExperiencesGForce), With<actor::Player>>,
q_target: Query<(&Transform, &Position, &LinearVelocity), (With<hud::IsTargeted>, Without<actor::PlayerCamera>)>, q_target: Query<(&Transform, &Position, Option<&LinearVelocity>), (With<hud::IsTargeted>, Without<actor::PlayerCamera>)>,
mut ew_playerdies: EventWriter<actor::PlayerDiesEvent>, mut ew_playerdies: EventWriter<actor::PlayerDiesEvent>,
mut settings: ResMut<var::Settings>, mut settings: ResMut<var::Settings>,
id2pos: Res<actor::Id2Pos>, id2pos: Res<actor::Id2Pos>,
@ -604,9 +604,11 @@ fn handle_cheats(
if let Ok((transform, target_pos, target_v)) = q_target.get_single() { 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(); let offset: DVec3 = 4.0 * (**pos - **target_pos).normalize() * transform.scale.as_dvec3();
pos.0 = **target_pos + offset; pos.0 = **target_pos + offset;
if let Some(target_v) = target_v {
*v = target_v.clone(); *v = target_v.clone();
} }
} }
}
if !settings.dev_mode { if !settings.dev_mode {
return; return;