#else
#ifdef SVQC
-void W_Shotgun_Reload()
-{
- self.reload_ammo_player = ammo_shells;
- self.reload_ammo_min = autocvar_g_balance_shotgun_primary_ammo;
- self.reload_ammo_amount = autocvar_g_balance_shotgun_reload_ammo;
- self.reload_time = autocvar_g_balance_shotgun_reload_time;
- self.reload_sound = "weapons/reload.wav";
-
- W_Reload();
-}
-
void W_Shotgun_Attack (void)
{
float sc;
bulletspeed = autocvar_g_balance_shotgun_primary_speed;
bulletconstant = autocvar_g_balance_shotgun_primary_bulletconstant;
- // 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_shotgun_reload_ammo)
- {
- self.clip_load -= ammoamount;
- self.weapon_load[WEP_SHOTGUN] = self.clip_load;
- }
- else
- self.ammo_shells -= ammoamount;
- }
+ W_DecreaseAmmo(ammo_shells, ammoamount, autocvar_g_balance_shotgun_reload_ammo);
W_SetupShot (self, autocvar_g_antilag_bullets && bulletspeed >= autocvar_g_antilag_bullets, 5, "weapons/shotgun_fire.wav", CHAN_WEAPON, d * bullets);
for (sc = 0;sc < bullets;sc = sc + 1)
Damage (trace_ent, self.owner, self.owner, autocvar_g_balance_shotgun_secondary_damage * min(1, f + 1), WEP_SHOTGUN | HITTYPE_SECONDARY , self.owner.origin + self.owner.view_ofs, force);
remove(self);
}
- else if(time >= self.cnt + meleetime) // missed, remove ent
+ else if(time >= self.cnt + meleetime || (self.owner.deadflag != DEAD_NO && autocvar_g_balance_shotgun_secondary_melee_no_doubleslap)) // missed or owner died, remove ent
remove(self);
else // continue swinging the weapon in hope of hitting someone :)
self.nextthink = time;
{
// don't force reload an empty shotgun if its melee attack is active
if not(autocvar_g_balance_shotgun_secondary && self.ammo_shells < autocvar_g_balance_shotgun_primary_ammo)
- W_Shotgun_Reload();
+ weapon_action(self.weapon, WR_RELOAD);
}
else
{
}
}
}
+ if (self.clip_load >= 0) // we are not currently reloading
if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
{
precache_sound ("misc/itempickup.wav");
precache_sound ("weapons/shotgun_fire.wav");
precache_sound ("weapons/shotgun_melee.wav");
- precache_sound ("weapons/reload.wav");
+ //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
}
else if (req == WR_SETUP)
{
weapon_setup(WEP_SHOTGUN);
+ self.current_ammo = ammo_shells;
}
else if (req == WR_CHECKAMMO1)
{
}
else if (req == WR_RELOAD)
{
- W_Shotgun_Reload();
+ W_Reload(autocvar_g_balance_shotgun_primary_ammo, autocvar_g_balance_shotgun_reload_ammo, autocvar_g_balance_shotgun_reload_time, "weapons/reload.wav");
}
return TRUE;
};