]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
prevent fall damage from dropship drops more reliably
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 24 Jan 2022 15:25:57 +0000 (16:25 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 24 Jan 2022 15:25:57 +0000 (16:25 +0100)
qcsrc/common/gamemodes/gamemode/br/br.qh
qcsrc/common/gamemodes/gamemode/br/sv_br.qc

index 046f9554e87fd9fb69fbb6ca091ce63dfa5d740a..1d9b7162ab7e6c02b941f2969e384cb81e565f83 100644 (file)
@@ -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
index 650b0280ef9534d9e7d2acfe9e6f0719f9ca81b2..2a84d6e9512337faf7c3d707f4b575831443e5ae 100644 (file)
@@ -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)
             {