mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added the possibility to toggle muting of any volume category via a keybind
This commit is contained in:
parent
be9e0497d1
commit
796a5f2f90
@ -152,8 +152,16 @@ pub enum GameInput {
|
||||
SpectateSpeedBoost,
|
||||
#[strum(serialize = "gameinput-spectateviewpoint")]
|
||||
SpectateViewpoint,
|
||||
#[strum(serialize = "gameinput-mute-music")]
|
||||
#[strum(serialize = "gameinput-mutemaster")]
|
||||
MuteMaster,
|
||||
#[strum(serialize = "gameinput-muteinactivemaster")]
|
||||
MuteInactiveMaster,
|
||||
#[strum(serialize = "gameinput-mutemusic")]
|
||||
MuteMusic,
|
||||
#[strum(serialize = "gameinput-mutesfx")]
|
||||
MuteSfx,
|
||||
#[strum(serialize = "gameinput-muteambience")]
|
||||
MuteAmbience,
|
||||
}
|
||||
|
||||
impl GameInput {
|
||||
|
@ -4126,6 +4126,13 @@ impl Hud {
|
||||
|
||||
// Press key while not typing
|
||||
WinEvent::InputUpdate(key, state) if !self.typing() => {
|
||||
let gs_audio = &global_state.settings.audio;
|
||||
let mut toggle_mute = |audio: Audio| {
|
||||
self.events
|
||||
.push(Event::SettingsChange(SettingsChange::Audio(audio)));
|
||||
true
|
||||
};
|
||||
|
||||
let matching_key = match key {
|
||||
GameInput::Command if state => {
|
||||
self.force_chat_input = Some("/".to_owned());
|
||||
@ -4189,14 +4196,22 @@ impl Hud {
|
||||
GameInput::MapZoomOut if state => {
|
||||
handle_map_zoom(0.5, self.world_map.1, &self.show, global_state)
|
||||
},
|
||||
GameInput::MuteMaster if state => {
|
||||
toggle_mute(Audio::MuteMasterVolume(!gs_audio.master_volume.muted))
|
||||
},
|
||||
GameInput::MuteInactiveMaster if state => {
|
||||
toggle_mute(Audio::MuteInactiveMasterVolume(
|
||||
!gs_audio.inactive_master_volume_perc.muted,
|
||||
))
|
||||
},
|
||||
GameInput::MuteMusic if state => {
|
||||
self.events
|
||||
.push(Event::SettingsChange(SettingsChange::Audio(
|
||||
Audio::MuteMusicVolume(
|
||||
!global_state.settings.audio.music_volume.muted,
|
||||
),
|
||||
)));
|
||||
true
|
||||
toggle_mute(Audio::MuteMusicVolume(!gs_audio.music_volume.muted))
|
||||
},
|
||||
GameInput::MuteSfx if state => {
|
||||
toggle_mute(Audio::MuteSfxVolume(!gs_audio.sfx_volume.muted))
|
||||
},
|
||||
GameInput::MuteAmbience if state => {
|
||||
toggle_mute(Audio::MuteAmbienceVolume(!gs_audio.ambience_volume.muted))
|
||||
},
|
||||
// Skillbar
|
||||
input => {
|
||||
|
@ -191,7 +191,11 @@ impl ControlSettings {
|
||||
GameInput::MapSetMarker => Some(KeyMouse::Mouse(MouseButton::Middle)),
|
||||
GameInput::SpectateSpeedBoost => Some(KeyMouse::Key(VirtualKeyCode::LControl)),
|
||||
GameInput::SpectateViewpoint => Some(KeyMouse::Mouse(MouseButton::Middle)),
|
||||
GameInput::MuteMaster => Some(KeyMouse::Key(VirtualKeyCode::Mute)),
|
||||
GameInput::MuteInactiveMaster => None,
|
||||
GameInput::MuteMusic => Some(KeyMouse::Key(VirtualKeyCode::F8)),
|
||||
GameInput::MuteSfx => None,
|
||||
GameInput::MuteAmbience => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user