From b79e293f331f69e27a4ea4afeae70ac5811c4f85 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Mon, 17 Apr 2017 20:16:53 +0200 Subject: [PATCH 1/4] 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. --- lua/autorun/server/prophunt_tauntmenu.lua | 58 ++++++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/lua/autorun/server/prophunt_tauntmenu.lua b/lua/autorun/server/prophunt_tauntmenu.lua index 81186b3..e46f101 100644 --- a/lua/autorun/server/prophunt_tauntmenu.lua +++ b/lua/autorun/server/prophunt_tauntmenu.lua @@ -127,8 +127,16 @@ local function PlayTaunt(pl, sound) -- TAUNT_DELAY from Prop Hunt, sh_config.lua:172 -- 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() - && tauntPaths ~= nil && table.HasValue(tauntPaths, sound) then + local tauntDelay = TAUNT_DELAY + + -- 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 = sound @@ -150,18 +158,42 @@ end -- Detect changes in the taunt list 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 (tauntsTable[TEAM_HUNTERS] ~= HUNTER_TAUNTS) - or (tauntsTable[TEAM_PROPS] ~= PROP_TAUNTS) then + if (tauntsTable[TEAM_HUNTERS] ~= taunts.HUNTER) + or (tauntsTable[TEAM_PROPS] ~= taunts.PROP) then tauntsTable= {} tauntsFixedTable= {} -- 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 - tauntsTable[TEAM_HUNTERS] = HUNTER_TAUNTS + tauntsTable[TEAM_HUNTERS] = taunts.HUNTER 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 tauntsFixedTable[TEAM_HUNTERS][index] = { path, FixName(path) } else @@ -169,9 +201,9 @@ hook.Add("Think", "PH_TauntMenu_DetectUpdate", function() end end - tauntsTable[TEAM_PROPS] = PROP_TAUNTS + tauntsTable[TEAM_PROPS] = taunts.PROP 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 tauntsFixedTable[TEAM_PROPS][index] = { path, FixName(path) } else @@ -180,8 +212,8 @@ hook.Add("Think", "PH_TauntMenu_DetectUpdate", function() end -- Tables that hold sound paths, see Prop Hunt, sh_config.lua:70-168 - tauntPathsTable[TEAM_HUNTERS] = HUNTER_TAUNTS - tauntPathsTable[TEAM_PROPS] = PROP_TAUNTS + tauntPathsTable[TEAM_HUNTERS] = taunts.HUNTER + tauntPathsTable[TEAM_PROPS] = taunts.PROP BroadcastUpdate() end @@ -218,8 +250,8 @@ hook.Add("Think", "PH_TauntMenu_DetectUpdate", function() end -- Tables that hold sound paths, see Prop Hunt, sh_config.lua:70-168 - tauntPathsTable[TEAM_HUNTERS] = HUNTER_TAUNTS - tauntPathsTable[TEAM_PROPS] = PROP_TAUNTS + tauntPathsTable[TEAM_HUNTERS] = taunts.HUNTER + tauntPathsTable[TEAM_PROPS] = taunts.PROP BroadcastUpdate() end From 19cf520340f0a24a8ab2a5c86f154f3927e9f706 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Mon, 17 Apr 2017 23:22:41 +0200 Subject: [PATCH 2/4] Add Jenkinsfile and add it to ignored files. --- Jenkinsfile | 9 +++++++++ addon.json | 1 + 2 files changed, 10 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..2afdb63 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,9 @@ +node('linux && amd64 && docker') { + docker.image('icedream/gmad:latest').inside { + ansiColor('xterm') { + git checkout + sh 'gmad create -folder . -out icedream-tauntmenu.gma' + archive '*.gma' + } + } +} diff --git a/addon.json b/addon.json index 58be85e..7559257 100644 --- a/addon.json +++ b/addon.json @@ -18,6 +18,7 @@ "*.txt", "*.gma", ".git*", + "Jenkinsfile", "logo.*" ] } From 814021f356708acd399d65df2a427e71e3cfb02c Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Mon, 17 Apr 2017 23:27:20 +0200 Subject: [PATCH 3/4] Fix bad checkout command in Jenkinsfile. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2afdb63..2705f3a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ node('linux && amd64 && docker') { docker.image('icedream/gmad:latest').inside { ansiColor('xterm') { - git checkout + checkout scm sh 'gmad create -folder . -out icedream-tauntmenu.gma' archive '*.gma' } From 6737e3072b8e0b8b3a9748ec4fa97099c1a4416c Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Mon, 17 Apr 2017 23:31:02 +0200 Subject: [PATCH 4/4] Fix name of gmad binary. This probably should be fixed in the image itself and then reverted on this repository. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2705f3a..56af1b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ node('linux && amd64 && docker') { docker.image('icedream/gmad:latest').inside { ansiColor('xterm') { checkout scm - sh 'gmad create -folder . -out icedream-tauntmenu.gma' + sh 'gmad_linux create -folder . -out icedream-tauntmenu.gma' archive '*.gma' } }