From 74f25d3754770f839b04fec7b4ac15b68ccdb274 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 14 Mar 2015 06:51:40 +1100 Subject: [PATCH] Disable machine gun reloading while carrying ammo buff --- qcsrc/server/mutators/mutator_buffs.qc | 11 +++++++++++ qcsrc/server/mutators/mutator_buffs.qh | 1 + 2 files changed, 12 insertions(+) diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index 16ea5f274..7dfdaca62 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -759,6 +759,10 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink) } } + if(self.buffs & BUFF_AMMO) + if(self.clip_size) + self.clip_load = self.(weapon_load[self.switchweapon]) = self.clip_size; + if((self.buffs & BUFF_INVISIBLE) && (self.oldbuffs & BUFF_INVISIBLE)) if(self.alpha != autocvar_g_buffs_invisible_alpha) self.alpha = autocvar_g_buffs_invisible_alpha; // powerups reset alpha, so we must enforce this (TODO) @@ -777,6 +781,10 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink) { self.buff_ammo_prev_infitems = (self.items & IT_UNLIMITED_WEAPON_AMMO); self.items |= IT_UNLIMITED_WEAPON_AMMO; + + if(self.clip_load) + self.buff_ammo_prev_clipload = self.clip_load; + self.clip_load = self.(weapon_load[self.switchweapon]) = self.clip_size; } BUFF_ONREM(BUFF_AMMO) @@ -785,6 +793,9 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink) self.items |= IT_UNLIMITED_WEAPON_AMMO; else self.items &= ~IT_UNLIMITED_WEAPON_AMMO; + + if(self.buff_ammo_prev_clipload) + self.clip_load = self.buff_ammo_prev_clipload; } BUFF_ONADD(BUFF_INVISIBLE) diff --git a/qcsrc/server/mutators/mutator_buffs.qh b/qcsrc/server/mutators/mutator_buffs.qh index 7c1734fc5..af600a4a6 100644 --- a/qcsrc/server/mutators/mutator_buffs.qh +++ b/qcsrc/server/mutators/mutator_buffs.qh @@ -5,6 +5,7 @@ // // ammo .float buff_ammo_prev_infitems; +.int buff_ammo_prev_clipload; // invisible .float buff_invisible_prev_alpha; // flight -- 2.39.2