]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
handle running out of crylink ammo better
authorRudolf Polzer <divverent@alientrap.org>
Tue, 9 Nov 2010 19:29:10 +0000 (20:29 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 9 Nov 2010 19:29:10 +0000 (20:29 +0100)
qcsrc/server/w_crylink.qc

index de5abb1fda2630afc7103b57d9ddda2fb083b87a..ce68dbeba1644e38ea465ce9f6b01188b0f1a30e 100644 (file)
@@ -482,8 +482,14 @@ float w_crylink(float req)
                                        linkjoineffect.owner = self;
                                        setorigin(linkjoineffect, pos);
                                }
+                               self.crylink_waitrelease = 0;
+                               if(!w_crylink(WR_CHECKAMMO1) && !w_crylink(WR_CHECKAMMO2))
+                               {
+                                       // ran out of ammo!
+                                       self.cnt = WEP_CRYLINK;
+                                       self.switchweapon = w_getbestweapon(self);
+                               }
                        }
-                       self.crylink_waitrelease = 0;
                }
        }
        else if (req == WR_PRECACHE)
@@ -498,9 +504,19 @@ float w_crylink(float req)
        else if (req == WR_SETUP)
                weapon_setup(WEP_CRYLINK);
        else if (req == WR_CHECKAMMO1)
+       {
+               // don't "run out of ammo" and switch weapons while waiting for release
+               if(self.crylink_lastgroup && self.crylink_waitrelease)
+                       return TRUE;
                return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
+       }
        else if (req == WR_CHECKAMMO2)
+       {
+               // don't "run out of ammo" and switch weapons while waiting for release
+               if(self.crylink_lastgroup && self.crylink_waitrelease)
+                       return TRUE;
                return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
+       }
        return TRUE;
 };
 #endif