// shared weapon reload code
.float reload_complain;
-float W_ReloadCheck(float ammo_amount)
+float W_ReloadCheck(float ammo_amount, float ammo_shot)
{
entity e;
e = get_weaponinfo(self.weapon);
sprint(self, strcat("You don't have enough ammo to reload the ^2", W_Name(self.weapon), "\n"));
self.reload_complain = time + 1;
}
- // is there's no more ammo to reload, only switch to another weapon if there's no more load in this one
- if(!self.clip_load)
+ // switch away if the loaded amount of ammo is not enough to keep using the weapon
+ if(self.clip_load < ammo_shot)
{
self.clip_load = -1; // reload later
W_SwitchToOtherWeapon(self);
if(!autocvar_g_balance_crylink_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_cells))
+ if(!W_ReloadCheck(self.ammo_cells, min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo)))
return;
float t;
if(!autocvar_g_balance_electro_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_cells))
+ if(!W_ReloadCheck(self.ammo_cells, min(autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_secondary_ammo)))
return;
float t;
if(!autocvar_g_balance_grenadelauncher_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_rockets))
+ if(!W_ReloadCheck(self.ammo_rockets, min(autocvar_g_balance_grenadelauncher_primary_ammo, autocvar_g_balance_grenadelauncher_secondary_ammo)))
return;
float t;
if(!autocvar_g_balance_hlac_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_cells))
+ if(!W_ReloadCheck(self.ammo_cells, min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo)))
return;
float t;
if(!autocvar_g_balance_minelayer_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_rockets))
+ if(!W_ReloadCheck(self.ammo_rockets, autocvar_g_balance_minelayer_ammo))
return;
float t;
if(!autocvar_g_balance_shotgun_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_shells))
+ if(!W_ReloadCheck(self.ammo_shells, autocvar_g_balance_shotgun_primary_ammo))
return;
float t;
if(!autocvar_g_balance_sniperrifle_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_nails))
+ if(!W_ReloadCheck(self.ammo_nails, min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)))
return;
float t;
if(!autocvar_g_balance_uzi_reload_ammo)
return;
- if(!W_ReloadCheck(self.ammo_nails))
+ if(!W_ReloadCheck(self.ammo_nails, min(max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo), autocvar_g_balance_uzi_burst_ammo)))
return;
float t;