Remove most usages of obsolete TransformComponent methods (#19571)
This commit is contained in:
@@ -16,6 +16,7 @@ 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;
|
||||
@@ -46,6 +47,7 @@ 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);
|
||||
@@ -78,7 +80,10 @@ 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);
|
||||
@@ -140,8 +145,8 @@ public class DockingControl : Control
|
||||
ScalePosition(rotation.Transform(new Vector2(0.5f, -0.5f)))), Color.Green);
|
||||
|
||||
// Draw nearby grids
|
||||
var worldPos = gridXform.WorldMatrix.Transform(Coordinates.Value.Position);
|
||||
var gridInvMatrix = gridXform.InvWorldMatrix;
|
||||
var worldPos = _transform.GetWorldMatrix(gridXform).Transform(Coordinates.Value.Position);
|
||||
var gridInvMatrix = _transform.GetInvWorldMatrix(gridXform);
|
||||
Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix);
|
||||
|
||||
// TODO: Getting some overdraw so need to fix that.
|
||||
@@ -157,7 +162,7 @@ public class DockingControl : Control
|
||||
if (!_entManager.TryGetComponent<FixturesComponent>(grid.Owner, out var gridFixtures))
|
||||
continue;
|
||||
|
||||
var gridMatrix = xformQuery.GetComponent(grid.Owner).WorldMatrix;
|
||||
var gridMatrix = _transform.GetWorldMatrix(grid.Owner);
|
||||
|
||||
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user