Raycast has an overload for predicates, various fixes (#848)

This commit is contained in:
Víctor Aguilera Puerto
2020-04-25 11:37:59 +02:00
committed by GitHub
parent a535567317
commit 55c54e415b
3 changed files with 34 additions and 10 deletions

View File

@@ -1,13 +1,15 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Mobs;
using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
namespace Content.Shared.GameObjects.EntitySystems
{
public abstract class ExamineSystemShared : EntitySystem
{
public const float ExamineRange = 8f;
public const float ExamineRange = 16f;
public const float ExamineRangeSquared = ExamineRange * ExamineRange;
[Pure]
@@ -28,8 +30,10 @@ namespace Content.Shared.GameObjects.EntitySystems
return false;
}
var delta = examined.Transform.WorldPosition - examiner.Transform.WorldPosition;
return delta.LengthSquared <= ExamineRangeSquared;
return IoCManager.Resolve<IEntitySystemManager>()
.GetEntitySystem<SharedInteractionSystem>()
.InRangeUnobstructed(examiner.Transform.MapPosition, examined.Transform.MapPosition.Position,
ExamineRange, predicate: entity => entity == examiner || entity == examined, insideBlockerValid:true);
}
}
}