Replace IEntityManager resolves in systems for cached EntityManager
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Content.Shared.Interaction
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
public bool TryFaceCoordinates(EntityUid user, Vector2 coordinates)
|
||||
{
|
||||
var diff = coordinates - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapPosition.Position;
|
||||
var diff = coordinates - EntityManager.GetComponent<TransformComponent>(user).MapPosition.Position;
|
||||
if (diff.LengthSquared <= 0.01f)
|
||||
return true;
|
||||
var diffAngle = Angle.FromWorldVec(diff);
|
||||
@@ -47,12 +47,12 @@ namespace Content.Shared.Interaction
|
||||
{
|
||||
if (_actionBlockerSystem.CanChangeDirection(user))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).WorldRotation = diffAngle;
|
||||
EntityManager.GetComponent<TransformComponent>(user).WorldRotation = diffAngle;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out SharedBuckleComponent? buckle) && buckle.Buckled)
|
||||
if (EntityManager.TryGetComponent(user, out SharedBuckleComponent? buckle) && buckle.Buckled)
|
||||
{
|
||||
var suid = buckle.LastEntityBuckledTo;
|
||||
if (suid != null)
|
||||
@@ -64,7 +64,7 @@ namespace Content.Shared.Interaction
|
||||
// (Since the user being buckled to it holds it down with their weight.)
|
||||
// This is logically equivalent to RotateWhileAnchored.
|
||||
// Barstools and office chairs have independent wheels, while regular chairs don't.
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(rotatable.Owner).WorldRotation = diffAngle;
|
||||
EntityManager.GetComponent<TransformComponent>(rotatable.Owner).WorldRotation = diffAngle;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user