From 73c762e875a10bbf1a18cfe57e63ba253633dd7d Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 27 May 2022 14:55:33 -0700 Subject: [PATCH] NSEntity: Fix for IsVisible(entity), where we wouldn't 'see' the target correctly, as the trace collides with them and isn't returning a fraction of 1.0. --- src/gs-entbase/shared/NSEntity.qc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gs-entbase/shared/NSEntity.qc b/src/gs-entbase/shared/NSEntity.qc index fb606b01..f6c71612 100644 --- a/src/gs-entbase/shared/NSEntity.qc +++ b/src/gs-entbase/shared/NSEntity.qc @@ -124,15 +124,18 @@ NSEntity::Visible(entity ent) float flFoV; makevectors(angles); - flDelta = normalize (ent.origin - origin); + flDelta = normalize(ent.origin - origin); flFoV = flDelta * v_forward; + /* is it in our field of view? */ if (flFoV > 0.3) { traceline(origin, ent.origin, MOVE_NORMAL, this); - if (trace_fraction == 1.0) { + if (trace_fraction == 1.0 || trace_ent == ent) { + print(sprintf("%s can see %s\n", classname, ent.classname)); return (true); } } + print(sprintf("%s can not see %s\n", classname, ent.classname)); return (false); }