]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_nex.qc
Doh, it CAN be done differently than my ugly list. Use WR checks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_nex.qc
index e93262e92b471109a39423cf8843b2da21e6fe94..d3e1b07d6b28d6c41338f1faba8b3e428ba63f58 100644 (file)
@@ -313,6 +313,15 @@ float w_nex(float req)
        {
                W_Nex_Reload();
        }
+       else if (req == WR_SWITCHABLE)
+       {
+               // checks if this weapon can be switched to, when reloading is enabled
+               // returns true if there's either enough load in the weapon to use it,
+               // or we have enough ammo to reload the weapon to a usable point
+               float ammo_amount;
+               ammo_amount = min(autocvar_g_balance_nex_primary_ammo, autocvar_g_balance_nex_secondary_ammo);
+               return self.nex_load >= ammo_amount || self.ammo_cells >= ammo_amount;
+       }
 
        return TRUE;
 };