From 10ce9ce2c7338e069e1d74131908e0d724edd023 Mon Sep 17 00:00:00 2001 From: drjaska Date: Thu, 18 Nov 2021 12:05:18 +0200 Subject: [PATCH] refactor and fix FilterItem handling powerups I'd wish to add buff handling to the hookfunction but I don't know how --- qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc | 12 +++++++----- .../common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc index b0c9774fa..2759f9bbe 100644 --- a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc +++ b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc @@ -71,18 +71,20 @@ MUTATOR_HOOKFUNCTION(mayhem, SetWeaponArena) MUTATOR_HOOKFUNCTION(mayhem, FilterItem) { entity item = M_ARGV(0, entity); - if (autocvar_g_powerups == 1){ + + //enable powerups if forced globally or global accepts gamemodes to have powerups according to their own settings + if (autocvar_g_powerups == 1 || (autocvar_g_powerups == -1 && autocvar_g_mayhem_powerups == 1)){ if (item.itemdef.instanceOfPowerup){ return false; } } - else if (autocvar_g_powerups == -1){ + //disabled powerups if forced off globally or in this gamemode + if (autocvar_g_powerups == 0 || autocvar_g_mayhem_powerups == 0){ if (item.itemdef.instanceOfPowerup){ - if (autocvar_g_mayhem_powerups){ - return false; - } + return true; } } + //handle other items, remove unless globally forced on if (autocvar_g_pickup_items <= 0) return true; } diff --git a/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc b/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc index a80b88f61..f86384b5b 100644 --- a/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc +++ b/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc @@ -111,18 +111,20 @@ MUTATOR_HOOKFUNCTION(tmayhem, SetWeaponArena) MUTATOR_HOOKFUNCTION(tmayhem, FilterItem) { entity item = M_ARGV(0, entity); - if (autocvar_g_powerups == 1){ + + //enable powerups if forced globally or global accepts gamemodes to have powerups according to their own settings + if (autocvar_g_powerups == 1 || (autocvar_g_powerups == -1 && autocvar_g_tmayhem_powerups == 1)){ if (item.itemdef.instanceOfPowerup){ return false; } } - else if (autocvar_g_powerups == -1){ + //disabled powerups if forced off globally or in this gamemode + if (autocvar_g_powerups == 0 || autocvar_g_tmayhem_powerups == 0){ if (item.itemdef.instanceOfPowerup){ - if (autocvar_g_tmayhem_powerups){ - return false; - } + return true; } } + //handle other items, remove unless globally forced on if (autocvar_g_pickup_items <= 0) return true; } -- 2.39.2