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

@@ -69,13 +69,14 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
return;
_needToTransform = true;
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.Owner);
var transform = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SharedTransformSystem>();
var size = (float) Grid.TileSize;
_matrix.R0C2 = size / 2;
_matrix.R1C2 = size / 2;
_matrix *= transform.WorldMatrix * Matrix3.Invert(spaceMatrix);
var relativeAngle = transform.WorldRotation - spaceAngle;
var (_, rot, mat) = transform.GetWorldPositionRotationMatrix(Grid.Owner);
_matrix *= mat * Matrix3.Invert(spaceMatrix);
var relativeAngle = rot - spaceAngle;
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4));
}

View File

@@ -61,8 +61,9 @@ public sealed partial class ExplosionSystem : EntitySystem
{
var targetGrid = _mapManager.GetGrid(referenceGrid.Value);
var xform = Transform(targetGrid.Owner);
targetAngle = xform.WorldRotation;
targetMatrix = xform.InvWorldMatrix;
var (_, rot, invMat) = _transformSystem.GetWorldPositionRotationInvMatrix(xform);
targetAngle = rot;
targetMatrix = invMat;
tileSize = targetGrid.TileSize;
}
@@ -95,7 +96,7 @@ public sealed partial class ExplosionSystem : EntitySystem
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
var xform = xforms.GetComponent(grid.Owner);
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform, xforms);
var localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
var matrix = offsetMatrix * gridWorldMatrix * targetMatrix;

View File

@@ -87,8 +87,8 @@ public sealed partial class ExplosionSystem : EntitySystem
if (referenceGrid != null)
{
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
spaceMatrix = xform.WorldMatrix;
spaceAngle = xform.WorldRotation;
spaceMatrix = _transformSystem.GetWorldMatrix(xform);
spaceAngle = _transformSystem.GetWorldRotation(xform);
}
// is the explosion starting on a grid?

View File

@@ -340,7 +340,7 @@ public sealed partial class ExplosionSystem : EntitySystem
if (player.AttachedEntity is not EntityUid uid)
continue;
var playerPos = Transform(player.AttachedEntity!.Value).WorldPosition;
var playerPos = _transformSystem.GetWorldPosition(player.AttachedEntity.Value);
var delta = epicenter.Position - playerPos;
if (delta.EqualsApprox(Vector2.Zero))