void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity)
{
W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.(weaponentity).misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)), deathtype);
+
if(!autocvar_g_norecoil)
{
actor.punchangle_x = random() - 0.5;
actor.punchangle_y = random() - 0.5;
}
+
// this attack_finished just enforces a cooldown at the end of a burst
ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor);
if(actor.(weaponentity).misc_bulletcounter == 1)
- fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), 0, WEP_CVAR(machinegun, first_force), deathtype, EFFECT_BULLET);
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir,
+ WEP_CVAR(machinegun, first_spread),
+ WEP_CVAR(machinegun, solidpenetration),
+ WEP_CVAR(machinegun, first_damage),
+ WEP_CVAR(machinegun, damagefalloff_halflife),
+ WEP_CVAR(machinegun, damagefalloff_mindist),
+ WEP_CVAR(machinegun, damagefalloff_maxdist),
+ 0,
+ WEP_CVAR(machinegun, first_force),
+ WEP_CVAR(machinegun, damagefalloff_forcehalflife),
+ deathtype, EFFECT_BULLET, true);
else
- fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), 0, WEP_CVAR(machinegun, sustained_force), deathtype, EFFECT_BULLET);
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir,
+ WEP_CVAR(machinegun, sustained_spread),
+ WEP_CVAR(machinegun, solidpenetration),
+ WEP_CVAR(machinegun, sustained_damage),
+ WEP_CVAR(machinegun, damagefalloff_halflife),
+ WEP_CVAR(machinegun, damagefalloff_mindist),
+ WEP_CVAR(machinegun, damagefalloff_maxdist),
+ 0,
+ WEP_CVAR(machinegun, sustained_force),
+ WEP_CVAR(machinegun, damagefalloff_forcehalflife),
+ deathtype, EFFECT_BULLET, true);
W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
}
machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
- fireBullet(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), 0, WEP_CVAR(machinegun, sustained_force), thiswep.m_id, EFFECT_BULLET);
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage),
+ WEP_CVAR(machinegun, damagefalloff_halflife), WEP_CVAR(machinegun, damagefalloff_mindist), WEP_CVAR(machinegun, damagefalloff_maxdist), 0,
+ WEP_CVAR(machinegun, sustained_force), WEP_CVAR(machinegun, damagefalloff_forcehalflife), thiswep.m_id, EFFECT_BULLET, true);
actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
actor.punchangle_y = random() - 0.5;
}
- fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), 0, WEP_CVAR(machinegun, sustained_force), thiswep.m_id, EFFECT_BULLET);
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage),
+ WEP_CVAR(machinegun, damagefalloff_halflife), WEP_CVAR(machinegun, damagefalloff_mindist), WEP_CVAR(machinegun, damagefalloff_maxdist), 0,
+ WEP_CVAR(machinegun, sustained_force), WEP_CVAR(machinegun, damagefalloff_forcehalflife), thiswep.m_id, EFFECT_BULLET, true);
W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);