From e4b213cac549cba6837552c9936782e0d4425795 Mon Sep 17 00:00:00 2001 From: Mckol Date: Mon, 9 May 2022 11:55:18 +0200 Subject: [PATCH] Added a keybind for muting the music [F8] --- voxygen/src/game_input.rs | 2 ++ voxygen/src/hud/mod.rs | 13 ++++++++++++- voxygen/src/settings/control.rs | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/voxygen/src/game_input.rs b/voxygen/src/game_input.rs index 537e954f26..c48a08c1aa 100644 --- a/voxygen/src/game_input.rs +++ b/voxygen/src/game_input.rs @@ -152,6 +152,8 @@ pub enum GameInput { SpectateSpeedBoost, #[strum(serialize = "gameinput-spectateviewpoint")] SpectateViewpoint, + #[strum(serialize = "gameinput-mute-music")] + MuteMusic, } impl GameInput { diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 5d950626d1..d03d2f969b 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -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) { diff --git a/voxygen/src/settings/control.rs b/voxygen/src/settings/control.rs index 6ed306bc90..2e844c3cf6 100644 --- a/voxygen/src/settings/control.rs +++ b/voxygen/src/settings/control.rs @@ -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), } } }