]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Disable machine gun reloading while carrying ammo buff
authorMario <zacjardine@y7mail.com>
Fri, 13 Mar 2015 19:51:40 +0000 (06:51 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 13 Mar 2015 19:51:40 +0000 (06:51 +1100)
qcsrc/server/mutators/mutator_buffs.qc
qcsrc/server/mutators/mutator_buffs.qh

index 16ea5f2749e0ea9db4e416e521d2350ac8f51cda..7dfdaca6225f8c6c5c1b0164e1f43d99fa6663ee 100644 (file)
@@ -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)
index 7c1734fc5581130b9cbb0c3f855ef33278408723..af600a4a6cf8aa8e09d89db0a35ecc05c752dad1 100644 (file)
@@ -5,6 +5,7 @@
 //
 // ammo
 .float buff_ammo_prev_infitems;
+.int buff_ammo_prev_clipload;
 // invisible
 .float buff_invisible_prev_alpha;
 // flight