From: drjaska Date: Thu, 18 Nov 2021 10:05:18 +0000 (+0200) Subject: refactor and fix FilterItem handling powerups X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=10ce9ce2c7338e069e1d74131908e0d724edd023;p=xonotic%2Fxonotic-data.pk3dir.git refactor and fix FilterItem handling powerups I'd wish to add buff handling to the hookfunction but I don't know how --- 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; }