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;
{
local entity proj;
+ // if there's not enough ammo for this attack (but we still have the weapon), reload
+ if(autocvar_g_balance_electro_reload_ammo && self.clip_load < autocvar_g_balance_electro_primary_ammo)
+ {
+ W_Electro_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(autocvar_g_balance_electro_reload_ammo)
+ {
+ self.clip_load -= autocvar_g_balance_electro_primary_ammo;
+ self.electro_load = self.clip_load;
+ }
+ else
+ self.ammo_cells -= autocvar_g_balance_electro_primary_ammo;
+ }
+
W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", CHAN_WEAPON, autocvar_g_balance_electro_primary_damage);
pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
other = proj; MUTATOR_CALLHOOK(EditProjectile);
+}
+
+void W_Electro_Attack2()
+{
+ local entity proj;
+
+ // if there's not enough ammo for this attack (but we still have the weapon), reload
+ if(autocvar_g_balance_electro_reload_ammo && self.clip_load < autocvar_g_balance_electro_secondary_ammo)
+ {
+ W_Electro_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(autocvar_g_balance_electro_reload_ammo)
{
- self.clip_load -= autocvar_g_balance_electro_primary_ammo;
+ self.clip_load -= autocvar_g_balance_electro_secondary_ammo;
self.electro_load = self.clip_load;
}
else
- self.ammo_cells -= autocvar_g_balance_electro_primary_ammo;
+ self.ammo_cells -= autocvar_g_balance_electro_secondary_ammo;
}
-}
-
-void W_Electro_Attack2()
-{
- local entity proj;
W_SetupShot_ProjectileSize (self, '0 0 -4', '0 0 -4', FALSE, 2, "weapons/electro_fire2.wav", CHAN_WEAPON, autocvar_g_balance_electro_secondary_damage);
CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
other = proj; MUTATOR_CALLHOOK(EditProjectile);
-
- // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- {
- if(autocvar_g_balance_electro_reload_ammo)
- {
- self.clip_load -= autocvar_g_balance_electro_secondary_ammo;
- self.electro_load = self.clip_load;
- }
- else
- self.ammo_cells -= autocvar_g_balance_electro_secondary_ammo;
- }
}
.vector hook_start, hook_end;
remove(self);
return;
}
- if(autocvar_g_balance_electro_reload_ammo)
if (self.owner.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || self.owner.deadflag != DEAD_NO || !self.owner.BUTTON_ATCK || self.owner.freezetag_frozen)
{
float dt, f;
dt = frametime;
+ // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
if not(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)
{
- // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
if(autocvar_g_balance_electro_primary_ammo)
{
if(autocvar_g_balance_electro_reload_ammo)