//** In fully automatic mode some of the gas is used to extract and reload the next cartrige, thus there is less power and range.
.float sniperrifle_accumulator;
-.float sniperrifle_load;
void W_SniperRifle_SetAmmoCounter()
{
void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant)
{
- // if there's not enough ammo for this attack (but we still have the weapon), reload
- if(autocvar_g_balance_sniperrifle_reload_ammo && self.clip_load < autocvar_g_balance_sniperrifle_primary_ammo)
- {
- W_SniperRifle_Reload();
- return;
- }
-
// if this weapon is reloadable, decrease its load. Else decrease the player's ammo
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
}
}
}
- if(self.wish_reload)
- {
- if(self.switchweapon == self.weapon)
- {
- if(self.weaponentity.state == WS_READY)
- {
- self.wish_reload = 0;
- W_SniperRifle_Reload();
- }
- }
- }
}
else if (req == WR_PRECACHE)
{
else if (req == WR_CHECKAMMO2)
{
if(autocvar_g_balance_sniperrifle_reload_ammo)
- return self.sniperrifle_load >= autocvar_g_balance_sniperrifle_primary_ammo;
+ return self.sniperrifle_load >= autocvar_g_balance_sniperrifle_secondary_ammo;
else
return self.ammo_nails >= autocvar_g_balance_sniperrifle_secondary_ammo;
}
self.sniperrifle_accumulator = time - autocvar_g_balance_sniperrifle_bursttime;
self.clip_load = autocvar_g_balance_sniperrifle_reload_ammo;
}
+ 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_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo);
+ return (autocvar_g_balance_sniperrifle_reload_ammo && self.sniperrifle_load >= ammo_amount) || self.ammo_nails >= ammo_amount;
+ }
return TRUE;
};
#endif