Fix hitting through directional windows (and more!) (#34793)
This commit is contained in:
@@ -667,7 +667,8 @@ namespace Content.Shared.Interaction
|
||||
float range = InteractionRange,
|
||||
CollisionGroup collisionMask = InRangeUnobstructedMask,
|
||||
Ignored? predicate = null,
|
||||
bool popup = false)
|
||||
bool popup = false,
|
||||
bool overlapCheck = true)
|
||||
{
|
||||
if (!Resolve(other, ref other.Comp))
|
||||
return false;
|
||||
@@ -687,7 +688,8 @@ namespace Content.Shared.Interaction
|
||||
range,
|
||||
collisionMask,
|
||||
predicate,
|
||||
popup);
|
||||
popup,
|
||||
overlapCheck);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -717,6 +719,7 @@ namespace Content.Shared.Interaction
|
||||
/// <returns>
|
||||
/// True if the two points are within a given range without being obstructed.
|
||||
/// </returns>
|
||||
/// <param name="overlapCheck">If true, if the broadphase query returns an overlap (0f distance) this function will early out true with no raycast made.</param>
|
||||
public bool InRangeUnobstructed(
|
||||
Entity<TransformComponent?> origin,
|
||||
Entity<TransformComponent?> other,
|
||||
@@ -725,7 +728,8 @@ namespace Content.Shared.Interaction
|
||||
float range = InteractionRange,
|
||||
CollisionGroup collisionMask = InRangeUnobstructedMask,
|
||||
Ignored? predicate = null,
|
||||
bool popup = false)
|
||||
bool popup = false,
|
||||
bool overlapCheck = true)
|
||||
{
|
||||
Ignored combinedPredicate = e => e == origin.Owner || (predicate?.Invoke(e) ?? false);
|
||||
var inRange = true;
|
||||
@@ -768,7 +772,7 @@ namespace Content.Shared.Interaction
|
||||
inRange = false;
|
||||
}
|
||||
// Overlap, early out and no raycast.
|
||||
else if (distance.Equals(0f))
|
||||
else if (overlapCheck && distance.Equals(0f))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user