From 355514f2ecd2a305b02c797084389e81d26c0e0a Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 3 Jun 2020 18:29:18 +1000 Subject: [PATCH] Only swap the Nexuiz weapons with items if they're mutator blocked, allows mutators and mods to make them available without needing to turn the weaponswap cvar off manually --- qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc | 2 -- qcsrc/common/weapons/weapon/hlac.qc | 2 +- qcsrc/common/weapons/weapon/minelayer.qc | 2 +- qcsrc/common/weapons/weapon/rifle.qc | 2 +- qcsrc/common/weapons/weapon/seeker.qc | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc index fdcce4608..47e1c97a9 100644 --- a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc +++ b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc @@ -86,8 +86,6 @@ REGISTER_MUTATOR(nt, expr_evaluate(cvar_string("g_new_toys")) && !MUTATOR_IS_ENA if(nt_IsNewToy(it.m_id)) it.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; }); - - cvar_settemp("sv_nexuizcompat_weaponswap", "0"); // disable compatibility so these weapons aren't auto replaced elsewhere } MUTATOR_ONROLLBACK_OR_REMOVE diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index dbc65b93e..9d58e513d 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -4,7 +4,7 @@ METHOD(HLAC, m_spawnfunc_hookreplace, Weapon(HLAC this, entity e)) { - if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e)) + if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e) && (this.spawnflags & WEP_FLAG_MUTATORBLOCKED)) { return ITEM_ArmorBig; } diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 48b869f94..f94d6c148 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -4,7 +4,7 @@ METHOD(MineLayer, m_spawnfunc_hookreplace, Weapon(MineLayer this, entity e)) { - if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e)) + if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e) && (this.spawnflags & WEP_FLAG_MUTATORBLOCKED)) { return ITEM_HealthBig; } diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 9edf486a0..0b8637345 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -4,7 +4,7 @@ METHOD(Rifle, m_spawnfunc_hookreplace, Weapon(Rifle this, entity e)) { - if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e)) + if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e) && (this.spawnflags & WEP_FLAG_MUTATORBLOCKED)) { return ITEM_ArmorBig; } diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 9a6abb11c..d60bb194d 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -4,7 +4,7 @@ METHOD(Seeker, m_spawnfunc_hookreplace, Weapon(Seeker this, entity e)) { - if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e)) + if (autocvar_sv_nexuizcompat_weaponswap && !Item_IsLoot(e) && (this.spawnflags & WEP_FLAG_MUTATORBLOCKED)) { return ITEM_HealthBig; } -- 2.39.2