Raycast has an overload for predicates, various fixes (#848)
This commit is contained in:
committed by
GitHub
parent
a535567317
commit
55c54e415b
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user