]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Set groundentity when sv_gameplayfix_downtracesupportsongroundflag detects a floor
authorbones_was_here <bones_was_here@xa.org.au>
Sun, 9 Jan 2022 11:31:12 +0000 (21:31 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 9 Jan 2022 12:35:25 +0000 (22:35 +1000)
Fixes movers not carrying players who walk onto them with no z
velocity, when sv_gameplayfix_nogravityonground is enabled

Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/22
sv_gameplayfix_nogravityonground 1 prevents movers from detecting players #22

Signed-off-by: bones_was_here <bones_was_here@xa.org.au>
sv_main.c
sv_phys.c

index ba0c5d525e3416d05719684870a7120802f7e0a7..c39069eb5b8f81926a63e0bf9f2c5893a777de07 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -122,7 +122,7 @@ cvar_t sv_gameplayfix_stepmultipletimes = {CF_SERVER, "sv_gameplayfix_stepmultip
 cvar_t sv_gameplayfix_nostepmoveonsteepslopes = {CF_SERVER, "sv_gameplayfix_nostepmoveonsteepslopes", "0", "crude fix which prevents MOVETYPE_STEP (not swimming or flying) to move on slopes whose angle is bigger than 45 degree"};
 cvar_t sv_gameplayfix_swiminbmodels = {CF_SERVER, "sv_gameplayfix_swiminbmodels", "1", "causes pointcontents (used to determine if you are in a liquid) to check bmodel entities as well as the world model, so you can swim around in (possibly moving) water bmodel entities"};
 cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag = {CF_SERVER, "sv_gameplayfix_upwardvelocityclearsongroundflag", "1", "prevents monsters, items, and most other objects from being stuck to the floor when pushed around by damage, and other situations in mods"};
-cvar_t sv_gameplayfix_downtracesupportsongroundflag = {CF_SERVER, "sv_gameplayfix_downtracesupportsongroundflag", "1", "prevents very short moves from clearing onground (which may make the player stick to the floor at high netfps)"};
+cvar_t sv_gameplayfix_downtracesupportsongroundflag = {CF_SERVER, "sv_gameplayfix_downtracesupportsongroundflag", "1", "prevents very short moves from clearing onground (which may make the player stick to the floor at high netfps), fixes groundentity not being set when walking onto a mover with sv_gameplayfix_nogravityonground"};
 cvar_t sv_gameplayfix_q1bsptracelinereportstexture = {CF_SERVER, "sv_gameplayfix_q1bsptracelinereportstexture", "1", "enables mods to get accurate trace_texture results on q1bsp by using a surface-hitting traceline implementation rather than the standard solidbsp method, q3bsp always reports texture accurately"};
 cvar_t sv_gameplayfix_unstickplayers = {CF_SERVER, "sv_gameplayfix_unstickplayers", "1", "big hack to try and fix the rare case of MOVETYPE_WALK entities getting stuck in the world clipping hull."};
 cvar_t sv_gameplayfix_unstickentities = {CF_SERVER, "sv_gameplayfix_unstickentities", "1", "hack to check if entities are crossing world collision hull and try to move them to the right position"};
index a918ea25603c7145aa59e09174643011a5e22152..b26ebe225e90f6020e8411a7d6491565605a320b 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -2350,7 +2350,11 @@ static void SV_WalkMove (prvm_edict_t *ent)
                VectorCopy(PRVM_serveredictvector(ent, maxs), entmaxs);
                trace = SV_TraceBox(upmove, entmins, entmaxs, downmove, type, ent, SV_GenericHitSuperContentsMask(ent), skipsupercontentsmask, skipmaterialflagsmask, collision_extendmovelength.value);
                if(trace.fraction < 1 && trace.plane.normal[2] > 0.7)
+               {
                        clip |= 1; // but we HAVE found a floor
+                       // set groundentity so we get carried when walking onto a mover with sv_gameplayfix_nogravityonground
+                       PRVM_serveredictedict(ent, groundentity) = PRVM_EDICT_TO_PROG(trace.ent);
+               }
        }
 
        // if the move did not hit the ground at any point, we're not on ground