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.

This commit is contained in:
Marco Cawthorne 2022-05-27 14:55:33 -07:00
parent ae23af60d8
commit 73c762e875
Signed by: eukara
GPG key ID: CE2032F0A2882A22

View file

@ -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);
}