fix velocity after using teleport cheats

This commit is contained in:
yuni 2024-06-11 02:59:10 +02:00
parent 4dd195e17a
commit 79351dc4d0

View file

@ -18,6 +18,10 @@ use bevy::window::{PrimaryWindow, Window, WindowMode};
use bevy_xpbd_3d::prelude::*;
use std::collections::HashMap;
pub const CHEAT_WARP_1: &str = "pizzeria";
pub const CHEAT_WARP_2: &str = "busstopclippy2";
pub const CHEAT_WARP_3: &str = "busstopclippy3";
pub struct GamePlugin;
impl Plugin for GamePlugin {
fn build(&self, app: &mut App) {
@ -268,6 +272,7 @@ fn handle_cheats(
mut ew_playerdies: EventWriter<PlayerDiesEvent>,
mut settings: ResMut<Settings>,
id2pos: Res<Id2Pos>,
id2v: Res<Id2V>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
) {
if q_player.is_empty() || q_life.is_empty() {
@ -326,22 +331,31 @@ fn handle_cheats(
}
if key_input.just_pressed(settings.key_cheat_pizza) {
if let Some(target) = id2pos.0.get(&"pizzeria".to_string()) {
if let Some(target) = id2pos.0.get(&CHEAT_WARP_1.to_string()) {
pos.0 = *target + DVec3::new(-60.0, 0.0, 0.0);
gforce.ignore_gforce_seconds = 1.0;
}
if let Some(target) = id2v.0.get(&CHEAT_WARP_1.to_string()) {
v.0 = *target;
}
}
if key_input.just_pressed(settings.key_cheat_farview1) {
if let Some(target) = id2pos.0.get(&"busstopclippy2".to_string()) {
if let Some(target) = id2pos.0.get(&CHEAT_WARP_2.to_string()) {
pos.0 = *target + DVec3::new(0.0, -1000.0, 0.0);
gforce.ignore_gforce_seconds = 1.0;
}
if let Some(target) = id2v.0.get(&CHEAT_WARP_2.to_string()) {
v.0 = *target;
}
}
if key_input.just_pressed(settings.key_cheat_farview2) {
if let Some(target) = id2pos.0.get(&"busstopclippy3".to_string()) {
if let Some(target) = id2pos.0.get(&CHEAT_WARP_3.to_string()) {
pos.0 = *target + DVec3::new(0.0, -1000.0, 0.0);
gforce.ignore_gforce_seconds = 1.0;
}
if let Some(target) = id2v.0.get(&CHEAT_WARP_3.to_string()) {
v.0 = *target;
}
}
if key_input.pressed(settings.key_cheat_adrenaline_zero) {
lifeform.adrenaline = 0.0;