Inline Transform

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:20:34 +01:00
parent 69b270017b
commit a5b57c8e10
283 changed files with 742 additions and 709 deletions

View File

@@ -36,7 +36,7 @@ namespace Content.Shared.Interaction
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
public bool TryFaceCoordinates(IEntity user, Vector2 coordinates)
{
var diff = coordinates - user.Transform.MapPosition.Position;
var diff = coordinates - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).MapPosition.Position;
if (diff.LengthSquared <= 0.01f)
return true;
var diffAngle = Angle.FromWorldVec(diff);
@@ -47,7 +47,7 @@ namespace Content.Shared.Interaction
{
if (_actionBlockerSystem.CanChangeDirection(user.Uid))
{
user.Transform.WorldRotation = diffAngle;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).WorldRotation = diffAngle;
return true;
}
else
@@ -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.
rotatable.Owner.Transform.WorldRotation = diffAngle;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(rotatable.Owner.Uid).WorldRotation = diffAngle;
return true;
}
}