spectate speedup key

This commit is contained in:
IsseW 2022-07-05 17:23:37 +02:00
parent 0471e78f41
commit bf44ebd12b
4 changed files with 13 additions and 2 deletions

View File

@ -63,4 +63,5 @@ gameinput-swimup = Swim upwards
gameinput-mapzoomin = Increase map zoom
gameinput-mapzoomout = Decrease map zoom
gameinput-greet = Greet
gameinput-map-locationmarkerbutton = Set a waypoint in the Map
gameinput-map-locationmarkerbutton = Set a waypoint in the Map
gameinput-spectatespeedboost = Spectate speed boost

View File

@ -148,6 +148,8 @@ pub enum GameInput {
MapZoomOut,
#[strum(serialize = "gameinput.map.locationmarkerbutton")]
MapSetMarker,
#[strum(serialize = "gameinput.spectatespeedboost")]
SpectateSpeedBoost,
}
impl GameInput {

View File

@ -1046,6 +1046,7 @@ impl PlayState for SessionState {
const FREEFLY_ACCEL: f32 = 120.0;
const FREEFLY_DAMPING: f32 = 80.0;
const FREEFLY_MAX_SPEED: f32 = 50.0;
const FREEFLY_SPEED_BOOST: f32 = 5.0;
let forward = self.scene.camera().forward();
let right = self.scene.camera().right();
@ -1067,10 +1068,16 @@ impl PlayState for SessionState {
}
}
let boost = if self.inputs_state.contains(&GameInput::SpectateSpeedBoost) {
FREEFLY_SPEED_BOOST
} else {
1.0
};
let pos = self.scene.camera().get_focus_pos();
self.scene
.camera_mut()
.set_focus_pos(pos + self.freefly_vel * dt);
.set_focus_pos(pos + self.freefly_vel * dt * boost);
// Do not apply any movement to the player character
self.inputs.move_dir = Vec2::zero();

View File

@ -189,6 +189,7 @@ impl ControlSettings {
GameInput::MapZoomIn => KeyMouse::Key(VirtualKeyCode::Plus),
GameInput::MapZoomOut => KeyMouse::Key(VirtualKeyCode::Minus),
GameInput::MapSetMarker => KeyMouse::Mouse(MouseButton::Middle),
GameInput::SpectateSpeedBoost => KeyMouse::Key(VirtualKeyCode::LControl),
}
}
}