From d7822b48dc834b170a7487609cfe925e29702dfc Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 29 Dec 2019 01:33:36 +1000 Subject: [PATCH] Add an option to only account for vertical travel when calculating fall damage --- balance-mario.cfg | 1 + balance-nexuiz25.cfg | 1 + balance-overkill.cfg | 1 + balance-samual.cfg | 1 + balance-testing.cfg | 1 + balance-testingxpm.cfg | 1 + balance-xdf.cfg | 1 + balance-xonotic.cfg | 1 + balance-xpm.cfg | 1 + qcsrc/server/autocvars.qh | 1 + qcsrc/server/sv_main.qc | 6 +++++- 11 files changed, 15 insertions(+), 1 deletion(-) diff --git a/balance-mario.cfg b/balance-mario.cfg index 1974ad6c8..de22d1f7b 100644 --- a/balance-mario.cfg +++ b/balance-mario.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-nexuiz25.cfg b/balance-nexuiz25.cfg index 73c63df9b..81c786ed6 100644 --- a/balance-nexuiz25.cfg +++ b/balance-nexuiz25.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 150 set g_balance_falldamage_minspeed 1400 set g_balance_falldamage_factor 0.15 set g_balance_falldamage_maxdamage 25 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 0 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-overkill.cfg b/balance-overkill.cfg index 0e929ee74..28f8f17d7 100644 --- a/balance-overkill.cfg +++ b/balance-overkill.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-samual.cfg b/balance-samual.cfg index 9bcb976b6..f98731e01 100644 --- a/balance-samual.cfg +++ b/balance-samual.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-testing.cfg b/balance-testing.cfg index 96426aaa5..960211605 100644 --- a/balance-testing.cfg +++ b/balance-testing.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-testingxpm.cfg b/balance-testingxpm.cfg index 4fa3130f0..4ee3f36cd 100644 --- a/balance-testingxpm.cfg +++ b/balance-testingxpm.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-xdf.cfg b/balance-xdf.cfg index 6a1622c2c..e866bd11d 100644 --- a/balance-xdf.cfg +++ b/balance-xdf.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-xonotic.cfg b/balance-xonotic.cfg index e19872454..2666108f4 100644 --- a/balance-xonotic.cfg +++ b/balance-xonotic.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/balance-xpm.cfg b/balance-xpm.cfg index c722638b1..bcd584878 100644 --- a/balance-xpm.cfg +++ b/balance-xpm.cfg @@ -185,6 +185,7 @@ set g_balance_falldamage_deadminspeed 250 set g_balance_falldamage_minspeed 900 set g_balance_falldamage_factor 0.20 set g_balance_falldamage_maxdamage 40 +set g_balance_falldamage_onlyvertical 0 set g_balance_damagepush_speedfactor 2.5 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage set g_balance_contents_drowndelay 10 // time under water before a player begins drowning diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index a783d7231..415fedab8 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -39,6 +39,7 @@ float autocvar_g_balance_falldamage_deadminspeed; float autocvar_g_balance_falldamage_factor; int autocvar_g_balance_falldamage_maxdamage; float autocvar_g_balance_falldamage_minspeed; +bool autocvar_g_balance_falldamage_onlyvertical; int autocvar_g_balance_firetransfer_damage; int autocvar_g_balance_firetransfer_time; float autocvar_g_balance_fuel_limit; diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 345b7fdb8..cd4693a2b 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -114,7 +114,11 @@ void CreatureFrame_FallDamage(entity this) } if(!have_hook) { - float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. + float dm; + if(autocvar_g_balance_falldamage_onlyvertical) + dm = vlen('0 0 1' * this.oldvelocity.z) - vlen('0 0 1' * this.velocity.z); + else + dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. if (IS_DEAD(this)) dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor; else -- 2.39.2