Skip to content

Commit

Permalink
Added setting to disable spree sounds (entirely, or for others)
Browse files Browse the repository at this point in the history
  • Loading branch information
timosmit committed Feb 2, 2019
1 parent 2bd4536 commit 217456c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/wolfadmin.toml
Expand Up @@ -62,4 +62,5 @@ bots = 1
[sprees]
file = "sprees.toml"
messages = 7
sounds = 3
records = 1
19 changes: 15 additions & 4 deletions luascripts/wolfadmin/game/sprees.lua
Expand Up @@ -36,6 +36,9 @@ sprees.RECORD_DEATH = 1
sprees.RECORD_REVIVE = 2
sprees.RECORD_NUM = 3

sprees.SOUND_PLAY_SELF = 0
sprees.SOUND_PLAY_PUBLIC = 1

sprees.RECORD_KILL_NAME = "kill"
sprees.RECORD_DEATH_NAME = "death"
sprees.RECORD_REVIVE_NAME = "revive"
Expand Down Expand Up @@ -257,8 +260,12 @@ function sprees.onPlayerSpree(clientId, type, sourceId)
currentSpree,
spreeNames[type])

if spreeMessage["sound"] and spreeMessage["sound"] ~= "" then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"sound/spree/"..spreeMessage["sound"].."\";")
if settings.get("g_spreeSounds") > 0 and spreeMessage["sound"] and spreeMessage["sound"] ~= "" then
if bits.hasbit(settings.get("g_spreeSounds"), sprees.SOUND_PLAY_PUBLIC) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"sound/spree/"..spreeMessage["sound"].."\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound "..clientId.." \"sound/spree/"..spreeMessage["sound"].."\";")
end
end

et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \""..msg.."\";")
Expand All @@ -270,8 +277,12 @@ function sprees.onPlayerSpree(clientId, type, sourceId)
currentSpree,
spreeNames[type])

if maxSpreeMessage["sound"] and maxSpreeMessage["sound"] ~= "" then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"sound/spree/"..maxSpreeMessage["sound"].."\";")
if settings.get("g_spreeSounds") > 0 and maxSpreeMessage["sound"] and maxSpreeMessage["sound"] ~= "" then
if bits.hasbit(settings.get("g_spreeSounds"), sprees.SOUND_PLAY_PUBLIC) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"sound/spree/"..maxSpreeMessage["sound"].."\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound "..clientId.." \"sound/spree/"..maxSpreeMessage["sound"].."\";")
end
end

et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \""..msg.."\";")
Expand Down
2 changes: 2 additions & 0 deletions luascripts/wolfadmin/util/settings.lua
Expand Up @@ -28,6 +28,7 @@ local data = {
["g_fileSprees"] = "sprees.toml",
["g_playerHistory"] = 1,
["g_spreeMessages"] = 7,
["g_spreeSounds"] = 3,
["g_spreeRecords"] = 1,
["g_botRecords"] = 1,
["g_announceRevives"] = 1,
Expand Down Expand Up @@ -111,6 +112,7 @@ local cfgStructure = {
["sprees"] = {
["file"] = "g_fileSprees",
["messages"] = "g_spreeMessages",
["sounds"] = "g_spreeSounds",
["records"] = "g_spreeRecords"
}
}
Expand Down

0 comments on commit 217456c

Please sign in to comment.