set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_bullets 12
set g_balance_shotgun_primary_damage 4
+set g_balance_shotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_shotgun_primary_damagefalloff_halflife 0
+set g_balance_shotgun_primary_damagefalloff_maxdist 0
+set g_balance_shotgun_primary_damagefalloff_mindist 0
set g_balance_shotgun_primary_force 15
set g_balance_shotgun_primary_refire 0.75
set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_machinegun_burst_refire 0.06
set g_balance_machinegun_burst_refire2 0.45
set g_balance_machinegun_burst_spread 0.02
+set g_balance_machinegun_damagefalloff_forcehalflife 0
+set g_balance_machinegun_damagefalloff_halflife 0
+set g_balance_machinegun_damagefalloff_maxdist 0
+set g_balance_machinegun_damagefalloff_mindist 0
set g_balance_machinegun_first 1
set g_balance_machinegun_first_ammo 1
set g_balance_machinegun_first_damage 14
set g_balance_vaporizer_primary_ammo 10
set g_balance_vaporizer_primary_animtime 0.3
set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_damagefalloff_forcehalflife 0
+set g_balance_vaporizer_primary_damagefalloff_halflife 0
+set g_balance_vaporizer_primary_damagefalloff_maxdist 0
+set g_balance_vaporizer_primary_damagefalloff_mindist 0
set g_balance_vaporizer_primary_force 800
set g_balance_vaporizer_primary_refire 1
set g_balance_vaporizer_reload_ammo 0
set g_balance_rifle_primary_bullethail 0
set g_balance_rifle_primary_burstcost 0
set g_balance_rifle_primary_damage 80
+set g_balance_rifle_primary_damagefalloff_forcehalflife 0
+set g_balance_rifle_primary_damagefalloff_halflife 0
+set g_balance_rifle_primary_damagefalloff_maxdist 0
+set g_balance_rifle_primary_damagefalloff_mindist 0
set g_balance_rifle_primary_force 100
set g_balance_rifle_primary_headshot_multiplier 0
set g_balance_rifle_primary_refire 1.2
set g_balance_rifle_secondary_bullethail 0
set g_balance_rifle_secondary_burstcost 0
set g_balance_rifle_secondary_damage 20
+set g_balance_rifle_secondary_damagefalloff_forcehalflife 0
+set g_balance_rifle_secondary_damagefalloff_halflife 0
+set g_balance_rifle_secondary_damagefalloff_maxdist 0
+set g_balance_rifle_secondary_damagefalloff_mindist 0
set g_balance_rifle_secondary_force 50
set g_balance_rifle_secondary_headshot_multiplier 0
set g_balance_rifle_secondary_refire 0.9
set g_balance_okhmg_weaponthrowable 0
// }}}
// {{{ #22: Overkill MachineGun (MUTATOR WEAPON)
+set g_balance_okmachinegun_damagefalloff_forcehalflife 0
+set g_balance_okmachinegun_damagefalloff_halflife 0
+set g_balance_okmachinegun_damagefalloff_maxdist 0
+set g_balance_okmachinegun_damagefalloff_mindist 0
set g_balance_okmachinegun_primary_ammo 1
set g_balance_okmachinegun_primary_damage 25
set g_balance_okmachinegun_primary_force 5
set g_balance_okshotgun_primary_bot_range 512
set g_balance_okshotgun_primary_bullets 10
set g_balance_okshotgun_primary_damage 17
+set g_balance_okshotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_okshotgun_primary_damagefalloff_halflife 0
+set g_balance_okshotgun_primary_damagefalloff_maxdist 0
+set g_balance_okshotgun_primary_damagefalloff_mindist 0
set g_balance_okshotgun_primary_force 80
set g_balance_okshotgun_primary_refire 0.75
set g_balance_okshotgun_primary_solidpenetration 3.8
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_bullets 6
set g_balance_shotgun_primary_damage 9
+set g_balance_shotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_shotgun_primary_damagefalloff_halflife 0
+set g_balance_shotgun_primary_damagefalloff_maxdist 0
+set g_balance_shotgun_primary_damagefalloff_mindist 0
set g_balance_shotgun_primary_force 60
set g_balance_shotgun_primary_refire 0.5
set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_machinegun_burst_refire 0.05
set g_balance_machinegun_burst_refire2 0.75
set g_balance_machinegun_burst_spread 0.04
+set g_balance_machinegun_damagefalloff_forcehalflife 0
+set g_balance_machinegun_damagefalloff_halflife 0
+set g_balance_machinegun_damagefalloff_maxdist 0
+set g_balance_machinegun_damagefalloff_mindist 0
set g_balance_machinegun_first 1
set g_balance_machinegun_first_ammo 1
set g_balance_machinegun_first_damage 30
set g_balance_vaporizer_primary_ammo 10
set g_balance_vaporizer_primary_animtime 0.3
set g_balance_vaporizer_primary_damage -1
+set g_balance_vaporizer_primary_damagefalloff_forcehalflife 0
+set g_balance_vaporizer_primary_damagefalloff_halflife 0
+set g_balance_vaporizer_primary_damagefalloff_maxdist 0
+set g_balance_vaporizer_primary_damagefalloff_mindist 0
set g_balance_vaporizer_primary_force 800
set g_balance_vaporizer_primary_refire 1
set g_balance_vaporizer_reload_ammo 0
set g_balance_rifle_primary_bullethail 0
set g_balance_rifle_primary_burstcost 0
set g_balance_rifle_primary_damage 80
+set g_balance_rifle_primary_damagefalloff_forcehalflife 0
+set g_balance_rifle_primary_damagefalloff_halflife 0
+set g_balance_rifle_primary_damagefalloff_maxdist 0
+set g_balance_rifle_primary_damagefalloff_mindist 0
set g_balance_rifle_primary_force 100
set g_balance_rifle_primary_headshot_multiplier 1.25
set g_balance_rifle_primary_refire 1.2
set g_balance_rifle_secondary_bullethail 0
set g_balance_rifle_secondary_burstcost 0
set g_balance_rifle_secondary_damage 20
+set g_balance_rifle_secondary_damagefalloff_forcehalflife 0
+set g_balance_rifle_secondary_damagefalloff_halflife 0
+set g_balance_rifle_secondary_damagefalloff_maxdist 0
+set g_balance_rifle_secondary_damagefalloff_mindist 0
set g_balance_rifle_secondary_force 50
set g_balance_rifle_secondary_headshot_multiplier 0.1875
set g_balance_rifle_secondary_refire 0.9
set g_balance_okhmg_weaponthrowable 0
// }}}
// {{{ #22: Overkill MachineGun (MUTATOR WEAPON)
+set g_balance_okmachinegun_damagefalloff_forcehalflife 0
+set g_balance_okmachinegun_damagefalloff_halflife 0
+set g_balance_okmachinegun_damagefalloff_maxdist 0
+set g_balance_okmachinegun_damagefalloff_mindist 0
set g_balance_okmachinegun_primary_ammo 1
set g_balance_okmachinegun_primary_damage 25
set g_balance_okmachinegun_primary_force 5
set g_balance_okshotgun_primary_bot_range 512
set g_balance_okshotgun_primary_bullets 10
set g_balance_okshotgun_primary_damage 17
+set g_balance_okshotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_okshotgun_primary_damagefalloff_halflife 0
+set g_balance_okshotgun_primary_damagefalloff_maxdist 0
+set g_balance_okshotgun_primary_damagefalloff_mindist 0
set g_balance_okshotgun_primary_force 80
set g_balance_okshotgun_primary_refire 0.75
set g_balance_okshotgun_primary_solidpenetration 3.8
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_bullets 14
set g_balance_shotgun_primary_damage 4
+set g_balance_shotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_shotgun_primary_damagefalloff_halflife 0
+set g_balance_shotgun_primary_damagefalloff_maxdist 0
+set g_balance_shotgun_primary_damagefalloff_mindist 0
set g_balance_shotgun_primary_force 15
set g_balance_shotgun_primary_refire 0.75
set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_machinegun_burst_refire 0.06
set g_balance_machinegun_burst_refire2 0.45
set g_balance_machinegun_burst_spread 0.02
+set g_balance_machinegun_damagefalloff_forcehalflife 0
+set g_balance_machinegun_damagefalloff_halflife 0
+set g_balance_machinegun_damagefalloff_maxdist 0
+set g_balance_machinegun_damagefalloff_mindist 0
set g_balance_machinegun_first 1
set g_balance_machinegun_first_ammo 1
set g_balance_machinegun_first_damage 14
set g_balance_vaporizer_primary_ammo 10
set g_balance_vaporizer_primary_animtime 0.3
set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_damagefalloff_forcehalflife 0
+set g_balance_vaporizer_primary_damagefalloff_halflife 0
+set g_balance_vaporizer_primary_damagefalloff_maxdist 0
+set g_balance_vaporizer_primary_damagefalloff_mindist 0
set g_balance_vaporizer_primary_force 800
set g_balance_vaporizer_primary_refire 1
set g_balance_vaporizer_reload_ammo 0
set g_balance_rifle_primary_bullethail 0
set g_balance_rifle_primary_burstcost 0
set g_balance_rifle_primary_damage 80
+set g_balance_rifle_primary_damagefalloff_forcehalflife 0
+set g_balance_rifle_primary_damagefalloff_halflife 0
+set g_balance_rifle_primary_damagefalloff_maxdist 0
+set g_balance_rifle_primary_damagefalloff_mindist 0
set g_balance_rifle_primary_force 100
set g_balance_rifle_primary_headshot_multiplier 0
set g_balance_rifle_primary_refire 1.2
set g_balance_rifle_secondary_bullethail 0
set g_balance_rifle_secondary_burstcost 0
set g_balance_rifle_secondary_damage 20
-set g_balance_rifle_secondary_headshot_multiplier 0
+set g_balance_rifle_secondary_damagefalloff_forcehalflife 0
+set g_balance_rifle_secondary_damagefalloff_halflife 0
+set g_balance_rifle_secondary_damagefalloff_maxdist 0
+set g_balance_rifle_secondary_damagefalloff_mindist 0
set g_balance_rifle_secondary_force 50
+set g_balance_rifle_secondary_headshot_multiplier 0
set g_balance_rifle_secondary_refire 0.9
set g_balance_rifle_secondary_reload 0
set g_balance_rifle_secondary_shots 4
set g_balance_okhmg_weaponthrowable 0
// }}}
// {{{ #22: Overkill MachineGun (MUTATOR WEAPON)
+set g_balance_okmachinegun_damagefalloff_forcehalflife 0
+set g_balance_okmachinegun_damagefalloff_halflife 0
+set g_balance_okmachinegun_damagefalloff_maxdist 0
+set g_balance_okmachinegun_damagefalloff_mindist 0
set g_balance_okmachinegun_primary_ammo 1
set g_balance_okmachinegun_primary_damage 25
set g_balance_okmachinegun_primary_force 5
set g_balance_okshotgun_primary_bot_range 512
set g_balance_okshotgun_primary_bullets 10
set g_balance_okshotgun_primary_damage 17
+set g_balance_okshotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_okshotgun_primary_damagefalloff_halflife 0
+set g_balance_okshotgun_primary_damagefalloff_maxdist 0
+set g_balance_okshotgun_primary_damagefalloff_mindist 0
set g_balance_okshotgun_primary_force 80
set g_balance_okshotgun_primary_refire 0.75
set g_balance_okshotgun_primary_solidpenetration 3.8
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_bullets 12
set g_balance_shotgun_primary_damage 4
+set g_balance_shotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_shotgun_primary_damagefalloff_halflife 0
+set g_balance_shotgun_primary_damagefalloff_maxdist 0
+set g_balance_shotgun_primary_damagefalloff_mindist 0
set g_balance_shotgun_primary_force 15
set g_balance_shotgun_primary_refire 0.75
set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_machinegun_burst_refire 0.06
set g_balance_machinegun_burst_refire2 0.45
set g_balance_machinegun_burst_spread 0.03
+set g_balance_machinegun_damagefalloff_forcehalflife 0
+set g_balance_machinegun_damagefalloff_halflife 0
+set g_balance_machinegun_damagefalloff_maxdist 0
+set g_balance_machinegun_damagefalloff_mindist 0
set g_balance_machinegun_first 1
set g_balance_machinegun_first_ammo 1
set g_balance_machinegun_first_damage 14
set g_balance_vaporizer_primary_ammo 10
set g_balance_vaporizer_primary_animtime 0.3
set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_damagefalloff_forcehalflife 0
+set g_balance_vaporizer_primary_damagefalloff_halflife 0
+set g_balance_vaporizer_primary_damagefalloff_maxdist 0
+set g_balance_vaporizer_primary_damagefalloff_mindist 0
set g_balance_vaporizer_primary_force 800
set g_balance_vaporizer_primary_refire 1
set g_balance_vaporizer_reload_ammo 0
set g_balance_rifle_primary_bullethail 0
set g_balance_rifle_primary_burstcost 0
set g_balance_rifle_primary_damage 80
+set g_balance_rifle_primary_damagefalloff_forcehalflife 0
+set g_balance_rifle_primary_damagefalloff_halflife 0
+set g_balance_rifle_primary_damagefalloff_maxdist 0
+set g_balance_rifle_primary_damagefalloff_mindist 0
set g_balance_rifle_primary_force 100
set g_balance_rifle_primary_headshot_multiplier 0
set g_balance_rifle_primary_refire 1.2
set g_balance_rifle_secondary_bullethail 0
set g_balance_rifle_secondary_burstcost 0
set g_balance_rifle_secondary_damage 20
+set g_balance_rifle_secondary_damagefalloff_forcehalflife 0
+set g_balance_rifle_secondary_damagefalloff_halflife 0
+set g_balance_rifle_secondary_damagefalloff_maxdist 0
+set g_balance_rifle_secondary_damagefalloff_mindist 0
set g_balance_rifle_secondary_force 50
set g_balance_rifle_secondary_headshot_multiplier 0
set g_balance_rifle_secondary_refire 0.9
set g_balance_okhmg_weaponthrowable 0
// }}}
// {{{ #22: Overkill MachineGun (MUTATOR WEAPON)
+set g_balance_okmachinegun_damagefalloff_forcehalflife 0
+set g_balance_okmachinegun_damagefalloff_halflife 0
+set g_balance_okmachinegun_damagefalloff_maxdist 0
+set g_balance_okmachinegun_damagefalloff_mindist 0
set g_balance_okmachinegun_primary_ammo 1
set g_balance_okmachinegun_primary_damage 25
set g_balance_okmachinegun_primary_force 5
set g_balance_okshotgun_primary_bot_range 512
set g_balance_okshotgun_primary_bullets 10
set g_balance_okshotgun_primary_damage 17
+set g_balance_okshotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_okshotgun_primary_damagefalloff_halflife 0
+set g_balance_okshotgun_primary_damagefalloff_maxdist 0
+set g_balance_okshotgun_primary_damagefalloff_mindist 0
set g_balance_okshotgun_primary_force 80
set g_balance_okshotgun_primary_refire 0.75
set g_balance_okshotgun_primary_solidpenetration 3.8
set g_balance_shotgun_primary_animtime 0.2
set g_balance_shotgun_primary_bullets 12
set g_balance_shotgun_primary_damage 4
+set g_balance_shotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_shotgun_primary_damagefalloff_halflife 0
+set g_balance_shotgun_primary_damagefalloff_maxdist 0
+set g_balance_shotgun_primary_damagefalloff_mindist 0
set g_balance_shotgun_primary_force 15
set g_balance_shotgun_primary_refire 0.75
set g_balance_shotgun_primary_solidpenetration 3.8
set g_balance_machinegun_burst_refire 0.06
set g_balance_machinegun_burst_refire2 0.45
set g_balance_machinegun_burst_spread 0
+set g_balance_machinegun_damagefalloff_forcehalflife 0
+set g_balance_machinegun_damagefalloff_halflife 0
+set g_balance_machinegun_damagefalloff_maxdist 0
+set g_balance_machinegun_damagefalloff_mindist 0
set g_balance_machinegun_first 1
set g_balance_machinegun_first_ammo 1
set g_balance_machinegun_first_damage 14
set g_balance_vaporizer_primary_ammo 10
set g_balance_vaporizer_primary_animtime 0.3
set g_balance_vaporizer_primary_damage 150
+set g_balance_vaporizer_primary_damagefalloff_forcehalflife 0
+set g_balance_vaporizer_primary_damagefalloff_halflife 0
+set g_balance_vaporizer_primary_damagefalloff_maxdist 0
+set g_balance_vaporizer_primary_damagefalloff_mindist 0
set g_balance_vaporizer_primary_force 800
set g_balance_vaporizer_primary_refire 1
set g_balance_vaporizer_reload_ammo 0
set g_balance_rifle_primary_bullethail 0
set g_balance_rifle_primary_burstcost 0
set g_balance_rifle_primary_damage 80
+set g_balance_rifle_primary_damagefalloff_forcehalflife 0
+set g_balance_rifle_primary_damagefalloff_halflife 0
+set g_balance_rifle_primary_damagefalloff_maxdist 0
+set g_balance_rifle_primary_damagefalloff_mindist 0
set g_balance_rifle_primary_force 100
set g_balance_rifle_primary_headshot_multiplier 0
set g_balance_rifle_primary_refire 1.2
set g_balance_rifle_secondary_bullethail 0
set g_balance_rifle_secondary_burstcost 0
set g_balance_rifle_secondary_damage 20
+set g_balance_rifle_secondary_damagefalloff_forcehalflife 0
+set g_balance_rifle_secondary_damagefalloff_halflife 0
+set g_balance_rifle_secondary_damagefalloff_maxdist 0
+set g_balance_rifle_secondary_damagefalloff_mindist 0
set g_balance_rifle_secondary_force 50
set g_balance_rifle_secondary_headshot_multiplier 0
set g_balance_rifle_secondary_refire 0.9
set g_balance_okhmg_weaponthrowable 0
// }}}
// {{{ #22: Overkill MachineGun (MUTATOR WEAPON)
+set g_balance_okmachinegun_damagefalloff_forcehalflife 0
+set g_balance_okmachinegun_damagefalloff_halflife 0
+set g_balance_okmachinegun_damagefalloff_maxdist 0
+set g_balance_okmachinegun_damagefalloff_mindist 0
set g_balance_okmachinegun_primary_ammo 1
set g_balance_okmachinegun_primary_damage 25
set g_balance_okmachinegun_primary_force 5
set g_balance_okshotgun_primary_bot_range 512
set g_balance_okshotgun_primary_bullets 10
set g_balance_okshotgun_primary_damage 17
+set g_balance_okshotgun_primary_damagefalloff_forcehalflife 0
+set g_balance_okshotgun_primary_damagefalloff_halflife 0
+set g_balance_okshotgun_primary_damagefalloff_maxdist 0
+set g_balance_okshotgun_primary_damagefalloff_mindist 0
set g_balance_okshotgun_primary_force 80
set g_balance_okshotgun_primary_refire 0.75
set g_balance_okshotgun_primary_solidpenetration 3.8
}
okmachinegun_spread = bound(WEP_CVAR_PRI(okmachinegun, spread_min), WEP_CVAR_PRI(okmachinegun, spread_min) + (WEP_CVAR_PRI(okmachinegun, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR_PRI(okmachinegun, spread_max));
- fireBullet(actor, weaponentity, w_shotorg, w_shotdir, okmachinegun_spread, WEP_CVAR_PRI(okmachinegun, solidpenetration), WEP_CVAR_PRI(okmachinegun, damage), 0, WEP_CVAR_PRI(okmachinegun, force), WEP_OVERKILL_MACHINEGUN.m_id, EFFECT_RIFLE);
+
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, okmachinegun_spread,
+ WEP_CVAR_PRI(okmachinegun, solidpenetration),
+ WEP_CVAR_PRI(okmachinegun, damage),
+ WEP_CVAR(okmachinegun, damagefalloff_halflife),
+ WEP_CVAR(okmachinegun, damagefalloff_mindist),
+ WEP_CVAR(okmachinegun, damagefalloff_maxdist),
+ 0,
+ WEP_CVAR_PRI(okmachinegun, force),
+ WEP_CVAR(okmachinegun, damagefalloff_forcehalflife),
+ WEP_OVERKILL_MACHINEGUN.m_id, EFFECT_RIFLE, true);
actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
P(class, prefix, shotangle, float, SEC) \
P(class, prefix, speed, float, SEC) \
P(class, prefix, spread, float, SEC) \
+ P(class, prefix, damagefalloff_forcehalflife, float, NONE) \
+ P(class, prefix, damagefalloff_halflife, float, NONE) \
+ P(class, prefix, damagefalloff_maxdist, float, NONE) \
+ P(class, prefix, damagefalloff_mindist, float, NONE) \
P(class, prefix, reload_ammo, float, NONE) \
P(class, prefix, reload_time, float, NONE) \
P(class, prefix, switchdelay_drop, float, NONE) \
W_Shotgun_Attack(thiswep, actor, weaponentity, true,
WEP_CVAR_PRI(okshotgun, ammo),
WEP_CVAR_PRI(okshotgun, damage),
+ WEP_CVAR_PRI(okshotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(okshotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(okshotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(okshotgun, bullets),
WEP_CVAR_PRI(okshotgun, spread),
WEP_CVAR_PRI(okshotgun, solidpenetration),
WEP_CVAR_PRI(okshotgun, force),
+ WEP_CVAR_PRI(okshotgun, damagefalloff_forcehalflife),
EFFECT_RIFLE_WEAK);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okshotgun, animtime), w_ready);
return;
P(class, prefix, bot_range, float, PRI) \
P(class, prefix, bullets, float, PRI) \
P(class, prefix, damage, float, PRI) \
+ P(class, prefix, damagefalloff_forcehalflife, float, PRI) \
+ P(class, prefix, damagefalloff_halflife, float, PRI) \
+ P(class, prefix, damagefalloff_maxdist, float, PRI) \
+ P(class, prefix, damagefalloff_mindist, float, PRI) \
P(class, prefix, force, float, PRI) \
P(class, prefix, refire, float, PRI) \
P(class, prefix, solidpenetration, float, PRI) \
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);
P(class, prefix, burst_refire2, float, NONE) \
P(class, prefix, burst_refire, float, NONE) \
P(class, prefix, burst_spread, float, NONE) \
+ P(class, prefix, damagefalloff_forcehalflife, float, NONE) \
+ P(class, prefix, damagefalloff_halflife, float, NONE) \
+ P(class, prefix, damagefalloff_maxdist, float, NONE) \
+ P(class, prefix, damagefalloff_mindist, float, NONE) \
P(class, prefix, first, float, NONE) \
P(class, prefix, first_ammo, float, NONE) \
P(class, prefix, first_damage, float, NONE) \
#ifdef SVQC
-void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, float pSpread, float pDamage, float pHeadshotDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound, entity actor)
-{
- float i;
+void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, int deathtype, Sound pSound, entity actor, bool isprimary)
+{
+ float pAmmo = WEP_CVAR_BOTH(rifle, isprimary, ammo);
+ float pDamage = WEP_CVAR_BOTH(rifle, isprimary, damage);
+ float pDF_HalfLife = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_halflife);
+ float pDF_ForceHalfLife = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_forcehalflife);
+ float pDF_MaxDist = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_maxdist);
+ float pDF_MinDist = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_mindist);
+ float pForce = WEP_CVAR_BOTH(rifle, isprimary, force);
+ float pHeadshotDamage = WEP_CVAR_BOTH(rifle, isprimary, headshot_multiplier);
+ float pShots = WEP_CVAR_BOTH(rifle, isprimary, shots);
+ float pSolidPenetration = WEP_CVAR_BOTH(rifle, isprimary, solidpenetration);
+ float pSpread = WEP_CVAR_BOTH(rifle, isprimary, spread);
+ float pTracer = WEP_CVAR_BOTH(rifle, isprimary, tracer);
W_DecreaseAmmo(thiswep, actor, pAmmo, weaponentity);
w_shotorg = actor.origin + actor.view_ofs + ((w_shotorg - actor.origin - actor.view_ofs) * v_forward) * v_forward;
}
- for(i = 0; i < pShots; ++i)
- fireBullet(actor, weaponentity, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pHeadshotDamage, pForce, deathtype, (pTracer ? EFFECT_RIFLE : EFFECT_RIFLE_WEAK));
+ for(int i = 0; i < pShots; ++i)
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, pSpread,
+ pSolidPenetration, pDamage, pDF_HalfLife, pDF_MinDist,
+ pDF_MaxDist, pHeadshotDamage, pForce, pDF_ForceHalfLife,
+ deathtype, (pTracer ? EFFECT_RIFLE : EFFECT_RIFLE_WEAK), true);
if(autocvar_g_casings >= 2)
{
void W_Rifle_Attack(Weapon thiswep, entity actor, .entity weaponentity)
{
- W_Rifle_FireBullet(thiswep, weaponentity, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, headshot_multiplier), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), thiswep.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE, actor);
+ W_Rifle_FireBullet(thiswep, weaponentity, thiswep.m_id, SND_CAMPINGRIFLE_FIRE, actor, true);
}
void W_Rifle_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
{
- W_Rifle_FireBullet(thiswep, weaponentity, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, headshot_multiplier), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), thiswep.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2, actor);
+ W_Rifle_FireBullet(thiswep, weaponentity, thiswep.m_id | HITTYPE_SECONDARY, SND_CAMPINGRIFLE_FIRE2, actor, false);
}
.void(Weapon thiswep, entity actor, .entity weaponentity) rifle_bullethail_attackfunc;
P(class, prefix, burstcost, float, BOTH) \
P(class, prefix, bursttime, float, NONE) \
P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
+ P(class, prefix, damagefalloff_halflife, float, BOTH) \
+ P(class, prefix, damagefalloff_maxdist, float, BOTH) \
+ P(class, prefix, damagefalloff_mindist, float, BOTH) \
P(class, prefix, force, float, BOTH) \
P(class, prefix, headshot_multiplier, float, BOTH) \
P(class, prefix, refire, float, BOTH) \
P(class, prefix, reload, float, SEC) \
P(class, prefix, reload_ammo, float, NONE) \
- P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
P(class, prefix, secondary, float, NONE) \
P(class, prefix, shots, float, BOTH) \
P(class, prefix, solidpenetration, float, BOTH) \
P(class, prefix, spread, float, BOTH) \
- P(class, prefix, switchdelay_drop, float, NONE) \
- P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
P(class, prefix, tracer, float, BOTH) \
- P(class, prefix, weaponreplace, string, NONE) \
- P(class, prefix, weaponstartoverride, float, NONE) \
- P(class, prefix, weaponstart, float, NONE) \
- P(class, prefix, weaponthrowable, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
END()
- W_PROPS(X, Rifle, rifle)
+ W_PROPS(X, Rifle, rifle)
#undef X
ENDCLASS(Rifle)
REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
// enable to debug melee range
//#define SHOTGUN_MELEEDEBUG
-void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary, float ammocount, float damage, float bullets, float spread, float solidpenetration, float force, entity bullet_trail_effect)
+void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity,
+ float isprimary, float ammocount, float damage,
+ float falloff_halflife, float falloff_mindist, float falloff_maxdist,
+ float bullets, float spread, float solidpenetration,
+ float force, float falloff_forcehalflife, entity bullet_trail_effect)
{
W_DecreaseAmmo(thiswep, actor, ammocount, weaponentity);
- W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), damage * bullets, thiswep.m_id);
+ W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE,
+ ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), damage * bullets, thiswep.m_id);
- // TRICK: do the antilag outside the regular fireBullet function, so it isn't performed unnecessarily on every single bullet!
+ // TRICK: do the antilag outside the regular fireBullet function,
+ // so it isn't performed unnecessarily on every single bullet!
float lag = antilag_getlag(actor);
if(lag && bullets > 0)
antilag_takeback_all(actor, lag);
for(int sc = 0;sc < bullets;sc = sc + 1)
- fireBullet_antilag(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, 0, force, thiswep.m_id, bullet_trail_effect, false);
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration,
+ damage, falloff_halflife, falloff_mindist, falloff_maxdist, 0, force,
+ falloff_forcehalflife, thiswep.m_id, bullet_trail_effect, false);
if(lag && bullets > 0)
antilag_restore_all(actor);
W_Shotgun_Attack(thiswep, actor, weaponentity, true,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK); // actually is secondary, but we trick the last shot into playing full reload sound
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
}
W_Shotgun_Attack(thiswep, actor, weaponentity, false,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
}
W_Shotgun_Attack(thiswep, actor, weaponentity, true,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK);
actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
W_Shotgun_Attack(thiswep, actor, weaponentity, false,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK);
actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
P(class, prefix, animtime, float, BOTH) \
P(class, prefix, bullets, float, PRI) \
P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, damagefalloff_forcehalflife, float, PRI) \
+ P(class, prefix, damagefalloff_halflife, float, PRI) \
+ P(class, prefix, damagefalloff_maxdist, float, PRI) \
+ P(class, prefix, damagefalloff_mindist, float, PRI) \
P(class, prefix, force, float, BOTH) \
P(class, prefix, melee_delay, float, SEC) \
P(class, prefix, melee_multihit, float, SEC) \
yoda = 0;
impressive_hits = 0;
- FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, true, WEP_CVAR_PRI(vaporizer, force), 0, 0, 0, 0, thiswep.m_id);
+ FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, true, WEP_CVAR_PRI(vaporizer, force), WEP_CVAR_PRI(vaporizer, damagefalloff_mindist), WEP_CVAR_PRI(vaporizer, damagefalloff_maxdist), WEP_CVAR_PRI(vaporizer, damagefalloff_halflife), WEP_CVAR_PRI(vaporizer, damagefalloff_forcehalflife), thiswep.m_id);
// do this now, as goodhits is disabled below
vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
#define X(BEGIN, P, END, class, prefix) \
BEGIN(class) \
P(class, prefix, ammo, float, PRI) \
- P(class, prefix, animtime, float, PRI) \
- P(class, prefix, damage, float, PRI) \
- P(class, prefix, force, float, PRI) \
- P(class, prefix, refire, float, PRI) \
- P(class, prefix, ammo, float, SEC) \
- P(class, prefix, animtime, float, SEC) \
- P(class, prefix, damage, float, SEC) \
- P(class, prefix, delay, float, SEC) \
- P(class, prefix, edgedamage, float, SEC) \
- P(class, prefix, force, float, SEC) \
- P(class, prefix, force_zscale, float, SEC) \
- P(class, prefix, lifetime, float, SEC) \
- P(class, prefix, radius, float, SEC) \
- P(class, prefix, refire, float, SEC) \
- P(class, prefix, shotangle, float, SEC) \
- P(class, prefix, speed, float, SEC) \
- P(class, prefix, spread, float, SEC) \
- P(class, prefix, reload_ammo, float, NONE) \
- P(class, prefix, reload_time, float, NONE) \
- P(class, prefix, switchdelay_raise, float, NONE) \
- P(class, prefix, switchdelay_drop, float, NONE) \
- P(class, prefix, weaponreplace, string, NONE) \
- P(class, prefix, weaponstart, float, NONE) \
- P(class, prefix, weaponstartoverride, float, NONE) \
- P(class, prefix, weaponthrowable, float, NONE) \
+ P(class, prefix, animtime, float, PRI) \
+ P(class, prefix, damage, float, PRI) \
+ P(class, prefix, damagefalloff_forcehalflife, float, PRI) \
+ P(class, prefix, damagefalloff_halflife, float, PRI) \
+ P(class, prefix, damagefalloff_maxdist, float, PRI) \
+ P(class, prefix, damagefalloff_mindist, float, PRI) \
+ P(class, prefix, force, float, PRI) \
+ P(class, prefix, refire, float, PRI) \
+ P(class, prefix, ammo, float, SEC) \
+ P(class, prefix, animtime, float, SEC) \
+ P(class, prefix, damage, float, SEC) \
+ P(class, prefix, delay, float, SEC) \
+ P(class, prefix, edgedamage, float, SEC) \
+ P(class, prefix, force, float, SEC) \
+ P(class, prefix, force_zscale, float, SEC) \
+ P(class, prefix, lifetime, float, SEC) \
+ P(class, prefix, radius, float, SEC) \
+ P(class, prefix, refire, float, SEC) \
+ P(class, prefix, shotangle, float, SEC) \
+ P(class, prefix, speed, float, SEC) \
+ P(class, prefix, spread, float, SEC) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
END()
- W_PROPS(X, Vaporizer, vaporizer)
+ W_PROPS(X, Vaporizer, vaporizer)
#undef X
ENDCLASS(Vaporizer)
P(class, prefix, charge_shot_multiplier, float, NONE) \
P(class, prefix, charge_start, float, NONE) \
P(class, prefix, charge_velocity_rate, float, NONE) \
+ P(class, prefix, damage, float, BOTH) \
P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
P(class, prefix, damagefalloff_halflife, float, BOTH) \
P(class, prefix, damagefalloff_maxdist, float, BOTH) \
P(class, prefix, damagefalloff_mindist, float, BOTH) \
- P(class, prefix, damage, float, BOTH) \
P(class, prefix, force, float, BOTH) \
P(class, prefix, refire, float, BOTH) \
P(class, prefix, secondary, float, NONE) \
fireBullet_last_hit = NULL;
}
-void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect, bool do_antilag)
+void fireBullet_falloff(entity this, .entity weaponentity, vector start, vector dir,
+ float spread, float max_solid_penetration, float damage,
+ float falloff_halflife, float falloff_mindist,
+ float falloff_maxdist, float headshot_multiplier,
+ float force, float falloff_forcehalflife,
+ float dtype, entity tracer_effect, bool do_antilag)
{
dir = normalize(dir + randomvec() * spread);
vector end = start + dir * max_shot_distance;
if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
Damage_DamageInfo(start, damage * damage_fraction, 0, 0, max(1, force) * dir * damage_fraction, dtype, hit.species, this);
- if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit) // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
+ // Avoid self-damage (except after going through a warp)
+ // avoid hitting the same entity twice (engine bug)
+ if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit)
{
fireBullet_last_hit = hit;
yoda = 0;
headshot = true;
}
bool gooddamage = accuracy_isgooddamage(this, hit);
- Damage(hit, this, this, damage * damage_fraction, dtype, weaponentity, start, force * dir * damage_fraction);
+
+ float dealt_damage = damage * damage_fraction;
+ vector dealt_force = force * dir * damage_fraction;
+
+ if (falloff_halflife || falloff_forcehalflife)
+ {
+ // start, end and trace_endpos seem unreliable for
+ // falloff calculations, using `entity.origin`s instead.
+ // dist is only used to measure distance between shooter
+ // and target entities and do math based on the distance
+ // target's location = hit.origin
+ // shooter's location = this.origin
+ float dist = vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hit.origin) - this.origin);
+
+ if (falloff_halflife)
+ dealt_damage *= ExponentialFalloff(falloff_mindist, falloff_maxdist, falloff_halflife, dist);
+
+ if (falloff_forcehalflife)
+ dealt_force *= ExponentialFalloff(falloff_mindist, falloff_maxdist, falloff_forcehalflife, dist);
+ }
+
+ Damage(hit, this, this, dealt_damage, dtype, weaponentity, start, dealt_force);
+
// calculate hits for ballistic weapons
if(gooddamage)
{
this.dphitcontentsmask = oldsolid;
}
+void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect, bool do_antilag)
+{
+ fireBullet_falloff(this, weaponentity, start, dir, spread, max_solid_penetration, damage, 0, 0, 0, headshot_multiplier, force, 0, dtype, tracer_effect, do_antilag);
+}
+
void fireBullet(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect)
{
fireBullet_antilag(this, weaponentity, start, dir, spread, max_solid_penetration, damage, headshot_multiplier, force, dtype, tracer_effect, true);