Added a keybind for muting the music [F8]

This commit is contained in:
Mckol 2022-05-09 11:55:18 +02:00 committed by LunarEclipse
parent 6605c2657f
commit e4b213cac5
3 changed files with 15 additions and 1 deletions

View File

@ -152,6 +152,8 @@ pub enum GameInput {
SpectateSpeedBoost,
#[strum(serialize = "gameinput-spectateviewpoint")]
SpectateViewpoint,
#[strum(serialize = "gameinput-mute-music")]
MuteMusic,
}
impl GameInput {

View File

@ -67,7 +67,9 @@ use crate::{
},
session::{
interactable::Interactable,
settings_change::{Chat as ChatChange, Interface as InterfaceChange, SettingsChange},
settings_change::{
Audio, Chat as ChatChange, Interface as InterfaceChange, SettingsChange,
},
},
settings::chat::ChatFilter,
ui::{
@ -4187,6 +4189,15 @@ impl Hud {
GameInput::MapZoomOut if state => {
handle_map_zoom(0.5, self.world_map.1, &self.show, global_state)
},
GameInput::MuteMusic if state => {
self.events
.push(Event::SettingsChange(SettingsChange::Audio(
Audio::MuteMusicVolume(
!global_state.settings.audio.music_volume.muted,
),
)));
true
},
// Skillbar
input => {
if let Some(slot) = try_hotbar_slot_from_input(input) {

View File

@ -191,6 +191,7 @@ impl ControlSettings {
GameInput::MapSetMarker => KeyMouse::Mouse(MouseButton::Middle),
GameInput::SpectateSpeedBoost => KeyMouse::Key(VirtualKeyCode::LControl),
GameInput::SpectateViewpoint => KeyMouse::Mouse(MouseButton::Middle),
GameInput::MuteMusic => KeyMouse::Key(VirtualKeyCode::F8),
}
}
}