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

@@ -14,7 +14,6 @@ public sealed class ExplosionDebugOverlay : Overlay
[Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
private readonly SharedTransformSystem _transform;
public Dictionary<int, List<Vector2i>>? SpaceTiles; public Dictionary<int, List<Vector2i>>? SpaceTiles;
public Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> Tiles = new(); public Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> Tiles = new();
@@ -36,8 +35,6 @@ public sealed class ExplosionDebugOverlay : Overlay
var cache = IoCManager.Resolve<IResourceCache>(); var cache = IoCManager.Resolve<IResourceCache>();
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8); _font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
_transform = _entityManager.System<SharedTransformSystem>();
} }
protected override void Draw(in OverlayDrawArgs args) protected override void Draw(in OverlayDrawArgs args)
@@ -71,7 +68,7 @@ public sealed class ExplosionDebugOverlay : Overlay
continue; continue;
var gridXform = xformQuery.GetComponent(grid.Owner); var gridXform = xformQuery.GetComponent(grid.Owner);
var (_, _, matrix, invMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery); var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2); gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
DrawText(handle, gridBounds, matrix, tileSets, grid.TileSize); DrawText(handle, gridBounds, matrix, tileSets, grid.TileSize);
} }
@@ -139,7 +136,7 @@ public sealed class ExplosionDebugOverlay : Overlay
continue; continue;
var gridXform = xformQuery.GetComponent(grid.Owner); var gridXform = xformQuery.GetComponent(grid.Owner);
var (_, _, worldMatrix, invWorldMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery); var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2); gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
handle.SetTransform(worldMatrix); handle.SetTransform(worldMatrix);
DrawTiles(handle, gridBounds, tileSets, SpaceTileSize); DrawTiles(handle, gridBounds, tileSets, SpaceTileSize);

View File

@@ -17,7 +17,6 @@ namespace Content.Client.Atmos.Overlays
[Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
private readonly SharedTransformSystem _transform;
public override OverlaySpace Space => OverlaySpace.WorldSpace; public override OverlaySpace Space => OverlaySpace.WorldSpace;
@@ -26,7 +25,6 @@ namespace Content.Client.Atmos.Overlays
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_atmosDebugOverlaySystem = system; _atmosDebugOverlaySystem = system;
_transform = _entManager.System<SharedTransformSystem>();
} }
protected override void Draw(in OverlayDrawArgs args) protected override void Draw(in OverlayDrawArgs args)
@@ -49,7 +47,7 @@ namespace Content.Client.Atmos.Overlays
!_entManager.TryGetComponent<TransformComponent>(mapGrid.Owner, out var xform)) !_entManager.TryGetComponent<TransformComponent>(mapGrid.Owner, out var xform))
continue; continue;
drawHandle.SetTransform(_transform.GetWorldMatrix(xform)); drawHandle.SetTransform(xform.WorldMatrix);
for (var pass = 0; pass < 2; pass++) for (var pass = 0; pass < 2; pass++)
{ {

View File

@@ -19,7 +19,6 @@ namespace Content.Client.Atmos.Overlays
public sealed class GasTileOverlay : Overlay public sealed class GasTileOverlay : Overlay
{ {
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager;
private readonly SharedTransformSystem _transform;
private readonly IMapManager _mapManager; private readonly IMapManager _mapManager;
public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities; public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
@@ -49,7 +48,6 @@ namespace Content.Client.Atmos.Overlays
public GasTileOverlay(GasTileOverlaySystem system, IEntityManager entManager, IResourceCache resourceCache, IPrototypeManager protoMan, SpriteSystem spriteSys) public GasTileOverlay(GasTileOverlaySystem system, IEntityManager entManager, IResourceCache resourceCache, IPrototypeManager protoMan, SpriteSystem spriteSys)
{ {
_entManager = entManager; _entManager = entManager;
_transform = entManager.System<SharedTransformSystem>();
_mapManager = IoCManager.Resolve<IMapManager>(); _mapManager = IoCManager.Resolve<IMapManager>();
_shader = protoMan.Index<ShaderPrototype>("unshaded").Instance(); _shader = protoMan.Index<ShaderPrototype>("unshaded").Instance();
ZIndex = GasOverlayZIndex; ZIndex = GasOverlayZIndex;
@@ -184,7 +182,7 @@ namespace Content.Client.Atmos.Overlays
// TODO: WorldBounds callback. // TODO: WorldBounds callback.
_mapManager.FindGridsIntersecting(args.MapId, args.WorldAABB, ref gridState, _mapManager.FindGridsIntersecting(args.MapId, args.WorldAABB, ref gridState,
(EntityUid uid, MapGridComponent grid, static (EntityUid uid, MapGridComponent grid,
ref (Box2Rotated WorldBounds, ref (Box2Rotated WorldBounds,
DrawingHandleWorld drawHandle, DrawingHandleWorld drawHandle,
int gasCount, int gasCount,
@@ -202,7 +200,7 @@ namespace Content.Client.Atmos.Overlays
return true; return true;
} }
var (_, _, worldMatrix, invMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform); var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
state.drawHandle.SetTransform(worldMatrix); state.drawHandle.SetTransform(worldMatrix);
var floatBounds = invMatrix.TransformBox(in state.WorldBounds).Enlarged(grid.TileSize); var floatBounds = invMatrix.TransformBox(in state.WorldBounds).Enlarged(grid.TileSize);
var localBounds = new Box2i( var localBounds = new Box2i(

View File

@@ -29,7 +29,6 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
protected override void QueueUpdate(EntityUid uid, AmbientSoundComponent ambience) protected override void QueueUpdate(EntityUid uid, AmbientSoundComponent ambience)
=> _treeSys.QueueTreeUpdate(uid, ambience); => _treeSys.QueueTreeUpdate(uid, ambience);
@@ -202,7 +201,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
} }
} }
private bool Callback( private static bool Callback(
ref QueryState state, ref QueryState state,
in ComponentTreeEntry<AmbientSoundComponent> value) in ComponentTreeEntry<AmbientSoundComponent> value)
{ {
@@ -212,7 +211,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
var delta = xform.ParentUid == state.Player.ParentUid var delta = xform.ParentUid == state.Player.ParentUid
? xform.LocalPosition - state.Player.LocalPosition ? xform.LocalPosition - state.Player.LocalPosition
: _transform.GetWorldPosition(xform) - state.MapPos; : xform.WorldPosition - state.MapPos;
var range = delta.Length(); var range = delta.Length();
if (range >= ambientComp.Range) if (range >= ambientComp.Range)
@@ -254,7 +253,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
{ {
var distance = (xform.ParentUid == playerXform.ParentUid) var distance = (xform.ParentUid == playerXform.ParentUid)
? xform.LocalPosition - playerXform.LocalPosition ? xform.LocalPosition - playerXform.LocalPosition
: _transform.GetWorldPosition(xform) - mapPos.Position; : xform.WorldPosition - mapPos.Position;
if (distance.LengthSquared() < comp.Range * comp.Range) if (distance.LengthSquared() < comp.Range * comp.Range)
continue; continue;

View File

@@ -10,7 +10,6 @@ namespace Content.Client.CardboardBox;
public sealed class CardboardBoxSystem : SharedCardboardBoxSystem public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
{ {
[Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -56,7 +55,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
continue; continue;
sprite.Offset = new Vector2(0, 1); sprite.Offset = new Vector2(0, 1);
_transform.SetParent(ent, entTransform, mob); entTransform.AttachParent(mob);
} }
} }
} }

View File

@@ -36,7 +36,6 @@ namespace Content.Client.Chat.UI
private readonly EntityUid _senderEntity; private readonly EntityUid _senderEntity;
private readonly IChatManager _chatManager; private readonly IChatManager _chatManager;
private readonly IEntityManager _entityManager; private readonly IEntityManager _entityManager;
private readonly SharedTransformSystem _transform;
private float _timeLeft = TotalTime; private float _timeLeft = TotalTime;
@@ -48,43 +47,30 @@ namespace Content.Client.Chat.UI
// man down // man down
public event Action<EntityUid, SpeechBubble>? OnDied; public event Action<EntityUid, SpeechBubble>? OnDied;
public static SpeechBubble CreateSpeechBubble(SpeechType type, public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager)
string text,
EntityUid senderEntity,
IEyeManager eyeManager,
IChatManager chatManager,
IEntityManager entityManager,
SharedTransformSystem transform)
{ {
switch (type) switch (type)
{ {
case SpeechType.Emote: case SpeechType.Emote:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, transform, "emoteBox"); return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "emoteBox");
case SpeechType.Say: case SpeechType.Say:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, transform, "sayBox"); return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "sayBox");
case SpeechType.Whisper: case SpeechType.Whisper:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, transform, "whisperBox"); return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox");
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
} }
public SpeechBubble(string text, public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
EntityUid senderEntity,
IEyeManager eyeManager,
IChatManager chatManager,
IEntityManager entityManager,
SharedTransformSystem transform,
string speechStyleClass)
{ {
_chatManager = chatManager; _chatManager = chatManager;
_senderEntity = senderEntity; _senderEntity = senderEntity;
_eyeManager = eyeManager; _eyeManager = eyeManager;
_entityManager = entityManager; _entityManager = entityManager;
_transform = transform;
// Use text clipping so new messages don't overlap old ones being pushed up. // Use text clipping so new messages don't overlap old ones being pushed up.
RectClipContent = true; RectClipContent = true;
@@ -142,7 +128,7 @@ namespace Content.Client.Chat.UI
} }
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset; var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
var worldPos = _transform.GetWorldPosition(xform) + offset; var worldPos = xform.WorldPosition + offset;
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale; var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved); var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved);
@@ -178,14 +164,8 @@ namespace Content.Client.Chat.UI
public sealed class TextSpeechBubble : SpeechBubble public sealed class TextSpeechBubble : SpeechBubble
{ {
public TextSpeechBubble(string text, public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
EntityUid senderEntity, : base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass)
IEyeManager eyeManager,
IChatManager chatManager,
IEntityManager entityManager,
SharedTransformSystem transform,
string speechStyleClass)
: base(text, senderEntity, eyeManager, chatManager, entityManager, transform, speechStyleClass)
{ {
} }

View File

@@ -11,7 +11,6 @@ namespace Content.Client.Decals.Overlays
private readonly SpriteSystem _sprites; private readonly SpriteSystem _sprites;
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager;
private readonly IPrototypeManager _prototypeManager; private readonly IPrototypeManager _prototypeManager;
private readonly SharedTransformSystem _transform;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowEntities; public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowEntities;
@@ -25,7 +24,6 @@ namespace Content.Client.Decals.Overlays
_sprites = sprites; _sprites = sprites;
_entManager = entManager; _entManager = entManager;
_prototypeManager = prototypeManager; _prototypeManager = prototypeManager;
_transform = _entManager.System<SharedTransformSystem>();
} }
protected override void Draw(in OverlayDrawArgs args) protected override void Draw(in OverlayDrawArgs args)
@@ -46,7 +44,7 @@ namespace Content.Client.Decals.Overlays
if (xform.MapID != args.MapId) if (xform.MapID != args.MapId)
continue; continue;
var (_, worldRot, worldMatrix) = _transform.GetWorldPositionRotationMatrix(xform, xformQuery); var (_, worldRot, worldMatrix) = xform.GetWorldPositionRotationMatrix(xformQuery);
handle.SetTransform(worldMatrix); handle.SetTransform(worldMatrix);

View File

@@ -44,7 +44,6 @@ public sealed class DragDropSystem : SharedDragDropSystem
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private ISawmill _sawmill = default!; private ISawmill _sawmill = default!;
@@ -254,7 +253,9 @@ public sealed class DragDropSystem : SharedDragDropSystem
// keep it on top of everything // keep it on top of everything
dragSprite.DrawDepth = (int) DrawDepth.Overlays; dragSprite.DrawDepth = (int) DrawDepth.Overlays;
if (!dragSprite.NoRotation) if (!dragSprite.NoRotation)
_transform.SetWorldRotation(_dragShadow.Value, _transform.GetWorldRotation(_draggedEntity.Value)); {
Transform(_dragShadow.Value).WorldRotation = Transform(_draggedEntity.Value).WorldRotation;
}
// drag initiated // drag initiated
return; return;
@@ -535,7 +536,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
if (Exists(_dragShadow)) if (Exists(_dragShadow))
{ {
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition); var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
_transform.SetWorldPosition(_dragShadow.Value, mousePos.Position); Transform(_dragShadow.Value).WorldPosition = mousePos.Position;
} }
} }
} }

View File

@@ -16,7 +16,6 @@ public sealed class ExplosionOverlay : Overlay
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
private readonly SharedTransformSystem _transform;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV; public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
@@ -26,7 +25,6 @@ public sealed class ExplosionOverlay : Overlay
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance(); _shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
_transform = _entMan.System<SharedTransformSystem>();
} }
protected override void Draw(in OverlayDrawArgs args) protected override void Draw(in OverlayDrawArgs args)
@@ -69,7 +67,7 @@ public sealed class ExplosionOverlay : Overlay
continue; continue;
var xform = xforms.GetComponent(grid.Owner); var xform = xforms.GetComponent(grid.Owner);
var (_, _, worldMatrix, invWorldMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(xform, xforms); var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2); gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
drawHandle.SetTransform(worldMatrix); drawHandle.SetTransform(worldMatrix);

View File

@@ -14,7 +14,6 @@ public sealed class PuddleOverlay : Overlay
[Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
private readonly PuddleDebugOverlaySystem _debugOverlaySystem; private readonly PuddleDebugOverlaySystem _debugOverlaySystem;
private readonly SharedTransformSystem _transform;
private readonly Color _heavyPuddle = new(0, 255, 255, 50); private readonly Color _heavyPuddle = new(0, 255, 255, 50);
private readonly Color _mediumPuddle = new(0, 150, 255, 50); private readonly Color _mediumPuddle = new(0, 150, 255, 50);
@@ -28,7 +27,6 @@ public sealed class PuddleOverlay : Overlay
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>(); _debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
_transform = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
var cache = IoCManager.Resolve<IResourceCache>(); var cache = IoCManager.Resolve<IResourceCache>();
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8); _font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
} }
@@ -58,7 +56,7 @@ public sealed class PuddleOverlay : Overlay
continue; continue;
var gridXform = xformQuery.GetComponent(gridId); var gridXform = xformQuery.GetComponent(gridId);
var (_, _, worldMatrix, invWorldMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery); var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2); gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
drawHandle.SetTransform(worldMatrix); drawHandle.SetTransform(worldMatrix);
@@ -91,7 +89,7 @@ public sealed class PuddleOverlay : Overlay
continue; continue;
var gridXform = xformQuery.GetComponent(gridId); var gridXform = xformQuery.GetComponent(gridId);
var (_, _, matrix, invMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery); var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2); var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.Owner)) foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.Owner))

View File

@@ -16,7 +16,6 @@ namespace Content.Client.HealthOverlay
{ {
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEntityManager _entities = default!; [Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private readonly Dictionary<EntityUid, HealthOverlayGui> _guis = new(); private readonly Dictionary<EntityUid, HealthOverlayGui> _guis = new();
private EntityUid? _attachedEntity; private EntityUid? _attachedEntity;
@@ -86,7 +85,7 @@ namespace Content.Client.HealthOverlay
var entity = mobState.Owner; var entity = mobState.Owner;
if (_entities.GetComponent<TransformComponent>(ent).MapID != _entities.GetComponent<TransformComponent>(entity).MapID || if (_entities.GetComponent<TransformComponent>(ent).MapID != _entities.GetComponent<TransformComponent>(entity).MapID ||
!viewBox.Contains(_transform.GetWorldPosition(entity))) !viewBox.Contains(_entities.GetComponent<TransformComponent>(entity).WorldPosition))
{ {
if (_guis.TryGetValue(entity, out var oldGui)) if (_guis.TryGetValue(entity, out var oldGui))
{ {

View File

@@ -18,7 +18,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
[Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly InputSystem _inputSystem = default!; [Dependency] private readonly InputSystem _inputSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public bool Enabled { get; set; } public bool Enabled { get; set; }
@@ -67,7 +66,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
xform.MapID == _lastMousePosition.Value.MapId) xform.MapID == _lastMousePosition.Value.MapId)
{ {
var tickTime = _gameTiming.TickPeriod; var tickTime = _gameTiming.TickPeriod;
var distance = _lastMousePosition.Value.Position - _transform.GetWorldPosition(xform); var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
RaiseNetworkEvent(new GridDragVelocityRequest() RaiseNetworkEvent(new GridDragVelocityRequest()
{ {
Grid = _dragging.Value, Grid = _dragging.Value,
@@ -102,7 +101,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid)) if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
return; return;
StartDragging(gridUid, _transform.GetInvWorldMatrix(gridUid).Transform(mousePos.Position)); StartDragging(gridUid, Transform(gridUid).InvWorldMatrix.Transform(mousePos.Position));
} }
if (!TryComp<TransformComponent>(_dragging, out var xform)) if (!TryComp<TransformComponent>(_dragging, out var xform))
@@ -117,12 +116,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
return; return;
} }
var localToWorld = _transform.GetWorldMatrix(xform).Transform(_localPosition); var localToWorld = xform.WorldMatrix.Transform(_localPosition);
if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) return;
return;
var requestedGridOrigin = mousePos.Position - _transform.GetWorldRotation(xform).RotateVec(_localPosition); var requestedGridOrigin = mousePos.Position - xform.WorldRotation.RotateVec(_localPosition);
_lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId); _lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId);
RaiseNetworkEvent(new GridDragRequestPosition() RaiseNetworkEvent(new GridDragRequestPosition()

View File

@@ -21,7 +21,6 @@ namespace Content.Client.Medical.CrewMonitoring
private List<(DirectionIcon Icon, Vector2 Position)> _directionIcons = new(); private List<(DirectionIcon Icon, Vector2 Position)> _directionIcons = new();
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager;
private readonly IEyeManager _eye; private readonly IEyeManager _eye;
private readonly SharedTransformSystem _transform;
private EntityUid? _stationUid; private EntityUid? _stationUid;
private CrewMonitoringButton? _trackedButton; private CrewMonitoringButton? _trackedButton;
@@ -32,7 +31,6 @@ namespace Content.Client.Medical.CrewMonitoring
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
_eye = IoCManager.Resolve<IEyeManager>(); _eye = IoCManager.Resolve<IEyeManager>();
_entManager = IoCManager.Resolve<IEntityManager>(); _entManager = IoCManager.Resolve<IEntityManager>();
_transform = _entManager.System<SharedTransformSystem>();
_stationUid = mapUid; _stationUid = mapUid;
if (_entManager.TryGetComponent<TransformComponent>(mapUid, out var xform)) if (_entManager.TryGetComponent<TransformComponent>(mapUid, out var xform))
@@ -195,7 +193,7 @@ namespace Content.Client.Medical.CrewMonitoring
// Apply the offset relative to the eye. // Apply the offset relative to the eye.
// For a station at 45 degrees rotation, the current eye rotation is -45 degrees. // For a station at 45 degrees rotation, the current eye rotation is -45 degrees.
// TODO: This feels sketchy. Is there something underlying wrong with eye rotation? // TODO: This feels sketchy. Is there something underlying wrong with eye rotation?
offsetAngle = -(_eye.CurrentEye.Rotation + _transform.GetWorldRotation(xform)); offsetAngle = -(_eye.CurrentEye.Rotation + xform.WorldRotation);
} }
foreach (var (icon, pos) in _directionIcons) foreach (var (icon, pos) in _directionIcons)

View File

@@ -7,16 +7,14 @@ namespace Content.Client.NPC.HTN;
public sealed class HTNOverlay : Overlay public sealed class HTNOverlay : Overlay
{ {
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager = default!;
private readonly SharedTransformSystem _transform; private readonly Font _font = default!;
private readonly Font _font;
public override OverlaySpace Space => OverlaySpace.ScreenSpace; public override OverlaySpace Space => OverlaySpace.ScreenSpace;
public HTNOverlay(IEntityManager entManager, IResourceCache resourceCache) public HTNOverlay(IEntityManager entManager, IResourceCache resourceCache)
{ {
_entManager = entManager; _entManager = entManager;
_transform = entManager.System<SharedTransformSystem>();
_font = new VectorFont(resourceCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10); _font = new VectorFont(resourceCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
} }
@@ -32,7 +30,7 @@ public sealed class HTNOverlay : Overlay
if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId) if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId)
continue; continue;
var worldPos = _transform.GetWorldPosition(xform); var worldPos = xform.WorldPosition;
if (!args.WorldAABB.Contains(worldPos)) if (!args.WorldAABB.Contains(worldPos))
continue; continue;

View File

@@ -78,12 +78,10 @@ public sealed class NPCSteeringOverlay : Overlay
public override OverlaySpace Space => OverlaySpace.WorldSpace; public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager;
private readonly SharedTransformSystem _transform;
public NPCSteeringOverlay(IEntityManager entManager) public NPCSteeringOverlay(IEntityManager entManager)
{ {
_entManager = entManager; _entManager = entManager;
_transform = entManager.System<SharedTransformSystem>();
} }
protected override void Draw(in OverlayDrawArgs args) protected override void Draw(in OverlayDrawArgs args)
@@ -95,7 +93,7 @@ public sealed class NPCSteeringOverlay : Overlay
continue; continue;
} }
var worldPos = _transform.GetWorldPosition(xform); var (worldPos, worldRot) = xform.GetWorldPositionRotation();
if (!args.WorldAABB.Contains(worldPos)) if (!args.WorldAABB.Contains(worldPos))
continue; continue;

View File

@@ -2,7 +2,6 @@ using System.Linq;
using System.Numerics; using System.Numerics;
using System.Text; using System.Text;
using Content.Shared.NPC; using Content.Shared.NPC;
using Robust.Client.GameObjects;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Client.Input; using Robust.Client.Input;
using Robust.Client.ResourceManagement; using Robust.Client.ResourceManagement;
@@ -21,7 +20,6 @@ namespace Content.Client.NPC
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IResourceCache _cache = default!; [Dependency] private readonly IResourceCache _cache = default!;
[Dependency] private readonly NPCSteeringSystem _steering = default!; [Dependency] private readonly NPCSteeringSystem _steering = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public PathfindingDebugMode Modes public PathfindingDebugMode Modes
{ {
@@ -138,7 +136,6 @@ namespace Content.Client.NPC
private readonly IInputManager _inputManager; private readonly IInputManager _inputManager;
private readonly IMapManager _mapManager; private readonly IMapManager _mapManager;
private readonly PathfindingSystem _system; private readonly PathfindingSystem _system;
private readonly SharedTransformSystem _transform;
public override OverlaySpace Space => OverlaySpace.ScreenSpace | OverlaySpace.WorldSpace; public override OverlaySpace Space => OverlaySpace.ScreenSpace | OverlaySpace.WorldSpace;
@@ -157,7 +154,6 @@ namespace Content.Client.NPC
_inputManager = inputManager; _inputManager = inputManager;
_mapManager = mapManager; _mapManager = mapManager;
_system = system; _system = system;
_transform = entManager.System<TransformSystem>();
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10); _font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
} }
@@ -191,7 +187,7 @@ namespace Content.Client.NPC
if (found || !_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform)) if (found || !_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
var (_, _, worldMatrix, invWorldMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform); var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize)); var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize));
foreach (var chunk in crumbs) foreach (var chunk in crumbs)
@@ -275,8 +271,9 @@ namespace Content.Client.NPC
return; return;
} }
var invGridMatrix = _transform.GetInvWorldMatrix(gridXform); var invGridMatrix = gridXform.InvWorldMatrix;
DebugPathPoly? nearest = null; DebugPathPoly? nearest = null;
var nearestDistance = float.MaxValue;
foreach (var poly in tile) foreach (var poly in tile)
{ {
@@ -342,7 +339,7 @@ namespace Content.Client.NPC
continue; continue;
} }
var (_, _, worldMatrix, invWorldMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform); var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
worldHandle.SetTransform(worldMatrix); worldHandle.SetTransform(worldMatrix);
var localAABB = invWorldMatrix.TransformBox(aabb); var localAABB = invWorldMatrix.TransformBox(aabb);
@@ -397,7 +394,7 @@ namespace Content.Client.NPC
!xformQuery.TryGetComponent(grid.Owner, out var gridXform)) !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
var (_, _, worldMatrix, invWorldMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform); var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
worldHandle.SetTransform(worldMatrix); worldHandle.SetTransform(worldMatrix);
var localAABB = invWorldMatrix.TransformBox(aabb); var localAABB = invWorldMatrix.TransformBox(aabb);
@@ -431,7 +428,7 @@ namespace Content.Client.NPC
!xformQuery.TryGetComponent(grid.Owner, out var gridXform)) !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
var (_, _, worldMatrix, invMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform); var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
worldHandle.SetTransform(worldMatrix); worldHandle.SetTransform(worldMatrix);
var localAABB = invMatrix.TransformBox(aabb); var localAABB = invMatrix.TransformBox(aabb);
@@ -485,7 +482,7 @@ namespace Content.Client.NPC
!xformQuery.TryGetComponent(grid.Owner, out var gridXform)) !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
var (_, _, worldMatrix, invWorldMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridXform); var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
worldHandle.SetTransform(worldMatrix); worldHandle.SetTransform(worldMatrix);
var localAABB = invWorldMatrix.TransformBox(args.WorldBounds); var localAABB = invWorldMatrix.TransformBox(args.WorldBounds);
@@ -512,7 +509,7 @@ namespace Content.Client.NPC
if (!_entManager.TryGetComponent<TransformComponent>(node.GraphUid, out var graphXform)) if (!_entManager.TryGetComponent<TransformComponent>(node.GraphUid, out var graphXform))
continue; continue;
worldHandle.SetTransform(_transform.GetWorldMatrix(graphXform)); worldHandle.SetTransform(graphXform.WorldMatrix);
worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f)); worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f));
} }
} }
@@ -534,7 +531,7 @@ namespace Content.Client.NPC
continue; continue;
matrix = node.GraphUid; matrix = node.GraphUid;
worldHandle.SetTransform(_transform.GetWorldMatrix(graphXform)); worldHandle.SetTransform(graphXform.WorldMatrix);
} }
worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f)); worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f));

View File

@@ -13,7 +13,6 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
[Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
private readonly DeviceListSystem _deviceListSystem; private readonly DeviceListSystem _deviceListSystem;
private readonly SharedTransformSystem _transform;
private Dictionary<EntityUid, Color> _colors = new(); private Dictionary<EntityUid, Color> _colors = new();
@@ -24,7 +23,6 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_deviceListSystem = _entityManager.System<DeviceListSystem>(); _deviceListSystem = _entityManager.System<DeviceListSystem>();
_transform = _entityManager.System<SharedTransformSystem>();
} }
public void ClearEntity(EntityUid uid) public void ClearEntity(EntityUid uid)
@@ -72,7 +70,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
continue; continue;
} }
args.WorldHandle.DrawLine(_transform.GetWorldPosition(sourceTransform), _transform.GetWorldPosition(linkTransform), _colors[tracker.Owner]); args.WorldHandle.DrawLine(sourceTransform.WorldPosition, linkTransform.WorldPosition, _colors[tracker.Owner]);
} }
} }
} }

View File

@@ -19,7 +19,6 @@ namespace Content.Client.NodeContainer
private readonly IMapManager _mapManager; private readonly IMapManager _mapManager;
private readonly IInputManager _inputManager; private readonly IInputManager _inputManager;
private readonly IEntityManager _entityManager; private readonly IEntityManager _entityManager;
private readonly SharedTransformSystem _transform;
private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new(); private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new();
private readonly Dictionary<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new (); private readonly Dictionary<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
@@ -45,7 +44,6 @@ namespace Content.Client.NodeContainer
_mapManager = mapManager; _mapManager = mapManager;
_inputManager = inputManager; _inputManager = inputManager;
_entityManager = entityManager; _entityManager = entityManager;
_transform = entityManager.System<SharedTransformSystem>();
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12); _font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
} }
@@ -143,7 +141,7 @@ namespace Content.Client.NodeContainer
foreach (var (gridId, gridDict) in _gridIndex) foreach (var (gridId, gridDict) in _gridIndex)
{ {
var grid = _mapManager.GetGrid(gridId); var grid = _mapManager.GetGrid(gridId);
var (_, _, worldMatrix, invMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(gridId); var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(grid.Owner).GetWorldPositionRotationMatrixWithInv();
var lCursorBox = invMatrix.TransformBox(cursorBox); var lCursorBox = invMatrix.TransformBox(cursorBox);
foreach (var (pos, list) in gridDict) foreach (var (pos, list) in gridDict)

View File

@@ -22,7 +22,6 @@ public sealed class TargetOutlineSystem : EntitySystem
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private bool _enabled = false; private bool _enabled = false;
@@ -165,8 +164,8 @@ public sealed class TargetOutlineSystem : EntitySystem
valid = _interactionSystem.InRangeUnobstructed(player, entity, Range); valid = _interactionSystem.InRangeUnobstructed(player, entity, Range);
else if (Range >= 0) else if (Range >= 0)
{ {
var origin = _transform.GetWorldPosition(player); var origin = Transform(player).WorldPosition;
var target = _transform.GetWorldPosition(entity); var target = Transform(entity).WorldPosition;
valid = (origin - target).LengthSquared() <= Range; valid = (origin - target).LengthSquared() <= Range;
} }

View File

@@ -35,7 +35,6 @@ public sealed class NavMapSystem : SharedNavMapSystem
public sealed class NavMapOverlay : Overlay public sealed class NavMapOverlay : Overlay
{ {
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager;
private readonly SharedTransformSystem _transform;
private readonly IMapManager _mapManager; private readonly IMapManager _mapManager;
public override OverlaySpace Space => OverlaySpace.WorldSpace; public override OverlaySpace Space => OverlaySpace.WorldSpace;
@@ -43,7 +42,6 @@ public sealed class NavMapOverlay : Overlay
public NavMapOverlay(IEntityManager entManager, IMapManager mapManager) public NavMapOverlay(IEntityManager entManager, IMapManager mapManager)
{ {
_entManager = entManager; _entManager = entManager;
_transform = entManager.System<SharedTransformSystem>();
_mapManager = mapManager; _mapManager = mapManager;
} }
@@ -59,7 +57,7 @@ public sealed class NavMapOverlay : Overlay
continue; continue;
// TODO: Faster helper method // TODO: Faster helper method
var (_, _, matrix, invMatrix) = _transform.GetWorldPositionRotationMatrixWithInv(xform); var (_, _, matrix, invMatrix) = xform.GetWorldPositionRotationMatrixWithInv();
var localAABB = invMatrix.TransformBox(args.WorldBounds); var localAABB = invMatrix.TransformBox(args.WorldBounds);
Matrix3.Multiply(in scale, in matrix, out var matty); Matrix3.Multiply(in scale, in matrix, out var matty);

View File

@@ -20,7 +20,6 @@ namespace Content.Client.Pinpointer.UI;
public sealed class NavMapControl : MapGridControl public sealed class NavMapControl : MapGridControl
{ {
[Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IEntityManager _entManager = default!;
private readonly SharedTransformSystem _transform;
public EntityUid? MapUid; public EntityUid? MapUid;
@@ -53,9 +52,6 @@ public sealed class NavMapControl : MapGridControl
public NavMapControl() : base(8f, 128f, 48f) public NavMapControl() : base(8f, 128f, 48f)
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_transform = _entManager.System<SharedTransformSystem>();
RectClipContent = true; RectClipContent = true;
HorizontalExpand = true; HorizontalExpand = true;
VerticalExpand = true; VerticalExpand = true;
@@ -330,7 +326,7 @@ public sealed class NavMapControl : MapGridControl
if (mapPos.MapId != MapId.Nullspace) if (mapPos.MapId != MapId.Nullspace)
{ {
var position = _transform.GetInvWorldMatrix(xform).Transform(mapPos.Position) - offset; var position = xform.InvWorldMatrix.Transform(mapPos.Position) - offset;
position = Scale(new Vector2(position.X, -position.Y)); position = Scale(new Vector2(position.X, -position.Y));
handle.DrawCircle(position, MinimapScale / 2f, value.Color); handle.DrawCircle(position, MinimapScale / 2f, value.Color);

View File

@@ -56,8 +56,7 @@ public sealed partial class ReplaySpectatorSystem
return data; return data;
data.Local = (xform.Coordinates, xform.LocalRotation); data.Local = (xform.Coordinates, xform.LocalRotation);
var (pos, rot) = _transform.GetWorldPositionRotation(xform); data.World = (new(xform.MapUid.Value, xform.WorldPosition), xform.WorldRotation);
data.World = (new(xform.MapUid.Value, pos), rot);
if (TryComp(player, out InputMoverComponent? mover)) if (TryComp(player, out InputMoverComponent? mover))
data.Eye = (mover.RelativeEntity, mover.TargetRelativeRotation); data.Eye = (mover.RelativeEntity, mover.TargetRelativeRotation);

View File

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

View File

@@ -16,7 +16,6 @@ namespace Content.Client.Shuttles.UI;
public class DockingControl : Control public class DockingControl : Control
{ {
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager;
private readonly SharedTransformSystem _transform;
private readonly IMapManager _mapManager; private readonly IMapManager _mapManager;
private float _range = 8f; private float _range = 8f;
@@ -47,7 +46,6 @@ public class DockingControl : Control
public DockingControl() public DockingControl()
{ {
_entManager = IoCManager.Resolve<IEntityManager>(); _entManager = IoCManager.Resolve<IEntityManager>();
_transform = _entManager.System<SharedTransformSystem>();
_mapManager = IoCManager.Resolve<IMapManager>(); _mapManager = IoCManager.Resolve<IMapManager>();
_rangeSquared = _range * _range; _rangeSquared = _range * _range;
MinSize = new Vector2(SizeFull, SizeFull); MinSize = new Vector2(SizeFull, SizeFull);
@@ -80,10 +78,7 @@ public class DockingControl : Control
if (Coordinates == null || if (Coordinates == null ||
Angle == null || Angle == null ||
!_entManager.TryGetComponent<TransformComponent>(GridEntity, out var gridXform)) !_entManager.TryGetComponent<TransformComponent>(GridEntity, out var gridXform)) return;
{
return;
}
var rotation = Matrix3.CreateRotation(-Angle.Value + Math.PI); var rotation = Matrix3.CreateRotation(-Angle.Value + Math.PI);
var matrix = Matrix3.CreateTranslation(-Coordinates.Value.Position); 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); ScalePosition(rotation.Transform(new Vector2(0.5f, -0.5f)))), Color.Green);
// Draw nearby grids // Draw nearby grids
var worldPos = _transform.GetWorldMatrix(gridXform).Transform(Coordinates.Value.Position); var worldPos = gridXform.WorldMatrix.Transform(Coordinates.Value.Position);
var gridInvMatrix = _transform.GetInvWorldMatrix(gridXform); var gridInvMatrix = gridXform.InvWorldMatrix;
Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix); Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix);
// TODO: Getting some overdraw so need to fix that. // 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)) if (!_entManager.TryGetComponent<FixturesComponent>(grid.Owner, out var gridFixtures))
continue; continue;
var gridMatrix = _transform.GetWorldMatrix(grid.Owner); var gridMatrix = xformQuery.GetComponent(grid.Owner).WorldMatrix;
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty); 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 IEntityManager _entManager;
private readonly IGameTiming _timing; private readonly IGameTiming _timing;
private readonly SharedTransformSystem _transform;
private EntityUid? _shuttleUid; private EntityUid? _shuttleUid;
@@ -52,7 +51,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>(); _entManager = IoCManager.Resolve<IEntityManager>();
_timing = IoCManager.Resolve<IGameTiming>(); _timing = IoCManager.Resolve<IGameTiming>();
_transform = _entManager.System<SharedTransformSystem>();
WorldRangeChange(RadarScreen.WorldRange); WorldRangeChange(RadarScreen.WorldRange);
RadarScreen.WorldRangeChanged += WorldRangeChange; RadarScreen.WorldRangeChanged += WorldRangeChange;
@@ -325,7 +323,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
FTLTimer.Text = GetFTLText(); FTLTimer.Text = GetFTLText();
var (_, worldRot, worldMatrix) = _transform.GetWorldPositionRotationMatrix(gridXform); var (_, worldRot, worldMatrix) = gridXform.GetWorldPositionRotationMatrix();
var worldPos = worldMatrix.Transform(gridBody.LocalCenter); var worldPos = worldMatrix.Transform(gridBody.LocalCenter);
// Get the positive reduced angle. // Get the positive reduced angle.

View File

@@ -10,7 +10,6 @@ namespace Content.Client.Stealth;
public sealed class StealthSystem : SharedStealthSystem public sealed class StealthSystem : SharedStealthSystem
{ {
[Dependency] private readonly IPrototypeManager _protoMan = default!; [Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private ShaderInstance _shader = default!; private ShaderInstance _shader = default!;
@@ -80,7 +79,7 @@ public sealed class StealthSystem : SharedStealthSystem
if (!parent.IsValid()) if (!parent.IsValid())
return; // should never happen, but lets not kill the client. return; // should never happen, but lets not kill the client.
var parentXform = Transform(parent); var parentXform = Transform(parent);
var reference = args.Viewport.WorldToLocal(_transform.GetWorldPosition(parentXform)); var reference = args.Viewport.WorldToLocal(parentXform.WorldPosition);
reference.X = -reference.X; reference.X = -reference.X;
var visibility = GetVisibility(uid, component); var visibility = GetVisibility(uid, component);

View File

@@ -28,7 +28,6 @@ namespace Content.Client.Tabletop
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!; [Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
// Time in seconds to wait until sending the location of a dragged entity to the server again // Time in seconds to wait until sending the location of a dragged entity to the server again
private const float Delay = 1f / 10; // 10 Hz private const float Delay = 1f / 10; // 10 Hz
@@ -77,8 +76,7 @@ namespace Content.Client.Tabletop
} }
// If no entity is being dragged or no viewport is clicked, return // If no entity is being dragged or no viewport is clicked, return
if (_draggedEntity == null || _viewport == null) if (_draggedEntity == null || _viewport == null) return;
return;
if (!CanDrag(playerEntity, _draggedEntity.Value, out var draggableComponent)) if (!CanDrag(playerEntity, _draggedEntity.Value, out var draggableComponent))
{ {
@@ -100,11 +98,10 @@ namespace Content.Client.Tabletop
// Clamp coordinates to viewport // Clamp coordinates to viewport
var clampedCoords = ClampPositionToViewport(coords, _viewport); var clampedCoords = ClampPositionToViewport(coords, _viewport);
if (clampedCoords.Equals(MapCoordinates.Nullspace)) if (clampedCoords.Equals(MapCoordinates.Nullspace)) return;
return;
// Move the entity locally every update // Move the entity locally every update
_transform.SetWorldPosition(_draggedEntity.Value, clampedCoords.Position); EntityManager.GetComponent<TransformComponent>(_draggedEntity.Value).WorldPosition = clampedCoords.Position;
// Increment total time passed // Increment total time passed
_timePassed += frameTime; _timePassed += frameTime;
@@ -185,11 +182,10 @@ namespace Content.Client.Tabletop
{ {
if (_draggedEntity != null && _table != null) if (_draggedEntity != null && _table != null)
{ {
RaiseNetworkEvent(new TabletopRequestTakeOut var ev = new TabletopRequestTakeOut();
{ ev.Entity = _draggedEntity.Value;
Entity = _draggedEntity.Value, ev.TableUid = _table.Value;
TableUid = _table.Value, RaiseNetworkEvent(ev);
});
} }
return false; return false;
} }
@@ -282,12 +278,10 @@ namespace Content.Client.Tabletop
/// <returns>Coordinates clamped to the viewport.</returns> /// <returns>Coordinates clamped to the viewport.</returns>
private static MapCoordinates ClampPositionToViewport(MapCoordinates coordinates, ScalingViewport viewport) private static MapCoordinates ClampPositionToViewport(MapCoordinates coordinates, ScalingViewport viewport)
{ {
if (coordinates == MapCoordinates.Nullspace) if (coordinates == MapCoordinates.Nullspace) return MapCoordinates.Nullspace;
return MapCoordinates.Nullspace;
var eye = viewport.Eye; var eye = viewport.Eye;
if (eye == null) if (eye == null) return MapCoordinates.Nullspace;
return MapCoordinates.Nullspace;
var size = (Vector2) viewport.ViewportSize / EyeManager.PixelsPerMeter; // Convert to tiles instead of pixels var size = (Vector2) viewport.ViewportSize / EyeManager.PixelsPerMeter; // Convert to tiles instead of pixels
var eyePosition = eye.Position.Position; var eyePosition = eye.Position.Position;

View File

@@ -19,7 +19,6 @@ using Content.Shared.Chat;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Input; using Content.Shared.Input;
using Content.Shared.Radio; using Content.Shared.Radio;
using Robust.Client.GameObjects;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Client.Input; using Robust.Client.Input;
using Robust.Client.Player; using Robust.Client.Player;
@@ -56,7 +55,6 @@ public sealed class ChatUIController : UIController
[UISystemDependency] private readonly GhostSystem? _ghost = default; [UISystemDependency] private readonly GhostSystem? _ghost = default;
[UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default; [UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
[UISystemDependency] private readonly ChatSystem? _chatSys = default; [UISystemDependency] private readonly ChatSystem? _chatSys = default;
[UISystemDependency] private readonly TransformSystem _transform = default!;
private ISawmill _sawmill = default!; private ISawmill _sawmill = default!;
@@ -410,7 +408,7 @@ public sealed class ChatUIController : UIController
private void CreateSpeechBubble(EntityUid entity, SpeechBubbleData speechData) private void CreateSpeechBubble(EntityUid entity, SpeechBubbleData speechData)
{ {
var bubble = var bubble =
SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eye, _manager, _entities, _transform); SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eye, _manager, _entities);
bubble.OnDied += SpeechBubbleDied; bubble.OnDied += SpeechBubbleDied;

View File

@@ -4,7 +4,6 @@ using Content.Shared.CCVar;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Client.Player; using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers; using Robust.Client.UserInterface.Controllers;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -17,7 +16,6 @@ public sealed class ViewportUIController : UIController
[Dependency] private readonly IPlayerManager _playerMan = default!; [Dependency] private readonly IPlayerManager _playerMan = default!;
[Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[UISystemDependency] private readonly TransformSystem _transform = default!;
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15); public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);
public const int ViewportHeight = 15; public const int ViewportHeight = 15;
@@ -89,10 +87,9 @@ public sealed class ViewportUIController : UIController
_entMan.TryGetComponent(ent, out EyeComponent? eye); _entMan.TryGetComponent(ent, out EyeComponent? eye);
if (eye?.Eye == _eyeManager.CurrentEye && _transform.GetWorldPosition(ent.Value) == default) if (eye?.Eye == _eyeManager.CurrentEye
{ && _entMan.GetComponent<TransformComponent>(ent.Value).WorldPosition == default)
return; // nothing to worry about, the player is just in null space... actually that is probably a problem? return; // nothing to worry about, the player is just in null space... actually that is probably a problem?
}
// Currently, this shouldn't happen. This likely happened because the main eye was set to null. When this // Currently, this shouldn't happen. This likely happened because the main eye was set to null. When this
// does happen it can create hard to troubleshoot bugs, so lets print some helpful warnings: // does happen it can create hard to troubleshoot bugs, so lets print some helpful warnings:

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Administration.Commands
? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates ? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint(); : EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
var ghost = _entities.SpawnEntity("AdminObserver", coordinates); var ghost = _entities.SpawnEntity("AdminObserver", coordinates);
_entities.System<SharedTransformSystem>().AttachToGridOrMap(ghost); _entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
if (canReturn) if (canReturn)
{ {

View File

@@ -4,7 +4,6 @@ using Content.Server.Warps;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Follower; using Content.Shared.Follower;
using Content.Shared.Ghost; using Content.Shared.Ghost;
using Robust.Server.GameObjects;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.Enums; using Robust.Shared.Enums;
@@ -122,9 +121,9 @@ namespace Content.Server.Administration.Commands
return; return;
} }
var transform = _entManager.System<SharedTransformSystem>(); var xform = _entManager.GetComponent<TransformComponent>(playerEntity);
transform.SetCoordinates(playerEntity, coords); xform.Coordinates = coords;
transform.AttachToGridOrMap(playerEntity); xform.AttachToGridOrMap();
if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics)) if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics))
{ {
_entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics); _entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics);

View File

@@ -76,7 +76,6 @@ public sealed partial class AdminVerbSystem
[Dependency] private readonly VomitSystem _vomitSystem = default!; [Dependency] private readonly VomitSystem _vomitSystem = default!;
[Dependency] private readonly WeldableSystem _weldableSystem = default!; [Dependency] private readonly WeldableSystem _weldableSystem = default!;
[Dependency] private readonly SharedContentEyeSystem _eyeSystem = default!; [Dependency] private readonly SharedContentEyeSystem _eyeSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
// All smite verbs have names so invokeverb works. // All smite verbs have names so invokeverb works.
private void AddSmiteVerbs(GetVerbsEvent<Verb> args) private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
@@ -131,8 +130,8 @@ public sealed partial class AdminVerbSystem
Filter.PvsExcept(args.Target), true, PopupType.MediumCaution); Filter.PvsExcept(args.Target), true, PopupType.MediumCaution);
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));
_transform.SetCoordinates(args.Target, EntityCoordinates.FromMap(_mapManager, session.Position)); xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
_transform.SetWorldRotation(xform, Angle.Zero); xform.WorldRotation = Angle.Zero;
}, },
Impact = LogImpact.Extreme, Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-smite-chess-dimension-description") Message = Loc.GetString("admin-smite-chess-dimension-description")

View File

@@ -18,7 +18,6 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
/// <summary> /// <summary>
/// Players allowed to see the atmos debug overlay. /// Players allowed to see the atmos debug overlay.
@@ -135,7 +134,7 @@ namespace Content.Server.Atmos.EntitySystems
var mapIsSpace = _atmosphereSystem.IsTileSpace(null, mapUid, Vector2i.Zero); var mapIsSpace = _atmosphereSystem.IsTileSpace(null, mapUid, Vector2i.Zero);
var worldBounds = Box2.CenteredAround(_transform.GetWorldPosition(transform), var worldBounds = Box2.CenteredAround(transform.WorldPosition,
new Vector2(LocalViewRange, LocalViewRange)); new Vector2(LocalViewRange, LocalViewRange));
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds)) foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))

View File

@@ -15,8 +15,6 @@ namespace Content.Server.Atmos.EntitySystems
{ {
public sealed partial class AtmosphereSystem public sealed partial class AtmosphereSystem
{ {
[Dependency] private readonly SharedTransformSystem _transform = default!;
private const int SpaceWindSoundCooldownCycles = 75; private const int SpaceWindSoundCooldownCycles = 75;
private int _spaceWindSoundCooldown = 0; private int _spaceWindSoundCooldown = 0;
@@ -120,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 = _transform.GetWorldRotation(gridAtmosphere.Owner); var gridWorldRotation = xforms.GetComponent(gridAtmosphere.Owner).WorldRotation;
// 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)
@@ -236,7 +234,7 @@ namespace Content.Server.Atmos.EntitySystems
// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs. // TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
if (throwTarget != EntityCoordinates.Invalid) if (throwTarget != EntityCoordinates.Invalid)
{ {
var pos = ((throwTarget.ToMap(EntityManager).Position - _transform.GetWorldPosition(xform)).Normalized() + dirVec).Normalized(); var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized();
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics); _physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
} }
else else

View File

@@ -29,7 +29,6 @@ namespace Content.Server.Bible
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!; [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly UseDelaySystem _delay = default!; [Dependency] private readonly UseDelaySystem _delay = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -236,7 +235,7 @@ namespace Content.Server.Bible
if (HasComp<GhostRoleMobSpawnerComponent>(familiar)) if (HasComp<GhostRoleMobSpawnerComponent>(familiar))
{ {
_popupSystem.PopupEntity(Loc.GetString("bible-summon-requested"), user, PopupType.Medium); _popupSystem.PopupEntity(Loc.GetString("bible-summon-requested"), user, PopupType.Medium);
_transform.SetParent(familiar, component.Owner); Transform(familiar).AttachParent(component.Owner);
} }
component.AlreadySummoned = true; component.AlreadySummoned = true;
_actionsSystem.RemoveAction(user, component.SummonAction); _actionsSystem.RemoveAction(user, component.SummonAction);

View File

@@ -4,6 +4,7 @@ using Content.Server.Body.Components;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Server.Humanoid; using Content.Server.Humanoid;
using Content.Server.Kitchen.Components; using Content.Server.Kitchen.Components;
using Content.Server.Mind;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
using Content.Shared.Body.Organ; using Content.Shared.Body.Organ;
using Content.Shared.Body.Part; using Content.Shared.Body.Part;
@@ -28,8 +29,7 @@ public sealed class BodySystem : SharedBodySystem
[Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!; [Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!;
[Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedMindSystem _mindSystem = default!; [Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -127,7 +127,7 @@ public sealed class BodySystem : SharedBodySystem
return; return;
// Don't microwave animals, kids // Don't microwave animals, kids
_transform.AttachToGridOrMap(uid); Transform(uid).AttachToGridOrMap();
GibBody(uid, false, component); GibBody(uid, false, component);
args.Handled = true; args.Handled = true;
@@ -209,7 +209,7 @@ public sealed class BodySystem : SharedBodySystem
else else
{ {
cont.Remove(ent, EntityManager, force: true); cont.Remove(ent, EntityManager, force: true);
_transform.SetCoordinates(ent, coordinates); Transform(ent).Coordinates = coordinates;
ent.RandomOffset(0.25f); ent.RandomOffset(0.25f);
} }
} }

View File

@@ -10,7 +10,6 @@ public sealed class RehydratableSystem : EntitySystem
[Dependency] private readonly SharedPopupSystem _popups = default!; [Dependency] private readonly SharedPopupSystem _popups = default!;
[Dependency] private readonly SolutionContainerSystem _solutions = default!; [Dependency] private readonly SolutionContainerSystem _solutions = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -37,7 +36,7 @@ public sealed class RehydratableSystem : EntitySystem
var target = Spawn(randomMob, Transform(uid).Coordinates); var target = Spawn(randomMob, Transform(uid).Coordinates);
_transform.AttachToGridOrMap(target); Transform(target).AttachToGridOrMap();
var ev = new GotRehydratedEvent(target); var ev = new GotRehydratedEvent(target);
RaiseLocalEvent(uid, ref ev); RaiseLocalEvent(uid, ref ev);

View File

@@ -27,7 +27,6 @@ namespace Content.Server.Chemistry.EntitySystems
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private const float ReactTime = 0.125f; private const float ReactTime = 0.125f;
@@ -70,7 +69,7 @@ namespace Content.Server.Chemistry.EntitySystems
_throwing.TryThrow(vapor.Owner, dir, speed, user: user, pushbackRatio: ThrowingSystem.PushbackDefault * 10f); _throwing.TryThrow(vapor.Owner, dir, speed, user: user, pushbackRatio: ThrowingSystem.PushbackDefault * 10f);
var distance = (target.Position - _transform.GetWorldPosition(vaporXform)).Length(); var distance = (target.Position - vaporXform.WorldPosition).Length();
var time = (distance / physics.LinearVelocity.Length()); var time = (distance / physics.LinearVelocity.Length());
despawn.Lifetime = MathF.Min(aliveTime, time); despawn.Lifetime = MathF.Min(aliveTime, time);
} }

View File

@@ -45,7 +45,6 @@ public sealed class ClimbSystem : SharedClimbSystem
[Dependency] private readonly InteractionSystem _interactionSystem = default!; [Dependency] private readonly InteractionSystem _interactionSystem = default!;
[Dependency] private readonly StunSystem _stunSystem = default!; [Dependency] private readonly StunSystem _stunSystem = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private const string ClimbingFixtureName = "climb"; private const string ClimbingFixtureName = "climb";
private const int ClimbingCollisionGroup = (int) (CollisionGroup.TableLayer | CollisionGroup.LowImpassable); private const int ClimbingCollisionGroup = (int) (CollisionGroup.TableLayer | CollisionGroup.LowImpassable);
@@ -395,8 +394,8 @@ public sealed class ClimbSystem : SharedClimbSystem
if (!Resolve(uid, ref physics, ref climbing, false)) if (!Resolve(uid, ref physics, ref climbing, false))
return; return;
var from = _transform.GetWorldPosition(uid); var from = Transform(uid).WorldPosition;
var to = _transform.GetWorldPosition(target); var to = Transform(target).WorldPosition;
var (x, y) = (to - from).Normalized(); var (x, y) = (to - from).Normalized();
if (MathF.Abs(x) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line if (MathF.Abs(x) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.Network; using Robust.Shared.Network;
@@ -48,5 +49,42 @@ namespace Content.Server.Commands
attachedEntity = session.AttachedEntity.Value; attachedEntity = session.AttachedEntity.Value;
return true; return true;
} }
public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var transform = entMan.GetComponent<TransformComponent>(ent);
// gross, is there a better way to do this?
ruleString = ruleString.Replace("$ID", ent.ToString());
ruleString = ruleString.Replace("$WX",
transform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$WY",
transform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$LX",
transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$LY",
transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$NAME", entMan.GetComponent<MetaDataComponent>(ent).EntityName);
if (shell.Player is IPlayerSession player)
{
if (player.AttachedEntity is {Valid: true} p)
{
var pTransform = entMan.GetComponent<TransformComponent>(p);
ruleString = ruleString.Replace("$PID", ent.ToString());
ruleString = ruleString.Replace("$PWX",
pTransform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$PWY",
pTransform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$PLX",
pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$PLY",
pTransform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
}
}
return ruleString;
}
} }
} }

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Construction.Completions
var transform = entityManager.GetComponent<TransformComponent>(uid); var transform = entityManager.GetComponent<TransformComponent>(uid);
if (!transform.Anchored) if (!transform.Anchored)
entityManager.System<SharedTransformSystem>().SetCoordinates(uid, transform, transform.Coordinates.SnapToGrid(entityManager)); transform.Coordinates = transform.Coordinates.SnapToGrid(entityManager);
if (SouthRotation) if (SouthRotation)
{ {

View File

@@ -341,7 +341,7 @@ namespace Content.Server.Construction
// Transform transferring. // Transform transferring.
var newTransform = Transform(newUid); var newTransform = Transform(newUid);
_transform.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container newTransform.AttachToGridOrMap(); // in case in hands or a container
newTransform.LocalRotation = transform.LocalRotation; newTransform.LocalRotation = transform.LocalRotation;
newTransform.Anchored = transform.Anchored; newTransform.Anchored = transform.Anchored;

View File

@@ -31,7 +31,6 @@ namespace Content.Server.Construction
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!; [Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
[Dependency] private readonly StorageSystem _storageSystem = default!; [Dependency] private readonly StorageSystem _storageSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
// --- WARNING! LEGACY CODE AHEAD! --- // --- WARNING! LEGACY CODE AHEAD! ---
// This entire file contains the legacy code for initial construction. // This entire file contains the legacy code for initial construction.
@@ -516,7 +515,7 @@ namespace Content.Server.Construction
var xform = Transform(structure); var xform = Transform(structure);
var wasAnchored = xform.Anchored; var wasAnchored = xform.Anchored;
xform.Anchored = false; xform.Anchored = false;
_transform.SetCoordinates(structure, xform, ev.Location); xform.Coordinates = ev.Location;
xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero; xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero;
xform.Anchored = wasAnchored; xform.Anchored = wasAnchored;

View File

@@ -6,8 +6,6 @@ namespace Content.Server.DeviceNetwork.Systems
[UsedImplicitly] [UsedImplicitly]
public sealed class WirelessNetworkSystem : EntitySystem public sealed class WirelessNetworkSystem : EntitySystem
{ {
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -27,7 +25,7 @@ namespace Content.Server.DeviceNetwork.Systems
return; return;
if (xform.MapID != args.SenderTransform.MapID if (xform.MapID != args.SenderTransform.MapID
|| (ownPosition - _transform.GetWorldPosition(xform)).Length() > sendingComponent.Range) || (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range)
{ {
args.Cancel(); args.Cancel();
} }

View File

@@ -38,7 +38,6 @@ public sealed partial class DragonSystem : EntitySystem
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!; [Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly NPCSystem _npc = default!; [Dependency] private readonly NPCSystem _npc = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
/// <summary> /// <summary>
/// Minimum distance between 2 rifts allowed. /// Minimum distance between 2 rifts allowed.
@@ -252,7 +251,7 @@ public sealed partial class DragonSystem : EntitySystem
} }
} }
foreach (var tile in grid.GetTilesIntersecting(new Circle(_transform.GetWorldPosition(xform), RiftTileRadius), false)) foreach (var tile in grid.GetTilesIntersecting(new Circle(xform.WorldPosition, RiftTileRadius), false))
{ {
if (!tile.IsSpace(_tileDef)) if (!tile.IsSpace(_tileDef))
continue; continue;

View File

@@ -69,14 +69,13 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
return; return;
_needToTransform = true; _needToTransform = true;
var transform = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SharedTransformSystem>(); var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.Owner);
var size = (float) Grid.TileSize; var size = (float) Grid.TileSize;
_matrix.R0C2 = size / 2; _matrix.R0C2 = size / 2;
_matrix.R1C2 = size / 2; _matrix.R1C2 = size / 2;
var (_, rot, mat) = transform.GetWorldPositionRotationMatrix(Grid.Owner); _matrix *= transform.WorldMatrix * Matrix3.Invert(spaceMatrix);
_matrix *= mat * Matrix3.Invert(spaceMatrix); var relativeAngle = transform.WorldRotation - spaceAngle;
var relativeAngle = rot - spaceAngle;
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4)); _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 targetGrid = _mapManager.GetGrid(referenceGrid.Value);
var xform = Transform(targetGrid.Owner); var xform = Transform(targetGrid.Owner);
var (_, rot, invMat) = _transformSystem.GetWorldPositionRotationInvMatrix(xform); targetAngle = xform.WorldRotation;
targetAngle = rot; targetMatrix = xform.InvWorldMatrix;
targetMatrix = invMat;
tileSize = targetGrid.TileSize; tileSize = targetGrid.TileSize;
} }
@@ -96,7 +95,7 @@ public sealed partial class ExplosionSystem : EntitySystem
var xforms = EntityManager.GetEntityQuery<TransformComponent>(); var xforms = EntityManager.GetEntityQuery<TransformComponent>();
var xform = xforms.GetComponent(grid.Owner); 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 localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
var matrix = offsetMatrix * gridWorldMatrix * targetMatrix; var matrix = offsetMatrix * gridWorldMatrix * targetMatrix;

View File

@@ -87,8 +87,8 @@ public sealed partial class ExplosionSystem : EntitySystem
if (referenceGrid != null) if (referenceGrid != null)
{ {
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner); var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
spaceMatrix = _transformSystem.GetWorldMatrix(xform); spaceMatrix = xform.WorldMatrix;
spaceAngle = _transformSystem.GetWorldRotation(xform); spaceAngle = xform.WorldRotation;
} }
// is the explosion starting on a grid? // 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) if (player.AttachedEntity is not EntityUid uid)
continue; continue;
var playerPos = _transformSystem.GetWorldPosition(player.AttachedEntity.Value); var playerPos = Transform(player.AttachedEntity!.Value).WorldPosition;
var delta = epicenter.Position - playerPos; var delta = epicenter.Position - playerPos;
if (delta.EqualsApprox(Vector2.Zero)) if (delta.EqualsApprox(Vector2.Zero))

View File

@@ -13,7 +13,6 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly PuddleSystem _puddle = default!; [Dependency] private readonly PuddleSystem _puddle = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private readonly HashSet<IPlayerSession> _playerObservers = new(); private readonly HashSet<IPlayerSession> _playerObservers = new();
@@ -56,7 +55,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
var transform = EntityManager.GetComponent<TransformComponent>(entity); var transform = EntityManager.GetComponent<TransformComponent>(entity);
var worldBounds = Box2.CenteredAround(_transform.GetWorldPosition(transform), var worldBounds = Box2.CenteredAround(transform.WorldPosition,
new Vector2(LocalViewRange, LocalViewRange)); new Vector2(LocalViewRange, LocalViewRange));

View File

@@ -375,7 +375,7 @@ namespace Content.Server.GameTicking
var gridXform = Transform(gridUid); var gridXform = Transform(gridUid);
return new EntityCoordinates(gridUid, return new EntityCoordinates(gridUid,
_transform.GetInvWorldMatrix(gridXform).Transform(toMap.Position)); gridXform.InvWorldMatrix.Transform(toMap.Position));
} }
return spawn; return spawn;

View File

@@ -2,6 +2,8 @@ using System.Linq;
using System.Numerics; using System.Numerics;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Server.Ghost.Components; using Content.Server.Ghost.Components;
using Content.Server.Mind;
using Content.Server.Roles.Jobs;
using Content.Server.Visible; using Content.Server.Visible;
using Content.Server.Warps; using Content.Server.Warps;
using Content.Shared.Actions; using Content.Shared.Actions;
@@ -37,9 +39,8 @@ namespace Content.Server.Ghost
[Dependency] private readonly FollowerSystem _followerSystem = default!; [Dependency] private readonly FollowerSystem _followerSystem = default!;
[Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedMindSystem _minds = default!; [Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!; [Dependency] private readonly JobSystem _jobs = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -206,8 +207,8 @@ namespace Content.Server.Ghost
private void OnGhostWarpToTargetRequest(GhostWarpToTargetRequestEvent msg, EntitySessionEventArgs args) private void OnGhostWarpToTargetRequest(GhostWarpToTargetRequestEvent msg, EntitySessionEventArgs args)
{ {
if (args.SenderSession.AttachedEntity is not { Valid: true } attached || if (args.SenderSession.AttachedEntity is not {Valid: true} attached ||
!EntityManager.HasComponent<GhostComponent>(attached)) !EntityManager.TryGetComponent(attached, out GhostComponent? ghost))
{ {
Logger.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Target} without being a ghost."); Logger.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Target} without being a ghost.");
return; return;
@@ -222,12 +223,13 @@ namespace Content.Server.Ghost
if (TryComp(msg.Target, out WarpPointComponent? warp) && warp.Follow if (TryComp(msg.Target, out WarpPointComponent? warp) && warp.Follow
|| HasComp<MobStateComponent>(msg.Target)) || HasComp<MobStateComponent>(msg.Target))
{ {
_followerSystem.StartFollowingEntity(attached, msg.Target); _followerSystem.StartFollowingEntity(ghost.Owner, msg.Target);
return; return;
} }
_transform.SetCoordinates(attached, Transform(msg.Target).Coordinates); var xform = Transform(ghost.Owner);
_transform.AttachToGridOrMap(attached); xform.Coordinates = Transform(msg.Target).Coordinates;
xform.AttachToGridOrMap();
if (TryComp(attached, out PhysicsComponent? physics)) if (TryComp(attached, out PhysicsComponent? physics))
_physics.SetLinearVelocity(attached, Vector2.Zero, body: physics); _physics.SetLinearVelocity(attached, Vector2.Zero, body: physics);
} }

View File

@@ -45,7 +45,6 @@ namespace Content.Server.Hands.Systems
[Dependency] private readonly StorageSystem _storageSystem = default!; [Dependency] private readonly StorageSystem _storageSystem = default!;
[Dependency] private readonly ISharedPlayerManager _player = default!; [Dependency] private readonly ISharedPlayerManager _player = default!;
[Dependency] private readonly IConfigurationManager _configuration = default!; [Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -202,7 +201,7 @@ namespace Content.Server.Hands.Systems
throwEnt = splitStack.Value; throwEnt = splitStack.Value;
} }
var direction = coords.ToMapPos(EntityManager) - _transform.GetWorldPosition(player); var direction = coords.ToMapPos(EntityManager) - Transform(player).WorldPosition;
if (direction == Vector2.Zero) if (direction == Vector2.Zero)
return true; return true;

View File

@@ -20,7 +20,6 @@ public sealed class ImmovableRodSystem : EntitySystem
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
@@ -63,11 +62,11 @@ public sealed class ImmovableRodSystem : EntitySystem
var vel = component.DirectionOverride.Degrees switch var vel = component.DirectionOverride.Degrees switch
{ {
0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed), 0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed),
_ => _transform.GetWorldRotation(xform).RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed), _ => xform.WorldRotation.RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
}; };
_physics.ApplyLinearImpulse(uid, vel, body: phys); _physics.ApplyLinearImpulse(uid, vel, body: phys);
xform.LocalRotation = (vel - _transform.GetWorldPosition(xform)).ToWorldAngle() + MathHelper.PiOver2; xform.LocalRotation = (vel - xform.WorldPosition).ToWorldAngle() + MathHelper.PiOver2;
} }
} }

View File

@@ -16,7 +16,6 @@ public sealed class LightningSystem : SharedLightningSystem
[Dependency] private readonly PhysicsSystem _physics = default!; [Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly BeamSystem _beam = default!; [Dependency] private readonly BeamSystem _beam = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -98,7 +97,7 @@ public sealed class LightningSystem : SharedLightningSystem
for (int i = 0; i < directions; i++) for (int i = 0; i < directions; i++)
{ {
var direction = (Direction) i; var direction = (Direction) i;
var (targetPos, targetRot) = _transform.GetWorldPositionRotation(targetXForm, xformQuery); var (targetPos, targetRot) = targetXForm.GetWorldPositionRotation(xformQuery);
var dirRad = direction.ToAngle() + targetRot; var dirRad = direction.ToAngle() + targetRot;
var ray = new CollisionRay(targetPos, dirRad.ToVec(), component.CollisionMask); var ray = new CollisionRay(targetPos, dirRad.ToVec(), component.CollisionMask);
var rayCastResults = _physics.IntersectRay(targetXForm.MapID, ray, component.MaxLength, target, false).ToList(); var rayCastResults = _physics.IntersectRay(targetXForm.MapID, ray, component.MaxLength, target, false).ToList();

View File

@@ -274,11 +274,10 @@ public sealed class MagicSystem : EntitySystem
var transform = Transform(args.Performer); var transform = Transform(args.Performer);
if (transform.MapID != args.Target.GetMapId(EntityManager)) if (transform.MapID != args.Target.GetMapId(EntityManager)) return;
return;
_transformSystem.SetCoordinates(args.Performer, args.Target); _transformSystem.SetCoordinates(args.Performer, args.Target);
_transformSystem.AttachToGridOrMap(args.Performer, transform); transform.AttachToGridOrMap();
_audio.PlayPvs(args.BlinkSound, args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume)); _audio.PlayPvs(args.BlinkSound, args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume));
Speak(args); Speak(args);
args.Handled = true; args.Handled = true;

View File

@@ -13,7 +13,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
{ {
[Dependency] private readonly IConGroupController _admin = default!; [Dependency] private readonly IConGroupController _admin = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private readonly HashSet<ICommonSession> _draggers = new(); private readonly HashSet<ICommonSession> _draggers = new();
@@ -66,11 +65,10 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
if (args.SenderSession is not IPlayerSession playerSession || if (args.SenderSession is not IPlayerSession playerSession ||
!_admin.CanCommand(playerSession, CommandName) || !_admin.CanCommand(playerSession, CommandName) ||
!Exists(msg.Grid) || !Exists(msg.Grid) ||
Deleted(msg.Grid)) Deleted(msg.Grid)) return;
{
return;
}
_transform.SetWorldPosition(msg.Grid, msg.WorldPosition); var gridXform = Transform(msg.Grid);
gridXform.WorldPosition = msg.WorldPosition;
} }
} }

View File

@@ -77,7 +77,7 @@ public sealed class MechGrabberSystem : EntitySystem
component.ItemContainer.Remove(toRemove); component.ItemContainer.Remove(toRemove);
var mechxform = Transform(mech); var mechxform = Transform(mech);
var xform = Transform(toRemove); var xform = Transform(toRemove);
_transform.AttachToGridOrMap(toRemove, xform); xform.AttachToGridOrMap();
var offset = _transform.GetWorldPosition(mechxform) + _transform.GetWorldRotation(mechxform).RotateVec(component.DepositOffset); var offset = _transform.GetWorldPosition(mechxform) + _transform.GetWorldRotation(mechxform).RotateVec(component.DepositOffset);
_transform.SetWorldPosition(xform, offset); _transform.SetWorldPosition(xform, offset);

View File

@@ -36,7 +36,7 @@ public sealed partial class PathfindingSystem
return Vector2.Zero; return Vector2.Zero;
} }
endPos = _transform.GetInvWorldMatrix(startXform).Transform(_transform.GetWorldMatrix(endXform).Transform(endPos)); endPos = startXform.InvWorldMatrix.Transform(endXform.WorldMatrix.Transform(endPos));
} }
// TODO: Numerics when we changeover. // TODO: Numerics when we changeover.

View File

@@ -410,7 +410,8 @@ public sealed partial class PathfindingSystem
private Vector2i GetOrigin(EntityCoordinates coordinates, EntityUid gridUid) private Vector2i GetOrigin(EntityCoordinates coordinates, EntityUid gridUid)
{ {
var localPos = _transform.GetInvWorldMatrix(gridUid).Transform(coordinates.ToMapPos(EntityManager)); var gridXform = Transform(gridUid);
var localPos = gridXform.InvWorldMatrix.Transform(coordinates.ToMapPos(EntityManager));
return new Vector2i((int) Math.Floor(localPos.X / ChunkSize), (int) Math.Floor(localPos.Y / ChunkSize)); return new Vector2i((int) Math.Floor(localPos.X / ChunkSize), (int) Math.Floor(localPos.Y / ChunkSize));
} }

View File

@@ -47,7 +47,6 @@ namespace Content.Server.NPC.Pathfinding
[Dependency] private readonly FixtureSystem _fixtures = default!; [Dependency] private readonly FixtureSystem _fixtures = default!;
[Dependency] private readonly NPCSystem _npc = default!; [Dependency] private readonly NPCSystem _npc = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private readonly Dictionary<ICommonSession, PathfindingDebugMode> _subscribedSessions = new(); private readonly Dictionary<ICommonSession, PathfindingDebugMode> _subscribedSessions = new();
@@ -383,7 +382,7 @@ namespace Content.Server.NPC.Pathfinding
return null; return null;
} }
var localPos = _transform.GetInvWorldMatrix(xform).Transform(coordinates.ToMapPos(EntityManager)); var localPos = xform.InvWorldMatrix.Transform(coordinates.ToMapPos(EntityManager));
var origin = GetOrigin(localPos); var origin = GetOrigin(localPos);
if (!TryGetChunk(origin, comp, out var chunk)) if (!TryGetChunk(origin, comp, out var chunk))

View File

@@ -16,7 +16,6 @@ namespace Content.Server.Pointing.EntitySystems
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ExplosionSystem _explosion = default!; [Dependency] private readonly ExplosionSystem _explosion = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null) private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null)
{ {
@@ -69,24 +68,24 @@ namespace Content.Server.Pointing.EntitySystems
if (component.TurningDelay > 0) if (component.TurningDelay > 0)
{ {
var difference = _transform.GetWorldPosition(chasing) - _transform.GetWorldPosition(transform); var difference = EntityManager.GetComponent<TransformComponent>(chasing).WorldPosition - transform.WorldPosition;
var angle = difference.ToAngle(); var angle = difference.ToAngle();
var adjusted = angle.Degrees + 90; var adjusted = angle.Degrees + 90;
var newAngle = Angle.FromDegrees(adjusted); var newAngle = Angle.FromDegrees(adjusted);
_transform.SetWorldRotation(transform, newAngle); transform.WorldRotation = newAngle;
UpdateAppearance(uid, component, transform); UpdateAppearance(uid, component, transform);
continue; continue;
} }
_transform.SetWorldRotation(transform, _transform.GetWorldRotation(transform) + Angle.FromDegrees(20)); transform.WorldRotation += Angle.FromDegrees(20);
UpdateAppearance(uid, component, transform); UpdateAppearance(uid, component, transform);
var toChased = _transform.GetWorldPosition(chasing) - _transform.GetWorldPosition(transform); var toChased = EntityManager.GetComponent<TransformComponent>(chasing).WorldPosition - transform.WorldPosition;
_transform.SetWorldPosition(transform, _transform.GetWorldPosition(transform) + toChased * frameTime * component.ChasingSpeed); transform.WorldPosition += toChased * frameTime * component.ChasingSpeed;
component.ChasingTime -= frameTime; component.ChasingTime -= frameTime;

View File

@@ -266,8 +266,8 @@ namespace Content.Server.Polymorph.Systems
var parentXform = Transform(parent); var parentXform = Transform(parent);
_transform.SetParent(parent, parentXform, uidXform.ParentUid); _transform.SetParent(parent, parentXform, uidXform.ParentUid);
_transform.SetCoordinates(parent, parentXform, uidXform.Coordinates); parentXform.Coordinates = uidXform.Coordinates;
_transform.SetLocalRotation(parentXform, uidXform.LocalRotation); parentXform.LocalRotation = uidXform.LocalRotation;
if (proto.TransferDamage && if (proto.TransferDamage &&
TryComp<DamageableComponent>(parent, out var damageParent) && TryComp<DamageableComponent>(parent, out var damageParent) &&
@@ -306,7 +306,7 @@ namespace Content.Server.Polymorph.Systems
_mindSystem.TransferTo(mindId, parent, mind: mind); _mindSystem.TransferTo(mindId, parent, mind: mind);
// if an item polymorph was picked up, put it back down after reverting // if an item polymorph was picked up, put it back down after reverting
_transform.AttachToGridOrMap(parent); Transform(parent).AttachToGridOrMap();
_popup.PopupEntity(Loc.GetString("polymorph-revert-popup-generic", _popup.PopupEntity(Loc.GetString("polymorph-revert-popup-generic",
("parent", Identity.Entity(uid, EntityManager)), ("parent", Identity.Entity(uid, EntityManager)),

View File

@@ -22,7 +22,6 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly TurfSystem _turf = default!; [Dependency] private readonly TurfSystem _turf = default!;
[Dependency] private readonly IChatManager _chat = default!; [Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -157,7 +156,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
var tile = tileRef.GridIndices; var tile = tileRef.GridIndices;
var found = false; var found = false;
var (gridPos, _, gridMatrix) = _transform.GetWorldPositionRotationMatrix(xform); var (gridPos, _, gridMatrix) = xform.GetWorldPositionRotationMatrix();
var gridBounds = gridMatrix.TransformBox(grid.LocalAABB); var gridBounds = gridMatrix.TransformBox(grid.LocalAABB);
//Obviously don't put anything ridiculous in here //Obviously don't put anything ridiculous in here

View File

@@ -40,7 +40,6 @@ public sealed partial class RevenantSystem
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!; [Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
[Dependency] private readonly GhostSystem _ghost = default!; [Dependency] private readonly GhostSystem _ghost = default!;
[Dependency] private readonly TileSystem _tile = default!; [Dependency] private readonly TileSystem _tile = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private void InitializeAbilities() private void InitializeAbilities()
{ {
@@ -215,7 +214,7 @@ public sealed partial class RevenantSystem
var xform = Transform(uid); var xform = Transform(uid);
if (!_mapManager.TryGetGrid(xform.GridUid, out var map)) if (!_mapManager.TryGetGrid(xform.GridUid, out var map))
return; return;
var tiles = map.GetTilesIntersecting(Box2.CenteredAround(_transform.GetWorldPosition(xform), var tiles = map.GetTilesIntersecting(Box2.CenteredAround(xform.WorldPosition,
new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray(); new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray();
_random.Shuffle(tiles); _random.Shuffle(tiles);

View File

@@ -50,7 +50,7 @@ sealed class SalvageRulerCommand : IConsoleCommand
var first = true; var first = true;
foreach (var mapGrid in _maps.GetAllMapGrids(entityTransform.MapID)) foreach (var mapGrid in _maps.GetAllMapGrids(entityTransform.MapID))
{ {
var aabb = _entities.System<SharedTransformSystem>().GetWorldMatrix(mapGrid.Owner).TransformBox(mapGrid.LocalAABB); var aabb = _entities.GetComponent<TransformComponent>(mapGrid.Owner).WorldMatrix.TransformBox(mapGrid.LocalAABB);
if (first) if (first)
{ {
total = aabb; total = aabb;

View File

@@ -54,7 +54,6 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
[Dependency] private readonly ShuttleSystem _shuttle = default!; [Dependency] private readonly ShuttleSystem _shuttle = default!;
[Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private ISawmill _sawmill = default!; private ISawmill _sawmill = default!;
@@ -416,6 +415,6 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
if (!Resolve(shuttle, ref grid, ref shuttleXform)) if (!Resolve(shuttle, ref grid, ref shuttleXform))
return false; return false;
return _transform.GetWorldMatrix(shuttleXform).TransformBox(grid.LocalAABB).Contains(_transform.GetWorldPosition(xform)); return shuttleXform.WorldMatrix.TransformBox(grid.LocalAABB).Contains(xform.WorldPosition);
} }
} }

View File

@@ -250,8 +250,8 @@ public sealed partial class ShuttleSystem
var fromRotation = _transform.GetWorldRotation(xform); var fromRotation = _transform.GetWorldRotation(xform);
var width = Comp<MapGridComponent>(uid).LocalAABB.Width; var width = Comp<MapGridComponent>(uid).LocalAABB.Width;
_transform.SetCoordinates(uid, xform, new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f))); xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
_transform.SetLocalRotation(xform, Angle.Zero); xform.LocalRotation = Angle.Zero;
_index += width + Buffer; _index += width + Buffer;
comp.Accumulator += comp.TravelTime - DefaultArrivalTime; comp.Accumulator += comp.TravelTime - DefaultArrivalTime;
@@ -336,7 +336,7 @@ public sealed partial class ShuttleSystem
} }
else else
{ {
_transform.SetCoordinates(uid, xform, comp.TargetCoordinates); xform.Coordinates = comp.TargetCoordinates;
mapId = comp.TargetCoordinates.GetMapId(EntityManager); mapId = comp.TargetCoordinates.GetMapId(EntityManager);
} }
@@ -506,7 +506,7 @@ public sealed partial class ShuttleSystem
if (config != null) if (config != null)
{ {
FTLDock(config, shuttleUid, shuttleXform); FTLDock(config, shuttleXform);
return true; return true;
} }
@@ -517,13 +517,10 @@ public sealed partial class ShuttleSystem
/// <summary> /// <summary>
/// Forces an FTL dock. /// Forces an FTL dock.
/// </summary> /// </summary>
public void FTLDock(DockingConfig config, EntityUid uid, TransformComponent? shuttleXform = null) public void FTLDock(DockingConfig config, TransformComponent shuttleXform)
{ {
if (!Resolve(uid, ref shuttleXform))
return;
// Set position // Set position
_transform.SetCoordinates(uid, shuttleXform, config.Coordinates); shuttleXform.Coordinates = config.Coordinates;
_transform.SetWorldRotation(shuttleXform, config.Angle); _transform.SetWorldRotation(shuttleXform, config.Angle);
// Connect everything // Connect everything
@@ -632,7 +629,7 @@ public sealed partial class ShuttleSystem
spawnPos = _transform.GetWorldPosition(targetXform, xformQuery); spawnPos = _transform.GetWorldPosition(targetXform, xformQuery);
} }
_transform.SetCoordinates(shuttleUid, xform, new EntityCoordinates(targetXform.MapUid.Value, spawnPos)); xform.Coordinates = new EntityCoordinates(targetXform.MapUid.Value, spawnPos);
if (!HasComp<MapComponent>(targetXform.GridUid)) if (!HasComp<MapComponent>(targetXform.GridUid))
{ {

View File

@@ -115,7 +115,7 @@ public sealed partial class ShuttleSystem
if (config != null) if (config != null)
{ {
FTLDock(config, ent[0], shuttleXform); FTLDock(config, shuttleXform);
if (TryComp<StationMemberComponent>(xform.GridUid, out var stationMember)) if (TryComp<StationMemberComponent>(xform.GridUid, out var stationMember))
{ {

View File

@@ -38,8 +38,8 @@ public sealed partial class ShuttleSystem
var otherXform = Transform(args.OtherEntity); var otherXform = Transform(args.OtherEntity);
var ourPoint = _transform.GetInvWorldMatrix(ourXform).Transform(args.WorldPoint); var ourPoint = ourXform.InvWorldMatrix.Transform(args.WorldPoint);
var otherPoint = _transform.GetInvWorldMatrix(otherXform).Transform(args.WorldPoint); var otherPoint = otherXform.InvWorldMatrix.Transform(args.WorldPoint);
var ourVelocity = _physics.GetLinearVelocity(uid, ourPoint, ourBody, ourXform); var ourVelocity = _physics.GetLinearVelocity(uid, ourPoint, ourBody, ourXform);
var otherVelocity = _physics.GetLinearVelocity(args.OtherEntity, otherPoint, otherBody, otherXform); var otherVelocity = _physics.GetLinearVelocity(args.OtherEntity, otherPoint, otherBody, otherXform);

View File

@@ -22,7 +22,6 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly PhysicsSystem _physics = default!; [Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly AppearanceSystem _visualizer = default!; [Dependency] private readonly AppearanceSystem _visualizer = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -229,7 +228,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
if (!gen1XForm.Anchored) if (!gen1XForm.Anchored)
return false; return false;
var genWorldPosRot = _transform.GetWorldPositionRotation(gen1XForm); var genWorldPosRot = gen1XForm.GetWorldPositionRotation();
var dirRad = dir.ToAngle() + genWorldPosRot.WorldRotation; //needs to be like this for the raycast to work properly var dirRad = dir.ToAngle() + genWorldPosRot.WorldRotation; //needs to be like this for the raycast to work properly
var ray = new CollisionRay(genWorldPosRot.WorldPosition, dirRad.ToVec(), component.CollisionMask); var ray = new CollisionRay(genWorldPosRot.WorldPosition, dirRad.ToVec(), component.CollisionMask);
@@ -305,7 +304,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
var newField = Spawn(firstGenComp.CreatedField, currentCoords); var newField = Spawn(firstGenComp.CreatedField, currentCoords);
var fieldXForm = Transform(newField); var fieldXForm = Transform(newField);
_transform.SetParent(newField, fieldXForm, firstGenComp.Owner); fieldXForm.AttachParent(firstGenComp.Owner);
if (dirVec.GetDir() == Direction.East || dirVec.GetDir() == Direction.West) if (dirVec.GetDir() == Direction.East || dirVec.GetDir() == Direction.West)
{ {
var angle = fieldXForm.LocalPosition.ToAngle(); var angle = fieldXForm.LocalPosition.ToAngle();

View File

@@ -13,7 +13,6 @@ public sealed class ContainmentFieldSystem : EntitySystem
{ {
[Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -27,16 +26,16 @@ public sealed class ContainmentFieldSystem : EntitySystem
{ {
var otherBody = args.OtherEntity; var otherBody = args.OtherEntity;
if (HasComp<SpaceGarbageComponent>(otherBody)) if (TryComp<SpaceGarbageComponent>(otherBody, out var garbage))
{ {
_popupSystem.PopupEntity(Loc.GetString("comp-field-vaporized", ("entity", otherBody)), uid, PopupType.LargeCaution); _popupSystem.PopupEntity(Loc.GetString("comp-field-vaporized", ("entity", otherBody)), component.Owner, PopupType.LargeCaution);
QueueDel(otherBody); QueueDel(garbage.Owner);
} }
if (TryComp<PhysicsComponent>(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard) if (TryComp<PhysicsComponent>(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard)
{ {
var fieldDir = _transform.GetWorldPosition(uid); var fieldDir = Transform(component.Owner).WorldPosition;
var playerDir = _transform.GetWorldPosition(otherBody); var playerDir = Transform(otherBody).WorldPosition;
_throwing.TryThrow(otherBody, playerDir-fieldDir, strength: component.ThrowForce); _throwing.TryThrow(otherBody, playerDir-fieldDir, strength: component.ThrowForce);
} }

View File

@@ -18,7 +18,6 @@ namespace Content.Server.Solar.EntitySystems
{ {
[Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!; [Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
/// <summary> /// <summary>
/// Maximum panel angular velocity range - used to stop people rotating panels fast enough that the lag prevention becomes noticable /// Maximum panel angular velocity range - used to stop people rotating panels fast enough that the lag prevention becomes noticable
@@ -112,7 +111,7 @@ namespace Content.Server.Solar.EntitySystems
foreach (var (panel, xform) in EntityManager.EntityQuery<SolarPanelComponent, TransformComponent>()) foreach (var (panel, xform) in EntityManager.EntityQuery<SolarPanelComponent, TransformComponent>())
{ {
TotalPanelPower += panel.MaxSupply * panel.Coverage; TotalPanelPower += panel.MaxSupply * panel.Coverage;
_transform.SetWorldRotation(xform, TargetPanelRotation); xform.WorldRotation = TargetPanelRotation;
_updateQueue.Enqueue(panel); _updateQueue.Enqueue(panel);
} }
} }
@@ -135,7 +134,7 @@ namespace Content.Server.Solar.EntitySystems
// directly downwards (abs(theta) = pi) = coverage -1 // directly downwards (abs(theta) = pi) = coverage -1
// as TowardsSun + = CCW, // as TowardsSun + = CCW,
// panelRelativeToSun should - = CW // panelRelativeToSun should - = CW
var panelRelativeToSun = _transform.GetWorldRotation(xform) - TowardsSun; var panelRelativeToSun = xform.WorldRotation - TowardsSun;
// essentially, given cos = X & sin = Y & Y is 'downwards', // essentially, given cos = X & sin = Y & Y is 'downwards',
// then for the first 90 degrees of rotation in either direction, // then for the first 90 degrees of rotation in either direction,
// this plots the lower-right quadrant of a circle. // this plots the lower-right quadrant of a circle.
@@ -153,7 +152,7 @@ namespace Content.Server.Solar.EntitySystems
if (coverage > 0) if (coverage > 0)
{ {
// Determine if the solar panel is occluded, and zero out coverage if so. // Determine if the solar panel is occluded, and zero out coverage if so.
var ray = new CollisionRay(_transform.GetWorldPosition(xform), TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); var ray = new CollisionRay(xform.WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque);
var rayCastResults = _physicsSystem.IntersectRayWithPredicate( var rayCastResults = _physicsSystem.IntersectRayWithPredicate(
xform.MapID, xform.MapID,
ray, ray,

View File

@@ -13,7 +13,6 @@ 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 _transform = default!;
private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args) private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args)
{ {
@@ -26,7 +25,7 @@ public sealed class StandingStateSystem : EntitySystem
if (!TryComp(uid, out HandsComponent? handsComp)) if (!TryComp(uid, out HandsComponent? handsComp))
return; return;
var worldRotation = _transform.GetWorldRotation(uid).ToVec(); var worldRotation = EntityManager.GetComponent<TransformComponent>(uid).WorldRotation.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)

View File

@@ -12,7 +12,6 @@ namespace Content.Server.Worldgen.Systems;
public abstract class BaseWorldSystem : EntitySystem public abstract class BaseWorldSystem : EntitySystem
{ {
[Dependency] private readonly WorldControllerSystem _worldController = default!; [Dependency] private readonly WorldControllerSystem _worldController = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
/// <summary> /// <summary>
/// Gets a chunk's coordinates in chunk space as an integer value. /// Gets a chunk's coordinates in chunk space as an integer value.
@@ -26,7 +25,7 @@ public abstract class BaseWorldSystem : EntitySystem
if (!Resolve(ent, ref xform)) if (!Resolve(ent, ref xform))
throw new Exception("Failed to resolve transform, somehow."); throw new Exception("Failed to resolve transform, somehow.");
return WorldGen.WorldToChunkCoords(_transform.GetWorldPosition(xform)).Floored(); return WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored();
} }
/// <summary> /// <summary>
@@ -41,7 +40,7 @@ public abstract class BaseWorldSystem : EntitySystem
if (!Resolve(ent, ref xform)) if (!Resolve(ent, ref xform))
throw new Exception("Failed to resolve transform, somehow."); throw new Exception("Failed to resolve transform, somehow.");
return WorldGen.WorldToChunkCoords(_transform.GetWorldPosition(xform)); return WorldGen.WorldToChunkCoords(xform.WorldPosition);
} }
/// <summary> /// <summary>

View File

@@ -16,7 +16,6 @@ public sealed class ThrowArtifactSystem : EntitySystem
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly TileSystem _tile = default!; [Dependency] private readonly TileSystem _tile = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
@@ -30,7 +29,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
if (_map.TryGetGrid(xform.GridUid, out var grid)) if (_map.TryGetGrid(xform.GridUid, out var grid))
{ {
var tiles = grid.GetTilesIntersecting( var tiles = grid.GetTilesIntersecting(
Box2.CenteredAround(_transform.GetWorldPosition(xform), new Vector2(component.Range * 2, component.Range))); Box2.CenteredAround(xform.WorldPosition, new Vector2(component.Range * 2, component.Range)));
foreach (var tile in tiles) foreach (var tile in tiles)
{ {

View File

@@ -140,7 +140,7 @@ public partial class SharedBodySystem
container.Remove(organId.Value); container.Remove(organId.Value);
if (TryComp(organId, out TransformComponent? transform)) if (TryComp(organId, out TransformComponent? transform))
_transform.AttachToGridOrMap(organId.Value, transform); transform.AttachToGridOrMap();
organ.Owner.RandomOffset(0.25f); organ.Owner.RandomOffset(0.25f);
@@ -165,7 +165,7 @@ public partial class SharedBodySystem
return false; return false;
if (TryComp(organId.Value, out TransformComponent? transform)) if (TryComp(organId.Value, out TransformComponent? transform))
_transform.SetCoordinates(organId.Value, transform, dropAt); transform.Coordinates = dropAt;
return true; return true;
} }

View File

@@ -249,7 +249,7 @@ public partial class SharedBodySystem
container.Remove(partId.Value); container.Remove(partId.Value);
if (TryComp(partId, out TransformComponent? transform)) if (TryComp(partId, out TransformComponent? transform))
_transform.AttachToGridOrMap(partId.Value, transform); transform.AttachToGridOrMap();
part.Owner.RandomOffset(0.25f); part.Owner.RandomOffset(0.25f);
@@ -331,7 +331,7 @@ public partial class SharedBodySystem
return false; return false;
if (TryComp(partId.Value, out TransformComponent? transform)) if (TryComp(partId.Value, out TransformComponent? transform))
_transform.SetCoordinates(partId.Value, transform, dropAt); transform.Coordinates = dropAt;
return true; return true;
} }

View File

@@ -16,7 +16,6 @@ public abstract partial class SharedBodySystem : EntitySystem
[Dependency] protected readonly DamageableSystem Damageable = default!; [Dependency] protected readonly DamageableSystem Damageable = default!;
[Dependency] protected readonly StandingStateSystem Standing = default!; [Dependency] protected readonly StandingStateSystem Standing = default!;
[Dependency] protected readonly MovementSpeedModifierSystem Movement = default!; [Dependency] protected readonly MovementSpeedModifierSystem Movement = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {

View File

@@ -465,7 +465,7 @@ public abstract partial class SharedBuckleSystem
_transformSystem.SetWorldRotation(buckleXform, oldBuckledToWorldRot); _transformSystem.SetWorldRotation(buckleXform, oldBuckledToWorldRot);
if (strapComp.UnbuckleOffset != Vector2.Zero) if (strapComp.UnbuckleOffset != Vector2.Zero)
_transformSystem.SetCoordinates(buckleUid, buckleXform, oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset)); buckleXform.Coordinates = oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset);
} }
if (TryComp(buckleUid, out AppearanceComponent? appearance)) if (TryComp(buckleUid, out AppearanceComponent? appearance))

View File

@@ -65,7 +65,7 @@ public abstract partial class SharedBuckleSystem : EntitySystem
var buckleTransform = Transform(buckleUid); var buckleTransform = Transform(buckleUid);
_transformSystem.SetCoordinates(buckleUid, buckleTransform, new EntityCoordinates(strapUid, strapComp.BuckleOffset)); buckleTransform.Coordinates = new EntityCoordinates(strapUid, strapComp.BuckleOffset);
// Buckle subscribes to move for <reasons> so this might fail. // Buckle subscribes to move for <reasons> so this might fail.
// TODO: Make buckle not do that. // TODO: Make buckle not do that.

View File

@@ -17,16 +17,15 @@ namespace Content.Shared.Construction.Conditions
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction) public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{ {
var entManager = IoCManager.Resolve<IEntityManager>(); var entManager = IoCManager.Resolve<IEntityManager>();
var transform = entManager.System<SharedTransformSystem>();
// get blueprint and user position // get blueprint and user position
var userWorldPosition = transform.GetWorldPosition(user); var userWorldPosition = entManager.GetComponent<TransformComponent>(user).WorldPosition;
var objWorldPosition = location.ToMap(entManager).Position; var objWorldPosition = location.ToMap(entManager).Position;
// find direction from user to blueprint // find direction from user to blueprint
var userToObject = (objWorldPosition - userWorldPosition); var userToObject = (objWorldPosition - userWorldPosition);
// get direction of the grid being placed on as an offset. // get direction of the grid being placed on as an offset.
var gridRotation = transform.GetWorldRotation(location.EntityId); var gridRotation = entManager.GetComponent<TransformComponent>(location.EntityId).WorldRotation;
var directionWithOffset = gridRotation.RotateVec(direction.ToVec()); var directionWithOffset = gridRotation.RotateVec(direction.ToVec());
// dot product will be positive if user direction and blueprint are co-directed // dot product will be positive if user direction and blueprint are co-directed

View File

@@ -7,7 +7,6 @@ namespace Content.Shared.Containers;
public sealed class ContainerFillSystem : EntitySystem public sealed class ContainerFillSystem : EntitySystem
{ {
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -40,7 +39,7 @@ public sealed class ContainerFillSystem : EntitySystem
if (!container.Insert(ent, EntityManager, null, xform)) if (!container.Insert(ent, EntityManager, null, xform))
{ {
Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}."); Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.");
_transform.AttachToGridOrMap(ent); Transform(ent).AttachToGridOrMap();
break; break;
} }
} }

View File

@@ -8,8 +8,6 @@ namespace Content.Shared.Hands.EntitySystems;
public abstract partial class SharedHandsSystem : EntitySystem public abstract partial class SharedHandsSystem : EntitySystem
{ {
[Dependency] private readonly SharedTransformSystem _transform = default!;
private void InitializeDrop() private void InitializeDrop()
{ {
SubscribeLocalEvent<HandsComponent, EntRemovedFromContainerMessage>(HandleEntityRemoved); SubscribeLocalEvent<HandsComponent, EntRemovedFromContainerMessage>(HandleEntityRemoved);
@@ -100,14 +98,12 @@ public abstract partial class SharedHandsSystem : EntitySystem
if (!isInContainer if (!isInContainer
|| !_containerSystem.TryGetContainingContainer(userXform.ParentUid, uid, out var container, skipExistCheck: true) || !_containerSystem.TryGetContainingContainer(userXform.ParentUid, uid, out var container, skipExistCheck: true)
|| !container.Insert(entity, EntityManager, itemXform)) || !container.Insert(entity, EntityManager, itemXform))
{ itemXform.AttachToGridOrMap();
_transform.AttachToGridOrMap(entity, itemXform);
}
return true; return true;
} }
var target = targetDropLocation.Value.ToMap(EntityManager); var target = targetDropLocation.Value.ToMap(EntityManager);
_transform.SetWorldPosition(itemXform, GetFinalDropCoordinates(uid, userXform.MapPosition, target)); itemXform.WorldPosition = GetFinalDropCoordinates(uid, userXform.MapPosition, target);
return true; return true;
} }

View File

@@ -85,7 +85,7 @@ namespace Content.Shared.Interaction
if (!Resolve(user, ref xform)) if (!Resolve(user, ref xform))
return false; return false;
_transform.SetWorldRotation(xform, diffAngle); xform.WorldRotation = diffAngle;
return true; return true;
} }
@@ -101,7 +101,7 @@ namespace Content.Shared.Interaction
// (Since the user being buckled to it holds it down with their weight.) // (Since the user being buckled to it holds it down with their weight.)
// This is logically equivalent to RotateWhileAnchored. // This is logically equivalent to RotateWhileAnchored.
// Barstools and office chairs have independent wheels, while regular chairs don't. // Barstools and office chairs have independent wheels, while regular chairs don't.
_transform.SetWorldRotation(suid.Value, diffAngle); Transform(rotatable.Owner).WorldRotation = diffAngle;
return true; return true;
} }
} }

View File

@@ -593,7 +593,7 @@ namespace Content.Shared.Interaction
fixtureB.FixtureCount > 0 && fixtureB.FixtureCount > 0 &&
TryComp<TransformComponent>(origin, out var xformA)) TryComp<TransformComponent>(origin, out var xformA))
{ {
var (worldPosA, worldRotA) = _transform.GetWorldPositionRotation(xformA); var (worldPosA, worldRotA) = xformA.GetWorldPositionRotation();
var xfA = new Transform(worldPosA, worldRotA); var xfA = new Transform(worldPosA, worldRotA);
var parentRotB = _transform.GetWorldRotation(otherCoordinates.EntityId); var parentRotB = _transform.GetWorldRotation(otherCoordinates.EntityId);
var xfB = new Transform(targetPos.Position, parentRotB + otherAngle); var xfB = new Transform(targetPos.Position, parentRotB + otherAngle);
@@ -659,7 +659,7 @@ namespace Content.Shared.Interaction
Ignored? predicate = null) Ignored? predicate = null)
{ {
var transform = Transform(target); var transform = Transform(target);
var (position, rotation) = _transform.GetWorldPositionRotation(transform); var (position, rotation) = transform.GetWorldPositionRotation();
var mapPos = new MapCoordinates(position, transform.MapID); var mapPos = new MapCoordinates(position, transform.MapID);
var combinedPredicate = GetPredicate(origin, target, mapPos, rotation, collisionMask, predicate); var combinedPredicate = GetPredicate(origin, target, mapPos, rotation, collisionMask, predicate);

View File

@@ -27,7 +27,6 @@ public abstract partial class InventorySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly INetManager _netMan = default!; [Dependency] private readonly INetManager _netMan = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private void InitializeEquip() private void InitializeEquip()
{ {
@@ -386,7 +385,7 @@ public abstract partial class InventorySystem
} }
} }
_transform.SetCoordinates(removedItem.Value, Transform(target).Coordinates); Transform(removedItem.Value).Coordinates = Transform(target).Coordinates;
if (!silent && Resolve(removedItem.Value, ref clothing, false) && clothing.UnequipSound != null && _gameTiming.IsFirstTimePredicted) if (!silent && Resolve(removedItem.Value, ref clothing, false) && clothing.UnequipSound != null && _gameTiming.IsFirstTimePredicted)
{ {

View File

@@ -175,7 +175,7 @@ namespace Content.Shared.Maps
if (map.TryGetGrid(turf.GridUid, out var tileGrid)) if (map.TryGetGrid(turf.GridUid, out var tileGrid))
{ {
var gridRot = entManager.System<SharedTransformSystem>().GetWorldRotation(tileGrid.Owner); var gridRot = entManager.GetComponent<TransformComponent>(tileGrid.Owner).WorldRotation;
// 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);

View File

@@ -18,7 +18,6 @@ public abstract class SharedConveyorController : VirtualController
[Dependency] protected readonly EntityLookupSystem Lookup = default!; [Dependency] protected readonly EntityLookupSystem Lookup = default!;
[Dependency] protected readonly SharedPhysicsSystem Physics = default!; [Dependency] protected readonly SharedPhysicsSystem Physics = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!; [Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
protected const string ConveyorFixture = "conveyor"; protected const string ConveyorFixture = "conveyor";
@@ -117,7 +116,7 @@ public abstract class SharedConveyorController : VirtualController
var itemRelative = conveyorPos - localPos; var itemRelative = conveyorPos - localPos;
localPos += Convey(direction, speed, frameTime, itemRelative); localPos += Convey(direction, speed, frameTime, itemRelative);
_transform.SetLocalPosition(transform, localPos); transform.LocalPosition = localPos;
// Force it awake for collisionwake reasons. // Force it awake for collisionwake reasons.
Physics.SetAwake(entity, body, true); Physics.SetAwake(entity, body, true);

View File

@@ -9,7 +9,6 @@ namespace Content.Shared.Placeable
public sealed class PlaceableSurfaceSystem : EntitySystem public sealed class PlaceableSurfaceSystem : EntitySystem
{ {
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -69,9 +68,9 @@ namespace Content.Shared.Placeable
return; return;
if (surface.PlaceCentered) if (surface.PlaceCentered)
_transform.SetLocalPosition(args.Used, Transform(uid).LocalPosition + surface.PositionOffset); Transform(args.Used).LocalPosition = Transform(uid).LocalPosition + surface.PositionOffset;
else else
_transform.SetCoordinates(args.Used, args.ClickLocation); Transform(args.Used).Coordinates = args.ClickLocation;
args.Handled = true; args.Handled = true;
} }

View File

@@ -17,10 +17,7 @@ namespace Content.Shared.Random.Helpers
var randomY = random.NextFloat() * (maxY - minY) + minY; var randomY = random.NextFloat() * (maxY - minY) + minY;
var offset = new Vector2(randomX, randomY); var offset = new Vector2(randomX, randomY);
var entMan = IoCManager.Resolve<IEntityManager>(); IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).LocalPosition += offset;
var comp = entMan.GetComponent<TransformComponent>(entity);
var transform = entMan.System<SharedTransformSystem>();
transform.SetLocalPosition(comp, comp.LocalPosition + offset);
} }
public static void RandomOffset(this EntityUid entity, float min, float max) public static void RandomOffset(this EntityUid entity, float min, float max)