{
public abstract partial class ExamineSystemShared : EntitySystem
{
+ [Dependency] private readonly OccluderSystem _occluder = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
length = MaxRaycastRange;
}
- var occluderSystem = Get<OccluderSystem>();
- IoCManager.Resolve(ref entMan);
-
var ray = new Ray(origin.Position, dir.Normalized());
- var rayResults = occluderSystem
- .IntersectRayWithPredicate(origin.MapId, ray, length, state, predicate, false).ToList();
+ var rayResults = _occluder
+ .IntersectRayWithPredicate(origin.MapId, ray, length, state, predicate, false);
if (rayResults.Count == 0) return true;
foreach (var result in rayResults)
{
- if (!entMan.TryGetComponent(result.HitEntity, out OccluderComponent? o))
+ if (!TryComp(result.HitEntity, out OccluderComponent? o))
{
continue;
}
var bBox = o.BoundingBox;
- bBox = bBox.Translated(entMan.GetComponent<TransformComponent>(result.HitEntity).WorldPosition);
+ bBox = bBox.Translated(_transform.GetWorldPosition(result.HitEntity));
if (bBox.Contains(origin.Position) || bBox.Contains(other.Position))
{
public bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
{
- var entMan = IoCManager.Resolve<IEntityManager>();
var originPos = _transform.GetMapCoordinates(origin);
var otherPos = _transform.GetMapCoordinates(other);
public bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
{
- var entMan = IoCManager.Resolve<IEntityManager>();
var originPos = _transform.GetMapCoordinates(origin);
- var otherPos = other.ToMap(entMan, _transform);
+ var otherPos = _transform.ToMapCoordinates(other);
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
}
public bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
{
- var entMan = IoCManager.Resolve<IEntityManager>();
var originPos = _transform.GetMapCoordinates(origin);
return InRangeUnOccluded(originPos, other, range, predicate, ignoreInsideBlocker);
}
var hasDescription = false;
+ var metadata = MetaData(entity);
//Add an entity description if one is declared
- if (!string.IsNullOrEmpty(EntityManager.GetComponent<MetaDataComponent>(entity).EntityDescription))
+ if (!string.IsNullOrEmpty(metadata.EntityDescription))
{
- message.AddText(EntityManager.GetComponent<MetaDataComponent>(entity).EntityDescription);
+ message.AddText(metadata.EntityDescription);
hasDescription = true;
}