Inline OwnerUid

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 16:30:34 +01:00
parent 2eacf98335
commit f386b57148
85 changed files with 219 additions and 215 deletions

View File

@@ -108,7 +108,7 @@ namespace Content.Server.Physics.Controllers
// then do the movement input once for it.
foreach (var (shuttle, pilots) in _shuttlePilots)
{
if (shuttle.Paused || !EntityManager.TryGetComponent(shuttle.OwnerUid, out PhysicsComponent? body)) continue;
if (shuttle.Paused || !EntityManager.TryGetComponent(((IComponent) shuttle).Owner, out PhysicsComponent? body)) continue;
// Collate movement linear and angular inputs together
var linearInput = Vector2.Zero;
@@ -131,7 +131,7 @@ namespace Content.Server.Physics.Controllers
if (sprint.Equals(Vector2.Zero)) continue;
var offsetRotation = EntityManager.GetComponent<TransformComponent>(console.OwnerUid).LocalRotation;
var offsetRotation = EntityManager.GetComponent<TransformComponent>(((IComponent) console).Owner).LocalRotation;
linearInput += offsetRotation.RotateVec(new Vector2(0f, sprint.Y));
angularInput += sprint.X;
@@ -153,7 +153,7 @@ namespace Content.Server.Physics.Controllers
if (sprint.Equals(Vector2.Zero)) continue;
var offsetRotation = EntityManager.GetComponent<TransformComponent>(console.OwnerUid).LocalRotation;
var offsetRotation = EntityManager.GetComponent<TransformComponent>(((IComponent) console).Owner).LocalRotation;
sprint = offsetRotation.RotateVec(sprint);
linearInput += sprint;
@@ -180,7 +180,7 @@ namespace Content.Server.Physics.Controllers
var angle = linearInput.ToWorldAngle();
var linearDir = angle.GetDir();
var dockFlag = linearDir.AsFlag();
var shuttleNorth = EntityManager.GetComponent<TransformComponent>(body.OwnerUid).WorldRotation.ToWorldVec();
var shuttleNorth = EntityManager.GetComponent<TransformComponent>(((IComponent) body).Owner).WorldRotation.ToWorldVec();
// Won't just do cardinal directions.
foreach (DirectionFlag dir in Enum.GetValues(typeof(DirectionFlag)))