Introduce compatibility with Wolvin's Prop Hunt Extended.
PHE uses its own configuration object from which we can derive all sound paths and taunt playback tweaks. The question in this case is whether PHE will change this still at some point. Hopefully not.pull/2/head
parent
1f9986d344
commit
b79e293f33
|
@ -127,8 +127,16 @@ local function PlayTaunt(pl, sound)
|
||||||
|
|
||||||
-- TAUNT_DELAY from Prop Hunt, sh_config.lua:172
|
-- TAUNT_DELAY from Prop Hunt, sh_config.lua:172
|
||||||
-- The code tries to match up with Prop Hunt, init.lua:163-178
|
-- The code tries to match up with Prop Hunt, init.lua:163-178
|
||||||
if GAMEMODE:InRound() && IsValid(pl) && pl:IsPlayer() && pl:Alive() && pl.last_taunt_time + TAUNT_DELAY <= CurTime()
|
local tauntDelay = TAUNT_DELAY
|
||||||
&& tauntPaths ~= nil && table.HasValue(tauntPaths, sound) then
|
|
||||||
|
-- Prop Hunt Extended uses its own configuration object
|
||||||
|
if PHE then
|
||||||
|
tauntDelay = PHE.TAUNT_DELAY
|
||||||
|
end
|
||||||
|
|
||||||
|
if GAMEMODE:InRound() and IsValid(pl) and pl:IsPlayer() and pl:Alive()
|
||||||
|
and pl.last_taunt_time + tauntDelay <= CurTime()
|
||||||
|
and tauntPaths ~= nil and table.HasValue(tauntPaths, sound) then
|
||||||
pl.last_taunt_time = CurTime()
|
pl.last_taunt_time = CurTime()
|
||||||
pl.last_taunt = sound
|
pl.last_taunt = sound
|
||||||
|
|
||||||
|
@ -150,18 +158,42 @@ end
|
||||||
|
|
||||||
-- Detect changes in the taunt list
|
-- Detect changes in the taunt list
|
||||||
hook.Add("Think", "PH_TauntMenu_DetectUpdate", function()
|
hook.Add("Think", "PH_TauntMenu_DetectUpdate", function()
|
||||||
-- If we don't have Tauntpack loader installed, we only have the global taunt tables used by Prop Hunt itself.
|
--[[
|
||||||
|
If we don't have Tauntpack loader installed, we only have the global taunt
|
||||||
|
tables used by Prop Hunt itself.
|
||||||
|
|
||||||
|
Here's some technical information on the global taunt tables:
|
||||||
|
- Garry's Mod own Prop Hunt mode uses HUNTER_TAUNTS and PROP_TAUNTS.
|
||||||
|
Each table is just a list of paths to sound files.
|
||||||
|
- Wolvin's Extended Prop Hunt ships with its own taunt menu and does not
|
||||||
|
use HUNTER_TAUNTS and PROP_TAUNTS, but instead PHE.PH_TAUNT_FILE_LIST.HUNTER
|
||||||
|
and PHE.PH_TAUNT_FILE_LIST.PROP which are also just a list of paths to
|
||||||
|
sound files.
|
||||||
|
]]
|
||||||
|
|
||||||
|
local taunts = {
|
||||||
|
-- Assume standard GMod Prop Hunt for now
|
||||||
|
HUNTER = HUNTER_TAUNTS,
|
||||||
|
PROP = PROP_TAUNTS,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Check for Prop Hunt Extended which stores the paths in a different variable
|
||||||
|
if PHE and PHE.PH_TAUNT_FILE_LIST then
|
||||||
|
taunts.HUNTER = table.Merge(PHE.HUNTER_TAUNTS, PHE.PH_TAUNT_CUSTOM.HUNTER)
|
||||||
|
taunts.PROP = table.Merge(PHE.PROP_TAUNTS, PHE.PH_TAUNT_CUSTOM.PROP)
|
||||||
|
end
|
||||||
|
|
||||||
if (GAMEMODE.Hunter_Taunts == nil) or (GAMEMODE.Prop_Taunts == nil) then
|
if (GAMEMODE.Hunter_Taunts == nil) or (GAMEMODE.Prop_Taunts == nil) then
|
||||||
if (tauntsTable[TEAM_HUNTERS] ~= HUNTER_TAUNTS)
|
if (tauntsTable[TEAM_HUNTERS] ~= taunts.HUNTER)
|
||||||
or (tauntsTable[TEAM_PROPS] ~= PROP_TAUNTS) then
|
or (tauntsTable[TEAM_PROPS] ~= taunts.PROP) then
|
||||||
tauntsTable= {}
|
tauntsTable= {}
|
||||||
tauntsFixedTable= {}
|
tauntsFixedTable= {}
|
||||||
|
|
||||||
-- Replace some of the names with fixed names since Tauntpack Loader
|
-- Replace some of the names with fixed names since Tauntpack Loader
|
||||||
-- just uses the file path for them which will look ugly on the UI
|
-- just uses the file path for them which will look ugly on the UI
|
||||||
tauntsTable[TEAM_HUNTERS] = HUNTER_TAUNTS
|
tauntsTable[TEAM_HUNTERS] = taunts.HUNTER
|
||||||
tauntsFixedTable[TEAM_HUNTERS] = {}
|
tauntsFixedTable[TEAM_HUNTERS] = {}
|
||||||
for index, path in pairs(HUNTER_TAUNTS) do
|
for index, path in pairs(taunts.HUNTER) do
|
||||||
if file.Exists("sound/" .. path, "GAME") then
|
if file.Exists("sound/" .. path, "GAME") then
|
||||||
tauntsFixedTable[TEAM_HUNTERS][index] = { path, FixName(path) }
|
tauntsFixedTable[TEAM_HUNTERS][index] = { path, FixName(path) }
|
||||||
else
|
else
|
||||||
|
@ -169,9 +201,9 @@ hook.Add("Think", "PH_TauntMenu_DetectUpdate", function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
tauntsTable[TEAM_PROPS] = PROP_TAUNTS
|
tauntsTable[TEAM_PROPS] = taunts.PROP
|
||||||
tauntsFixedTable[TEAM_PROPS] = {}
|
tauntsFixedTable[TEAM_PROPS] = {}
|
||||||
for index, path in pairs(PROP_TAUNTS) do
|
for index, path in pairs(taunts.PROP) do
|
||||||
if file.Exists("sound/" .. path, "GAME") then
|
if file.Exists("sound/" .. path, "GAME") then
|
||||||
tauntsFixedTable[TEAM_PROPS][index] = { path, FixName(path) }
|
tauntsFixedTable[TEAM_PROPS][index] = { path, FixName(path) }
|
||||||
else
|
else
|
||||||
|
@ -180,8 +212,8 @@ hook.Add("Think", "PH_TauntMenu_DetectUpdate", function()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Tables that hold sound paths, see Prop Hunt, sh_config.lua:70-168
|
-- Tables that hold sound paths, see Prop Hunt, sh_config.lua:70-168
|
||||||
tauntPathsTable[TEAM_HUNTERS] = HUNTER_TAUNTS
|
tauntPathsTable[TEAM_HUNTERS] = taunts.HUNTER
|
||||||
tauntPathsTable[TEAM_PROPS] = PROP_TAUNTS
|
tauntPathsTable[TEAM_PROPS] = taunts.PROP
|
||||||
|
|
||||||
BroadcastUpdate()
|
BroadcastUpdate()
|
||||||
end
|
end
|
||||||
|
@ -218,8 +250,8 @@ hook.Add("Think", "PH_TauntMenu_DetectUpdate", function()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Tables that hold sound paths, see Prop Hunt, sh_config.lua:70-168
|
-- Tables that hold sound paths, see Prop Hunt, sh_config.lua:70-168
|
||||||
tauntPathsTable[TEAM_HUNTERS] = HUNTER_TAUNTS
|
tauntPathsTable[TEAM_HUNTERS] = taunts.HUNTER
|
||||||
tauntPathsTable[TEAM_PROPS] = PROP_TAUNTS
|
tauntPathsTable[TEAM_PROPS] = taunts.PROP
|
||||||
|
|
||||||
BroadcastUpdate()
|
BroadcastUpdate()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue