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:
DrSmugleaf
2020-10-28 13:04:29 +01:00
committed by GitHub
parent 03d85cea1d
commit 04cf4d4a20
2 changed files with 37 additions and 4 deletions

View File

@@ -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>