Added setting to disable spree sounds (entirely, or for others)

This commit is contained in:
Timo Smit 2019-02-02 18:12:35 +01:00
parent 2bd45363e5
commit 217456cbb6
3 changed files with 18 additions and 4 deletions

View file

@ -62,4 +62,5 @@ bots = 1
[sprees]
file = "sprees.toml"
messages = 7
sounds = 3
records = 1

View file

@ -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"
@ -257,8 +260,12 @@ function sprees.onPlayerSpree(clientId, type, sourceId)
currentSpree,
spreeNames[type])
if spreeMessage["sound"] and spreeMessage["sound"] ~= "" then
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.."\";")
@ -270,8 +277,12 @@ function sprees.onPlayerSpree(clientId, type, sourceId)
currentSpree,
spreeNames[type])
if maxSpreeMessage["sound"] and maxSpreeMessage["sound"] ~= "" then
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.."\";")

View file

@ -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,
@ -111,6 +112,7 @@ local cfgStructure = {
["sprees"] = {
["file"] = "g_fileSprees",
["messages"] = "g_spreeMessages",
["sounds"] = "g_spreeSounds",
["records"] = "g_spreeRecords"
}
}