]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - phys.c
cmd: reinstate execution of aliases with the same name as a command
[xonotic/darkplaces.git] / phys.c
diff --git a/phys.c b/phys.c
index 1e602a1ffbe72013669221e7c31bea1629f77cb8..7128ea3ddc9a440dc42b88bd581ebd0dcd824c9a 100644 (file)
--- a/phys.c
+++ b/phys.c
@@ -12,7 +12,6 @@ int PHYS_NudgeOutOfSolid(prvm_prog_t *prog, prvm_edict_t *ent)
        trace_t stucktrace;
        vec3_t stuckorigin;
        vec3_t stuckmins, stuckmaxs;
-       vec_t nudge;
        vec_t separation;
        model_t *worldmodel;
 
@@ -55,14 +54,17 @@ int PHYS_NudgeOutOfSolid(prvm_prog_t *prog, prvm_edict_t *ent)
                        else
                                stucktrace = CL_TraceBox(stuckorigin, stuckmins, stuckmaxs, stuckorigin, pass ? MOVE_WORLDONLY : MOVE_NOMONSTERS, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value, pass ? false : true, false, NULL, false);
 
-                       if (!stucktrace.bmodelstartsolid || stucktrace.startdepth >= 0)
+                       // Separation compared here to ensure a good location will be recognised reliably.
+                       if (-stucktrace.startdepth <= separation
+                       || (!stucktrace.bmodelstartsolid && !stucktrace.worldstartsolid)
+                       || (pass && !stucktrace.worldstartsolid))
                        {
                                // found a good location, use it
                                VectorCopy(stuckorigin, PRVM_serveredictvector(ent, origin));
                                return bump || pass ? 1 : -1; // -1 means it wasn't stuck
                        }
-                       nudge = -stucktrace.startdepth;
-                       VectorMA(stuckorigin, nudge, stucktrace.startdepthnormal, stuckorigin);
+
+                       VectorMA(stuckorigin, -stucktrace.startdepth, stucktrace.startdepthnormal, stuckorigin);
                }
        }
        return 0;