]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Mario/droptofloor_outofsolid' into 'master'
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 2 Dec 2022 17:27:34 +0000 (17:27 +0000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 2 Dec 2022 17:27:34 +0000 (17:27 +0000)
Make sv_gameplayfix_droptofloorstartsolid_nudgetocorrect functional again

Closes #2774

See merge request xonotic/xonotic-data.pk3dir!1084

qcsrc/server/world.qc
qcsrc/server/world.qh

index a54ad9aa792ebbfd07ab3c85d0ed24ce052e0ae3..cdc7d3169816a6548b37d4b4b02112ef18fa7e9d 100644 (file)
@@ -22,6 +22,7 @@
 #include <common/util.qh>
 #include <common/vehicles/all.qh>
 #include <common/weapons/_all.qh>
+#include <lib/warpzone/common.qh>
 #include <server/anticheat.qh>
 #include <server/antilag.qh>
 #include <server/bot/api.qh>
@@ -2260,9 +2261,9 @@ void DropToFloor_Handler(entity this)
 
        vector end = this.origin - '0 0 256';
 
-       // NOTE: NudgeOutOfSolid support is not added as Xonotic's physics do not use it!
-       //if(autocvar_sv_gameplayfix_droptofloorstartsolid_nudgetocorrect)
-               //SV_NudgeOutOfSolid(this);
+       // NOTE: SV_NudgeOutOfSolid is used in the engine here
+       if(autocvar_sv_gameplayfix_droptofloorstartsolid_nudgetocorrect)
+               move_out_of_solid(this);
 
        tracebox(this.origin, this.mins, this.maxs, end, MOVE_NORMAL, this);
 
@@ -2284,9 +2285,9 @@ void DropToFloor_Handler(entity this)
                else if(trace_fraction < 1)
                {
                        LOG_DEBUGF("DropToFloor_Handler: %v fixed badly placed entity", this.origin);
-                       //if(autocvar_sv_gameplayfix_droptofloorstartsolid_nudgetocorrect)
-                               //SV_NudgeOutOfSolid(this);
                        setorigin(this, trace_endpos);
+                       if(autocvar_sv_gameplayfix_droptofloorstartsolid_nudgetocorrect)
+                               move_out_of_solid(this);
                        SET_ONGROUND(this);
                        this.groundentity = trace_ent;
                        // if support is destroyed, keep suspended (gross hack for floating items in various maps)
@@ -2303,6 +2304,12 @@ void DropToFloor_Handler(entity this)
                        // if support is destroyed, keep suspended (gross hack for floating items in various maps)
                        this.move_suspendedinair = true;
                }
+               else
+               {
+                       // if we can't get the entity out of solid, mark it as on ground so physics doesn't attempt to drop it
+                       // hacky workaround for #2774
+                       SET_ONGROUND(this);
+               }
        }
        this.dropped_origin = this.origin;
 }
index 57b240d2abe0985a703ec0f8d12cf6d8c3b5219b..271f394adaa91c84f801a48db1856032781ca485 100644 (file)
@@ -28,6 +28,7 @@ float autocvar_timelimit_overtime;
 int autocvar_timelimit_overtimes;
 float autocvar_timelimit_suddendeath;
 bool autocvar_sv_gameplayfix_droptofloorstartsolid;
+bool autocvar_sv_gameplayfix_droptofloorstartsolid_nudgetocorrect;
 
 float checkrules_equality;
 float checkrules_suddendeathwarning;