Fix InRangeUnobstructed

I said the opposite of what I meant to say
This commit is contained in:
metalgearsloth
2022-01-30 14:00:11 +11:00
parent a184069070
commit a0b86b76f9

View File

@@ -292,11 +292,17 @@ namespace Content.Shared.Interaction
Ignored? predicate = null,
bool ignoreInsideBlocker = false)
{
if (range > 0f && !origin.InRange(other, range)) return false;
// Have to be on same map regardless.
if (other.MapId != origin.MapId) return false;
// Uhh this does mean we could raycast infinity distance so may need to limit it.
var dir = other.Position - origin.Position;
var lengthSquared = dir.LengthSquared;
if (dir.LengthSquared.Equals(0f)) return true;
if (lengthSquared.Equals(0f)) return true;
// If range specified also check it
if (range > 0f && lengthSquared > range * range) return false;
predicate ??= _ => false;