From 8d08f25f834754bf8df5ffb6eb0c48ba6f0b6d23 Mon Sep 17 00:00:00 2001 From: "Dr. Jaska" Date: Tue, 21 May 2024 18:50:21 +0000 Subject: [PATCH] Add damage and force falloff to shotgun, machinegun, rifle, vaporizer, okmachinegun and okshotgun --- bal-wep-mario.cfg | 28 ++++++++++ bal-wep-nexuiz25.cfg | 28 ++++++++++ bal-wep-samual.cfg | 30 +++++++++- bal-wep-xdf.cfg | 28 ++++++++++ bal-wep-xonotic.cfg | 28 ++++++++++ .../mutators/mutator/overkill/okmachinegun.qc | 12 +++- .../mutators/mutator/overkill/okmachinegun.qh | 4 ++ .../mutators/mutator/overkill/okshotgun.qc | 4 ++ .../mutators/mutator/overkill/okshotgun.qh | 4 ++ qcsrc/common/weapons/weapon/machinegun.qc | 34 +++++++++-- qcsrc/common/weapons/weapon/machinegun.qh | 4 ++ qcsrc/common/weapons/weapon/rifle.qc | 28 +++++++--- qcsrc/common/weapons/weapon/rifle.qh | 20 ++++--- qcsrc/common/weapons/weapon/shotgun.qc | 32 +++++++++-- qcsrc/common/weapons/weapon/shotgun.qh | 4 ++ qcsrc/common/weapons/weapon/vaporizer.qc | 2 +- qcsrc/common/weapons/weapon/vaporizer.qh | 56 ++++++++++--------- qcsrc/common/weapons/weapon/vortex.qh | 2 +- qcsrc/server/weapons/tracing.qc | 40 ++++++++++++- 19 files changed, 332 insertions(+), 56 deletions(-) diff --git a/bal-wep-mario.cfg b/bal-wep-mario.cfg index 25293a947..66b029fea 100644 --- a/bal-wep-mario.cfg +++ b/bal-wep-mario.cfg @@ -36,6 +36,10 @@ set g_balance_shotgun_primary_ammo 1 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 @@ -72,6 +76,10 @@ set g_balance_machinegun_burst_animtime 0.3 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 @@ -446,6 +454,10 @@ set g_balance_porto_weaponthrowable 1 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 @@ -558,6 +570,10 @@ set g_balance_rifle_primary_animtime 0.4 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 @@ -573,6 +589,10 @@ set g_balance_rifle_secondary_animtime 0.3 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 @@ -829,6 +849,10 @@ set g_balance_okhmg_weaponstartoverride 0 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 @@ -955,6 +979,10 @@ set g_balance_okshotgun_primary_animtime 0.65 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 diff --git a/bal-wep-nexuiz25.cfg b/bal-wep-nexuiz25.cfg index 17f5b31ca..ebc0ab772 100644 --- a/bal-wep-nexuiz25.cfg +++ b/bal-wep-nexuiz25.cfg @@ -36,6 +36,10 @@ set g_balance_shotgun_primary_ammo 1 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 @@ -72,6 +76,10 @@ set g_balance_machinegun_burst_animtime 0.75 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 @@ -446,6 +454,10 @@ set g_balance_porto_weaponthrowable 1 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 @@ -558,6 +570,10 @@ set g_balance_rifle_primary_animtime 0.4 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 @@ -573,6 +589,10 @@ set g_balance_rifle_secondary_animtime 0.3 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 @@ -829,6 +849,10 @@ set g_balance_okhmg_weaponstartoverride 0 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 @@ -955,6 +979,10 @@ set g_balance_okshotgun_primary_animtime 0.65 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 diff --git a/bal-wep-samual.cfg b/bal-wep-samual.cfg index 2799a2496..049e080cb 100644 --- a/bal-wep-samual.cfg +++ b/bal-wep-samual.cfg @@ -36,6 +36,10 @@ set g_balance_shotgun_primary_ammo 1 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 @@ -72,6 +76,10 @@ set g_balance_machinegun_burst_animtime 0.3 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 @@ -446,6 +454,10 @@ set g_balance_porto_weaponthrowable 1 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 @@ -558,6 +570,10 @@ set g_balance_rifle_primary_animtime 0.4 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 @@ -573,8 +589,12 @@ set g_balance_rifle_secondary_animtime 0.3 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 @@ -829,6 +849,10 @@ set g_balance_okhmg_weaponstartoverride 0 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 @@ -955,6 +979,10 @@ set g_balance_okshotgun_primary_animtime 0.65 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 diff --git a/bal-wep-xdf.cfg b/bal-wep-xdf.cfg index 491f0db71..70fdb4700 100644 --- a/bal-wep-xdf.cfg +++ b/bal-wep-xdf.cfg @@ -36,6 +36,10 @@ set g_balance_shotgun_primary_ammo 1 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 @@ -72,6 +76,10 @@ set g_balance_machinegun_burst_animtime 0.3 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 @@ -446,6 +454,10 @@ set g_balance_porto_weaponthrowable 1 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 @@ -558,6 +570,10 @@ set g_balance_rifle_primary_animtime 0.4 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 @@ -573,6 +589,10 @@ set g_balance_rifle_secondary_animtime 0.3 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 @@ -829,6 +849,10 @@ set g_balance_okhmg_weaponstartoverride 0 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 @@ -955,6 +979,10 @@ set g_balance_okshotgun_primary_animtime 0.65 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 diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index 29d73a424..1b2a56176 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -36,6 +36,10 @@ set g_balance_shotgun_primary_ammo 1 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 @@ -72,6 +76,10 @@ set g_balance_machinegun_burst_animtime 0.3 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 @@ -446,6 +454,10 @@ set g_balance_porto_weaponthrowable 1 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 @@ -558,6 +570,10 @@ set g_balance_rifle_primary_animtime 0.4 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 @@ -573,6 +589,10 @@ set g_balance_rifle_secondary_animtime 0.3 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 @@ -829,6 +849,10 @@ set g_balance_okhmg_weaponstartoverride 0 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 @@ -955,6 +979,10 @@ set g_balance_okshotgun_primary_animtime 0.65 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 diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc index 0b5fdc7df..e73e63fa1 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc @@ -30,7 +30,17 @@ void W_OverkillMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weap } 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; diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh index 5ec40b7f7..cd1eac827 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh @@ -42,6 +42,10 @@ CLASS(OverkillMachineGun, Weapon) 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) \ diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc index cd1d618a8..7fae9ad30 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc @@ -50,10 +50,14 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea 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; diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh index e70fc4326..094f15688 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh @@ -24,6 +24,10 @@ CLASS(OverkillShotgun, Weapon) 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) \ diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index b05f9f720..efb4913c0 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -5,18 +5,40 @@ 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); @@ -87,7 +109,9 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity } 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; @@ -112,7 +136,9 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit 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); diff --git a/qcsrc/common/weapons/weapon/machinegun.qh b/qcsrc/common/weapons/weapon/machinegun.qh index a4097f947..1b77baaee 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qh +++ b/qcsrc/common/weapons/weapon/machinegun.qh @@ -28,6 +28,10 @@ CLASS(MachineGun, Weapon) 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) \ diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index df3b537c1..265a27b93 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -2,9 +2,20 @@ #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); @@ -18,8 +29,11 @@ void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, float pSpread, flo 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) { @@ -30,12 +44,12 @@ void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, float pSpread, flo 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; diff --git a/qcsrc/common/weapons/weapon/rifle.qh b/qcsrc/common/weapons/weapon/rifle.qh index e5a2cde2b..9b69985a4 100644 --- a/qcsrc/common/weapons/weapon/rifle.qh +++ b/qcsrc/common/weapons/weapon/rifle.qh @@ -28,25 +28,29 @@ CLASS(Rifle, Weapon) 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)); diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 65cc0d9d9..89bdf2a36 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -5,19 +5,27 @@ // 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); @@ -163,10 +171,14 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity 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); } @@ -183,10 +195,14 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity 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); } @@ -224,10 +240,14 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit 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); @@ -244,10 +264,14 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit 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); diff --git a/qcsrc/common/weapons/weapon/shotgun.qh b/qcsrc/common/weapons/weapon/shotgun.qh index 5b200ed58..ca30189fa 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qh +++ b/qcsrc/common/weapons/weapon/shotgun.qh @@ -27,6 +27,10 @@ CLASS(Shotgun, Weapon) 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) \ diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 4066efc4e..00be9c218 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -126,7 +126,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) 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); diff --git a/qcsrc/common/weapons/weapon/vaporizer.qh b/qcsrc/common/weapons/weapon/vaporizer.qh index 83a1660cc..6d582d45b 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qh +++ b/qcsrc/common/weapons/weapon/vaporizer.qh @@ -24,33 +24,37 @@ CLASS(Vaporizer, Weapon) #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) diff --git a/qcsrc/common/weapons/weapon/vortex.qh b/qcsrc/common/weapons/weapon/vortex.qh index 2d80a7a61..ef88c6bd8 100644 --- a/qcsrc/common/weapons/weapon/vortex.qh +++ b/qcsrc/common/weapons/weapon/vortex.qh @@ -42,11 +42,11 @@ CLASS(Vortex, Weapon) 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) \ diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index a8385b686..d531fab51 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -361,7 +361,12 @@ void fireBullet_trace_callback(vector start, vector hit, vector end) 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; @@ -426,7 +431,9 @@ void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector 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; @@ -438,7 +445,29 @@ void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector 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) { @@ -507,6 +536,11 @@ void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector 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); -- 2.39.2