Small tweaks to the weapon reload code, that I also worked on in Xonotic
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 14 Mar 2011 22:25:05 +0000 (00:25 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 14 Mar 2011 22:25:05 +0000 (00:25 +0200)
data/qcsrc/server/bot/havocbot/havocbot.qc
data/qcsrc/server/cl_weaponsystem.qc

index 6a21f4f..faca874 100644 (file)
@@ -171,7 +171,7 @@ void havocbot_ai()
                        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                        {
                                e = get_weaponinfo(i);
-                               if(self.weapon_load[i] < cvar(strcat("g_balance_", e.netname, "_reload_ammo")))
+                               if ((e.spawnflags & WEP_FLAG_RELOADABLE) && self.weapon_load[i] < cvar(strcat("g_balance_", e.netname, "_reload_ammo")))
                                        self.switchweapon = i;
                        }
                }
index 5ae32e0..b2706ec 100644 (file)
@@ -1548,7 +1548,7 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 \r
 void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)\r
 {\r
-       if(self.items & IT_UNLIMITED_WEAPON_AMMO)\r
+       if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)\r
                return;\r
 \r
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo\r
@@ -1581,7 +1581,8 @@ void W_ReloadedAndReady()
                while(self.clip_load < self.reload_ammo_amount && self.(self.current_ammo)) // make sure we don't add more ammo than we have\r
                {\r
                        self.clip_load += 1;\r
-                       self.(self.current_ammo) -= 1;\r
+                       if not(self.items & IT_UNLIMITED_WEAPON_AMMO)\r
+                               self.(self.current_ammo) -= 1;\r
                }\r
        }\r
        self.weapon_load[self.weapon] = self.clip_load;\r