From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Mon, 24 Jan 2022 15:25:57 +0000 (+0100) Subject: prevent fall damage from dropship drops more reliably X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8c72160419be8a09fdd80ccbbafa5f704a7c7049;p=xonotic%2Fxonotic-data.pk3dir.git prevent fall damage from dropship drops more reliably --- diff --git a/qcsrc/common/gamemodes/gamemode/br/br.qh b/qcsrc/common/gamemodes/gamemode/br/br.qh index 046f9554e..1d9b7162a 100644 --- a/qcsrc/common/gamemodes/gamemode/br/br.qh +++ b/qcsrc/common/gamemodes/gamemode/br/br.qh @@ -69,6 +69,7 @@ REGISTER_GAMETYPE(BR, NEW(BattleRoyale)); #ifdef GAMEQC const int DROP_LANDED = 0; -const int DROP_FALLING = 1; -const int DROP_TRANSPORT = 2; +const int DROP_LANDING = 1; // intermediate frame between falling and landed, makes sure player takes no fall damage +const int DROP_FALLING = 2; +const int DROP_TRANSPORT = 3; #endif diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc index 650b0280e..2a84d6e95 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc @@ -415,6 +415,10 @@ MUTATOR_HOOKFUNCTION(br, PM_Physics) if(STAT(DROP, player) == DROP_TRANSPORT) return true; + // set the drop stat to landed on the next frame if it was set on landing + if(STAT(DROP, player) == DROP_LANDING) + STAT(DROP, player) = DROP_LANDED; + // TODO: improve dropping physics if(STAT(DROP, player) == DROP_FALLING){ if(!IS_ONGROUND(player) && ((tracebox(player.origin, player.mins, player.maxs, player.origin - '0 0 1', MOVE_NOMONSTERS, player), trace_fraction) >= 1)) // IS_ONGROUND doesn't work if jump is held (jump is theoretically blocked until landed) @@ -473,7 +477,7 @@ MUTATOR_HOOKFUNCTION(br, PM_Physics) } else { - STAT(DROP, player) = DROP_LANDED; + STAT(DROP, player) = DROP_LANDING; ITEMS_STAT(player) &= ~IT_USING_JETPACK; player.flags |= FL_PICKUPITEMS; player.dphitcontentsmask |= DPCONTENTS_BODY; @@ -504,7 +508,7 @@ MUTATOR_HOOKFUNCTION(br, Damage_Calculate) if(STAT(DROP, target) == DROP_TRANSPORT) M_ARGV(4, float) = M_ARGV(5, float) = 0; // can't take damage while on the dropship - else if(STAT(DROP, target) == DROP_FALLING) + else { switch(deathtype) {