Revert "Remove most usages of obsolete TransformComponent methods (#1… (#19714)

This commit is contained in:
metalgearsloth
2023-09-01 12:30:29 +10:00
committed by GitHub
parent 37222930d9
commit 4cfc578011
91 changed files with 227 additions and 315 deletions

View File

@@ -57,8 +57,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
/// </summary>
public sealed class EmergencyShuttleOverlay : Overlay
{
private readonly IEntityManager _entManager;
private readonly SharedTransformSystem _transform;
private IEntityManager _entManager;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
@@ -68,15 +67,13 @@ public sealed class EmergencyShuttleOverlay : Overlay
public EmergencyShuttleOverlay(IEntityManager entManager)
{
_entManager = entManager;
_transform = entManager.System<SharedTransformSystem>();
}
protected override void Draw(in OverlayDrawArgs args)
{
if (Position == null || !_entManager.TryGetComponent<TransformComponent>(StationUid, out var xform))
return;
if (Position == null || !_entManager.TryGetComponent<TransformComponent>(StationUid, out var xform)) return;
args.WorldHandle.SetTransform(_transform.GetWorldMatrix(xform));
args.WorldHandle.SetTransform(xform.WorldMatrix);
args.WorldHandle.DrawRect(Position.Value, Color.Red.WithAlpha(100));
args.WorldHandle.SetTransform(Matrix3.Identity);
}

View File

@@ -16,7 +16,6 @@ namespace Content.Client.Shuttles.UI;
public class DockingControl : Control
{
private readonly IEntityManager _entManager;
private readonly SharedTransformSystem _transform;
private readonly IMapManager _mapManager;
private float _range = 8f;
@@ -47,7 +46,6 @@ public class DockingControl : Control
public DockingControl()
{
_entManager = IoCManager.Resolve<IEntityManager>();
_transform = _entManager.System<SharedTransformSystem>();
_mapManager = IoCManager.Resolve<IMapManager>();
_rangeSquared = _range * _range;
MinSize = new Vector2(SizeFull, SizeFull);
@@ -80,10 +78,7 @@ public class DockingControl : Control
if (Coordinates == null ||
Angle == null ||
!_entManager.TryGetComponent<TransformComponent>(GridEntity, out var gridXform))
{
return;
}
!_entManager.TryGetComponent<TransformComponent>(GridEntity, out var gridXform)) return;
var rotation = Matrix3.CreateRotation(-Angle.Value + Math.PI);
var matrix = Matrix3.CreateTranslation(-Coordinates.Value.Position);
@@ -145,8 +140,8 @@ public class DockingControl : Control
ScalePosition(rotation.Transform(new Vector2(0.5f, -0.5f)))), Color.Green);
// Draw nearby grids
var worldPos = _transform.GetWorldMatrix(gridXform).Transform(Coordinates.Value.Position);
var gridInvMatrix = _transform.GetInvWorldMatrix(gridXform);
var worldPos = gridXform.WorldMatrix.Transform(Coordinates.Value.Position);
var gridInvMatrix = gridXform.InvWorldMatrix;
Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix);
// TODO: Getting some overdraw so need to fix that.
@@ -162,7 +157,7 @@ public class DockingControl : Control
if (!_entManager.TryGetComponent<FixturesComponent>(grid.Owner, out var gridFixtures))
continue;
var gridMatrix = _transform.GetWorldMatrix(grid.Owner);
var gridMatrix = xformQuery.GetComponent(grid.Owner).WorldMatrix;
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);

View File

@@ -21,7 +21,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
{
private readonly IEntityManager _entManager;
private readonly IGameTiming _timing;
private readonly SharedTransformSystem _transform;
private EntityUid? _shuttleUid;
@@ -52,7 +51,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
_timing = IoCManager.Resolve<IGameTiming>();
_transform = _entManager.System<SharedTransformSystem>();
WorldRangeChange(RadarScreen.WorldRange);
RadarScreen.WorldRangeChanged += WorldRangeChange;
@@ -325,7 +323,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
FTLTimer.Text = GetFTLText();
var (_, worldRot, worldMatrix) = _transform.GetWorldPositionRotationMatrix(gridXform);
var (_, worldRot, worldMatrix) = gridXform.GetWorldPositionRotationMatrix();
var worldPos = worldMatrix.Transform(gridBody.LocalCenter);
// Get the positive reduced angle.