From 9a662980f13608efd119f106575de333b396a89c Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 5 Dec 2014 23:54:36 +1100 Subject: [PATCH] Disable reloading when weapon use is forbidden (fixes reload spam while frozen) --- qcsrc/server/cl_impulse.qc | 2 +- qcsrc/server/weapons/selection.qc | 2 +- qcsrc/server/weapons/weaponsystem.qh | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index c6ede7f98..76610f4c3 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -108,7 +108,7 @@ void ImpulseCommands (void) W_PreviousWeapon(1); break; case 20: - WEP_ACTION(self.weapon, WR_RELOAD); + if(!forbidWeaponUse()) { WEP_ACTION(self.weapon, WR_RELOAD); } break; } } diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 0816ff44a..12ffbb9b4 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -253,7 +253,7 @@ void W_SwitchWeapon(float imp) else self.selectweapon = imp; // update selectweapon ANYWAY } - else { WEP_ACTION(self.weapon, WR_RELOAD); } + else if(!forbidWeaponUse()) { WEP_ACTION(self.weapon, WR_RELOAD); } } void W_CycleWeapon(string weaponorder, float dir) diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index b1854145b..ddb1ee695 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -2,3 +2,5 @@ float weaponswapping; float internalteam; void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item); + +float forbidWeaponUse(); -- 2.39.2