Remove most usages of obsolete TransformComponent methods (#19571)

This commit is contained in:
Visne
2023-08-30 04:05:19 +02:00
committed by GitHub
parent 3ba60835ec
commit 1416942bea
91 changed files with 312 additions and 221 deletions

View File

@@ -54,6 +54,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
[Dependency] private readonly ShuttleSystem _shuttle = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private ISawmill _sawmill = default!;
@@ -415,6 +416,6 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
if (!Resolve(shuttle, ref grid, ref shuttleXform))
return false;
return shuttleXform.WorldMatrix.TransformBox(grid.LocalAABB).Contains(xform.WorldPosition);
return _transform.GetWorldMatrix(shuttleXform).TransformBox(grid.LocalAABB).Contains(_transform.GetWorldPosition(xform));
}
}

View File

@@ -250,8 +250,8 @@ public sealed partial class ShuttleSystem
var fromRotation = _transform.GetWorldRotation(xform);
var width = Comp<MapGridComponent>(uid).LocalAABB.Width;
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
xform.LocalRotation = Angle.Zero;
_transform.SetCoordinates(uid, xform, new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f)));
_transform.SetLocalRotation(xform, Angle.Zero);
_index += width + Buffer;
comp.Accumulator += comp.TravelTime - DefaultArrivalTime;
@@ -336,7 +336,7 @@ public sealed partial class ShuttleSystem
}
else
{
xform.Coordinates = comp.TargetCoordinates;
_transform.SetCoordinates(uid, xform, comp.TargetCoordinates);
mapId = comp.TargetCoordinates.GetMapId(EntityManager);
}
@@ -506,7 +506,7 @@ public sealed partial class ShuttleSystem
if (config != null)
{
FTLDock(config, shuttleXform);
FTLDock(config, shuttleUid, shuttleXform);
return true;
}
@@ -517,10 +517,13 @@ public sealed partial class ShuttleSystem
/// <summary>
/// Forces an FTL dock.
/// </summary>
public void FTLDock(DockingConfig config, TransformComponent shuttleXform)
public void FTLDock(DockingConfig config, EntityUid uid, TransformComponent? shuttleXform = null)
{
if (!Resolve(uid, ref shuttleXform))
return;
// Set position
shuttleXform.Coordinates = config.Coordinates;
_transform.SetCoordinates(uid, shuttleXform, config.Coordinates);
_transform.SetWorldRotation(shuttleXform, config.Angle);
// Connect everything
@@ -629,7 +632,7 @@ public sealed partial class ShuttleSystem
spawnPos = _transform.GetWorldPosition(targetXform, xformQuery);
}
xform.Coordinates = new EntityCoordinates(targetXform.MapUid.Value, spawnPos);
_transform.SetCoordinates(shuttleUid, xform, new EntityCoordinates(targetXform.MapUid.Value, spawnPos));
if (!HasComp<MapComponent>(targetXform.GridUid))
{

View File

@@ -115,7 +115,7 @@ public sealed partial class ShuttleSystem
if (config != null)
{
FTLDock(config, shuttleXform);
FTLDock(config, ent[0], shuttleXform);
if (TryComp<StationMemberComponent>(xform.GridUid, out var stationMember))
{

View File

@@ -38,8 +38,8 @@ public sealed partial class ShuttleSystem
var otherXform = Transform(args.OtherEntity);
var ourPoint = ourXform.InvWorldMatrix.Transform(args.WorldPoint);
var otherPoint = otherXform.InvWorldMatrix.Transform(args.WorldPoint);
var ourPoint = _transform.GetInvWorldMatrix(ourXform).Transform(args.WorldPoint);
var otherPoint = _transform.GetInvWorldMatrix(otherXform).Transform(args.WorldPoint);
var ourVelocity = _physics.GetLinearVelocity(uid, ourPoint, ourBody, ourXform);
var otherVelocity = _physics.GetLinearVelocity(args.OtherEntity, otherPoint, otherBody, otherXform);