Purges uses of TransformComponent.WorldRotation (#34946)
This commit is contained in:
@@ -256,7 +256,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
|||||||
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||||
if (!dragSprite.NoRotation)
|
if (!dragSprite.NoRotation)
|
||||||
{
|
{
|
||||||
Transform(_dragShadow.Value).WorldRotation = Transform(_draggedEntity.Value).WorldRotation;
|
_transformSystem.SetWorldRotationNoLerp(_dragShadow.Value, _transformSystem.GetWorldRotation(_draggedEntity.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// drag initiated
|
// drag initiated
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
|
|
||||||
if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) return;
|
if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) return;
|
||||||
|
|
||||||
var requestedGridOrigin = mousePos.Position - xform.WorldRotation.RotateVec(_localPosition);
|
var requestedGridOrigin = mousePos.Position - _transformSystem.GetWorldRotation(xform).RotateVec(_localPosition);
|
||||||
_lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId);
|
_lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId);
|
||||||
|
|
||||||
RaiseNetworkEvent(new GridDragRequestPosition()
|
RaiseNetworkEvent(new GridDragRequestPosition()
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
var board = Spawn("ChessBoard", xform.Coordinates);
|
var board = Spawn("ChessBoard", xform.Coordinates);
|
||||||
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
|
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
|
||||||
xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
|
xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
|
||||||
xform.WorldRotation = Angle.Zero;
|
_transformSystem.SetWorldRotationNoLerp((args.Target, xform), Angle.Zero);
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Extreme,
|
Impact = LogImpact.Extreme,
|
||||||
Message = string.Join(": ", chessName, Loc.GetString("admin-smite-chess-dimension-description"))
|
Message = string.Join(": ", chessName, Loc.GetString("admin-smite-chess-dimension-description"))
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Used by ExperiencePressureDifference to correct push/throw directions from tile-relative to physics world.
|
// Used by ExperiencePressureDifference to correct push/throw directions from tile-relative to physics world.
|
||||||
var gridWorldRotation = xforms.GetComponent(gridAtmosphere).WorldRotation;
|
var gridWorldRotation = _transformSystem.GetWorldRotation(gridAtmosphere);
|
||||||
|
|
||||||
// If we're using monstermos, smooth out the yeet direction to follow the flow
|
// If we're using monstermos, smooth out the yeet direction to follow the flow
|
||||||
if (MonstermosEqualization)
|
if (MonstermosEqualization)
|
||||||
|
|||||||
@@ -69,14 +69,17 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_needToTransform = true;
|
_needToTransform = true;
|
||||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.Owner);
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
|
var transformSystem = entityManager.System<SharedTransformSystem>();
|
||||||
|
var transform = entityManager.GetComponent<TransformComponent>(Grid.Owner);
|
||||||
var size = (float) Grid.TileSize;
|
var size = (float) Grid.TileSize;
|
||||||
|
|
||||||
_matrix.M31 = size / 2;
|
_matrix.M31 = size / 2;
|
||||||
_matrix.M32 = size / 2;
|
_matrix.M32 = size / 2;
|
||||||
Matrix3x2.Invert(spaceMatrix, out var invSpace);
|
Matrix3x2.Invert(spaceMatrix, out var invSpace);
|
||||||
_matrix *= transform.WorldMatrix * invSpace;
|
_matrix *= transform.WorldMatrix * invSpace;
|
||||||
var relativeAngle = transform.WorldRotation - spaceAngle;
|
var relativeAngle = transformSystem.GetWorldRotation(transform) - spaceAngle;
|
||||||
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4));
|
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public sealed partial class ExplosionSystem
|
|||||||
{
|
{
|
||||||
var targetGrid = Comp<MapGridComponent>(referenceGrid.Value);
|
var targetGrid = Comp<MapGridComponent>(referenceGrid.Value);
|
||||||
var xform = Transform(referenceGrid.Value);
|
var xform = Transform(referenceGrid.Value);
|
||||||
targetAngle = xform.WorldRotation;
|
targetAngle = _transformSystem.GetWorldRotation(xform);
|
||||||
targetMatrix = xform.InvWorldMatrix;
|
targetMatrix = xform.InvWorldMatrix;
|
||||||
tileSize = targetGrid.TileSize;
|
tileSize = targetGrid.TileSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public sealed partial class ExplosionSystem
|
|||||||
{
|
{
|
||||||
var xform = Transform(Comp<MapGridComponent>(referenceGrid.Value).Owner);
|
var xform = Transform(Comp<MapGridComponent>(referenceGrid.Value).Owner);
|
||||||
spaceMatrix = xform.WorldMatrix;
|
spaceMatrix = xform.WorldMatrix;
|
||||||
spaceAngle = xform.WorldRotation;
|
spaceAngle = _transformSystem.GetWorldRotation(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the explosion starting on a grid?
|
// is the explosion starting on a grid?
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public sealed class StandingStateSystem : EntitySystem
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args)
|
private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args)
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ public sealed class StandingStateSystem : EntitySystem
|
|||||||
if (!TryComp(uid, out HandsComponent? handsComp))
|
if (!TryComp(uid, out HandsComponent? handsComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var worldRotation = EntityManager.GetComponent<TransformComponent>(uid).WorldRotation.ToVec();
|
var worldRotation = _transformSystem.GetWorldRotation(uid).ToVec();
|
||||||
foreach (var hand in handsComp.Hands.Values)
|
foreach (var hand in handsComp.Hands.Values)
|
||||||
{
|
{
|
||||||
if (hand.HeldEntity is not EntityUid held)
|
if (hand.HeldEntity is not EntityUid held)
|
||||||
|
|||||||
@@ -120,10 +120,11 @@ namespace Content.Shared.Maps
|
|||||||
private static bool GetWorldTileBox(TileRef turf, out Box2Rotated res)
|
private static bool GetWorldTileBox(TileRef turf, out Box2Rotated res)
|
||||||
{
|
{
|
||||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
var xformSystem = entManager.System<SharedTransformSystem>();
|
||||||
|
|
||||||
if (entManager.TryGetComponent<MapGridComponent>(turf.GridUid, out var tileGrid))
|
if (entManager.TryGetComponent<MapGridComponent>(turf.GridUid, out var tileGrid))
|
||||||
{
|
{
|
||||||
var gridRot = entManager.GetComponent<TransformComponent>(turf.GridUid).WorldRotation;
|
var gridRot = xformSystem.GetWorldRotation(turf.GridUid);
|
||||||
|
|
||||||
// This is scaled to 90 % so it doesn't encompass walls on other tiles.
|
// This is scaled to 90 % so it doesn't encompass walls on other tiles.
|
||||||
var tileBox = Box2.UnitCentered.Scale(0.9f);
|
var tileBox = Box2.UnitCentered.Scale(0.9f);
|
||||||
|
|||||||
Reference in New Issue
Block a user