position cheats now teleport you relative to identified objects

This commit is contained in:
yuni 2024-04-19 22:29:57 +02:00
parent e3ff386011
commit 5c29681ee3

View file

@ -376,6 +376,7 @@ fn handle_cheats(
q_target: Query<(&Transform, &Position, &LinearVelocity), (With<hud::IsTargeted>, Without<actor::PlayerCamera>)>, 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>,
id2pos: Res<actor::Id2Pos>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
) { ) {
if q_player.is_empty() || q_life.is_empty() { 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) { if key_input.just_pressed(settings.key_cheat_pizza) {
pos.0 = DVec3::new(-121100218.0, 593057.0, -190818113.0); if let Some(target) = id2pos.0.get(&"pizzeria".to_string()) {
gforce.ignore_gforce_seconds = 1.0; 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) { if key_input.just_pressed(settings.key_cheat_farview1) {
pos.0 = DVec3::new(27643e3, -47e3, -124434e3); if let Some(target) = id2pos.0.get(&"busstop2".to_string()) {
gforce.ignore_gforce_seconds = 1.0; 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) { if key_input.just_pressed(settings.key_cheat_farview2) {
pos.0 = DVec3::new(-184968e3, 149410e3, -134273e3); if let Some(target) = id2pos.0.get(&"busstop3".to_string()) {
gforce.ignore_gforce_seconds = 1.0; 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) { if key_input.pressed(settings.key_cheat_adrenaline_zero) {
lifeform.adrenaline = 0.0; lifeform.adrenaline = 0.0;