Fix ignoreInsideBlocker not working correctly for inRangeUnobstructed and inRangeUnoccluded (#2417)
* Fix ignoreInsideBlocker not working correctly for range checks * Other way around
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Physics;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
@@ -132,9 +133,24 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
|
||||
if (!ignoreInsideBlocker) return false;
|
||||
|
||||
if (rayResults.Count <= 0) return false;
|
||||
foreach (var result in rayResults)
|
||||
{
|
||||
if (!result.HitEntity.TryGetComponent(out IPhysicsComponent p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return (rayResults[0].HitPos - other.Position).Length < 1f;
|
||||
var bBox = p.WorldAABB;
|
||||
|
||||
if (bBox.Contains(origin.Position) || bBox.Contains(other.Position))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user