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

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

View File

@@ -61,9 +61,8 @@ public sealed partial class ExplosionSystem : EntitySystem
{
var targetGrid = _mapManager.GetGrid(referenceGrid.Value);
var xform = Transform(targetGrid.Owner);
var (_, rot, invMat) = _transformSystem.GetWorldPositionRotationInvMatrix(xform);
targetAngle = rot;
targetMatrix = invMat;
targetAngle = xform.WorldRotation;
targetMatrix = xform.InvWorldMatrix;
tileSize = targetGrid.TileSize;
}
@@ -96,7 +95,7 @@ public sealed partial class ExplosionSystem : EntitySystem
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
var xform = xforms.GetComponent(grid.Owner);
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform, xforms);
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = xform.GetWorldPositionRotationMatrixWithInv(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 = _transformSystem.GetWorldMatrix(xform);
spaceAngle = _transformSystem.GetWorldRotation(xform);
spaceMatrix = xform.WorldMatrix;
spaceAngle = xform.WorldRotation;
}
// 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 = _transformSystem.GetWorldPosition(player.AttachedEntity.Value);
var playerPos = Transform(player.AttachedEntity!.Value).WorldPosition;
var delta = epicenter.Position - playerPos;
if (delta.EqualsApprox(Vector2.Zero))