Fish Key: quiet all but sound effects while fishing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-12 15:42:26 +00:00
parent 25e3aa4fec
commit 38e942ac1d
3 changed files with 59 additions and 6 deletions

View file

@ -68,7 +68,13 @@ local function advance(sec)
clock = target
end
local cvars = { SoftTargetInteract = "0", SoftTargetInteractRange = "10", ActionButtonUseKeyHeldSpell = "1" }
local cvars = {
SoftTargetInteract = "0", SoftTargetInteractRange = "10", ActionButtonUseKeyHeldSpell = "1",
Sound_EnableMusic = "1", Sound_EnableAmbience = "1", Sound_EnableDialog = "0",
Sound_EnablePetSounds = "1", Sound_EnableErrorSpeech = "1", Sound_EnableSFX = "1",
Sound_SFXVolume = "0.6", Sound_EnableSoundWhenGameIsInBG = "0",
Sound_EnablePositionalLowPassFilter = "1",
}
local temp = {}
C_CVar = {
GetCVar = function(n) return temp[n] or cvars[n] end,
@ -116,8 +122,15 @@ check(C_CVar.GetCVar("SoftTargetInteract") == "3", "Interact Key turned on while
local function restored()
return count(overrides) == 0 and C_CVar.GetCVar("SoftTargetInteract") == "0"
and C_CVar.GetCVar("SoftTargetInteractRange") == "10" and C_CVar.GetCVar("ActionButtonUseKeyHeldSpell") == "1"
and C_CVar.GetCVar("Sound_EnableMusic") == "1" and C_CVar.GetCVar("Sound_SFXVolume") == "0.6"
end
check(C_CVar.GetCVar("ActionButtonUseKeyHeldSpell") == "0", "press and hold casting off while fishing")
check(C_CVar.GetCVar("Sound_EnableMusic") == "0" and C_CVar.GetCVar("Sound_EnableAmbience") == "0"
and C_CVar.GetCVar("Sound_EnablePetSounds") == "0" and C_CVar.GetCVar("Sound_EnableErrorSpeech") == "0",
"music, ambience, pets and error speech off while fishing")
check(C_CVar.GetCVar("Sound_SFXVolume") == "1" and C_CVar.GetCVar("Sound_EnableSoundWhenGameIsInBG") == "1"
and C_CVar.GetCVar("Sound_EnablePositionalLowPassFilter") == "0", "effects full, background sound on, no muffling")
check(temp.Sound_EnableDialog == nil and temp.Sound_EnableSFX == nil, "settings already right are left alone")
local function press() C_PlayerInteractionManager.InteractUnit("anyinteract") end
@ -222,6 +235,16 @@ handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
check(count(overrides) == 0, "nothing when off")
SlashCmdList.FISHKEY("on")
check(FishKeyDB.enabled == true, "/fish on")
finish()
SlashCmdList.FISHKEY("sound off")
check(FishKeyDB.sound == false and printed[#printed]:find("quiet sound off", 1, true), "/fish sound off")
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
check(overrides["F"] == "INTERACTTARGET" and C_CVar.GetCVar("Sound_EnableMusic") == "1"
and C_CVar.GetCVar("SoftTargetInteract") == "3", "sound off: key still works, sound untouched")
finish()
SlashCmdList.FISHKEY("sound on")
check(FishKeyDB.sound == true, "/fish sound on")
print(failures == 0 and "all passed" or (failures .. " failed"))
os.exit(failures == 0 and 0 or 1)