Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sv_gameplayfix_nosquashentities to control entity hitbox squashing #170

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ cvar_t sv_gameplayfix_q1bsptracelinereportstexture = {CF_SERVER, "sv_gameplayfix
cvar_t sv_gameplayfix_unstickplayers = {CF_SERVER, "sv_gameplayfix_unstickplayers", "0", "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, superseded by sv_gameplayfix_nudgeoutofsolid"};
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"};
Expand Down Expand Up @@ -612,6 +613,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);
Expand Down
11 changes: 8 additions & 3 deletions sv_phys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,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;
}
}
Expand Down Expand Up @@ -1934,8 +1934,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;
}

Expand Down