diff --git a/src/game.rs b/src/game.rs index 79e4fb5..f359948 100644 --- a/src/game.rs +++ b/src/game.rs @@ -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, mut settings: ResMut, id2pos: Res, + id2v: Res, mut ew_sfx: EventWriter, ) { 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;