add teleport key (x)
This commit is contained in:
parent
d1aaefb490
commit
27ada34377
|
@ -49,6 +49,7 @@ Links:
|
||||||
- V/B: Impossible acceleration forward/backward
|
- V/B: Impossible acceleration forward/backward
|
||||||
- Shift+V/B: Same as V/B, but a thousand times faster
|
- Shift+V/B: Same as V/B, but a thousand times faster
|
||||||
- C: Impossibly instant stopping
|
- C: Impossibly instant stopping
|
||||||
|
- X: Teleport to target
|
||||||
|
|
||||||
# System Requirements
|
# System Requirements
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ pub struct Settings {
|
||||||
pub key_cheat_stop: KeyCode,
|
pub key_cheat_stop: KeyCode,
|
||||||
pub key_cheat_speed: KeyCode,
|
pub key_cheat_speed: KeyCode,
|
||||||
pub key_cheat_speed_backward: KeyCode,
|
pub key_cheat_speed_backward: KeyCode,
|
||||||
|
pub key_cheat_teleport: KeyCode,
|
||||||
pub key_cheat_pizza: KeyCode,
|
pub key_cheat_pizza: KeyCode,
|
||||||
pub key_cheat_farview1: KeyCode,
|
pub key_cheat_farview1: KeyCode,
|
||||||
pub key_cheat_farview2: KeyCode,
|
pub key_cheat_farview2: KeyCode,
|
||||||
|
@ -157,6 +158,7 @@ impl Default for Settings {
|
||||||
key_cheat_stop: KeyCode::KeyC,
|
key_cheat_stop: KeyCode::KeyC,
|
||||||
key_cheat_speed: KeyCode::KeyV,
|
key_cheat_speed: KeyCode::KeyV,
|
||||||
key_cheat_speed_backward: KeyCode::KeyB,
|
key_cheat_speed_backward: KeyCode::KeyB,
|
||||||
|
key_cheat_teleport: KeyCode::KeyX,
|
||||||
key_cheat_pizza: KeyCode::F9,
|
key_cheat_pizza: KeyCode::F9,
|
||||||
key_cheat_farview1: KeyCode::F10,
|
key_cheat_farview1: KeyCode::F10,
|
||||||
key_cheat_farview2: KeyCode::F12,
|
key_cheat_farview2: KeyCode::F12,
|
||||||
|
|
|
@ -390,6 +390,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>)>,
|
||||||
mut ew_playerdies: EventWriter<actor::PlayerDiesEvent>,
|
mut ew_playerdies: EventWriter<actor::PlayerDiesEvent>,
|
||||||
mut settings: ResMut<var::Settings>,
|
mut settings: ResMut<var::Settings>,
|
||||||
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
||||||
|
@ -426,6 +427,14 @@ fn handle_cheats(
|
||||||
gforce.ignore_gforce_seconds = 1.0;
|
gforce.ignore_gforce_seconds = 1.0;
|
||||||
v.0 += DVec3::from(trans.rotation * Vec3::new(0.0, 0.0, -boost));
|
v.0 += DVec3::from(trans.rotation * Vec3::new(0.0, 0.0, -boost));
|
||||||
}
|
}
|
||||||
|
if key_input.just_pressed(settings.key_cheat_teleport) {
|
||||||
|
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 !settings.dev_mode {
|
if !settings.dev_mode {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue