Replace direct IoC.Resolve calls in Unobstructed and Unoccluded extensions (#2225)

* Unobstructed resolves

* Replace direct IoC.Resolve calls from Unobstructed and Unoccluded extensions
This commit is contained in:
DrSmugleaf
2020-10-11 13:32:42 +02:00
committed by GitHub
parent d3d4f7ebe6
commit c84622c3a0
2 changed files with 90 additions and 82 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.GameObjects.EntitySystems; #nullable enable
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Physics; using Content.Shared.Physics;
using Robust.Shared.GameObjects.Systems; using Robust.Shared.GameObjects.Systems;
@@ -20,7 +21,7 @@ namespace Content.Shared.Utility
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -33,7 +34,7 @@ namespace Content.Shared.Utility
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -46,7 +47,7 @@ namespace Content.Shared.Utility
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -61,7 +62,7 @@ namespace Content.Shared.Utility
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -74,7 +75,7 @@ namespace Content.Shared.Utility
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -89,7 +90,7 @@ namespace Content.Shared.Utility
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -104,7 +105,7 @@ namespace Content.Shared.Utility
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -119,7 +120,7 @@ namespace Content.Shared.Utility
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -135,7 +136,7 @@ namespace Content.Shared.Utility
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -150,7 +151,7 @@ namespace Content.Shared.Utility
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -167,7 +168,7 @@ namespace Content.Shared.Utility
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -181,7 +182,7 @@ namespace Content.Shared.Utility
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -196,7 +197,7 @@ namespace Content.Shared.Utility
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -212,7 +213,7 @@ namespace Content.Shared.Utility
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -227,7 +228,7 @@ namespace Content.Shared.Utility
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -244,11 +245,10 @@ namespace Content.Shared.Utility
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); var originPosition = origin.ToMap(other.EntityManager);
var originPosition = origin.ToMap(entityManager);
var otherPosition = other.Transform.MapPosition; var otherPosition = other.Transform.MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
@@ -260,11 +260,10 @@ namespace Content.Shared.Utility
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); var originPosition = origin.ToMap(other.Owner.EntityManager);
var originPosition = origin.ToMap(entityManager);
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
@@ -276,11 +275,10 @@ namespace Content.Shared.Utility
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); var originPosition = origin.ToMap(other.Owner.EntityManager);
var originPosition = origin.ToMap(entityManager);
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
@@ -292,10 +290,12 @@ namespace Content.Shared.Utility
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false,
IEntityManager? entityManager = null)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); entityManager ??= IoCManager.Resolve<IEntityManager>();
var originPosition = origin.ToMap(entityManager); var originPosition = origin.ToMap(entityManager);
var otherPosition = other.ToMap(entityManager); var otherPosition = other.ToMap(entityManager);
@@ -308,10 +308,12 @@ namespace Content.Shared.Utility
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false,
IEntityManager? entityManager = null)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); entityManager ??= IoCManager.Resolve<IEntityManager>();
var originPosition = origin.ToMap(entityManager); var originPosition = origin.ToMap(entityManager);
return SharedInteractionSystem.InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, return SharedInteractionSystem.InRangeUnobstructed(originPosition, other, range, collisionMask, predicate,
@@ -325,7 +327,7 @@ namespace Content.Shared.Utility
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var otherPosition = other.Transform.MapPosition; var otherPosition = other.Transform.MapPosition;
@@ -339,7 +341,7 @@ namespace Content.Shared.Utility
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
@@ -353,7 +355,7 @@ namespace Content.Shared.Utility
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
@@ -367,10 +369,12 @@ namespace Content.Shared.Utility
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false,
IEntityManager? entityManager = null)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); entityManager ??= IoCManager.Resolve<IEntityManager>();
var otherPosition = other.ToMap(entityManager); var otherPosition = other.ToMap(entityManager);
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate, return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
@@ -382,7 +386,7 @@ namespace Content.Shared.Utility
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate, return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate,
@@ -395,7 +399,7 @@ namespace Content.Shared.Utility
this ITargetedInteractEventArgs args, this ITargetedInteractEventArgs args,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -407,7 +411,7 @@ namespace Content.Shared.Utility
this DragDropEventArgs args, this DragDropEventArgs args,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
@@ -419,7 +423,7 @@ namespace Content.Shared.Utility
this AfterInteractEventArgs args, this AfterInteractEventArgs args,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {

View File

@@ -1,4 +1,5 @@
using Content.Shared.GameObjects.EntitySystems; #nullable enable
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components; using Robust.Shared.Interfaces.GameObjects.Components;
@@ -16,7 +17,7 @@ namespace Content.Shared.Utility
this IEntity origin, this IEntity origin,
IEntity other, IEntity other,
float range = ExamineRange, float range = ExamineRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker); return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker);
@@ -26,7 +27,7 @@ namespace Content.Shared.Utility
this IEntity origin, this IEntity origin,
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker); return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker);
@@ -36,7 +37,7 @@ namespace Content.Shared.Utility
this IEntity origin, this IEntity origin,
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var otherEntity = other.Owner; var otherEntity = other.Owner;
@@ -48,7 +49,7 @@ namespace Content.Shared.Utility
this IEntity origin, this IEntity origin,
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker); return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker);
@@ -58,7 +59,7 @@ namespace Content.Shared.Utility
this IEntity origin, this IEntity origin,
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker); return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, ignoreInsideBlocker);
@@ -70,7 +71,7 @@ namespace Content.Shared.Utility
this IComponent origin, this IComponent origin,
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -82,7 +83,7 @@ namespace Content.Shared.Utility
this IComponent origin, this IComponent origin,
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -94,7 +95,7 @@ namespace Content.Shared.Utility
this IComponent origin, this IComponent origin,
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -108,7 +109,7 @@ namespace Content.Shared.Utility
this IComponent origin, this IComponent origin,
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -120,7 +121,7 @@ namespace Content.Shared.Utility
this IComponent origin, this IComponent origin,
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -135,7 +136,7 @@ namespace Content.Shared.Utility
this IContainer origin, this IContainer origin,
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -148,7 +149,7 @@ namespace Content.Shared.Utility
this IContainer origin, this IContainer origin,
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -160,7 +161,7 @@ namespace Content.Shared.Utility
this IContainer origin, this IContainer origin,
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -174,7 +175,7 @@ namespace Content.Shared.Utility
this IContainer origin, this IContainer origin,
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -186,7 +187,7 @@ namespace Content.Shared.Utility
this IContainer origin, this IContainer origin,
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var originEntity = origin.Owner; var originEntity = origin.Owner;
@@ -200,11 +201,10 @@ namespace Content.Shared.Utility
this EntityCoordinates origin, this EntityCoordinates origin,
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); var originPosition = origin.ToMap(other.EntityManager);
var originPosition = origin.ToMap(entityManager);
var otherPosition = other.Transform.MapPosition; var otherPosition = other.Transform.MapPosition;
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
@@ -215,11 +215,10 @@ namespace Content.Shared.Utility
this EntityCoordinates origin, this EntityCoordinates origin,
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); var originPosition = origin.ToMap(other.Owner.EntityManager);
var originPosition = origin.ToMap(entityManager);
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
@@ -230,11 +229,10 @@ namespace Content.Shared.Utility
this EntityCoordinates origin, this EntityCoordinates origin,
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); var originPosition = origin.ToMap(other.Owner.EntityManager);
var originPosition = origin.ToMap(entityManager);
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
@@ -245,10 +243,12 @@ namespace Content.Shared.Utility
this EntityCoordinates origin, this EntityCoordinates origin,
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false,
IEntityManager? entityManager = null)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); entityManager ??= IoCManager.Resolve<IEntityManager>();
var originPosition = origin.ToMap(entityManager); var originPosition = origin.ToMap(entityManager);
var otherPosition = other.ToMap(entityManager); var otherPosition = other.ToMap(entityManager);
@@ -260,10 +260,12 @@ namespace Content.Shared.Utility
this EntityCoordinates origin, this EntityCoordinates origin,
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false,
IEntityManager? entityManager = null)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); entityManager ??= IoCManager.Resolve<IEntityManager>();
var originPosition = origin.ToMap(entityManager); var originPosition = origin.ToMap(entityManager);
return ExamineSystemShared.InRangeUnOccluded(originPosition, other, range, predicate, return ExamineSystemShared.InRangeUnOccluded(originPosition, other, range, predicate,
@@ -276,7 +278,7 @@ namespace Content.Shared.Utility
this MapCoordinates origin, this MapCoordinates origin,
IEntity other, IEntity other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var otherPosition = other.Transform.MapPosition; var otherPosition = other.Transform.MapPosition;
@@ -289,7 +291,7 @@ namespace Content.Shared.Utility
this MapCoordinates origin, this MapCoordinates origin,
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
@@ -302,7 +304,7 @@ namespace Content.Shared.Utility
this MapCoordinates origin, this MapCoordinates origin,
IContainer other, IContainer other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
var otherPosition = other.Owner.Transform.MapPosition; var otherPosition = other.Owner.Transform.MapPosition;
@@ -315,10 +317,12 @@ namespace Content.Shared.Utility
this MapCoordinates origin, this MapCoordinates origin,
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false,
IEntityManager? entityManager = null)
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); entityManager ??= IoCManager.Resolve<IEntityManager>();
var otherPosition = other.ToMap(entityManager); var otherPosition = other.ToMap(entityManager);
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate, return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
@@ -329,7 +333,7 @@ namespace Content.Shared.Utility
this MapCoordinates origin, this MapCoordinates origin,
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate, return ExamineSystemShared.InRangeUnOccluded(origin, other, range, predicate,
@@ -341,7 +345,7 @@ namespace Content.Shared.Utility
public static bool InRangeUnOccluded( public static bool InRangeUnOccluded(
this ITargetedInteractEventArgs args, this ITargetedInteractEventArgs args,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(args, range, predicate, return ExamineSystemShared.InRangeUnOccluded(args, range, predicate,
@@ -351,7 +355,7 @@ namespace Content.Shared.Utility
public static bool InRangeUnOccluded( public static bool InRangeUnOccluded(
this DragDropEventArgs args, this DragDropEventArgs args,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(args, range, predicate, return ExamineSystemShared.InRangeUnOccluded(args, range, predicate,
@@ -361,7 +365,7 @@ namespace Content.Shared.Utility
public static bool InRangeUnOccluded( public static bool InRangeUnOccluded(
this AfterInteractEventArgs args, this AfterInteractEventArgs args,
float range = InteractionRange, float range = InteractionRange,
Ignored predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = false) bool ignoreInsideBlocker = false)
{ {
return ExamineSystemShared.InRangeUnOccluded(args, range, predicate, return ExamineSystemShared.InRangeUnOccluded(args, range, predicate,