expose speed cheats outside of dev mode

This commit is contained in:
yuni 2024-04-02 17:24:39 +02:00
parent 910d1b4407
commit e00d891150
2 changed files with 21 additions and 11 deletions

View file

@ -29,6 +29,12 @@ Key features:
- f: toggle 3rd person view
- TAB: toggle augmented reality overlay (HUD, low-light amplifier)
Cheats:
- v/b: Impossible acceleration forward/backward
- Shift+v/b: Same as v/b, but a thousand times faster
- c: Impossible instant stopping
# System Requirements
- Screen, keyboard

View file

@ -353,25 +353,15 @@ fn handle_cheats(
mut q_life: Query<(&mut actor::LifeForm, ), With<actor::Player>>,
settings: ResMut<settings::Settings>,
) {
if !settings.dev_mode || q_player.is_empty() || q_life.is_empty() {
if q_player.is_empty() || q_life.is_empty() {
return;
}
let (trans, mut pos, mut v) = q_player.get_single_mut().unwrap();
let (mut lifeform, ) = q_life.get_single_mut().unwrap();
let boost = if key_input.pressed(KeyCode::ShiftLeft) {
1e6
} else {
1e3
};
if key_input.just_pressed(settings.key_cheat_pizza) {
pos.0 = DVec3::new(-303370.0, 0.0, -500000.0);
}
if key_input.just_pressed(settings.key_cheat_farview1) {
pos.0 = DVec3::new(-1000.0e6, 1000.0e6, -500.0e6);
}
if key_input.just_pressed(settings.key_cheat_farview2) {
pos.0 = DVec3::new(1000.0e6, 1000.0e6, -500.0e6);
}
if key_input.just_pressed(settings.key_cheat_stop) {
v.0 = DVec3::ZERO;
}
@ -381,6 +371,20 @@ fn handle_cheats(
if key_input.pressed(settings.key_cheat_speed_backward) {
v.0 += DVec3::from(trans.rotation * Vec3::new(0.0, 0.0, -boost));
}
if !settings.dev_mode {
return;
}
let (mut lifeform, ) = q_life.get_single_mut().unwrap();
if key_input.just_pressed(settings.key_cheat_pizza) {
pos.0 = DVec3::new(-303370.0, 0.0, -500000.0);
}
if key_input.just_pressed(settings.key_cheat_farview1) {
pos.0 = DVec3::new(-1000.0e6, 1000.0e6, -500.0e6);
}
if key_input.just_pressed(settings.key_cheat_farview2) {
pos.0 = DVec3::new(1000.0e6, 1000.0e6, -500.0e6);
}
if key_input.pressed(settings.key_cheat_adrenaline_zero) {
lifeform.adrenaline = 0.0;
}