From 5c29681ee33fe737a6abc9f4f9c0643ff581c485 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 19 Apr 2024 22:29:57 +0200 Subject: [PATCH] position cheats now teleport you relative to identified objects --- src/world.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/world.rs b/src/world.rs index 991cd9d..a12a665 100644 --- a/src/world.rs +++ b/src/world.rs @@ -376,6 +376,7 @@ fn handle_cheats( q_target: Query<(&Transform, &Position, &LinearVelocity), (With, Without)>, mut ew_playerdies: EventWriter, mut settings: ResMut, + id2pos: Res, mut ew_sfx: EventWriter, ) { if q_player.is_empty() || q_life.is_empty() { @@ -423,16 +424,22 @@ fn handle_cheats( } if key_input.just_pressed(settings.key_cheat_pizza) { - pos.0 = DVec3::new(-121100218.0, 593057.0, -190818113.0); - gforce.ignore_gforce_seconds = 1.0; + if let Some(target) = id2pos.0.get(&"pizzeria".to_string()) { + pos.0 = *target + DVec3::new(-60.0, 0.0, 0.0); + gforce.ignore_gforce_seconds = 1.0; + } } if key_input.just_pressed(settings.key_cheat_farview1) { - pos.0 = DVec3::new(27643e3, -47e3, -124434e3); - gforce.ignore_gforce_seconds = 1.0; + if let Some(target) = id2pos.0.get(&"busstop2".to_string()) { + pos.0 = *target + DVec3::new(0.0, -1000.0, 0.0); + gforce.ignore_gforce_seconds = 1.0; + } } if key_input.just_pressed(settings.key_cheat_farview2) { - pos.0 = DVec3::new(-184968e3, 149410e3, -134273e3); - gforce.ignore_gforce_seconds = 1.0; + if let Some(target) = id2pos.0.get(&"busstop3".to_string()) { + pos.0 = *target + DVec3::new(0.0, -1000.0, 0.0); + gforce.ignore_gforce_seconds = 1.0; + } } if key_input.pressed(settings.key_cheat_adrenaline_zero) { lifeform.adrenaline = 0.0;