]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Add sv_gameplayfix_nosquashentities to control entity hitbox squashing (#170) master
authorJames O'Neill <hemebond@gmail.com>
Fri, 8 Nov 2024 13:18:34 +0000 (22:18 +0900)
committerGitHub <noreply@github.com>
Fri, 8 Nov 2024 13:18:34 +0000 (08:18 -0500)
Adds new cvar `sv_gameplayfix_nosquashentities` which, when enabled,
will prevent entity hitboxes being resized when the entity is squashed
by a mover. This means the entity can continue to interact with pushers
and movers. Fixes #155.

server.h
sv_main.c
sv_phys.c

index 26ba7e696d858c8be4a285989b7a42ba2393f47e..9c442c96b9bac16faa00c5d6ce08d789de39d51f 100644 (file)
--- a/server.h
+++ b/server.h
@@ -465,6 +465,7 @@ extern cvar_t sv_gameplayfix_q1bsptracelinereportstexture;
 extern cvar_t sv_gameplayfix_unstickplayers;
 extern cvar_t sv_gameplayfix_unstickentities;
 extern cvar_t sv_gameplayfix_fixedcheckwatertransition;
+extern cvar_t sv_gameplayfix_nosquashentities;
 extern cvar_t sv_gravity;
 extern cvar_t sv_idealpitchscale;
 extern cvar_t sv_jumpstep;
index 75ee16593ae950dec93f6bc991447eb211fc8ffa..f75a8d25cd47770d4e0dffbd59c5c2733c8fa5ac 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -130,6 +130,7 @@ cvar_t sv_gameplayfix_q1bsptracelinereportstexture = {CF_SERVER, "sv_gameplayfix
 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. Quake did something similar."};
 cvar_t sv_gameplayfix_unstickentities = {CF_SERVER, "sv_gameplayfix_unstickentities", "0", "hack to check if entities are crossing world collision hull and try to move them to the right position. Quake didn't do this so maps shouldn't depend on it."};
 cvar_t sv_gameplayfix_fixedcheckwatertransition = {CF_SERVER, "sv_gameplayfix_fixedcheckwatertransition", "1", "fix two very stupid bugs in SV_CheckWaterTransition when watertype is CONTENTS_EMPTY (the bugs causes waterlevel to be 1 on first frame, -1 on second frame - the fix makes it 0 on both frames)"};
+cvar_t sv_gameplayfix_nosquashentities = {CF_SERVER, "sv_gameplayfix_nosquashentities", "0", "Entity hitboxes will not be resized or disabled when they are crushed by movers, and will continue to be affected by movers."};
 cvar_t sv_gravity = {CF_SERVER | CF_NOTIFY, "sv_gravity","800", "how fast you fall (512 = roughly earth gravity)"};
 cvar_t sv_init_frame_count = {CF_SERVER, "sv_init_frame_count", "2", "number of frames to run to allow everything to settle before letting clients connect"};
 cvar_t sv_idealpitchscale = {CF_SERVER, "sv_idealpitchscale","0.8", "how much to look up/down slopes and stairs when not using freelook"};
@@ -617,6 +618,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_gameplayfix_unstickplayers);
        Cvar_RegisterVariable (&sv_gameplayfix_unstickentities);
        Cvar_RegisterVariable (&sv_gameplayfix_fixedcheckwatertransition);
+       Cvar_RegisterVariable (&sv_gameplayfix_nosquashentities);
        Cvar_RegisterVariable (&sv_qcstats);
        Cvar_RegisterVariable (&sv_gravity);
        Cvar_RegisterVariable (&sv_init_frame_count);
index dbfc1baaa7cd37e70586d4ad025d102fa660b26f..e67f518c52b8e38852cff6588db312d90ba5696d 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1771,7 +1771,7 @@ static void SV_PushMove (prvm_edict_t *pusher, float movetime)
                        //trace = SV_TraceBox(PRVM_serveredictvector(check, origin), PRVM_serveredictvector(check, mins), PRVM_serveredictvector(check, maxs), PRVM_serveredictvector(check, origin), MOVE_NOMONSTERS, check, checkcontents);
                        if (!trace.startsolid)
                        {
-                               //Con_Printf("- not in solid\n");
+                               // Con_Printf("- not in solid\n");
                                continue;
                        }
                }
@@ -1859,8 +1859,13 @@ static void SV_PushMove (prvm_edict_t *pusher, float movetime)
                        if (PRVM_serveredictfloat(check, solid) == SOLID_NOT || PRVM_serveredictfloat(check, solid) == SOLID_TRIGGER)
                        {
                                // corpse
-                               PRVM_serveredictvector(check, mins)[0] = PRVM_serveredictvector(check, mins)[1] = 0;
-                               VectorCopy (PRVM_serveredictvector(check, mins), PRVM_serveredictvector(check, maxs));
+                               if (sv_gameplayfix_nosquashentities.integer == 0)
+                               {
+                                       // When sv_gameplayfix_nosquashentities is disabled, entity hitboxes will be squashed when
+                                       // the entity is crushed by a mover, preventing it from being interacted with again
+                                       PRVM_serveredictvector(check, mins)[0] = PRVM_serveredictvector(check, mins)[1] = 0;
+                                       VectorCopy (PRVM_serveredictvector(check, mins), PRVM_serveredictvector(check, maxs));
+                               }
                                continue;
                        }