add F1 key to show key bindings
This commit is contained in:
parent
a26a8c79f7
commit
45fbd4e2b5
|
@ -27,6 +27,7 @@ Links:
|
||||||
|
|
||||||
# Key Bindings
|
# Key Bindings
|
||||||
|
|
||||||
|
- F1: Show key bindings
|
||||||
- Space: Slow down (or match velocity)
|
- Space: Slow down (or match velocity)
|
||||||
- AWSD/Shift/Ctrl: Accelerate
|
- AWSD/Shift/Ctrl: Accelerate
|
||||||
- R: Rotate (hold & move mouse)
|
- R: Rotate (hold & move mouse)
|
||||||
|
|
|
@ -691,6 +691,11 @@ pub fn handle_chat_events(
|
||||||
hud::LogLevel::Warning => {
|
hud::LogLevel::Warning => {
|
||||||
log.warning(message.into());
|
log.warning(message.into());
|
||||||
}
|
}
|
||||||
|
hud::LogLevel::Always => {
|
||||||
|
log.add(message.into(),
|
||||||
|
chat.talker.name.clone().unwrap_or("".to_string()),
|
||||||
|
hud::LogLevel::Always);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
chat.timer = now + ((message.len() as f32).max(CHAT_SPEED_MIN_LEN) * TALKER_SPEED_FACTOR * chat.talker.talking_speed / settings.chat_speed) as f64;
|
chat.timer = now + ((message.len() as f32).max(CHAT_SPEED_MIN_LEN) * TALKER_SPEED_FACTOR * chat.talker.talking_speed / settings.chat_speed) as f64;
|
||||||
|
|
||||||
|
|
20
src/data/keybindings.in
Normal file
20
src/data/keybindings.in
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
X: Teleport to target [CHEAT]
|
||||||
|
C: Impossibly instant stopping [CHEAT]
|
||||||
|
Shift+V/B: Same as V/B, but a thousand times faster [CHEAT]
|
||||||
|
V/B: Impossible acceleration forward/backward [CHEAT]
|
||||||
|
G: Toggle god mode / cheats [CHEAT]
|
||||||
|
M: Toggle sound effects
|
||||||
|
T: Toggle music
|
||||||
|
Y: Toggle rotation stabilizer
|
||||||
|
F: Toggle 3rd person view
|
||||||
|
F11: Toggle fullscreen
|
||||||
|
Tab: Toggle HUD + Augmented Reality
|
||||||
|
Right click: Zoom [AUGMENTED REALITY ONLY]
|
||||||
|
Left click: Target objects [AUGMENTED REALITY ONLY]
|
||||||
|
JKULIO: Mouseless camera rotation
|
||||||
|
F7: Restart game
|
||||||
|
Q: Exit vehicle
|
||||||
|
E: Interact: Talk to people, enter vehicles
|
||||||
|
R: Rotate (hold & move mouse)
|
||||||
|
AWSD/Shift/Ctrl: Accelerate
|
||||||
|
Space: Slow down (or match velocity)
|
23
src/hud.rs
23
src/hud.rs
|
@ -9,9 +9,9 @@ use std::time::SystemTime;
|
||||||
|
|
||||||
pub const HUD_REFRESH_TIME: f32 = 0.1;
|
pub const HUD_REFRESH_TIME: f32 = 0.1;
|
||||||
pub const FONT: &str = "fonts/Yupiter-Regular.ttf";
|
pub const FONT: &str = "fonts/Yupiter-Regular.ttf";
|
||||||
pub const LOG_MAX: usize = 16;
|
|
||||||
pub const LOG_MAX_TIME_S: f64 = 30.0;
|
pub const LOG_MAX_TIME_S: f64 = 30.0;
|
||||||
pub const LOG_MAX_ROWS: usize = 30;
|
pub const LOG_MAX_ROWS: usize = 30;
|
||||||
|
pub const LOG_MAX: usize = LOG_MAX_ROWS;
|
||||||
pub const MAX_CHOICES: usize = 10;
|
pub const MAX_CHOICES: usize = 10;
|
||||||
pub const AMBIENT_LIGHT: f32 = 0.0; // Space is DARK
|
pub const AMBIENT_LIGHT: f32 = 0.0; // Space is DARK
|
||||||
pub const AMBIENT_LIGHT_AR: f32 = 15.0;
|
pub const AMBIENT_LIGHT_AR: f32 = 15.0;
|
||||||
|
@ -74,6 +74,7 @@ pub struct AugmentedRealityOverlay {
|
||||||
struct FPSUpdateTimer(Timer);
|
struct FPSUpdateTimer(Timer);
|
||||||
|
|
||||||
pub enum LogLevel {
|
pub enum LogLevel {
|
||||||
|
Always,
|
||||||
Warning,
|
Warning,
|
||||||
//Error,
|
//Error,
|
||||||
Info,
|
Info,
|
||||||
|
@ -234,6 +235,9 @@ fn setup(
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add Console
|
// Add Console
|
||||||
|
// This one is intentionally NOT a ToggleableHudElement. Instead, console entries
|
||||||
|
// are filtered based on whether the hud is active or not. LogLevel::Always is
|
||||||
|
// even shown when hud is inactive.
|
||||||
let bundle_chatbox = TextBundle::from_sections((0..LOG_MAX_ROWS).map(|_|
|
let bundle_chatbox = TextBundle::from_sections((0..LOG_MAX_ROWS).map(|_|
|
||||||
TextSection::new("", style_console.clone()))
|
TextSection::new("", style_console.clone()))
|
||||||
).with_style(Style {
|
).with_style(Style {
|
||||||
|
@ -243,7 +247,6 @@ fn setup(
|
||||||
..default()
|
..default()
|
||||||
}).with_text_justify(JustifyText::Right);
|
}).with_text_justify(JustifyText::Right);
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
ToggleableHudElement,
|
|
||||||
NodeBundle {
|
NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
width: Val::Percent(50.0),
|
width: Val::Percent(50.0),
|
||||||
|
@ -253,7 +256,6 @@ fn setup(
|
||||||
right: Val::VMin(3.0),
|
right: Val::VMin(3.0),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
visibility,
|
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
)).with_children(|parent| {
|
)).with_children(|parent| {
|
||||||
|
@ -503,7 +505,16 @@ fn update_hud(
|
||||||
let mut row = 0;
|
let mut row = 0;
|
||||||
|
|
||||||
// Chat Log and System Log
|
// Chat Log and System Log
|
||||||
|
let logfilter = if settings.hud_active {
|
||||||
|
|_msg: &&Message| { true }
|
||||||
|
} else {
|
||||||
|
|msg: &&Message| { match msg.level {
|
||||||
|
LogLevel::Always => true,
|
||||||
|
_ => false
|
||||||
|
}}
|
||||||
|
};
|
||||||
let messages: Vec<&Message> = log.logs.iter()
|
let messages: Vec<&Message> = log.logs.iter()
|
||||||
|
.filter(logfilter)
|
||||||
.rev()
|
.rev()
|
||||||
.take(LOG_MAX_ROWS)
|
.take(LOG_MAX_ROWS)
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -591,6 +602,7 @@ fn handle_input(
|
||||||
keyboard_input: Res<ButtonInput<KeyCode>>,
|
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||||
mouse_input: Res<ButtonInput<MouseButton>>,
|
mouse_input: Res<ButtonInput<MouseButton>>,
|
||||||
mut settings: ResMut<var::Settings>,
|
mut settings: ResMut<var::Settings>,
|
||||||
|
mut log: ResMut<Log>,
|
||||||
mut q_hud: Query<(&mut Visibility, Option<&OnlyHideWhenTogglingHud>), With<ToggleableHudElement>>,
|
mut q_hud: Query<(&mut Visibility, Option<&OnlyHideWhenTogglingHud>), With<ToggleableHudElement>>,
|
||||||
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
||||||
mut ew_togglemusic: EventWriter<audio::ToggleMusicEvent>,
|
mut ew_togglemusic: EventWriter<audio::ToggleMusicEvent>,
|
||||||
|
@ -599,6 +611,11 @@ fn handle_input(
|
||||||
q_objects: Query<(Entity, &Transform), (With<IsClickable>, Without<IsTargeted>, Without<actor::PlayerDrivesThis>, Without<actor::Player>)>,
|
q_objects: Query<(Entity, &Transform), (With<IsClickable>, Without<IsTargeted>, Without<actor::PlayerDrivesThis>, Without<actor::Player>)>,
|
||||||
q_camera: Query<&Transform, With<Camera>>,
|
q_camera: Query<&Transform, With<Camera>>,
|
||||||
) {
|
) {
|
||||||
|
if keyboard_input.just_pressed(settings.key_help) {
|
||||||
|
for line in include_str!("data/keybindings.in").trim().split("\n") {
|
||||||
|
log.add(line.to_string(), "".to_string(), LogLevel::Always);
|
||||||
|
}
|
||||||
|
}
|
||||||
if keyboard_input.just_pressed(settings.key_togglehud) {
|
if keyboard_input.just_pressed(settings.key_togglehud) {
|
||||||
if settings.hud_active {
|
if settings.hud_active {
|
||||||
for (mut hudelement_visibility, _) in q_hud.iter_mut() {
|
for (mut hudelement_visibility, _) in q_hud.iter_mut() {
|
||||||
|
|
|
@ -49,6 +49,7 @@ pub struct Settings {
|
||||||
pub key_exit: KeyCode,
|
pub key_exit: KeyCode,
|
||||||
pub key_restart: KeyCode,
|
pub key_restart: KeyCode,
|
||||||
pub key_fullscreen: KeyCode,
|
pub key_fullscreen: KeyCode,
|
||||||
|
pub key_help: KeyCode,
|
||||||
pub key_forward: KeyCode,
|
pub key_forward: KeyCode,
|
||||||
pub key_back: KeyCode,
|
pub key_back: KeyCode,
|
||||||
pub key_left: KeyCode,
|
pub key_left: KeyCode,
|
||||||
|
@ -130,7 +131,7 @@ impl Default for Settings {
|
||||||
hud_color_console: Color::rgb(0.2, 0.5, 0.2),
|
hud_color_console: Color::rgb(0.2, 0.5, 0.2),
|
||||||
hud_color_console_warn: Color::rgb(1.0, 0.3, 0.3),
|
hud_color_console_warn: Color::rgb(1.0, 0.3, 0.3),
|
||||||
hud_color_console_system: Color::rgb(0.5, 0.5, 0.5),
|
hud_color_console_system: Color::rgb(0.5, 0.5, 0.5),
|
||||||
hud_color_alert: Color::rgb(0.7, 0.3, 0.3),
|
hud_color_alert: Color::rgb(0.8, 0.3, 0.5),
|
||||||
hud_color_subtitles: Color::rgb(0.8, 0.8, 0.8),
|
hud_color_subtitles: Color::rgb(0.8, 0.8, 0.8),
|
||||||
hud_color_choices: Color::rgb(0.45, 0.45, 0.45),
|
hud_color_choices: Color::rgb(0.45, 0.45, 0.45),
|
||||||
chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 },
|
chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 },
|
||||||
|
@ -144,6 +145,7 @@ impl Default for Settings {
|
||||||
key_exit: KeyCode::Escape,
|
key_exit: KeyCode::Escape,
|
||||||
key_restart: KeyCode::F7,
|
key_restart: KeyCode::F7,
|
||||||
key_fullscreen: KeyCode::F11,
|
key_fullscreen: KeyCode::F11,
|
||||||
|
key_help: KeyCode::F1,
|
||||||
key_forward: KeyCode::KeyW,
|
key_forward: KeyCode::KeyW,
|
||||||
key_back: KeyCode::KeyS,
|
key_back: KeyCode::KeyS,
|
||||||
key_left: KeyCode::KeyA,
|
key_left: KeyCode::KeyA,
|
||||||
|
|
Loading…
Reference in a new issue