From 5ec0fae66f230a5e4a003fe4defc72d75aaca270 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 1 Oct 2018 15:29:56 +1000 Subject: [PATCH] Add an option (disabled by default) to spawn powerups in duel --- gamemodes-server.cfg | 1 + qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc | 12 ++++++++++++ qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh | 2 ++ 3 files changed, 15 insertions(+) diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 7cc47c363..7b2203c39 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -539,3 +539,4 @@ set g_invasion_type 0 "type of invasion mode - 0: round-based, 1: hunting, 2: co // duel // ====== set g_duel 0 "Duel: frag the opponent more in a one versus one arena battle" +set g_duel_with_powerups 0 "Enable powerups to spawn in the duel gamemode" diff --git a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc index 7e4c891e6..0f771411a 100644 --- a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc +++ b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc @@ -16,3 +16,15 @@ MUTATOR_HOOKFUNCTION(duel, Scores_CountFragsRemaining) // announce remaining frags? return true; } + +MUTATOR_HOOKFUNCTION(duel, FilterItemDefinition) +{ + entity definition = M_ARGV(0, entity); + + if(definition.instanceOfPowerup) + { + return !autocvar_g_duel_with_powerups; + } + + return false; +} diff --git a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh index 9a0d716b9..d255c9b35 100644 --- a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh +++ b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qh @@ -6,3 +6,5 @@ REGISTER_MUTATOR(duel, false) MUTATOR_STATIC(); return 0; } + +bool autocvar_g_duel_with_powerups; -- 2.39.2