From 45842aab87799aacc3664f61f6bd74edfbe5ecc8 Mon Sep 17 00:00:00 2001 From: Lucasgood <65530145+Lucasgood5@users.noreply.github.com> Date: Sat, 28 Feb 2026 12:06:32 +0100 Subject: [PATCH 1/3] Fixing User Interaction Distance Gard Sync This commit fix desync from the check between Serverside CanPlayerInteractEntity and ClienSide ShowEntityMenu. The issue was that client side, we were checking distance by using a trace of 96u. Trace take origin from eye and stop at collision box. Serverside, the anti cheat check was comparing distance of entity. But this was starting by foot up to entity center. Meaning that if the entity was above, or with large entity, the client would think it is in range but the server said no. This commit make both check use the same methods (trace). Fixing the issue at the origin of #483 without adding any configuration requirement. This commit doesn't edit but is also related to https://github.com/NebulousCloud/helix/blob/e35c691d630eda7693aef17d92015586294f95e6/gamemode/core/hooks/cl_hooks.lua#L737-L748 --- gamemode/core/hooks/sv_hooks.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gamemode/core/hooks/sv_hooks.lua b/gamemode/core/hooks/sv_hooks.lua index 32720d6bb..db0cf8c8f 100644 --- a/gamemode/core/hooks/sv_hooks.lua +++ b/gamemode/core/hooks/sv_hooks.lua @@ -146,7 +146,13 @@ function GM:KeyRelease(client, key) end function GM:CanPlayerInteractEntity(client, entity, option, data) - return entity:GetPos():DistToSqr(client:GetPos()) <= 96 ^ 2 + local lookedEntity = util.TraceLine({ + start = client:GetShootPos(), + endpos = client:GetShootPos() + client:GetAimVector() * 96, + filter = client + }) + if (!IsValid(lookedEntity.Entity)) then return false end + return (entity == lookedEntity.Entity) end function GM:CanPlayerInteractItem(client, action, item, data) From 2f98aab4f474e53fb78159a44c0761a23a72fa31 Mon Sep 17 00:00:00 2001 From: Lucasgood <65530145+Lucasgood5@users.noreply.github.com> Date: Sat, 28 Feb 2026 12:13:06 +0100 Subject: [PATCH 2/3] Refactored to avoid duplicate call to client:GetShootPos() just a little cleanner i guess Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- gamemode/core/hooks/sv_hooks.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gamemode/core/hooks/sv_hooks.lua b/gamemode/core/hooks/sv_hooks.lua index db0cf8c8f..862cd8cf1 100644 --- a/gamemode/core/hooks/sv_hooks.lua +++ b/gamemode/core/hooks/sv_hooks.lua @@ -146,9 +146,10 @@ function GM:KeyRelease(client, key) end function GM:CanPlayerInteractEntity(client, entity, option, data) + local start = client:GetShootPos() local lookedEntity = util.TraceLine({ - start = client:GetShootPos(), - endpos = client:GetShootPos() + client:GetAimVector() * 96, + start = start, + endpos = start + client:GetAimVector() * 96, filter = client }) if (!IsValid(lookedEntity.Entity)) then return false end From eb85b2171f1ca87b530fd286bfc85a16f66a67b2 Mon Sep 17 00:00:00 2001 From: Lucasgood <65530145+Lucasgood5@users.noreply.github.com> Date: Sat, 28 Feb 2026 12:13:42 +0100 Subject: [PATCH 3/3] Better traceResult Naming Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- gamemode/core/hooks/sv_hooks.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gamemode/core/hooks/sv_hooks.lua b/gamemode/core/hooks/sv_hooks.lua index 862cd8cf1..710afecaa 100644 --- a/gamemode/core/hooks/sv_hooks.lua +++ b/gamemode/core/hooks/sv_hooks.lua @@ -147,13 +147,13 @@ end function GM:CanPlayerInteractEntity(client, entity, option, data) local start = client:GetShootPos() - local lookedEntity = util.TraceLine({ - start = start, - endpos = start + client:GetAimVector() * 96, + local traceResult = util.TraceLine({ + start = client:GetShootPos(), + endpos = client:GetShootPos() + client:GetAimVector() * 96, filter = client }) - if (!IsValid(lookedEntity.Entity)) then return false end - return (entity == lookedEntity.Entity) + if (!IsValid(traceResult.Entity)) then return false end + return (entity == traceResult.Entity) end function GM:CanPlayerInteractItem(client, action, item, data)