From eaabc6b3a85dd0aec1e8c7619b84561c55d1d121 Mon Sep 17 00:00:00 2001 From: cypress Date: Sun, 24 Dec 2023 17:34:00 -0500 Subject: [PATCH] SERVER: Fix PlayerIsLooking() when inside of bounding box --- source/server/clientfuncs.qc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/server/clientfuncs.qc b/source/server/clientfuncs.qc index 9e6b270..2bcdf16 100644 --- a/source/server/clientfuncs.qc +++ b/source/server/clientfuncs.qc @@ -729,10 +729,17 @@ float(entity them, entity me) PlayerIsLooking = vector source; makevectors (them.v_angle); source = them.origin + them.view_ofs; - traceline (source, source + v_forward*500, 0, them); - if (trace_ent == me) + // Standard 'are we facing' test.. + traceline(source, source + v_forward*50, 0, them); + + // We're inside of an object.. is it the target? + if (trace_startsolid) { + if (v_forward*normalize(me.origin - them.origin) > 0.7) + ret = true; + } else if (trace_ent == me) { ret = true; + } me.solid = old_solid; setorigin(me, me.origin);