diff --git a/Content.Client/AI/ClientAiDebugSystem.cs b/Content.Client/AI/ClientAiDebugSystem.cs index 7290bdf945..80565b0051 100644 --- a/Content.Client/AI/ClientAiDebugSystem.cs +++ b/Content.Client/AI/ClientAiDebugSystem.cs @@ -46,13 +46,13 @@ namespace Content.Client.AI continue; } - if (!_eyeManager.GetWorldViewport().Contains(entity.Transform.WorldPosition)) + if (!_eyeManager.GetWorldViewport().Contains(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition)) { panel.Visible = false; continue; } - var (x, y) = _eyeManager.CoordinatesToScreen(entity.Transform.Coordinates).Position; + var (x, y) = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates).Position; var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f); panel.Visible = true; diff --git a/Content.Client/AI/ClientPathfindingDebugSystem.cs b/Content.Client/AI/ClientPathfindingDebugSystem.cs index f81918ad9f..82d3326722 100644 --- a/Content.Client/AI/ClientPathfindingDebugSystem.cs +++ b/Content.Client/AI/ClientPathfindingDebugSystem.cs @@ -287,7 +287,7 @@ namespace Content.Client.AI private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport) { var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity; - if (attachedEntity == null || !CachedRegions.TryGetValue(attachedEntity.Transform.GridID, out var entityRegions)) + if (attachedEntity == null || !CachedRegions.TryGetValue(IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID, out var entityRegions)) { return; } @@ -305,7 +305,7 @@ namespace Content.Client.AI screenTile.X + 15.0f, screenTile.Y + 15.0f); - screenHandle.DrawRect(box, _cachedRegionColors[attachedEntity.Transform.GridID][region]); + screenHandle.DrawRect(box, _cachedRegionColors[IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID][region]); } } } @@ -336,7 +336,7 @@ namespace Content.Client.AI private void DrawRegions(DrawingHandleScreen screenHandle, Box2 viewport) { var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity; - if (attachedEntity == null || !Regions.TryGetValue(attachedEntity.Transform.GridID, out var entityRegions)) + if (attachedEntity == null || !Regions.TryGetValue(IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID, out var entityRegions)) { return; } @@ -356,7 +356,7 @@ namespace Content.Client.AI screenTile.X + 15.0f, screenTile.Y + 15.0f); - screenHandle.DrawRect(box, _regionColors[attachedEntity.Transform.GridID][chunk][region]); + screenHandle.DrawRect(box, _regionColors[IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID][chunk][region]); } } } diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index 7b84e17d5d..a0899c27c8 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -4,6 +4,7 @@ using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Shared.Enums; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Client.Administration @@ -41,7 +42,7 @@ namespace Content.Client.Administration } // if not on the same map, continue - if (entity.Transform.MapID != _eyeManager.CurrentMap) + if (IoCManager.Resolve().GetComponent(entity.Uid).MapID != _eyeManager.CurrentMap) { continue; } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs index 11390ea3b8..b806fbaf58 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs @@ -6,6 +6,7 @@ using Robust.Client.Console; using Robust.Client.Player; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; @@ -22,7 +23,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab _data = IoCManager.Resolve().GetAllGrids().Where(g => (int) g.Index != 0); foreach (var grid in _data) { - var playerGrid = IoCManager.Resolve().LocalPlayer?.ControlledEntity?.Transform.GridID; + IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs index 1d43aeeb23..c75ff3854f 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs @@ -28,7 +28,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab _gridData = IoCManager.Resolve().GetAllGrids().Where(g => (int) g.Index != 0); foreach (var grid in _gridData) { - var playerGrid = IoCManager.Resolve().LocalPlayer?.ControlledEntity?.Transform.GridID; + IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs index 6c51f34357..7ffa8c8b25 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs @@ -28,7 +28,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab _gridData = IoCManager.Resolve().GetAllGrids().Where(g => (int) g.Index != 0); foreach (var grid in _gridData) { - var playerGrid = IoCManager.Resolve().LocalPlayer?.ControlledEntity?.Transform.GridID; + IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs index a5be641a21..87c6b9ab15 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs @@ -6,6 +6,7 @@ using Robust.Client.Console; using Robust.Client.Player; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; @@ -22,7 +23,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab _data = IoCManager.Resolve().GetAllGrids().Where(g => (int) g.Index != 0); foreach (var grid in _data) { - var playerGrid = IoCManager.Resolve().LocalPlayer?.ControlledEntity?.Transform.GridID; + IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index ab9295671d..baf6b9e9e6 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -96,11 +96,11 @@ namespace Content.Client.Audio return; } - var coordinates = player.Transform.Coordinates; + var coordinates = IoCManager.Resolve().GetComponent(player.Uid).Coordinates; foreach (var (comp, (stream, _)) in _playingSounds.ToArray()) { - if (!comp.Deleted && comp.Enabled && comp.Owner.Transform.Coordinates.TryDistance(EntityManager, coordinates, out var range) && + if (!comp.Deleted && comp.Enabled && IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates.TryDistance(EntityManager, coordinates, out var range) && range <= comp.Range) { continue; @@ -140,7 +140,7 @@ namespace Content.Client.Audio _playingSounds.ContainsKey(ambientComp) || !ambientComp.Enabled || // We'll also do this crude distance check because it's what we're doing in the active loop above. - !entity.Transform.Coordinates.TryDistance(EntityManager, coordinates, out var range) || + !IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(EntityManager, coordinates, out var range) || range > ambientComp.Range - RangeBuffer) { continue; diff --git a/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs b/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs index 70b3a548d1..dfad58cb91 100644 --- a/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs +++ b/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs @@ -38,7 +38,7 @@ namespace Content.Client.Body.UI if (!IoCManager.Resolve().TryGetEntity(scannerState.Uid, out _entity)) { - throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {Owner.Owner.Transform.MapPosition}"); + throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {IoCManager.Resolve().GetComponent(Owner.Owner.Uid).MapPosition}"); } _display?.UpdateDisplay(_entity); diff --git a/Content.Client/Chat/Managers/ChatManager.cs b/Content.Client/Chat/Managers/ChatManager.cs index 971a5e0a2c..d50869ca8f 100644 --- a/Content.Client/Chat/Managers/ChatManager.cs +++ b/Content.Client/Chat/Managers/ChatManager.cs @@ -475,7 +475,7 @@ namespace Content.Client.Chat.Managers private void EnqueueSpeechBubble(IEntity entity, string contents, SpeechBubble.SpeechType speechType) { // Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps? - if (entity.Transform.MapID != _eyeManager.CurrentMap) + if (IoCManager.Resolve().GetComponent(entity.Uid).MapID != _eyeManager.CurrentMap) return; if (!_queuedSpeechBubbles.TryGetValue(entity.Uid, out var queueData)) diff --git a/Content.Client/Chat/UI/SpeechBubble.cs b/Content.Client/Chat/UI/SpeechBubble.cs index 5c849850f2..b73d3837af 100644 --- a/Content.Client/Chat/UI/SpeechBubble.cs +++ b/Content.Client/Chat/UI/SpeechBubble.cs @@ -99,7 +99,7 @@ namespace Content.Client.Chat.UI _verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds); } - if (!_senderEntity.Transform.Coordinates.IsValid(IoCManager.Resolve())) + if (!IoCManager.Resolve().GetComponent(_senderEntity.Uid).Coordinates.IsValid(IoCManager.Resolve())) { Modulate = Color.White.WithAlpha(0); return; @@ -123,7 +123,7 @@ namespace Content.Client.Chat.UI return; } - var worldPos = _senderEntity.Transform.WorldPosition; + var worldPos = IoCManager.Resolve().GetComponent(_senderEntity.Uid).WorldPosition; var scale = _eyeManager.MainViewport.GetRenderScale(); var offset = new Vector2(0, EntityVerticalOffset * EyeManager.PixelsPerMeter * scale); var lowerCenter = (_eyeManager.WorldToScreen(worldPos) - offset) / UIScale; diff --git a/Content.Client/Clickable/ClickableComponent.cs b/Content.Client/Clickable/ClickableComponent.cs index 2bafe81188..7ee5c98db1 100644 --- a/Content.Client/Clickable/ClickableComponent.cs +++ b/Content.Client/Clickable/ClickableComponent.cs @@ -36,7 +36,7 @@ namespace Content.Client.Clickable return false; } - var transform = Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(Owner.Uid); var localPos = transform.InvWorldMatrix.Transform(worldPos); var spriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix()); diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index 7f644642b9..b5ce427521 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -174,7 +174,7 @@ namespace Content.Client.Construction var comp = IoCManager.Resolve().GetComponent(ghost.Uid); comp.Prototype = prototype; comp.GhostId = _nextId++; - ghost.Transform.LocalRotation = dir.ToAngle(); + IoCManager.Resolve().GetComponent(ghost.Uid).LocalRotation = dir.ToAngle(); _ghosts.Add(comp.GhostId, comp); var sprite = IoCManager.Resolve().GetComponent(ghost.Uid); sprite.Color = new Color(48, 255, 48, 128); @@ -191,7 +191,7 @@ namespace Content.Client.Construction { foreach (var ghost in _ghosts) { - if (ghost.Value.Owner.Transform.Coordinates.Equals(loc)) return true; + if (IoCManager.Resolve().GetComponent(ghost.Value.Owner.Uid).Coordinates.Equals(loc)) return true; } return false; @@ -206,7 +206,7 @@ namespace Content.Client.Construction throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}"); } - var transform = ghost.Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(ghost.Owner.Uid); var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId); RaiseNetworkEvent(msg); } diff --git a/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs b/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs index d5866df317..e10980f170 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs @@ -135,7 +135,7 @@ namespace Content.Client.ContextMenu.UI var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func); var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId, - BoundKeyState.Down, entity.Transform.Coordinates, args.PointerLocation, entity.Uid); + BoundKeyState.Down, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, args.PointerLocation, entity.Uid); var session = _playerManager.LocalPlayer?.Session; if (session != null) @@ -190,7 +190,7 @@ namespace Content.Client.ContextMenu.UI } /// - /// Add menu elements for a list of grouped entities; + /// Add menu elements for a list of grouped entities; /// /// A list of entity groups. Entities are grouped together based on prototype. private void AddToUI(List> entityGroups) @@ -220,7 +220,7 @@ namespace Content.Client.ContextMenu.UI AddElement(RootMenu, element); Elements.TryAdd(group[0], element); } - + } /// diff --git a/Content.Client/DoAfter/DoAfterSystem.cs b/Content.Client/DoAfter/DoAfterSystem.cs index 240d8be54f..55b9943c69 100644 --- a/Content.Client/DoAfter/DoAfterSystem.cs +++ b/Content.Client/DoAfter/DoAfterSystem.cs @@ -59,23 +59,23 @@ namespace Content.Client.DoAfter foreach (var comp in EntityManager.EntityQuery(true)) { var doAfters = comp.DoAfters.ToList(); - var compPos = comp.Owner.Transform.WorldPosition; + var compPos = IoCManager.Resolve().GetComponent(comp.Owner.Uid).WorldPosition; if (doAfters.Count == 0 || - comp.Owner.Transform.MapID != _attachedEntity.Transform.MapID || + IoCManager.Resolve().GetComponent(comp.Owner.Uid).MapID != IoCManager.Resolve().GetComponent(_attachedEntity.Uid).MapID || !viewbox.Contains(compPos)) { comp.Disable(); continue; } - var range = (compPos - _attachedEntity.Transform.WorldPosition).Length + + var range = (compPos - IoCManager.Resolve().GetComponent(_attachedEntity.Uid).WorldPosition).Length + 0.01f; if (comp.Owner != _attachedEntity && !ExamineSystemShared.InRangeUnOccluded( - _attachedEntity.Transform.MapPosition, - comp.Owner.Transform.MapPosition, range, + IoCManager.Resolve().GetComponent(_attachedEntity.Uid).MapPosition, + IoCManager.Resolve().GetComponent(comp.Owner.Uid).MapPosition, range, entity => entity == comp.Owner || entity == _attachedEntity)) { comp.Disable(); @@ -84,7 +84,7 @@ namespace Content.Client.DoAfter comp.Enable(); - var userGrid = comp.Owner.Transform.Coordinates; + var userGrid = IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates; // Check cancellations / finishes foreach (var (id, doAfter) in doAfters) @@ -117,7 +117,7 @@ namespace Content.Client.DoAfter if (doAfter.BreakOnTargetMove) { if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) && - !targetEntity.Transform.Coordinates.InRange(EntityManager, doAfter.TargetGrid, + !IoCManager.Resolve().GetComponent(targetEntity.Uid).Coordinates.InRange(EntityManager, doAfter.TargetGrid, doAfter.MovementThreshold)) { comp.Cancel(id, currentTime); diff --git a/Content.Client/DoAfter/UI/DoAfterGui.cs b/Content.Client/DoAfter/UI/DoAfterGui.cs index ff11a7a64d..3f37075fad 100644 --- a/Content.Client/DoAfter/UI/DoAfterGui.cs +++ b/Content.Client/DoAfter/UI/DoAfterGui.cs @@ -166,8 +166,8 @@ namespace Content.Client.DoAfter.UI return; } - if (_eyeManager.CurrentMap != AttachedEntity.Transform.MapID || - !AttachedEntity.Transform.Coordinates.IsValid(_entityManager)) + if (_eyeManager.CurrentMap != IoCManager.Resolve().GetComponent(AttachedEntity.Uid).MapID || + !IoCManager.Resolve().GetComponent(AttachedEntity.Uid).Coordinates.IsValid(_entityManager)) { Visible = false; return; @@ -217,7 +217,7 @@ namespace Content.Client.DoAfter.UI RemoveDoAfter(id); } - var screenCoordinates = _eyeManager.CoordinatesToScreen(AttachedEntity.Transform.Coordinates); + var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(AttachedEntity.Uid).Coordinates); _playerPosition = new ScreenCoordinates(screenCoordinates.Position / UIScale, screenCoordinates.Window); LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f)); } diff --git a/Content.Client/DragDrop/DragDropSystem.cs b/Content.Client/DragDrop/DragDropSystem.cs index e6991c2de4..960a18b2ad 100644 --- a/Content.Client/DragDrop/DragDropSystem.cs +++ b/Content.Client/DragDrop/DragDropSystem.cs @@ -196,7 +196,7 @@ namespace Content.Client.DragDrop dragSprite.DrawDepth = (int) DrawDepth.Overlays; if (!dragSprite.NoRotation) { - _dragShadow.Transform.WorldRotation = _dragDropHelper.Dragged.Transform.WorldRotation; + IoCManager.Resolve().GetComponent(_dragShadow.Uid).WorldRotation = IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged.Uid).WorldRotation; } HighlightTargets(); @@ -233,7 +233,7 @@ namespace Content.Client.DragDrop if (_dragShadow == null) return false; - _dragShadow.Transform.WorldPosition = mousePos.Position; + IoCManager.Resolve().GetComponent(_dragShadow.Uid).WorldPosition = mousePos.Position; _targetRecheckTime += frameTime; if (_targetRecheckTime > TargetRecheckInterval) @@ -295,7 +295,7 @@ namespace Content.Client.DragDrop // now when ending the drag, we will not replay the click because // by this time we've determined the input was actually a drag attempt - var range = (args.Coordinates.ToMapPos(EntityManager) - _dragger.Transform.MapPosition.Position).Length + 0.01f; + var range = (args.Coordinates.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(_dragger.Uid).MapPosition.Position).Length + 0.01f; // tell the server we are dropping if we are over a valid drop target in range. // We don't use args.EntityUid here because drag interactions generally should // work even if there's something "on top" of the drop target @@ -379,7 +379,7 @@ namespace Content.Client.DragDrop pvsEntity == _dragDropHelper.Dragged) continue; // check if it's able to be dropped on by current dragged entity - var dropArgs = new DragDropEvent(_dragger!, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity); + var dropArgs = new DragDropEvent(_dragger!, IoCManager.Resolve().GetComponent(pvsEntity.Uid).Coordinates, _dragDropHelper.Dragged, pvsEntity); var valid = ValidDragDrop(dropArgs); if (valid == null) continue; diff --git a/Content.Client/HealthOverlay/HealthOverlaySystem.cs b/Content.Client/HealthOverlay/HealthOverlaySystem.cs index 7f5969c5a8..dc37b63932 100644 --- a/Content.Client/HealthOverlay/HealthOverlaySystem.cs +++ b/Content.Client/HealthOverlay/HealthOverlaySystem.cs @@ -83,13 +83,13 @@ namespace Content.Client.HealthOverlay { var entity = mobState.Owner; - if (_attachedEntity.Transform.MapID != entity.Transform.MapID || - !viewBox.Contains(entity.Transform.WorldPosition)) + if (IoCManager.Resolve().GetComponent(_attachedEntity.Uid).MapID != IoCManager.Resolve().GetComponent(entity.Uid).MapID || + !viewBox.Contains(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition)) { if (_guis.TryGetValue(entity.Uid, out var oldGui)) { _guis.Remove(entity.Uid); - oldGui.Dispose(); + oldGui.Dispose(); } continue; diff --git a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs index c8657e37c6..f7284f7cdf 100644 --- a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs +++ b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs @@ -139,7 +139,7 @@ namespace Content.Client.HealthOverlay.UI MoreFrameUpdate(args); if ((!IoCManager.Resolve().EntityExists(Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - _eyeManager.CurrentMap != Entity.Transform.MapID) + _eyeManager.CurrentMap != IoCManager.Resolve().GetComponent(Entity.Uid).MapID) { Visible = false; return; @@ -147,7 +147,7 @@ namespace Content.Client.HealthOverlay.UI Visible = true; - var screenCoordinates = _eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates); + var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(Entity.Uid).Coordinates); var playerPosition = UserInterfaceManager.ScreenToUIPosition(screenCoordinates); LayoutContainer.SetPosition(this, new Vector2(playerPosition.X - Width / 2, playerPosition.Y - Height - 30.0f)); } diff --git a/Content.Client/IconSmoothing/IconSmoothComponent.cs b/Content.Client/IconSmoothing/IconSmoothComponent.cs index af57ceeeb5..2b7cdec664 100644 --- a/Content.Client/IconSmoothing/IconSmoothComponent.cs +++ b/Content.Client/IconSmoothing/IconSmoothComponent.cs @@ -71,7 +71,7 @@ namespace Content.Client.IconSmoothing { base.Startup(); - if (Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) { // ensures lastposition initial value is populated on spawn. Just calling // the hook here would cause a dirty event to fire needlessly @@ -95,9 +95,9 @@ namespace Content.Client.IconSmoothing private void UpdateLastPosition() { - if (_mapManager.TryGetGrid(Owner.Transform.GridID, out var grid)) + if (_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID, out var grid)) { - _lastPosition = (Owner.Transform.GridID, grid.TileIndicesFor(Owner.Transform.Coordinates)); + _lastPosition = (IoCManager.Resolve().GetComponent(Owner.Uid).GridID, grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)); } else { @@ -109,9 +109,9 @@ namespace Content.Client.IconSmoothing internal virtual void CalculateNewSprite() { - if (!_mapManager.TryGetGrid(Owner.Transform.GridID, out var grid)) + if (!_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID, out var grid)) { - Logger.Error($"Failed to calculate IconSmoothComponent sprite in {Owner} because grid {Owner.Transform.GridID} was missing."); + Logger.Error($"Failed to calculate IconSmoothComponent sprite in {Owner} because grid {IoCManager.Resolve().GetComponent(Owner.Uid).GridID} was missing."); return; } CalculateNewSprite(grid); @@ -136,14 +136,14 @@ namespace Content.Client.IconSmoothing private void CalculateNewSpriteCardinal(IMapGrid grid) { - if (!Owner.Transform.Anchored || Sprite == null) + if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored || Sprite == null) { return; } var dirs = CardinalConnectDirs.None; - var position = Owner.Transform.Coordinates; + var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; if (MatchingEntity(grid.GetInDir(position, Direction.North))) dirs |= CardinalConnectDirs.North; if (MatchingEntity(grid.GetInDir(position, Direction.South))) @@ -173,12 +173,12 @@ namespace Content.Client.IconSmoothing protected (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(IMapGrid grid) { - if (!Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) { return (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None); } - var position = Owner.Transform.Coordinates; + var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; var n = MatchingEntity(grid.GetInDir(position, Direction.North)); var ne = MatchingEntity(grid.GetInDir(position, Direction.NorthEast)); var e = MatchingEntity(grid.GetInDir(position, Direction.East)); @@ -240,7 +240,7 @@ namespace Content.Client.IconSmoothing } // Local is fine as we already know it's parented to the grid (due to the way anchoring works). - switch (Owner.Transform.LocalRotation.GetCardinalDir()) + switch (IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetCardinalDir()) { case Direction.North: return (cornerSW, cornerSE, cornerNE, cornerNW); @@ -258,7 +258,7 @@ namespace Content.Client.IconSmoothing { base.Shutdown(); - if (Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) { IoCManager.Resolve().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode)); } @@ -266,7 +266,7 @@ namespace Content.Client.IconSmoothing public void AnchorStateChanged() { - if (Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) { IoCManager.Resolve().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode)); UpdateLastPosition(); diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index 35d0f72285..17b8fd59c8 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -52,11 +52,11 @@ namespace Content.Client.IconSmoothing // This is simpler to implement. If you want to optimize it be my guest. var senderEnt = ev.Sender; if (IoCManager.Resolve().EntityExists(senderEnt.Uid) && - _mapManager.TryGetGrid(senderEnt.Transform.GridID, out var grid1) && + _mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(senderEnt.Uid).GridID, out var grid1) && IoCManager.Resolve().TryGetComponent(senderEnt.Uid, out IconSmoothComponent? iconSmooth) && iconSmooth.Running) { - var coords = senderEnt.Transform.Coordinates; + var coords = IoCManager.Resolve().GetComponent(senderEnt.Uid).Coordinates; _dirtyEntities.Enqueue(senderEnt.Uid); AddValidEntities(grid1.GetInDir(coords, Direction.North)); diff --git a/Content.Client/Interactable/UnobstructedExtensions.cs b/Content.Client/Interactable/UnobstructedExtensions.cs index aa3ad83bdf..a583d16e4a 100644 --- a/Content.Client/Interactable/UnobstructedExtensions.cs +++ b/Content.Client/Interactable/UnobstructedExtensions.cs @@ -22,7 +22,7 @@ namespace Content.Client.Interactable bool ignoreInsideBlocker = false, bool popup = false) { - var otherPosition = other.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; return origin.InRangeUnobstructed(otherPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup); diff --git a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs index c782dca838..ef4c6a3db8 100644 --- a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs +++ b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs @@ -8,6 +8,7 @@ using Robust.Client.ResourceManagement; using Robust.Client.UserInterface.CustomControls; using Robust.Shared.Enums; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Timing; @@ -80,9 +81,9 @@ namespace Content.Client.NodeContainer var entity = _entityManager.GetEntity(node.Entity); - var gridId = entity.Transform.GridID; + var gridId = IoCManager.Resolve().GetComponent(entity.Uid).GridID; var grid = _mapManager.GetGrid(gridId); - var gridTile = grid.TileIndicesFor(entity.Transform.Coordinates); + var gridTile = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); var sb = new StringBuilder(); sb.Append($"entity: {entity}\n"); @@ -119,10 +120,10 @@ namespace Content.Client.NodeContainer if (!_system.Entities.TryGetValue(entity.Uid, out var nodeData)) return; - var gridId = entity.Transform.GridID; + var gridId = IoCManager.Resolve().GetComponent(entity.Uid).GridID; var grid = _mapManager.GetGrid(gridId); var gridDict = _gridIndex.GetOrNew(gridId); - var coords = entity.Transform.Coordinates; + var coords = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; // TODO: This probably shouldn't be capable of returning NaN... if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y)) diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index 5352fd9278..1d369fc80d 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -162,7 +162,7 @@ namespace Content.Client.Popups var position = Entity == null ? InitialPos - : (_eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates).Position / UIScale) - DesiredSize / 2; + : (_eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(Entity.Uid).Coordinates).Position / UIScale) - DesiredSize / 2; LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft))); diff --git a/Content.Client/Singularity/SingularityOverlay.cs b/Content.Client/Singularity/SingularityOverlay.cs index b4a057d02d..a4f9a5ca1c 100644 --- a/Content.Client/Singularity/SingularityOverlay.cs +++ b/Content.Client/Singularity/SingularityOverlay.cs @@ -80,7 +80,7 @@ namespace Content.Client.Singularity if (!_singularities.Keys.Contains(singuloEntity.Uid) && SinguloQualifies(singuloEntity, currentEyeLoc)) { - _singularities.Add(singuloEntity.Uid, new SingularityShaderInstance(singuloEntity.Transform.MapPosition.Position, distortion.Intensity, distortion.Falloff)); + _singularities.Add(singuloEntity.Uid, new SingularityShaderInstance(IoCManager.Resolve().GetComponent(singuloEntity.Uid).MapPosition.Position, distortion.Intensity, distortion.Falloff)); } } @@ -102,7 +102,7 @@ namespace Content.Client.Singularity else { var shaderInstance = _singularities[activeSinguloUid]; - shaderInstance.CurrentMapCoords = singuloEntity.Transform.MapPosition.Position; + shaderInstance.CurrentMapCoords = IoCManager.Resolve().GetComponent(singuloEntity.Uid).MapPosition.Position; shaderInstance.Intensity = distortion.Intensity; shaderInstance.Falloff = distortion.Falloff; } @@ -119,7 +119,7 @@ namespace Content.Client.Singularity private bool SinguloQualifies(IEntity singuloEntity, MapCoordinates currentEyeLoc) { - return singuloEntity.Transform.MapID == currentEyeLoc.MapId && singuloEntity.Transform.Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, singuloEntity.Transform.ParentUid, currentEyeLoc), MaxDist); + return IoCManager.Resolve().GetComponent(singuloEntity.Uid).MapID == currentEyeLoc.MapId && IoCManager.Resolve().GetComponent(singuloEntity.Uid).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve().GetComponent(singuloEntity.Uid).ParentUid, currentEyeLoc), MaxDist); } private sealed class SingularityShaderInstance diff --git a/Content.Client/Spawners/ClientEntitySpawnerComponent.cs b/Content.Client/Spawners/ClientEntitySpawnerComponent.cs index ae76f94958..8e56097e57 100644 --- a/Content.Client/Spawners/ClientEntitySpawnerComponent.cs +++ b/Content.Client/Spawners/ClientEntitySpawnerComponent.cs @@ -33,7 +33,7 @@ namespace Content.Client.Spawners { foreach (var proto in _prototypes) { - var entity = IoCManager.Resolve().SpawnEntity(proto, Owner.Transform.Coordinates); + var entity = IoCManager.Resolve().SpawnEntity(proto, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _entity.Add(entity); } } diff --git a/Content.Client/StationEvents/RadiationPulseOverlay.cs b/Content.Client/StationEvents/RadiationPulseOverlay.cs index 4b707d3ee2..a2ce7672af 100644 --- a/Content.Client/StationEvents/RadiationPulseOverlay.cs +++ b/Content.Client/StationEvents/RadiationPulseOverlay.cs @@ -93,7 +93,7 @@ namespace Content.Client.StationEvents ( _baseShader.Duplicate(), new RadiationShaderInstance( - pulseEntity.Transform.MapPosition.Position, + IoCManager.Resolve().GetComponent(pulseEntity.Uid).MapPosition.Position, pulse.Range, pulse.StartTime, pulse.EndTime @@ -111,7 +111,7 @@ namespace Content.Client.StationEvents IoCManager.Resolve().TryGetComponent(pulseEntity.Uid, out var pulse)) { var shaderInstance = _pulses[activePulseUid]; - shaderInstance.instance.CurrentMapCoords = pulseEntity.Transform.MapPosition.Position; + shaderInstance.instance.CurrentMapCoords = IoCManager.Resolve().GetComponent(pulseEntity.Uid).MapPosition.Position; shaderInstance.instance.Range = pulse.Range; } else { _pulses[activePulseUid].shd.Dispose(); @@ -123,7 +123,7 @@ namespace Content.Client.StationEvents private bool PulseQualifies(IEntity pulseEntity, MapCoordinates currentEyeLoc) { - return pulseEntity.Transform.MapID == currentEyeLoc.MapId && pulseEntity.Transform.Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, pulseEntity.Transform.ParentUid, currentEyeLoc), MaxDist); + return IoCManager.Resolve().GetComponent(pulseEntity.Uid).MapID == currentEyeLoc.MapId && IoCManager.Resolve().GetComponent(pulseEntity.Uid).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve().GetComponent(pulseEntity.Uid).ParentUid, currentEyeLoc), MaxDist); } private sealed record RadiationShaderInstance(Vector2 CurrentMapCoords, float Range, TimeSpan Start, TimeSpan End) diff --git a/Content.Client/Storage/ClientStorageComponent.cs b/Content.Client/Storage/ClientStorageComponent.cs index ed51af412e..b14f830fa2 100644 --- a/Content.Client/Storage/ClientStorageComponent.cs +++ b/Content.Client/Storage/ClientStorageComponent.cs @@ -120,7 +120,7 @@ namespace Content.Client.Storage if (IoCManager.Resolve().TryGetEntity(entityId, out var entity)) { - ReusableAnimations.AnimateEntityPickup(entity, initialPosition, Owner.Transform.LocalPosition); + ReusableAnimations.AnimateEntityPickup(entity, initialPosition, IoCManager.Resolve().GetComponent(Owner.Uid).LocalPosition); } } } diff --git a/Content.Client/Suspicion/TraitorOverlay.cs b/Content.Client/Suspicion/TraitorOverlay.cs index e5a1318e23..d79cc098e8 100644 --- a/Content.Client/Suspicion/TraitorOverlay.cs +++ b/Content.Client/Suspicion/TraitorOverlay.cs @@ -59,14 +59,14 @@ namespace Content.Client.Suspicion continue; } - if (!ExamineSystemShared.InRangeUnOccluded(ent.Transform.MapPosition, ally.Transform.MapPosition, 15, + if (!ExamineSystemShared.InRangeUnOccluded(IoCManager.Resolve().GetComponent(ent.Uid).MapPosition, IoCManager.Resolve().GetComponent(ally.Uid).MapPosition, 15, entity => entity == ent || entity == ally)) { continue; } // if not on the same map, continue - if (physics.Owner.Transform.MapID != _eyeManager.CurrentMap || physics.Owner.IsInContainer()) + if (IoCManager.Resolve().GetComponent(physics.Owner.Uid).MapID != _eyeManager.CurrentMap || physics.Owner.IsInContainer()) { continue; } diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index ba948a62fc..5ac29f0299 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -111,7 +111,7 @@ namespace Content.Client.Verbs if (!_examineSystem.CanExamine(player, targetPos, predicate)) return false; } - + // Get entities var entities = _entityLookup.GetEntitiesInRange(targetPos.MapId, targetPos.Position, EntityMenuLookupSize) .ToList(); @@ -155,12 +155,12 @@ namespace Content.Client.Verbs // Remove any entities that do not have LOS if ((visibility & MenuVisibility.NoFov) == 0) { - var playerPos = player.Transform.MapPosition; + var playerPos = IoCManager.Resolve().GetComponent(player.Uid).MapPosition; foreach (var entity in entities.ToList()) { if (!ExamineSystemShared.InRangeUnOccluded( playerPos, - entity.Transform.MapPosition, + IoCManager.Resolve().GetComponent(entity.Uid).MapPosition, ExamineSystemShared.ExamineRange, null)) { @@ -186,7 +186,7 @@ namespace Content.Client.Verbs { RaiseNetworkEvent(new RequestServerVerbsEvent(target.Uid, verbTypes)); } - + return GetLocalVerbs(target, user, verbTypes); } diff --git a/Content.Client/Viewport/GameScreenBase.cs b/Content.Client/Viewport/GameScreenBase.cs index 571ebcb20f..8c2d2af6db 100644 --- a/Content.Client/Viewport/GameScreenBase.cs +++ b/Content.Client/Viewport/GameScreenBase.cs @@ -223,8 +223,8 @@ namespace Content.Client.Viewport } */ - var transX = x.clicked.Transform; - var transY = y.clicked.Transform; + var transX = IoCManager.Resolve().GetComponent(x.clicked.Uid); + var transY = IoCManager.Resolve().GetComponent(y.clicked.Uid); val = transX.Coordinates.Y.CompareTo(transY.Coordinates.Y); if (val != 0) { diff --git a/Content.Client/Wall/Components/LowWallComponent.cs b/Content.Client/Wall/Components/LowWallComponent.cs index c10e3e8f7c..cca0478b8f 100644 --- a/Content.Client/Wall/Components/LowWallComponent.cs +++ b/Content.Client/Wall/Components/LowWallComponent.cs @@ -42,9 +42,9 @@ namespace Content.Client.Wall.Components { base.Startup(); - _overlayEntity = IoCManager.Resolve().SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates); - _overlayEntity.Transform.AttachParent(Owner); - _overlayEntity.Transform.LocalPosition = Vector2.Zero; + _overlayEntity = IoCManager.Resolve().SpawnEntity("LowWallOverlay", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().GetComponent(_overlayEntity.Uid).AttachParent(Owner); + IoCManager.Resolve().GetComponent(_overlayEntity.Uid).LocalPosition = Vector2.Zero; _overlaySprite = IoCManager.Resolve().GetComponent(_overlayEntity.Uid); @@ -74,13 +74,13 @@ namespace Content.Client.Wall.Components { base.CalculateNewSprite(); - if (Sprite == null || !Owner.Transform.Anchored || _overlaySprite == null) + if (Sprite == null || !IoCManager.Resolve().GetComponent(Owner.Uid).Anchored || _overlaySprite == null) { return; } - var grid = _mapManager.GetGrid(Owner.Transform.GridID); - var coords = Owner.Transform.Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; var (n, nl) = MatchingWall(grid.GetInDir(coords, Direction.North)); var (ne, nel) = MatchingWall(grid.GetInDir(coords, Direction.NorthEast)); diff --git a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs index 21a4abfe31..d72ce62f58 100644 --- a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs +++ b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs @@ -31,7 +31,7 @@ namespace Content.Client.Weapons.Melee.Components _sprite?.AddLayer(new RSI.StateId(prototype.State)); _baseAngle = baseAngle; if(followAttacker) - Owner.Transform.AttachParent(attacker); + IoCManager.Resolve().GetComponent(Owner.Uid).AttachParent(attacker); } internal void Update(float frameTime) @@ -55,12 +55,12 @@ namespace Content.Client.Weapons.Melee.Components { case WeaponArcType.Slash: var angle = Angle.FromDegrees(_meleeWeaponAnimation.Width)/2; - Owner.Transform.WorldRotation = + IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation = _baseAngle + Angle.Lerp(-angle, angle, (float) (_timer / _meleeWeaponAnimation.Length.TotalSeconds)); break; case WeaponArcType.Poke: - Owner.Transform.WorldRotation = _baseAngle; + IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation = _baseAngle; if (_sprite != null) { diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index c5e7e0e2eb..3e4c33a1c5 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -56,8 +56,8 @@ namespace Content.Client.Weapons.Melee var lunge = attacker.EnsureComponent(); lunge.SetData(msg.Angle); - var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates); - entity.Transform.LocalRotation = msg.Angle; + var entity = EntityManager.SpawnEntity(weaponArc.Prototype, IoCManager.Resolve().GetComponent(attacker.Uid).Coordinates); + IoCManager.Resolve().GetComponent(entity.Uid).LocalRotation = msg.Angle; var weaponArcAnimation = IoCManager.Resolve().GetComponent(entity.Uid); weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker); @@ -73,7 +73,7 @@ namespace Content.Client.Weapons.Melee { EffectSprite = sourceSprite.BaseRSI.Path.ToString(), RsiState = sourceSprite.LayerGetState(0).Name, - Coordinates = attacker.Transform.Coordinates, + Coordinates = IoCManager.Resolve().GetComponent(attacker.Uid).Coordinates, Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f), ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f), Velocity = msg.Angle.ToWorldVec(), diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs index ae36255dfa..4aaf4e097f 100644 --- a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs +++ b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs @@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.False(actionBlocker.CanMove(human.Uid)); Assert.False(actionBlocker.CanChangeDirection(human.Uid)); Assert.False(standingState.Down(human.Uid)); - Assert.That((human.Transform.WorldPosition - chair.Transform.WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length)); + Assert.That((IoCManager.Resolve().GetComponent(human.Uid).WorldPosition - IoCManager.Resolve().GetComponent(chair.Uid).WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length)); // Side effects of buckling for the strap Assert.That(strap.BuckledEntities, Does.Contain(human)); @@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.False(buckle.Buckled); // Move away from the chair - human.Transform.WorldPosition += (1000, 1000); + IoCManager.Resolve().GetComponent(human.Uid).WorldPosition += (1000, 1000); // Out of range Assert.False(buckle.TryBuckle(human, chair)); @@ -179,7 +179,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.False(buckle.ToggleBuckle(human, chair)); // Move near the chair - human.Transform.WorldPosition = chair.Transform.WorldPosition + (0.5f, 0); + IoCManager.Resolve().GetComponent(human.Uid).WorldPosition = IoCManager.Resolve().GetComponent(chair.Uid).WorldPosition + (0.5f, 0); // In range Assert.True(buckle.TryBuckle(human, chair)); @@ -200,7 +200,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.True(buckle.TryBuckle(human, chair)); // Move away from the chair - human.Transform.WorldPosition += (1, 0); + IoCManager.Resolve().GetComponent(human.Uid).WorldPosition += (1, 0); }); await server.WaitRunTicks(1); @@ -333,7 +333,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.True(buckle.Buckled); // Move the buckled entity away - human.Transform.WorldPosition += (100, 0); + IoCManager.Resolve().GetComponent(human.Uid).WorldPosition += (100, 0); }); await WaitUntil(server, () => !buckle.Buckled, 10); @@ -343,7 +343,7 @@ namespace Content.IntegrationTests.Tests.Buckle await server.WaitAssertion(() => { // Move the now unbuckled entity back onto the chair - human.Transform.WorldPosition -= (100, 0); + IoCManager.Resolve().GetComponent(human.Uid).WorldPosition -= (100, 0); // Buckle Assert.True(buckle.TryBuckle(human, chair)); diff --git a/Content.IntegrationTests/Tests/ClickableTest.cs b/Content.IntegrationTests/Tests/ClickableTest.cs index 6379bc0e97..8ad4efa657 100644 --- a/Content.IntegrationTests/Tests/ClickableTest.cs +++ b/Content.IntegrationTests/Tests/ClickableTest.cs @@ -77,10 +77,11 @@ namespace Content.IntegrationTests.Tests await _server.WaitPost(() => { var gridEnt = mapManager.GetAllGrids().First().GridEntityId; - worldPos = serverEntManager.GetEntity(gridEnt).Transform.WorldPosition; + IEntity tempQualifier = serverEntManager.GetEntity(gridEnt); + worldPos = IoCManager.Resolve().GetComponent(tempQualifier.Uid).WorldPosition; var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f)); - ent.Transform.LocalRotation = angle; + IoCManager.Resolve().GetComponent(ent.Uid).LocalRotation = angle; IoCManager.Resolve().GetComponent(ent.Uid).Scale = (scale, scale); entity = ent.Uid; }); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs index 83428a257b..fa1a13a043 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs @@ -46,7 +46,7 @@ namespace Content.IntegrationTests.Tests.Destructible await server.WaitAssertion(() => { - var coordinates = sDestructibleEntity.Transform.Coordinates; + var coordinates = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid).Coordinates; var bruteDamageGroup = sPrototypeManager.Index("TestBrute"); DamageSpecifier bruteDamage = new(bruteDamageGroup,50); diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index 35dbe06d7f..455881988f 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -143,7 +143,7 @@ namespace Content.IntegrationTests.Tests.Disposal human = entityManager.SpawnEntity("HumanDummy", coordinates); wrench = entityManager.SpawnEntity("WrenchDummy", coordinates); disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates); - disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition); + disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", IoCManager.Resolve().GetComponent(disposalUnit.Uid).MapPosition); // Test for components existing ref DisposalUnitComponent? comp = ref unit!; @@ -151,14 +151,14 @@ namespace Content.IntegrationTests.Tests.Disposal Assert.True(IoCManager.Resolve().HasComponent(disposalTrunk.Uid)); // Can't insert, unanchored and unpowered - unit.Owner.Transform.Anchored = false; + IoCManager.Resolve().GetComponent(unit.Owner.Uid).Anchored = false; UnitInsertContains(unit, false, human, wrench, disposalUnit, disposalTrunk); }); await server.WaitAssertion(() => { // Anchor the disposal unit - unit.Owner.Transform.Anchored = true; + IoCManager.Resolve().GetComponent(unit.Owner.Uid).Anchored = true; // No power Assert.False(unit.Powered); @@ -173,7 +173,7 @@ namespace Content.IntegrationTests.Tests.Disposal await server.WaitAssertion(() => { // Move the disposal trunk away - disposalTrunk.Transform.WorldPosition += (1, 0); + IoCManager.Resolve().GetComponent(disposalTrunk.Uid).WorldPosition += (1, 0); // Fail to flush with a mob and an item Flush(unit, false, human, wrench); @@ -182,7 +182,7 @@ namespace Content.IntegrationTests.Tests.Disposal await server.WaitAssertion(() => { // Move the disposal trunk back - disposalTrunk.Transform.WorldPosition -= (1, 0); + IoCManager.Resolve().GetComponent(disposalTrunk.Uid).WorldPosition -= (1, 0); // Fail to flush with a mob and an item, no power Flush(unit, false, human, wrench); diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index 9af9029278..867c38ef6a 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -164,7 +164,7 @@ namespace Content.IntegrationTests.Tests.Doors // Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX)); // Blocked by the airlock - await server.WaitAssertion(() => Assert.That(Math.Abs(physicsDummy.Transform.MapPosition.X - 1) > 0.01f)); + await server.WaitAssertion(() => Assert.That(Math.Abs(IoCManager.Resolve().GetComponent(physicsDummy.Uid).MapPosition.X - 1) > 0.01f)); } } } diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs index e94bdb317d..94edfadd74 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs @@ -63,7 +63,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking cuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates); secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates); - human.Transform.WorldPosition = otherHuman.Transform.WorldPosition; + IoCManager.Resolve().GetComponent(human.Uid).WorldPosition = IoCManager.Resolve().GetComponent(otherHuman.Uid).WorldPosition; // Test for components existing ref CuffableComponent? comp = ref cuffed!; diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs index 88da4fe102..6cf7531e30 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs @@ -335,7 +335,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { // drop the item, and the item actions should go away IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid) - .TryDropEntity(serverFlashlight, serverPlayerEnt.Transform.Coordinates, false); + .TryDropEntity(serverFlashlight, IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid).Coordinates, false); Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False); }); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index e6e9182c67..903dc5b20d 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -60,7 +60,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement // Now let's make the player enter a climbing transitioning state. climbing.IsClimbing = true; - climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition); + climbing.TryMoveTo(IoCManager.Resolve().GetComponent(human.Uid).WorldPosition, IoCManager.Resolve().GetComponent(table.Uid).WorldPosition); var body = IoCManager.Resolve().GetComponent(human.Uid); // TODO: Check it's climbing diff --git a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs index 0bbbf43529..0d3fd65f70 100644 --- a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs +++ b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs @@ -64,7 +64,7 @@ namespace Content.IntegrationTests.Tests.Gravity // No gravity without a gravity generator Assert.True(alerts.IsShowingAlert(AlertType.Weightless)); - entityManager.SpawnEntity("GravityGeneratorDummy", human.Transform.Coordinates); + entityManager.SpawnEntity("GravityGeneratorDummy", IoCManager.Resolve().GetComponent(human.Uid).Coordinates); }); // Let WeightlessSystem and GravitySystem tick diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index 1e3b0b9cb1..bd7d547edc 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -123,7 +123,7 @@ namespace Content.IntegrationTests.Tests private static bool IsDescendant(IEntity descendant, IEntity parent) { - var tmpParent = descendant.Transform.Parent; + var tmpParent = IoCManager.Resolve().GetComponent(descendant.Uid).Parent; while (tmpParent != null) { if (tmpParent.Owner == parent) diff --git a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs index d148a856ee..c272aacd2f 100644 --- a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs +++ b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs @@ -89,8 +89,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(attack); Assert.That(interactUsing, Is.False); Assert.That(interactHand); @@ -98,7 +98,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(interactUsing); }); @@ -143,7 +143,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click target = entityManager.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId)); item = entityManager.SpawnEntity(null, coords); item.EnsureComponent(); - wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), user.Transform.MapID)); + wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), IoCManager.Resolve().GetComponent(user.Uid).MapID)); }); await server.WaitRunTicks(1); @@ -161,8 +161,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(attack, Is.False); Assert.That(interactUsing, Is.False); Assert.That(interactHand, Is.False); @@ -170,7 +170,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(interactUsing, Is.False); }); @@ -230,8 +230,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(attack); Assert.That(interactUsing, Is.False); Assert.That(interactHand); @@ -239,7 +239,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(interactUsing); }); @@ -300,8 +300,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(attack, Is.False); Assert.That(interactUsing, Is.False); Assert.That(interactHand, Is.False); @@ -309,7 +309,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(interactUsing, Is.False); }); @@ -373,20 +373,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click server.Assert(() => { Assert.That(container.Insert(user)); - Assert.That(user.Transform.Parent.Owner, Is.EqualTo(containerEntity)); + Assert.That(IoCManager.Resolve().GetComponent(user.Uid).Parent.Owner, Is.EqualTo(containerEntity)); testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity.Uid)); attack = true; }; testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactHand = true; }; - interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(attack, Is.False); Assert.That(interactUsing, Is.False); Assert.That(interactHand, Is.False); - interactionSystem.DoAttack(user, containerEntity.Transform.Coordinates, false, containerEntity.Uid); - interactionSystem.UserInteraction(user, containerEntity.Transform.Coordinates, containerEntity.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(containerEntity.Uid).Coordinates, false, containerEntity.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(containerEntity.Uid).Coordinates, containerEntity.Uid); Assert.That(attack); Assert.That(interactUsing, Is.False); Assert.That(interactHand); @@ -394,10 +394,10 @@ namespace Content.IntegrationTests.Tests.Interaction.Click Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); - interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); Assert.That(interactUsing, Is.False); - interactionSystem.UserInteraction(user, containerEntity.Transform.Coordinates, containerEntity.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(containerEntity.Uid).Coordinates, containerEntity.Uid); Assert.That(interactUsing, Is.True); }); diff --git a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs index 1f773108f2..0f1cb446ad 100644 --- a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs +++ b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs @@ -5,6 +5,7 @@ using Content.Shared.Interaction.Helpers; using NUnit.Framework; using Robust.Shared.Containers; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -51,9 +52,9 @@ namespace Content.IntegrationTests.Tests.Interaction origin = entityManager.SpawnEntity(HumanId, coordinates); other = entityManager.SpawnEntity(HumanId, coordinates); container = ContainerHelpers.EnsureContainer(other, "InRangeUnobstructedTestOtherContainer"); - component = other.Transform; - entityCoordinates = other.Transform.Coordinates; - mapCoordinates = other.Transform.MapPosition; + component = IoCManager.Resolve().GetComponent(other.Uid); + entityCoordinates = IoCManager.Resolve().GetComponent(other.Uid).Coordinates; + mapCoordinates = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; }); await server.WaitIdleAsync(); @@ -82,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Interaction // Move them slightly apart - origin.Transform.LocalPosition += _interactionRangeDivided15X; + IoCManager.Resolve().GetComponent(origin.Uid).LocalPosition += _interactionRangeDivided15X; // Entity <-> Entity Assert.True(origin.InRangeUnobstructed(other)); @@ -106,7 +107,7 @@ namespace Content.IntegrationTests.Tests.Interaction // Move them out of range - origin.Transform.LocalPosition += _interactionRangeDivided15X; + IoCManager.Resolve().GetComponent(origin.Uid).LocalPosition += _interactionRangeDivided15X; // Entity <-> Entity Assert.False(origin.InRangeUnobstructed(other)); diff --git a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs index c90e104c52..f847d9d5f7 100644 --- a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs +++ b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs @@ -70,12 +70,12 @@ namespace Content.IntegrationTests.Tests.PDA Assert.NotNull(id); // Put PDA in hand - var dummyPda = sEntityManager.SpawnEntity(PdaDummy, player.Transform.MapPosition); + var dummyPda = sEntityManager.SpawnEntity(PdaDummy, IoCManager.Resolve().GetComponent(player.Uid).MapPosition); var pdaItemComponent = IoCManager.Resolve().GetComponent(dummyPda.Uid); IoCManager.Resolve().GetComponent(player.Uid).PutInHand(pdaItemComponent); var pdaComponent = IoCManager.Resolve().GetComponent(dummyPda.Uid); - var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition); + var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve().GetComponent(player.Uid).MapPosition); var itemSlots = IoCManager.Resolve().GetComponent(dummyPda.Uid); sEntityManager.EntitySysManager.GetEntitySystem() @@ -90,7 +90,7 @@ namespace Content.IntegrationTests.Tests.PDA Assert.That(id, Is.EqualTo(pdaContainedId)); // Put ID card in hand - var idDummy = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition); + var idDummy = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve().GetComponent(player.Uid).MapPosition); var idItemComponent = IoCManager.Resolve().GetComponent(idDummy.Uid); IoCManager.Resolve().GetComponent(player.Uid).PutInHand(idItemComponent); diff --git a/Content.IntegrationTests/Tests/Power/PowerTest.cs b/Content.IntegrationTests/Tests/Power/PowerTest.cs index d880fbd973..942fc5e72a 100644 --- a/Content.IntegrationTests/Tests/Power/PowerTest.cs +++ b/Content.IntegrationTests/Tests/Power/PowerTest.cs @@ -499,7 +499,7 @@ namespace Content.IntegrationTests.Tests.Power } var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - terminal.Transform.LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); @@ -567,7 +567,7 @@ namespace Content.IntegrationTests.Tests.Power } var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - terminal.Transform.LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); @@ -643,7 +643,7 @@ namespace Content.IntegrationTests.Tests.Power _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); - terminal.Transform.LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1)); var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3)); @@ -730,7 +730,7 @@ namespace Content.IntegrationTests.Tests.Power _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); - terminal.Transform.LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1)); var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3)); @@ -800,7 +800,7 @@ namespace Content.IntegrationTests.Tests.Power } var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - terminal.Transform.LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); @@ -879,7 +879,7 @@ namespace Content.IntegrationTests.Tests.Power var rightEnt = _entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3)); var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - terminal.Transform.LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var batteryNodeContainer = IoCManager.Resolve().GetComponent(battery.Uid); diff --git a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs index 46b7747614..7d4cd21d70 100644 --- a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Robust.Server.Maps; using Robust.Shared.ContentPack; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -39,13 +40,13 @@ namespace Content.IntegrationTests.Tests { var mapGrid = mapManager.CreateGrid(mapId); var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId); - mapGridEnt.Transform.WorldPosition = new Vector2(10, 10); + IoCManager.Resolve().GetComponent(mapGridEnt.Uid).WorldPosition = new Vector2(10, 10); mapGrid.SetTile(new Vector2i(0,0), new Tile(1, 512)); } { var mapGrid = mapManager.CreateGrid(mapId); var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId); - mapGridEnt.Transform.WorldPosition = new Vector2(-8, -8); + IoCManager.Resolve().GetComponent(mapGridEnt.Uid).WorldPosition = new Vector2(-8, -8); mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, 511)); } diff --git a/Content.IntegrationTests/Tests/ShuttleTest.cs b/Content.IntegrationTests/Tests/ShuttleTest.cs index 6f1758d093..6a91090b56 100644 --- a/Content.IntegrationTests/Tests/ShuttleTest.cs +++ b/Content.IntegrationTests/Tests/ShuttleTest.cs @@ -34,7 +34,7 @@ namespace Content.IntegrationTests.Tests Assert.That(IoCManager.Resolve().TryGetComponent(gridEnt.Uid, out ShuttleComponent? shuttleComponent)); Assert.That(IoCManager.Resolve().TryGetComponent(gridEnt.Uid, out PhysicsComponent? physicsComponent)); Assert.That(physicsComponent!.BodyType, Is.EqualTo(BodyType.Dynamic)); - Assert.That(gridEnt.Transform.LocalPosition, Is.EqualTo(Vector2.Zero)); + Assert.That(IoCManager.Resolve().GetComponent(gridEnt.Uid).LocalPosition, Is.EqualTo(Vector2.Zero)); physicsComponent.ApplyLinearImpulse(Vector2.One); }); @@ -44,7 +44,7 @@ namespace Content.IntegrationTests.Tests await server.WaitAssertion(() => { - Assert.That(gridEnt?.Transform.LocalPosition, Is.Not.EqualTo(Vector2.Zero)); + Assert.That((gridEnt != null ? IoCManager.Resolve().GetComponent(gridEnt.Uid) : null).LocalPosition, Is.Not.EqualTo(Vector2.Zero)); }); } } diff --git a/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs b/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs index 2fd29238ca..d93ea05719 100644 --- a/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs +++ b/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs @@ -4,6 +4,7 @@ using Content.Shared.Physics; using Content.Shared.Spawning; using NUnit.Framework; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Physics; @@ -46,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Utility { var grid = GetMainGrid(sMapManager); var gridEnt = sEntityManager.GetEntity(grid.GridEntityId); - var gridPos = gridEnt.Transform.WorldPosition; + var gridPos = IoCManager.Resolve().GetComponent(gridEnt.Uid).WorldPosition; var entityCoordinates = GetMainEntityCoordinates(sMapManager); // Nothing blocking it, only entity is the grid diff --git a/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs b/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs index 936bc27130..e499206f86 100644 --- a/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs +++ b/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs @@ -72,9 +72,9 @@ namespace Content.Server.AI.EntitySystems { if ((component.Factions & hostile) == 0) continue; - if (component.Owner.Transform.MapID != entity.Transform.MapID) + if (IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID != IoCManager.Resolve().GetComponent(entity.Uid).MapID) continue; - if (!component.Owner.Transform.MapPosition.InRange(entity.Transform.MapPosition, range)) + if (!IoCManager.Resolve().GetComponent(component.Owner.Uid).MapPosition.InRange(IoCManager.Resolve().GetComponent(entity.Uid).MapPosition, range)) continue; yield return component.Owner; diff --git a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs index 315e963ec6..df991f69bc 100644 --- a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs @@ -70,7 +70,7 @@ namespace Content.Server.AI.Operators.Combat.Melee var meleeWeapon = hands.GetActiveHand.Owner; IoCManager.Resolve().TryGetComponent(meleeWeapon.Uid, out MeleeWeaponComponent? meleeWeaponComponent); - if ((_target.Transform.Coordinates.Position - _owner.Transform.Coordinates.Position).Length > + if ((IoCManager.Resolve().GetComponent(_target.Uid).Coordinates.Position - IoCManager.Resolve().GetComponent(_owner.Uid).Coordinates.Position).Length > meleeWeaponComponent?.Range) { return Outcome.Failed; @@ -78,7 +78,7 @@ namespace Content.Server.AI.Operators.Combat.Melee var interactionSystem = IoCManager.Resolve().GetEntitySystem(); - interactionSystem.AiUseInteraction(_owner, _target.Transform.Coordinates, _target.Uid); + interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_target.Uid).Coordinates, _target.Uid); _elapsedTime += frameTime; return Outcome.Continuing; } diff --git a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs index dcc8abd803..9b09fe37eb 100644 --- a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs @@ -76,14 +76,14 @@ namespace Content.Server.AI.Operators.Combat.Melee return Outcome.Failed; } - if ((_target.Transform.Coordinates.Position - _owner.Transform.Coordinates.Position).Length > + if ((IoCManager.Resolve().GetComponent(_target.Uid).Coordinates.Position - IoCManager.Resolve().GetComponent(_owner.Uid).Coordinates.Position).Length > _unarmedCombat.Range) { return Outcome.Failed; } var interactionSystem = IoCManager.Resolve().GetEntitySystem(); - interactionSystem.AiUseInteraction(_owner, _target.Transform.Coordinates, _target.Uid); + interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_target.Uid).Coordinates, _target.Uid); _elapsedTime += frameTime; return Outcome.Continuing; } diff --git a/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs b/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs index b85c7a4ac4..40cb324e9e 100644 --- a/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs @@ -23,7 +23,7 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { - if (_useTarget.Transform.GridID != _owner.Transform.GridID) + if (IoCManager.Resolve().GetComponent(_useTarget.Uid).GridID != IoCManager.Resolve().GetComponent(_owner.Uid).GridID) { return Outcome.Failed; } @@ -40,7 +40,7 @@ namespace Content.Server.AI.Operators.Inventory // Click on da thing var interactionSystem = IoCManager.Resolve().GetEntitySystem(); - interactionSystem.AiUseInteraction(_owner, _useTarget.Transform.Coordinates, _useTarget.Uid); + interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_useTarget.Uid).Coordinates, _useTarget.Uid); return Outcome.Success; } diff --git a/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs b/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs index 45360958c5..6593d94ce6 100644 --- a/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs +++ b/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs @@ -174,10 +174,10 @@ namespace Content.Server.AI.Pathfinding.Accessible public bool CanAccess(IEntity entity, IEntity target, float range = 0.0f) { // TODO: Handle this gracefully instead of just failing. - if (!target.Transform.GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(target.Uid).GridID.IsValid()) return false; - var targetTile = _mapManager.GetGrid(target.Transform.GridID).GetTileRef(target.Transform.Coordinates); + var targetTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(target.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(target.Uid).Coordinates); var targetNode = _pathfindingSystem.GetNode(targetTile); var collisionMask = 0; @@ -210,12 +210,12 @@ namespace Content.Server.AI.Pathfinding.Accessible public bool CanAccess(IEntity entity, PathfindingNode targetNode) { - if (entity.Transform.GridID != targetNode.TileRef.GridIndex) + if (IoCManager.Resolve().GetComponent(entity.Uid).GridID != targetNode.TileRef.GridIndex) { return false; } - var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates); + var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); var entityNode = _pathfindingSystem.GetNode(entityTile); var entityRegion = GetRegion(entityNode); var targetRegion = GetRegion(targetNode); @@ -425,12 +425,12 @@ namespace Content.Server.AI.Pathfinding.Accessible /// public PathfindingRegion? GetRegion(IEntity entity) { - if (!entity.Transform.GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(entity.Uid).GridID.IsValid()) { return null; } - var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates); + var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); var entityNode = _pathfindingSystem.GetNode(entityTile); return GetRegion(entityNode); } diff --git a/Content.Server/AI/Pathfinding/PathfindingNode.cs b/Content.Server/AI/Pathfinding/PathfindingNode.cs index 1184bd79f9..ef4ce54d9e 100644 --- a/Content.Server/AI/Pathfinding/PathfindingNode.cs +++ b/Content.Server/AI/Pathfinding/PathfindingNode.cs @@ -44,7 +44,7 @@ namespace Content.Server.AI.Pathfinding public static bool IsRelevant(IEntity entity, IPhysBody physicsComponent) { - if (entity.Transform.GridID == GridId.Invalid || + if (IoCManager.Resolve().GetComponent(entity.Uid).GridID == GridId.Invalid || (PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0) { return false; diff --git a/Content.Server/AI/Pathfinding/PathfindingSystem.cs b/Content.Server/AI/Pathfinding/PathfindingSystem.cs index 7343912160..97fc42775c 100644 --- a/Content.Server/AI/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/AI/Pathfinding/PathfindingSystem.cs @@ -184,7 +184,7 @@ namespace Content.Server.AI.Pathfinding /// public PathfindingNode GetNode(IEntity entity) { - var tile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates); + var tile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); return GetNode(tile); } @@ -273,8 +273,8 @@ namespace Content.Server.AI.Pathfinding return; } - var grid = _mapManager.GetGrid(entity.Transform.GridID); - var tileRef = grid.GetTileRef(entity.Transform.Coordinates); + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); + var tileRef = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); var chunk = GetChunk(tileRef); var node = chunk.GetNode(tileRef); @@ -315,9 +315,9 @@ namespace Content.Server.AI.Pathfinding } // Memory leak protection until grid parenting confirmed fix / you REALLY need the performance - var gridBounds = _mapManager.GetGrid(moveEvent.Sender.Transform.GridID).WorldBounds; + var gridBounds = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(moveEvent.Sender.Uid).GridID).WorldBounds; - if (!gridBounds.Contains(moveEvent.Sender.Transform.WorldPosition)) + if (!gridBounds.Contains(IoCManager.Resolve().GetComponent(moveEvent.Sender.Uid).WorldPosition)) { HandleEntityRemove(moveEvent.Sender); return; diff --git a/Content.Server/AI/Steering/AiSteeringSystem.cs b/Content.Server/AI/Steering/AiSteeringSystem.cs index c38326f303..9baef0a02a 100644 --- a/Content.Server/AI/Steering/AiSteeringSystem.cs +++ b/Content.Server/AI/Steering/AiSteeringSystem.cs @@ -251,7 +251,7 @@ namespace Content.Server.AI.Steering if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || !IoCManager.Resolve().TryGetComponent(entity.Uid, out AiControllerComponent? controller) || !EntitySystem.Get().CanMove(entity.Uid) || - !entity.Transform.GridID.IsValid()) + !IoCManager.Resolve().GetComponent(entity.Uid).GridID.IsValid()) { return SteeringStatus.NoPath; } @@ -264,7 +264,7 @@ namespace Content.Server.AI.Steering return SteeringStatus.NoPath; } - if (_pauseManager.IsGridPaused(entity.Transform.GridID)) + if (_pauseManager.IsGridPaused(IoCManager.Resolve().GetComponent(entity.Uid).GridID)) { controller.VelocityDir = Vector2.Zero; return SteeringStatus.Pending; @@ -272,14 +272,14 @@ namespace Content.Server.AI.Steering // Validation // Check if we can even arrive -> Currently only samegrid movement supported - if (entity.Transform.GridID != steeringRequest.TargetGrid.GetGridId(EntityManager)) + if (IoCManager.Resolve().GetComponent(entity.Uid).GridID != steeringRequest.TargetGrid.GetGridId(EntityManager)) { controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } // Check if we have arrived - var targetDistance = (entity.Transform.MapPosition.Position - steeringRequest.TargetMap.Position).Length; + var targetDistance = (IoCManager.Resolve().GetComponent(entity.Uid).MapPosition.Position - steeringRequest.TargetMap.Position).Length; steeringRequest.TimeUntilInteractionCheck -= frameTime; if (targetDistance <= steeringRequest.ArrivalDistance && steeringRequest.TimeUntilInteractionCheck <= 0.0f) @@ -416,8 +416,8 @@ namespace Content.Server.AI.Steering } var cancelToken = new CancellationTokenSource(); - var gridManager = _mapManager.GetGrid(entity.Transform.GridID); - var startTile = gridManager.GetTileRef(entity.Transform.Coordinates); + var gridManager = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); + var startTile = gridManager.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid); var collisionMask = 0; if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics)) @@ -447,7 +447,7 @@ namespace Content.Server.AI.Steering { _pathfindingRequests.Remove(entity); - var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates); + var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); var tile = path.Dequeue(); var closestDistance = PathfindingHelpers.OctileDistance(entityTile, tile); @@ -485,7 +485,7 @@ namespace Content.Server.AI.Steering // If no tiles left just move towards the target (if we're close) if (!_paths.ContainsKey(entity) || _paths[entity].Count == 0) { - if ((steeringRequest.TargetGrid.Position - entity.Transform.Coordinates.Position).Length <= 2.0f) + if ((steeringRequest.TargetGrid.Position - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position).Length <= 2.0f) { return steeringRequest.TargetGrid; } @@ -495,7 +495,7 @@ namespace Content.Server.AI.Steering } if (!_nextGrid.TryGetValue(entity, out var nextGrid) || - (nextGrid.Position - entity.Transform.Coordinates.Position).Length <= TileTolerance) + (nextGrid.Position - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position).Length <= TileTolerance) { UpdateGridCache(entity); nextGrid = _nextGrid[entity]; @@ -514,7 +514,7 @@ namespace Content.Server.AI.Steering { if (_paths[entity].Count == 0) return; var nextTile = dequeue ? _paths[entity].Dequeue() : _paths[entity].Peek(); - var nextGrid = _mapManager.GetGrid(entity.Transform.GridID).GridTileToLocal(nextTile.GridIndices); + var nextGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GridTileToLocal(nextTile.GridIndices); _nextGrid[entity] = nextGrid; } @@ -526,12 +526,12 @@ namespace Content.Server.AI.Steering { if (!_stuckPositions.TryGetValue(entity, out var stuckPosition)) { - _stuckPositions[entity] = entity.Transform.Coordinates; + _stuckPositions[entity] = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; _stuckCounter[entity] = 0; return; } - if ((entity.Transform.Coordinates.Position - stuckPosition.Position).Length <= 1.0f) + if ((IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position - stuckPosition.Position).Length <= 1.0f) { _stuckCounter.TryGetValue(entity, out var stuckCount); _stuckCounter[entity] = stuckCount + 1; @@ -539,7 +539,7 @@ namespace Content.Server.AI.Steering else { // No longer stuck - _stuckPositions[entity] = entity.Transform.Coordinates; + _stuckPositions[entity] = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; _stuckCounter[entity] = 0; return; } @@ -565,7 +565,7 @@ namespace Content.Server.AI.Steering private Vector2 Seek(IEntity entity, EntityCoordinates grid) { // is-even much - var entityPos = entity.Transform.Coordinates; + var entityPos = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; return entityPos == grid ? Vector2.Zero : (grid.Position - entityPos.Position).Normalized; @@ -580,7 +580,7 @@ namespace Content.Server.AI.Steering /// private Vector2 Arrival(IEntity entity, EntityCoordinates grid, float slowingDistance = 1.0f) { - var entityPos = entity.Transform.Coordinates; + var entityPos = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; DebugTools.Assert(slowingDistance > 0.0f); if (entityPos == grid) { @@ -599,8 +599,8 @@ namespace Content.Server.AI.Steering /// private Vector2 Pursuit(IEntity entity, IEntity target) { - var entityPos = entity.Transform.Coordinates; - var targetPos = target.Transform.Coordinates; + var entityPos = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + var targetPos = IoCManager.Resolve().GetComponent(target.Uid).Coordinates; if (entityPos == targetPos) { return Vector2.Zero; @@ -636,8 +636,8 @@ namespace Content.Server.AI.Steering var avoidanceVector = Vector2.Zero; var checkTiles = new HashSet(); var avoidTiles = new HashSet(); - var entityGridCoords = entity.Transform.Coordinates; - var grid = _mapManager.GetGrid(entity.Transform.GridID); + var entityGridCoords = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); var currentTile = grid.GetTileRef(entityGridCoords); var halfwayTile = grid.GetTileRef(entityGridCoords.Offset(direction / 2)); var nextTile = grid.GetTileRef(entityGridCoords.Offset(direction)); @@ -671,7 +671,7 @@ namespace Content.Server.AI.Steering continue; } - var centerGrid = physicsEntity.Transform.Coordinates; + var centerGrid = IoCManager.Resolve().GetComponent(physicsEntity.Uid).Coordinates; // Check how close we are to center of tile and get the inverse; if we're closer this is stronger var additionalVector = (centerGrid.Position - entityGridCoords.Position); var distance = additionalVector.Length; diff --git a/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs b/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs index 7480ad325c..70279fbf00 100644 --- a/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs +++ b/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs @@ -1,4 +1,5 @@ using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; namespace Content.Server.AI.Steering @@ -6,8 +7,8 @@ namespace Content.Server.AI.Steering public sealed class EntityTargetSteeringRequest : IAiSteeringRequest { public SteeringStatus Status { get; set; } = SteeringStatus.Pending; - public MapCoordinates TargetMap => _target.Transform.MapPosition; - public EntityCoordinates TargetGrid => _target.Transform.Coordinates; + public MapCoordinates TargetMap => IoCManager.Resolve().GetComponent(_target.Uid).MapPosition; + public EntityCoordinates TargetGrid => IoCManager.Resolve().GetComponent(_target.Uid).Coordinates; public IEntity Target => _target; private readonly IEntity _target; diff --git a/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs b/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs index 52d4657094..c576df6770 100644 --- a/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs +++ b/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs @@ -81,7 +81,7 @@ namespace Content.Server.AI.Utility.Actions.Idle var targetNode = robustRandom.Pick(reachableNodes); var mapManager = IoCManager.Resolve(); - var grid = mapManager.GetGrid(Owner.Transform.GridID); + var grid = mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); var targetGrid = grid.GridTileToLocal(targetNode.TileRef.GridIndices); return targetGrid; diff --git a/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs b/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs index 57ea73172b..49817c8212 100644 --- a/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs +++ b/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs @@ -19,8 +19,8 @@ namespace Content.Server.AI.Utility.Actions.Test public override void SetupOperators(Blackboard context) { - var currentPosition = Owner.Transform.Coordinates; - var nextPosition = Owner.Transform.Coordinates.Offset(new Vector2(10.0f, 0.0f)); + var currentPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var nextPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.Offset(new Vector2(10.0f, 0.0f)); var originalPosOp = new MoveToGridOperator(Owner, currentPosition, 0.25f); var newPosOp = new MoveToGridOperator(Owner, nextPosition, 0.25f); diff --git a/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs b/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs index 6533915a1a..ec790605fc 100644 --- a/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs +++ b/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs @@ -11,13 +11,13 @@ namespace Content.Server.AI.Utility.Considerations.Movement { var self = context.GetState().GetValue(); var target = context.GetState().GetValue(); - if (target == null || (!IoCManager.Resolve().EntityExists(target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || target.Transform.GridID != self?.Transform.GridID) + if (target == null || (!IoCManager.Resolve().EntityExists(target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(target.Uid).GridID != (self != null ? IoCManager.Resolve().GetComponent(self.Uid) : null).GridID) { return 0.0f; } // Anything further than 100 tiles gets clamped - return (target.Transform.Coordinates.Position - self.Transform.Coordinates.Position).Length / 100; + return (IoCManager.Resolve().GetComponent(target.Uid).Coordinates.Position - IoCManager.Resolve().GetComponent(self.Uid).Coordinates.Position).Length / 100; } } } diff --git a/Content.Server/AI/Utils/Visibility.cs b/Content.Server/AI/Utils/Visibility.cs index e94fb5e398..1b16b7279b 100644 --- a/Content.Server/AI/Utils/Visibility.cs +++ b/Content.Server/AI/Utils/Visibility.cs @@ -18,7 +18,7 @@ namespace Content.Server.AI.Utils public static IEnumerable GetNearestEntities(EntityCoordinates grid, Type component, float range) { var inRange = GetEntitiesInRange(grid, component, range).ToList(); - var sortedInRange = inRange.OrderBy(o => (o.Transform.Coordinates.Position - grid.Position).Length); + var sortedInRange = inRange.OrderBy(o => (IoCManager.Resolve().GetComponent(o.Uid).Coordinates.Position - grid.Position).Length); return sortedInRange; } @@ -28,12 +28,12 @@ namespace Content.Server.AI.Utils var entityManager = IoCManager.Resolve(); foreach (var entity in entityManager.GetAllComponents(component).Select(c => c.Owner)) { - if (entity.Transform.Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager)) + if (IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager)) { continue; } - if ((entity.Transform.Coordinates.Position - grid.Position).Length <= range) + if ((IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position - grid.Position).Length <= range) { yield return entity; } diff --git a/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs b/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs index 02420aa344..9967959fb1 100644 --- a/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs +++ b/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs @@ -25,7 +25,7 @@ namespace Content.Server.AI.WorldState.States.Clothing } foreach (var entity in Visibility - .GetNearestEntities(Owner.Transform.Coordinates, typeof(ClothingComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(ClothingComponent), controller.VisionRadius)) { if (entity.TryGetContainer(out var container)) { diff --git a/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs b/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs index 4bf667902b..36af6b96cb 100644 --- a/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs +++ b/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs @@ -23,7 +23,7 @@ namespace Content.Server.AI.WorldState.States.Combat.Nearby } foreach (var entity in Visibility - .GetNearestEntities(Owner.Transform.Coordinates, typeof(MeleeWeaponComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(MeleeWeaponComponent), controller.VisionRadius)) { result.Add(entity); } diff --git a/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs b/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs index 36a3d346a9..e191fd34fb 100644 --- a/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs +++ b/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs @@ -22,7 +22,7 @@ namespace Content.Server.AI.WorldState.States.Mobs return result; } - foreach (var entity in Visibility.GetEntitiesInRange(Owner.Transform.Coordinates, typeof(SharedBodyComponent), controller.VisionRadius)) + foreach (var entity in Visibility.GetEntitiesInRange(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(SharedBodyComponent), controller.VisionRadius)) { if (entity == Owner) continue; result.Add(entity); diff --git a/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs b/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs index 646e061fb8..aa2625c9a7 100644 --- a/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs +++ b/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs @@ -26,7 +26,7 @@ namespace Content.Server.AI.WorldState.States.Mobs } var nearbyPlayers = Filter.Empty() - .AddInRange(Owner.Transform.MapPosition, controller.VisionRadius) + .AddInRange(IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition, controller.VisionRadius) .Recipients; foreach (var player in nearbyPlayers) diff --git a/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs b/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs index a14a01e626..bc1cd4c6eb 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs @@ -25,7 +25,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition } foreach (var entity in Visibility - .GetNearestEntities(Owner.Transform.Coordinates, typeof(DrinkComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(DrinkComponent), controller.VisionRadius)) { if (entity.TryGetContainer(out var container)) { diff --git a/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs b/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs index 332b15809b..33278f7d00 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs @@ -25,7 +25,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition } foreach (var entity in Visibility - .GetNearestEntities(Owner.Transform.Coordinates, typeof(FoodComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(FoodComponent), controller.VisionRadius)) { if (entity.TryGetContainer(out var container)) { diff --git a/Content.Server/AME/AMENodeGroup.cs b/Content.Server/AME/AMENodeGroup.cs index b459c84e78..3667e9fb1c 100644 --- a/Content.Server/AME/AMENodeGroup.cs +++ b/Content.Server/AME/AMENodeGroup.cs @@ -48,7 +48,7 @@ namespace Content.Server.AME var nodeOwner = node.Owner; if (IoCManager.Resolve().TryGetComponent(nodeOwner.Uid, out AMEShieldComponent? shield)) { - var nodeNeighbors = grid.GetCellsInSquareArea(nodeOwner.Transform.Coordinates, 1) + var nodeNeighbors = grid.GetCellsInSquareArea(IoCManager.Resolve().GetComponent(nodeOwner.Uid).Coordinates, 1) .Select(sgc => IoCManager.Resolve().GetEntity(sgc)) .Where(entity => entity != nodeOwner && IoCManager.Resolve().HasComponent(entity.Uid)); diff --git a/Content.Server/Actions/Actions/DisarmAction.cs b/Content.Server/Actions/Actions/DisarmAction.cs index 837179d9a7..fb236d4a38 100644 --- a/Content.Server/Actions/Actions/DisarmAction.cs +++ b/Content.Server/Actions/Actions/DisarmAction.cs @@ -59,7 +59,7 @@ namespace Content.Server.Actions.Actions { // Fall back to a normal interaction with the entity var player = actor.PlayerSession; - var coordinates = args.Target.Transform.Coordinates; + var coordinates = IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates; var target = args.Target.Uid; EntitySystem.Get().HandleUseInteraction(player, coordinates, target); return; @@ -74,7 +74,7 @@ namespace Content.Server.Actions.Actions var random = IoCManager.Resolve(); var system = EntitySystem.Get(); - var diff = args.Target.Transform.MapPosition.Position - args.Performer.Transform.MapPosition.Position; + var diff = IoCManager.Resolve().GetComponent(args.Target.Uid).MapPosition.Position - IoCManager.Resolve().GetComponent(args.Performer.Uid).MapPosition.Position; var angle = Angle.FromWorldVec(diff); actions.Cooldown(ActionType.Disarm, Cooldowns.SecondsFromNow(_cooldown)); @@ -114,7 +114,7 @@ namespace Content.Server.Actions.Actions return; } - SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), args.Performer.Transform.Coordinates, AudioHelpers.WithVariation(0.025f)); + SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), IoCManager.Resolve().GetComponent(args.Performer.Uid).Coordinates, AudioHelpers.WithVariation(0.025f)); } } } diff --git a/Content.Server/Actions/ServerActionsComponent.cs b/Content.Server/Actions/ServerActionsComponent.cs index c5a66cd39c..40c1693086 100644 --- a/Content.Server/Actions/ServerActionsComponent.cs +++ b/Content.Server/Actions/ServerActionsComponent.cs @@ -117,7 +117,7 @@ namespace Content.Server.Actions targetEntityMsg.Target); return; } - if (!CheckRangeAndSetFacing(entity.Transform.Coordinates, player)) return; + if (!CheckRangeAndSetFacing(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, player)) return; attempt.DoTargetEntityAction(player, entity); break; @@ -198,7 +198,7 @@ namespace Content.Server.Actions { // ensure it's within their clickable range var targetWorldPos = target.ToMapPos(EntityManager); - var rangeBox = new Box2(player.Transform.WorldPosition, player.Transform.WorldPosition) + var rangeBox = new Box2(IoCManager.Resolve().GetComponent(player.Uid).WorldPosition, IoCManager.Resolve().GetComponent(player.Uid).WorldPosition) .Enlarged(MaxUpdateRange); if (!rangeBox.Contains(targetWorldPos)) { diff --git a/Content.Server/Actions/Spells/GiveItemSpell.cs b/Content.Server/Actions/Spells/GiveItemSpell.cs index 7e2faf84fc..8919c0bfa3 100644 --- a/Content.Server/Actions/Spells/GiveItemSpell.cs +++ b/Content.Server/Actions/Spells/GiveItemSpell.cs @@ -52,7 +52,7 @@ namespace Content.Server.Actions.Spells } // TODO: Look this is shitty and ideally a test would do it - var spawnedProto = IoCManager.Resolve().SpawnEntity(ItemProto, caster.Transform.MapPosition); + var spawnedProto = IoCManager.Resolve().SpawnEntity(ItemProto, IoCManager.Resolve().GetComponent(caster.Uid).MapPosition); if (!IoCManager.Resolve().TryGetComponent(spawnedProto.Uid, out ItemComponent? itemComponent)) { diff --git a/Content.Server/Administration/AdminVerbSystem.cs b/Content.Server/Administration/AdminVerbSystem.cs index ba715fe8cc..cf05a2a747 100644 --- a/Content.Server/Administration/AdminVerbSystem.cs +++ b/Content.Server/Administration/AdminVerbSystem.cs @@ -125,7 +125,7 @@ namespace Content.Server.Administration verb.Category = VerbCategory.Debug; verb.Act = () => { - var coords = args.Target.Transform.Coordinates; + var coords = IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates; Timer.Spawn(_gameTiming.TickPeriod, () => _explosions.SpawnExplosion(coords, 0, 1, 2, 1), CancellationToken.None); if (IoCManager.Resolve().TryGetComponent(args.Target.Uid, out SharedBodyComponent? body)) { diff --git a/Content.Server/Administration/Commands/AGhost.cs b/Content.Server/Administration/Commands/AGhost.cs index 822fc9b131..822183d943 100644 --- a/Content.Server/Administration/Commands/AGhost.cs +++ b/Content.Server/Administration/Commands/AGhost.cs @@ -7,6 +7,7 @@ using Robust.Server.Player; using Robust.Shared.Console; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Map; namespace Content.Server.Administration.Commands { @@ -41,9 +42,9 @@ namespace Content.Server.Administration.Commands } var canReturn = mind.CurrentEntity != null; - var ghost = IoCManager.Resolve() - .SpawnEntity("AdminObserver", player.AttachedEntity?.Transform.Coordinates - ?? EntitySystem.Get().GetObserverSpawnPoint()); + IEntity? tempQualifier = player.AttachedEntity; + var ghost = IoCManager.Resolve().SpawnEntity((string?) "AdminObserver", (EntityCoordinates) ((tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).Coordinates + ?? EntitySystem.Get().GetObserverSpawnPoint())); if (canReturn) { diff --git a/Content.Server/Administration/Commands/ExplosionCommand.cs b/Content.Server/Administration/Commands/ExplosionCommand.cs index d9f9c86912..056319bfe6 100644 --- a/Content.Server/Administration/Commands/ExplosionCommand.cs +++ b/Content.Server/Administration/Commands/ExplosionCommand.cs @@ -3,6 +3,7 @@ using Content.Shared.Administration; using Robust.Server.Player; using Robust.Shared.Console; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; namespace Content.Server.Administration.Commands @@ -32,7 +33,7 @@ namespace Content.Server.Administration.Commands var lgh = int.Parse(args[4]); var fla = int.Parse(args[5]); - var mapTransform = player.AttachedEntity.Transform.GetMapTransform(); + var mapTransform = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GetMapTransform(); var coords = new EntityCoordinates(mapTransform.Owner.Uid, x, y); EntitySystem.Get().SpawnExplosion(coords, dev, hvy, lgh, fla); diff --git a/Content.Server/Administration/Commands/SetOutfitCommand.cs b/Content.Server/Administration/Commands/SetOutfitCommand.cs index 211b420f54..cdefb02589 100644 --- a/Content.Server/Administration/Commands/SetOutfitCommand.cs +++ b/Content.Server/Administration/Commands/SetOutfitCommand.cs @@ -98,7 +98,7 @@ namespace Content.Server.Administration.Commands { continue; } - var equipmentEntity = entityManager.SpawnEntity(gearStr, target.Transform.Coordinates); + var equipmentEntity = entityManager.SpawnEntity(gearStr, IoCManager.Resolve().GetComponent(target.Uid).Coordinates); if (slot == EquipmentSlotDefines.Slots.IDCARD && IoCManager.Resolve().TryGetComponent(equipmentEntity.Uid, out var pdaComponent) && pdaComponent.ContainedID != null) diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index 359f56aae1..fc3313c5df 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -60,12 +60,12 @@ namespace Content.Server.Administration.Commands } var mapManager = IoCManager.Resolve(); - var currentMap = player.AttachedEntity.Transform.MapID; - var currentGrid = player.AttachedEntity.Transform.GridID; + var currentMap = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).MapID; + var currentGrid = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; var found = entMan.EntityQuery(true) .Where(p => p.Location == location) - .Select(p => p.Owner.Transform.Coordinates) + .Select(p => IoCManager.Resolve().GetComponent(p.Owner.Uid).Coordinates) .OrderBy(p => p, Comparer.Create((a, b) => { // Sort so that warp points on the same grid/map are first. @@ -113,7 +113,7 @@ namespace Content.Server.Administration.Commands if (found.GetGridId(entMan) != GridId.Invalid) { - player.AttachedEntity.Transform.Coordinates = found; + IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates = found; if (IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out IPhysBody? physics)) { physics.LinearVelocity = Vector2.Zero; diff --git a/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs b/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs index 14e5b8e001..1e89a3bc22 100644 --- a/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs +++ b/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs @@ -223,7 +223,7 @@ namespace Content.Server.Arcade.Components public void ProcessWin() { var entityManager = IoCManager.Resolve(); - entityManager.SpawnEntity(_random.Pick(_possibleRewards), Owner.Transform.MapPosition); + entityManager.SpawnEntity(_random.Pick(_possibleRewards), IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); } /// diff --git a/Content.Server/Atmos/Commands/DeleteGasCommand.cs b/Content.Server/Atmos/Commands/DeleteGasCommand.cs index a06da56564..e3dde932a2 100644 --- a/Content.Server/Atmos/Commands/DeleteGasCommand.cs +++ b/Content.Server/Atmos/Commands/DeleteGasCommand.cs @@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Commands return; } - gridId = player.AttachedEntity.Transform.GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; if (gridId == GridId.Invalid) { @@ -65,7 +65,7 @@ namespace Content.Server.Atmos.Commands return; } - gridId = player.AttachedEntity.Transform.GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; if (gridId == GridId.Invalid) { diff --git a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs index d15155a6c2..9d03df42c8 100644 --- a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs +++ b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs @@ -123,7 +123,7 @@ namespace Content.Server.Atmos.Components { // Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth var pressure = 0f; - var tile = EntitySystem.Get().GetTileMixture(Owner.Transform.Coordinates); + var tile = EntitySystem.Get().GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if (tile != null) { pressure = tile.Pressure; @@ -171,7 +171,7 @@ namespace Content.Server.Atmos.Components } } - var pos = Owner.Transform.Coordinates; + var pos = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; if (!_checkPlayer && _position.HasValue) { // Check if position is out of range => don't update diff --git a/Content.Server/Atmos/Components/GasTankComponent.cs b/Content.Server/Atmos/Components/GasTankComponent.cs index c31d8b7761..768702961f 100644 --- a/Content.Server/Atmos/Components/GasTankComponent.cs +++ b/Content.Server/Atmos/Components/GasTankComponent.cs @@ -279,11 +279,11 @@ namespace Content.Server.Atmos.Components { if (_integrity <= 0) { - var environment = atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true); + var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, true); if(environment != null) atmosphereSystem.Merge(environment, Air); - SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioHelpers.WithVariation(0.125f)); IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); return; @@ -297,7 +297,7 @@ namespace Content.Server.Atmos.Components { if (_integrity <= 0) { - var environment = atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true); + var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, true); if (environment == null) return; diff --git a/Content.Server/Atmos/Components/MovedByPressureComponent.cs b/Content.Server/Atmos/Components/MovedByPressureComponent.cs index 3118f219e8..9c2fc8b370 100644 --- a/Content.Server/Atmos/Components/MovedByPressureComponent.cs +++ b/Content.Server/Atmos/Components/MovedByPressureComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Components // TODO ATMOS stuns? - var transform = physics.Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(physics.Owner.Uid); var maxForce = MathF.Sqrt(pressureDifference) * 2.25f; var moveProb = 100f; diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index 33ad557adc..85b55acbfc 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -29,13 +29,13 @@ namespace Content.Server.Atmos.EntitySystems { if (airtight.FixAirBlockedDirectionInitialize) { - var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, airtight.Owner.Transform.WorldRotation); + var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, IoCManager.Resolve().GetComponent(airtight.Owner.Uid).WorldRotation); OnAirtightRotated(uid, airtight, ref rotateEvent); } // Adding this component will immediately anchor the entity, because the atmos system // requires airtight entities to be anchored for performance. - airtight.Owner.Transform.Anchored = true; + IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Anchored = true; UpdatePosition(airtight); } @@ -54,8 +54,8 @@ namespace Content.Server.Atmos.EntitySystems private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args) { - var gridId = airtight.Owner.Transform.GridID; - var coords = airtight.Owner.Transform.Coordinates; + var gridId = IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID; + var coords = IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Coordinates; var grid = _mapManager.GetGrid(gridId); var tilePos = grid.TileIndicesFor(coords); @@ -84,11 +84,11 @@ namespace Content.Server.Atmos.EntitySystems public void UpdatePosition(AirtightComponent airtight) { - if (!airtight.Owner.Transform.Anchored || !airtight.Owner.Transform.GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Anchored || !IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID.IsValid()) return; - var grid = _mapManager.GetGrid(airtight.Owner.Transform.GridID); - airtight.LastPosition = (airtight.Owner.Transform.GridID, grid.TileIndicesFor(airtight.Owner.Transform.Coordinates)); + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID); + airtight.LastPosition = (IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID, grid.TileIndicesFor(IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Coordinates)); InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked); } diff --git a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs index 8225998713..19514ab6d0 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs @@ -136,16 +136,16 @@ namespace Content.Server.Atmos.EntitySystems var entity = session.AttachedEntity; - var worldBounds = Box2.CenteredAround(entity.Transform.WorldPosition, + var worldBounds = Box2.CenteredAround(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition, new Vector2(LocalViewRange, LocalViewRange)); - foreach (var grid in _mapManager.FindGridsIntersecting(entity.Transform.MapID, worldBounds)) + foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(entity.Uid).MapID, worldBounds)) { if (!EntityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) continue; if (!IoCManager.Resolve().TryGetComponent(gridEnt.Uid, out var gam)) continue; - var entityTile = grid.GetTileRef(entity.Transform.Coordinates).GridIndices; + var entityTile = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates).GridIndices; var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2)); var debugOverlayContent = new AtmosDebugOverlayData[LocalViewRange * LocalViewRange]; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs index 6433bf92bf..805228f4d4 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs @@ -1315,7 +1315,7 @@ namespace Content.Server.Atmos.EntitySystems public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice) { - var grid = atmosDevice.Owner.Transform.GridID; + var grid = IoCManager.Resolve().GetComponent(atmosDevice.Owner.Uid).GridID; if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return false; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs index b977d883e8..acf6b7e293 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs @@ -75,9 +75,9 @@ namespace Content.Server.Atmos.EntitySystems { foreach (var exposed in EntityManager.EntityQuery()) { - var tile = GetTileMixture(exposed.Owner.Transform.Coordinates); + var tile = GetTileMixture(IoCManager.Resolve().GetComponent(exposed.Owner.Uid).Coordinates); if (tile == null) continue; - var updateEvent = new AtmosExposedUpdateEvent(exposed.Owner.Transform.Coordinates, tile); + var updateEvent = new AtmosExposedUpdateEvent(IoCManager.Resolve().GetComponent(exposed.Owner.Uid).Coordinates, tile); RaiseLocalEvent(exposed.Owner.Uid, ref updateEvent); } diff --git a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs index 90ddea67b7..8b6b755404 100644 --- a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -197,17 +197,17 @@ namespace Content.Server.Atmos.EntitySystems // This is the max in any direction that we can get a chunk (e.g. max 2 chunks away of data). var (maxXDiff, maxYDiff) = ((int) (_updateRange / ChunkSize) + 1, (int) (_updateRange / ChunkSize) + 1); - var worldBounds = Box2.CenteredAround(entity.Transform.WorldPosition, + var worldBounds = Box2.CenteredAround(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition, new Vector2(_updateRange, _updateRange)); - foreach (var grid in _mapManager.FindGridsIntersecting(entity.Transform.MapID, worldBounds)) + foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(entity.Uid).MapID, worldBounds)) { if (!_overlay.TryGetValue(grid.Index, out var chunks)) { continue; } - var entityTile = grid.GetTileRef(entity.Transform.Coordinates).GridIndices; + var entityTile = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates).GridIndices; for (var x = -maxXDiff; x <= maxXDiff; x++) { diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs index 5018ae8203..b756c09aea 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs @@ -45,7 +45,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems return; } - var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner.Uid).Coordinates, true); // We're in an air-blocked tile... Do nothing. if (environment == null) diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index d94b32c8e2..43f4cffcd4 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnExamined(EntityUid uid, GasPressurePumpComponent pump, ExaminedEvent args) { - if (!pump.Owner.Transform.Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. + if (!IoCManager.Resolve().GetComponent(pump.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. return; if (Loc.TryGetString("gas-pressure-pump-system-examined", out var str, @@ -95,7 +95,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) return; - if (component.Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) { _userInterfaceSystem.TryOpen(uid, GasPressurePumpUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs index d4d4465d39..33b0454bf1 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs @@ -11,6 +11,7 @@ using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Player; @@ -30,7 +31,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnExamined(EntityUid uid, GasValveComponent valve, ExaminedEvent args) { - if (!valve.Owner.Transform.Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. + if (!IoCManager.Resolve().GetComponent(valve.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. return; if (Loc.TryGetString("gas-valve-system-examined", out var str, diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index 470e083ed5..ab05f12529 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnExamined(EntityUid uid, GasVolumePumpComponent pump, ExaminedEvent args) { - if (!pump.Owner.Transform.Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. + if (!IoCManager.Resolve().GetComponent(pump.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. return; if (Loc.TryGetString("gas-volume-pump-system-examined", out var str, @@ -83,7 +83,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems // Some of the gas from the mixture leaks when overclocked. if (pump.Overclocked) { - var tile = _atmosphereSystem.GetTileMixture(pump.Owner.Transform.Coordinates, true); + var tile = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(pump.Owner.Uid).Coordinates, true); if (tile != null) { @@ -100,7 +100,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) return; - if (component.Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) { _userInterfaceSystem.TryOpen(uid, GasVolumePumpUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs index 1c4e0807e3..1f6ac4d801 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private bool CanJoinAtmosphere(AtmosDeviceComponent component) { - return !component.RequireAnchored || component.Owner.Transform.Anchored; + return !component.RequireAnchored || IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored; } public void JoinAtmosphere(AtmosDeviceComponent component) @@ -104,7 +104,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!component.RequireAnchored) return; - if(component.Owner.Transform.Anchored) + if(IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) JoinAtmosphere(component); else LeaveAtmosphere(component); diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs index 68005e9ff4..6ada0a09e3 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) return; - if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates) is not {} environment) + if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates) is not {} environment) return; foreach (var node in nodes.Nodes.Values) @@ -52,7 +52,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) return; - if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is not {} environment) + if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates, true) is not {} environment) environment = GasMixture.SpaceGas; var lost = 0f; diff --git a/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs b/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs index 0a4379d7f6..7732c1d0f4 100644 --- a/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs +++ b/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs @@ -37,10 +37,10 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems private bool CheckMinerOperation(GasMinerComponent miner, [NotNullWhen(true)] out GasMixture? environment) { - environment = _atmosphereSystem.GetTileMixture(miner.Owner.Transform.Coordinates, true); + environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(miner.Owner.Uid).Coordinates, true); // Space. - if (_atmosphereSystem.IsTileSpace(miner.Owner.Transform.Coordinates)) + if (_atmosphereSystem.IsTileSpace(IoCManager.Resolve().GetComponent(miner.Owner.Uid).Coordinates)) { miner.Broken = true; return false; diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs index d0c9d49649..178b99611e 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs @@ -84,7 +84,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) return; - if (component.Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) { _userInterfaceSystem.TryOpen(uid, GasFilterUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index ac0aafb41e..1f0414b29d 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -109,7 +109,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) return; - if (component.Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) { _userInterfaceSystem.TryOpen(uid, GasMixerUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index 0fa28d5f2b..f02b288c8c 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -211,7 +211,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems } else { - var environment = _atmosphereSystem.GetTileMixture(canister.Owner.Transform.Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(canister.Owner.Uid).Coordinates, true); _atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure); } } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs index 07b81c85c4..1c1a1bdc88 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet)) return; - var environment = _atmosphereSystem.GetTileMixture(injector.Owner.Transform.Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(injector.Owner.Uid).Coordinates, true); if (environment == null) return; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs index a6bb3533ef..05603665bf 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, AtmosDeviceUpdateEvent args) { - var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner.Uid).Coordinates, true); if (environment == null) return; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 6cedebe94c..4afbe0e9a6 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -43,7 +43,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return; } - var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner.Uid).Coordinates, true); // We're in an air-blocked tile... Do nothing. if (environment == null) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index c59f60aefa..85ff881b7f 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -44,14 +44,14 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return; } - var environment = _atmosphereSystem.GetTileMixture(scrubber.Owner.Transform.Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(scrubber.Owner.Uid).Coordinates, true); Scrub(_atmosphereSystem, scrubber, appearance, environment, outlet); if (!scrubber.WideNet) return; // Scrub adjacent tiles too. - foreach (var adjacent in _atmosphereSystem.GetAdjacentTileMixtures(scrubber.Owner.Transform.Coordinates, false, true)) + foreach (var adjacent in _atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve().GetComponent(scrubber.Owner.Uid).Coordinates, false, true)) { Scrub(_atmosphereSystem, scrubber, null, adjacent, outlet); } diff --git a/Content.Server/Body/Components/BodyComponent.cs b/Content.Server/Body/Components/BodyComponent.cs index a0fb78c782..9e773bdc2c 100644 --- a/Content.Server/Body/Components/BodyComponent.cs +++ b/Content.Server/Body/Components/BodyComponent.cs @@ -58,7 +58,7 @@ namespace Content.Server.Body.Components { // Using MapPosition instead of Coordinates here prevents // a crash within the character preview menu in the lobby - var entity = IoCManager.Resolve().SpawnEntity(preset.PartIDs[slot.Id], Owner.Transform.MapPosition); + var entity = IoCManager.Resolve().SpawnEntity(preset.PartIDs[slot.Id], IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedBodyPartComponent? part)) { @@ -88,7 +88,7 @@ namespace Content.Server.Body.Components { base.Gib(gibParts); - SoundSystem.Play(Filter.Pvs(Owner), _gibSound.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.025f)); + SoundSystem.Play(Filter.Pvs(Owner), _gibSound.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioHelpers.WithVariation(0.025f)); if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ContainerManagerComponent? container)) { @@ -97,7 +97,7 @@ namespace Content.Server.Body.Components foreach (var ent in cont.ContainedEntities) { cont.ForceRemove(ent); - ent.Transform.Coordinates = Owner.Transform.Coordinates; + IoCManager.Resolve().GetComponent(ent.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; ent.RandomOffset(0.25f); } } diff --git a/Content.Server/Body/Components/BodyPartComponent.cs b/Content.Server/Body/Components/BodyPartComponent.cs index dc4ba1b041..ec739784f7 100644 --- a/Content.Server/Body/Components/BodyPartComponent.cs +++ b/Content.Server/Body/Components/BodyPartComponent.cs @@ -64,7 +64,7 @@ namespace Content.Server.Body.Components // identical on it foreach (var mechanismId in MechanismIds) { - var entity = IoCManager.Resolve().SpawnEntity(mechanismId, Owner.Transform.MapPosition); + var entity = IoCManager.Resolve().SpawnEntity(mechanismId, IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedMechanismComponent? mechanism)) { diff --git a/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs b/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs index 7e577a3758..ac1f96254a 100644 --- a/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs +++ b/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs @@ -342,14 +342,14 @@ namespace Content.Server.Body.Surgery if (!IoCManager.Resolve().HasComponent(performer.Uid)) { - Parent.RemoveMechanism(target, performer.Transform.Coordinates); + Parent.RemoveMechanism(target, IoCManager.Resolve().GetComponent(performer.Uid).Coordinates); RemoveDisconnectedOrgan(target); return; } if (await SurgeryDoAfter(performer)) { - Parent.RemoveMechanism(target, performer.Transform.Coordinates); + Parent.RemoveMechanism(target, IoCManager.Resolve().GetComponent(performer.Uid).Coordinates); RemoveDisconnectedOrgan(target); } } diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs index a619b45f86..99037f0434 100644 --- a/Content.Server/Body/Systems/MetabolizerSystem.cs +++ b/Content.Server/Body/Systems/MetabolizerSystem.cs @@ -165,7 +165,7 @@ namespace Content.Server.Body.Systems { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {entity.Transform.Coordinates}"); + $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); } effect.Effect(args); diff --git a/Content.Server/Botany/Components/LogComponent.cs b/Content.Server/Botany/Components/LogComponent.cs index eca2ca419b..7d504fc3b1 100644 --- a/Content.Server/Botany/Components/LogComponent.cs +++ b/Content.Server/Botany/Components/LogComponent.cs @@ -23,7 +23,7 @@ namespace Content.Server.Botany.Components { for (var i = 0; i < 2; i++) { - var plank = IoCManager.Resolve().SpawnEntity("MaterialWoodPlank1", Owner.Transform.Coordinates); + var plank = IoCManager.Resolve().SpawnEntity("MaterialWoodPlank1", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); plank.RandomOffset(0.25f); } diff --git a/Content.Server/Botany/Components/PlantHolderComponent.cs b/Content.Server/Botany/Components/PlantHolderComponent.cs index f9fe988cc8..6866f01747 100644 --- a/Content.Server/Botany/Components/PlantHolderComponent.cs +++ b/Content.Server/Botany/Components/PlantHolderComponent.cs @@ -248,7 +248,7 @@ namespace Content.Server.Botany.Components _updateSpriteAfterUpdate = true; } - var environment = EntitySystem.Get().GetTileMixture(Owner.Transform.Coordinates, true) ?? + var environment = EntitySystem.Get().GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, true) ?? GasMixture.SpaceGas; if (Seed.ConsumeGasses.Count > 0) @@ -361,7 +361,7 @@ namespace Content.Server.Botany.Components } else if (Age < 0) // Revert back to seed packet! { - Seed.SpawnSeedPacket(Owner.Transform.Coordinates); + Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); RemovePlant(); ForceUpdate = true; Update(); @@ -453,7 +453,7 @@ namespace Content.Server.Botany.Components if (Seed == null || !Harvest) return; - Seed.AutoHarvest(Owner.Transform.Coordinates); + Seed.AutoHarvest(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); AfterHarvest(); } @@ -783,7 +783,7 @@ namespace Content.Server.Botany.Components return false; } - var seed = Seed.SpawnSeedPacket(user.Transform.Coordinates); + var seed = Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(user.Uid).Coordinates); seed.RandomOffset(0.25f); user.PopupMessageCursor(Loc.GetString("plant-holder-component-take-sample-message", ("seedName", Seed.DisplayName))); diff --git a/Content.Server/Botany/Components/SeedExtractorComponent.cs b/Content.Server/Botany/Components/SeedExtractorComponent.cs index 8403efec93..39efb4ee91 100644 --- a/Content.Server/Botany/Components/SeedExtractorComponent.cs +++ b/Content.Server/Botany/Components/SeedExtractorComponent.cs @@ -37,7 +37,7 @@ namespace Content.Server.Botany.Components for (var i = 0; i < random; i++) { - produce.Seed.SpawnSeedPacket(Owner.Transform.Coordinates, IoCManager.Resolve()); + produce.Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, IoCManager.Resolve()); } return true; diff --git a/Content.Server/Botany/Seed.cs b/Content.Server/Botany/Seed.cs index 51aef6ffad..1699a0b2bd 100644 --- a/Content.Server/Botany/Seed.cs +++ b/Content.Server/Botany/Seed.cs @@ -300,7 +300,7 @@ namespace Content.Server.Botany } user.PopupMessageCursor(Loc.GetString("botany-harvest-success-message", ("name", DisplayName))); - return GenerateProduct(user.Transform.Coordinates, yieldMod); + return GenerateProduct(IoCManager.Resolve().GetComponent(user.Uid).Coordinates, yieldMod); } public IEnumerable GenerateProduct(EntityCoordinates position, int yieldMod = 1) diff --git a/Content.Server/Buckle/Components/BuckleComponent.cs b/Content.Server/Buckle/Components/BuckleComponent.cs index ae6c0b7986..0d466395b6 100644 --- a/Content.Server/Buckle/Components/BuckleComponent.cs +++ b/Content.Server/Buckle/Components/BuckleComponent.cs @@ -118,8 +118,8 @@ namespace Content.Server.Buckle.Components /// The strap to reattach to. public void ReAttach(StrapComponent strap) { - var ownTransform = Owner.Transform; - var strapTransform = strap.Owner.Transform; + var ownTransform = IoCManager.Resolve().GetComponent(Owner.Uid); + var strapTransform = IoCManager.Resolve().GetComponent(strap.Owner.Uid); ownTransform.AttachParent(strapTransform); ownTransform.LocalRotation = Angle.Zero; @@ -194,10 +194,10 @@ namespace Content.Server.Buckle.Components return false; } - var parent = to.Transform.Parent; + var parent = IoCManager.Resolve().GetComponent(to.Uid).Parent; while (parent != null) { - if (parent == user.Transform) + if (parent == IoCManager.Resolve().GetComponent(user.Uid)) { var message = Loc.GetString(Owner == user ? "buckle-component-cannot-buckle-message" @@ -317,10 +317,10 @@ namespace Content.Server.Buckle.Components BuckledTo = null; - if (Owner.Transform.Parent == oldBuckledTo.Owner.Transform) + if (IoCManager.Resolve().GetComponent(Owner.Uid).Parent == IoCManager.Resolve().GetComponent(oldBuckledTo.Owner.Uid)) { - Owner.Transform.AttachParentToContainerOrGrid(); - Owner.Transform.WorldRotation = oldBuckledTo.Owner.Transform.WorldRotation; + IoCManager.Resolve().GetComponent(Owner.Uid).AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation = IoCManager.Resolve().GetComponent(oldBuckledTo.Owner.Uid).WorldRotation; } Appearance?.SetData(BuckleVisuals.Buckled, false); @@ -395,7 +395,7 @@ namespace Content.Server.Buckle.Components int? drawDepth = null; if (BuckledTo != null && - BuckledTo.Owner.Transform.LocalRotation.GetCardinalDir() == Direction.North && + IoCManager.Resolve().GetComponent(BuckledTo.Owner.Uid).LocalRotation.GetCardinalDir() == Direction.North && BuckledTo.SpriteComponent != null) { drawDepth = BuckledTo.SpriteComponent.DrawDepth - 1; diff --git a/Content.Server/Buckle/Systems/BuckleSystem.cs b/Content.Server/Buckle/Systems/BuckleSystem.cs index 5dfa21fbc5..ceec287143 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.cs @@ -79,7 +79,7 @@ namespace Content.Server.Buckle.Systems return; } - var strapPosition = strap.Owner.Transform.Coordinates.Offset(buckle.BuckleOffset); + var strapPosition = IoCManager.Resolve().GetComponent(strap.Owner.Uid).Coordinates.Offset(buckle.BuckleOffset); if (ev.NewPosition.InRange(EntityManager, strapPosition, 0.2f)) { diff --git a/Content.Server/Cargo/Components/CargoConsoleComponent.cs b/Content.Server/Cargo/Components/CargoConsoleComponent.cs index c599e2e1ea..c392e3eeac 100644 --- a/Content.Server/Cargo/Components/CargoConsoleComponent.cs +++ b/Content.Server/Cargo/Components/CargoConsoleComponent.cs @@ -162,13 +162,13 @@ namespace Content.Server.Cargo.Components // TODO replace with shuttle code // TEMPORARY loop for spawning stuff on telepad (looks for a telepad adjacent to the console) IEntity? cargoTelepad = null; - var indices = Owner.Transform.Coordinates.ToVector2i(IoCManager.Resolve(), _mapManager); + var indices = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.ToVector2i(IoCManager.Resolve(), _mapManager); var offsets = new Vector2i[] { new Vector2i(0, 1), new Vector2i(1, 1), new Vector2i(1, 0), new Vector2i(1, -1), new Vector2i(0, -1), new Vector2i(-1, -1), new Vector2i(-1, 0), new Vector2i(-1, 1), }; var adjacentEntities = new List>(); //Probably better than IEnumerable.concat foreach (var offset in offsets) { - adjacentEntities.Add((indices+offset).GetEntitiesInTileFast(Owner.Transform.GridID)); + adjacentEntities.Add((indices+offset).GetEntitiesInTileFast(IoCManager.Resolve().GetComponent(Owner.Uid).GridID)); } foreach (var enumerator in adjacentEntities) diff --git a/Content.Server/Cargo/Components/CargoTelepadComponent.cs b/Content.Server/Cargo/Components/CargoTelepadComponent.cs index e77e8fabd5..00095c8764 100644 --- a/Content.Server/Cargo/Components/CargoTelepadComponent.cs +++ b/Content.Server/Cargo/Components/CargoTelepadComponent.cs @@ -119,12 +119,12 @@ namespace Content.Server.Cargo.Components if (!_prototypeManager.TryIndex(data.ProductId, out CargoProductPrototype? prototype)) return; - var product = IoCManager.Resolve().SpawnEntity(prototype.Product, Owner.Transform.Coordinates); + var product = IoCManager.Resolve().SpawnEntity(prototype.Product, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); - product.Transform.Anchored = false; + IoCManager.Resolve().GetComponent(product.Uid).Anchored = false; // spawn a piece of paper. - var printed = IoCManager.Resolve().SpawnEntity(PrinterOutput, Owner.Transform.Coordinates); + var printed = IoCManager.Resolve().SpawnEntity(PrinterOutput, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if (!IoCManager.Resolve().TryGetComponent(printed.Uid, out PaperComponent paper)) return; diff --git a/Content.Server/Chat/Managers/ChatManager.cs b/Content.Server/Chat/Managers/ChatManager.cs index aa625f3746..02d85b605f 100644 --- a/Content.Server/Chat/Managers/ChatManager.cs +++ b/Content.Server/Chat/Managers/ChatManager.cs @@ -142,15 +142,15 @@ namespace Content.Server.Chat.Managers // We'll try to avoid using MapPosition as EntityCoordinates can early-out and potentially be faster for common use cases // Downside is it may potentially convert to MapPosition unnecessarily. - var sourceMapId = source.Transform.MapID; - var sourceCoords = source.Transform.Coordinates; + var sourceMapId = IoCManager.Resolve().GetComponent(source.Uid).MapID; + var sourceCoords = IoCManager.Resolve().GetComponent(source.Uid).Coordinates; var clients = new List(); foreach (var player in _playerManager.Sessions) { if (player.AttachedEntity == null) continue; - var transform = player.AttachedEntity.Transform; + var transform = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid); if (transform.MapID != sourceMapId || !IoCManager.Resolve().HasComponent(player.AttachedEntity.Uid) && @@ -223,7 +223,7 @@ namespace Content.Server.Chat.Managers action = FormattedMessage.EscapeText(action); var clients = Filter.Empty() - .AddInRange(source.Transform.MapPosition, VoiceRange) + .AddInRange(IoCManager.Resolve().GetComponent(source.Uid).MapPosition, VoiceRange) .Recipients .Select(p => p.ConnectedClient) .ToList(); diff --git a/Content.Server/Chemistry/Components/ChemMasterComponent.cs b/Content.Server/Chemistry/Components/ChemMasterComponent.cs index e3e8cf2928..97873bdc6d 100644 --- a/Content.Server/Chemistry/Components/ChemMasterComponent.cs +++ b/Content.Server/Chemistry/Components/ChemMasterComponent.cs @@ -302,7 +302,7 @@ namespace Content.Server.Chemistry.Components var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30)); for (int i = 0; i < bottleAmount; i++) { - var bottle = IoCManager.Resolve().SpawnEntity("ChemistryEmptyBottle01", Owner.Transform.Coordinates); + var bottle = IoCManager.Resolve().SpawnEntity("ChemistryEmptyBottle01", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); //Adding label LabelComponent labelComponent = bottle.EnsureComponent(); @@ -327,7 +327,7 @@ namespace Content.Server.Chemistry.Components } //Put it on the floor - bottle.Transform.Coordinates = user.Transform.Coordinates; + IoCManager.Resolve().GetComponent(bottle.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; //Give it an offset bottle.RandomOffset(0.2f); } @@ -344,7 +344,7 @@ namespace Content.Server.Chemistry.Components var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50)); for (int i = 0; i < pillAmount; i++) { - var pill = IoCManager.Resolve().SpawnEntity("pill", Owner.Transform.Coordinates); + var pill = IoCManager.Resolve().SpawnEntity("pill", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); //Adding label LabelComponent labelComponent = pill.EnsureComponent(); @@ -375,7 +375,7 @@ namespace Content.Server.Chemistry.Components } //Put it on the floor - pill.Transform.Coordinates = user.Transform.Coordinates; + IoCManager.Resolve().GetComponent(pill.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; //Give it an offset pill.RandomOffset(0.2f); } diff --git a/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs index a156153199..940099a05f 100644 --- a/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs @@ -79,7 +79,7 @@ namespace Content.Server.Chemistry.Components { if (!string.IsNullOrEmpty(_foamedMetalPrototype)) { - IoCManager.Resolve().SpawnEntity(_foamedMetalPrototype, Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(_foamedMetalPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); diff --git a/Content.Server/Chemistry/Components/HyposprayComponent.cs b/Content.Server/Chemistry/Components/HyposprayComponent.cs index dfe2aea594..32709752dc 100644 --- a/Content.Server/Chemistry/Components/HyposprayComponent.cs +++ b/Content.Server/Chemistry/Components/HyposprayComponent.cs @@ -80,7 +80,7 @@ namespace Content.Server.Chemistry.Components { target.PopupMessage(Loc.GetString("hypospray-component-feel-prick-message")); var meleeSys = EntitySystem.Get(); - var angle = Angle.FromWorldVec(target.Transform.WorldPosition - user.Transform.WorldPosition); + var angle = Angle.FromWorldVec(IoCManager.Resolve().GetComponent(target.Uid).WorldPosition - IoCManager.Resolve().GetComponent(user.Uid).WorldPosition); meleeSys.SendLunge(angle, user); } diff --git a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs index 2201bea440..13db7a4bb6 100644 --- a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs @@ -70,8 +70,8 @@ namespace Content.Server.Chemistry.Components void SpreadToDir(Direction dir) { - var grid = MapManager.GetGrid(Owner.Transform.GridID); - var coords = Owner.Transform.Coordinates; + var grid = MapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; foreach (var neighbor in grid.GetInDir(coords, dir)) { if (IoCManager.Resolve().TryGetComponent(neighbor, @@ -132,8 +132,8 @@ namespace Content.Server.Chemistry.Components return; var chemistry = EntitySystem.Get(); - var mapGrid = MapManager.GetGrid(Owner.Transform.GridID); - var tile = mapGrid.GetTileRef(Owner.Transform.Coordinates.ToVector2i(IoCManager.Resolve(), MapManager)); + var mapGrid = MapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var tile = mapGrid.GetTileRef(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.ToVector2i(IoCManager.Resolve(), MapManager)); var solutionFraction = 1 / Math.Floor(averageExposures); diff --git a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs index cd5247f3ac..4f2e2b1820 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Database; using Content.Shared.FixedPoint; using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Player; namespace Content.Server.Chemistry.EntitySystems @@ -18,7 +19,7 @@ namespace Content.Server.Chemistry.EntitySystems var entity = EntityManager.GetEntity(ownerUid); _logSystem.Add(LogType.ChemicalReaction, reaction.Impact, - $"Chemical reaction {reaction.ID} occurred with strength {unitReactions:strength} on entity {entity} at {entity.Transform.Coordinates}"); + $"Chemical reaction {reaction.ID} occurred with strength {unitReactions:strength} on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); SoundSystem.Play(Filter.Pvs(ownerUid, entityManager:EntityManager), reaction.Sound.GetSound(), ownerUid); } diff --git a/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs b/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs index 256c28824d..6aefb1952c 100644 --- a/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs @@ -41,8 +41,8 @@ namespace Content.Server.Chemistry.EntitySystems if (!string.IsNullOrEmpty(component.TargetPrototype)) { var ent = IoCManager.Resolve().SpawnEntity(component.TargetPrototype, - owner.Transform.Coordinates); - ent.Transform.AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(owner.Uid).Coordinates); + IoCManager.Resolve().GetComponent(ent.Uid).AttachToGridOrMap(); } IoCManager.Resolve().QueueDeleteEntity(owner.Uid); diff --git a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs index 515e0580a6..075d72a413 100644 --- a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs @@ -97,12 +97,12 @@ namespace Content.Server.Chemistry.EntitySystems vapor.Timer += frameTime; vapor.ReactTimer += frameTime; - if (vapor.ReactTimer >= ReactTime && vapor.Owner.Transform.GridID.IsValid()) + if (vapor.ReactTimer >= ReactTime && IoCManager.Resolve().GetComponent(vapor.Owner.Uid).GridID.IsValid()) { vapor.ReactTimer = 0; - var mapGrid = _mapManager.GetGrid(entity.Transform.GridID); + var mapGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); - var tile = mapGrid.GetTileRef(entity.Transform.Coordinates.ToVector2i(EntityManager, _mapManager)); + var tile = mapGrid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.ToVector2i(EntityManager, _mapManager)); foreach (var reagentQuantity in contents.Contents.ToArray()) { if (reagentQuantity.Quantity == FixedPoint2.Zero) continue; @@ -114,7 +114,7 @@ namespace Content.Server.Chemistry.EntitySystems // Check if we've reached our target. if (!vapor.Reached && - vapor.Target.TryDistance(EntityManager, entity.Transform.Coordinates, out var distance) && + vapor.Target.TryDistance(EntityManager, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, out var distance) && distance <= 0.5f) { vapor.Reached = true; diff --git a/Content.Server/Climbing/Components/ClimbableComponent.cs b/Content.Server/Climbing/Components/ClimbableComponent.cs index 4acc706a46..2c03b463c9 100644 --- a/Content.Server/Climbing/Components/ClimbableComponent.cs +++ b/Content.Server/Climbing/Components/ClimbableComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.Climbing.Components if (!Owner.EnsureComponent(out PhysicsComponent _)) { - Logger.Warning($"Entity {Owner.Name} at {Owner.Transform.MapPosition} didn't have a {nameof(PhysicsComponent)}"); + Logger.Warning($"Entity {Owner.Name} at {IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition} didn't have a {nameof(PhysicsComponent)}"); } } @@ -161,10 +161,10 @@ namespace Content.Server.Climbing.Components if (result != DoAfterStatus.Cancelled && IoCManager.Resolve().TryGetComponent(entityToMove.Uid, out PhysicsComponent? body) && body.Fixtures.Count >= 1) { - var entityPos = entityToMove.Transform.WorldPosition; + var entityPos = IoCManager.Resolve().GetComponent(entityToMove.Uid).WorldPosition; - var direction = (Owner.Transform.WorldPosition - entityPos).Normalized; - var endPoint = Owner.Transform.WorldPosition; + var direction = (IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition - entityPos).Normalized; + var endPoint = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; var climbMode = IoCManager.Resolve().GetComponent(entityToMove.Uid); climbMode.IsClimbing = true; @@ -209,21 +209,21 @@ namespace Content.Server.Climbing.Components if (result != DoAfterStatus.Cancelled && IoCManager.Resolve().TryGetComponent(user.Uid, out PhysicsComponent? body) && body.Fixtures.Count >= 1) { // TODO: Remove the copy-paste code - var userPos = user.Transform.WorldPosition; + var userPos = IoCManager.Resolve().GetComponent(user.Uid).WorldPosition; - var direction = (Owner.Transform.WorldPosition - userPos).Normalized; - var endPoint = Owner.Transform.WorldPosition; + var direction = (IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition - userPos).Normalized; + var endPoint = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; var climbMode = IoCManager.Resolve().GetComponent(user.Uid); climbMode.IsClimbing = true; if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line { - endPoint = new Vector2(user.Transform.WorldPosition.X, endPoint.Y); + endPoint = new Vector2(IoCManager.Resolve().GetComponent(user.Uid).WorldPosition.X, endPoint.Y); } else if (MathF.Abs(direction.Y) < 0.6f) // user climbed mostly horizontally so lets make it a clean straight line { - endPoint = new Vector2(endPoint.X, user.Transform.WorldPosition.Y); + endPoint = new Vector2(endPoint.X, IoCManager.Resolve().GetComponent(user.Uid).WorldPosition.Y); } climbMode.TryMoveTo(userPos, endPoint); diff --git a/Content.Server/Cloning/Components/CloningPodComponent.cs b/Content.Server/Cloning/Components/CloningPodComponent.cs index 9665e10f53..f206f333d6 100644 --- a/Content.Server/Cloning/Components/CloningPodComponent.cs +++ b/Content.Server/Cloning/Components/CloningPodComponent.cs @@ -135,7 +135,7 @@ namespace Content.Server.Cloning.Components return; // If we can't track down the client, we can't offer transfer. That'd be quite bad. } - var mob = IoCManager.Resolve().SpawnEntity("MobHuman", Owner.Transform.MapPosition); + var mob = IoCManager.Resolve().SpawnEntity("MobHuman", IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); EntitySystem.Get().UpdateFromProfile(mob.Uid, dna.Profile); diff --git a/Content.Server/Commands/CommandUtils.cs b/Content.Server/Commands/CommandUtils.cs index a1f42144b8..10aaf535f8 100644 --- a/Content.Server/Commands/CommandUtils.cs +++ b/Content.Server/Commands/CommandUtils.cs @@ -58,13 +58,13 @@ namespace Content.Server.Commands // gross, is there a better way to do this? ruleString = ruleString.Replace("$ID", ent.Uid.ToString()); ruleString = ruleString.Replace("$WX", - ent.Transform.WorldPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(ent.Uid).WorldPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$WY", - ent.Transform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(ent.Uid).WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$LX", - ent.Transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(ent.Uid).LocalPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$LY", - ent.Transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(ent.Uid).LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$NAME", ent.Name); if (shell.Player is IPlayerSession player) @@ -74,13 +74,13 @@ namespace Content.Server.Commands var p = player.AttachedEntity; ruleString = ruleString.Replace("$PID", ent.Uid.ToString()); ruleString = ruleString.Replace("$PWX", - p.Transform.WorldPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p.Uid).WorldPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$PWY", - p.Transform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p.Uid).WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$PLX", - p.Transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p.Uid).LocalPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$PLY", - p.Transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p.Uid).LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); } } return ruleString; diff --git a/Content.Server/Computer/ComputerComponent.cs b/Content.Server/Computer/ComputerComponent.cs index 5c98c60b2c..4486637cfa 100644 --- a/Content.Server/Computer/ComputerComponent.cs +++ b/Content.Server/Computer/ComputerComponent.cs @@ -79,7 +79,7 @@ namespace Content.Server.Computer return; } - var board = IoCManager.Resolve().SpawnEntity(_boardPrototype, Owner.Transform.Coordinates); + var board = IoCManager.Resolve().SpawnEntity(_boardPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if(!container.Insert(board)) Logger.Warning($"Couldn't insert board {board} to computer {Owner}!"); diff --git a/Content.Server/Construction/Commands/FixRotationsCommand.cs b/Content.Server/Construction/Commands/FixRotationsCommand.cs index 61e181eeef..6d676608ca 100644 --- a/Content.Server/Construction/Commands/FixRotationsCommand.cs +++ b/Content.Server/Construction/Commands/FixRotationsCommand.cs @@ -36,7 +36,7 @@ namespace Content.Server.Construction.Commands return; } - gridId = player.AttachedEntity.Transform.GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; break; case 1: if (!int.TryParse(args[0], out var id)) @@ -67,7 +67,7 @@ namespace Content.Server.Construction.Commands } var changed = 0; - foreach (var childUid in gridEntity.Transform.ChildEntityUids) + foreach (var childUid in IoCManager.Resolve().GetComponent(gridEntity.Uid).ChildEntityUids) { if (!entityManager.TryGetEntity(childUid, out var childEntity)) { @@ -96,9 +96,9 @@ namespace Content.Server.Construction.Commands continue; } - if (childEntity.Transform.LocalRotation != Angle.Zero) + if (IoCManager.Resolve().GetComponent(childEntity.Uid).LocalRotation != Angle.Zero) { - childEntity.Transform.LocalRotation = Angle.Zero; + IoCManager.Resolve().GetComponent(childEntity.Uid).LocalRotation = Angle.Zero; changed++; } } diff --git a/Content.Server/Construction/Commands/TileWallsCommand.cs b/Content.Server/Construction/Commands/TileWallsCommand.cs index c088c867f9..8276ca16d0 100644 --- a/Content.Server/Construction/Commands/TileWallsCommand.cs +++ b/Content.Server/Construction/Commands/TileWallsCommand.cs @@ -32,7 +32,7 @@ namespace Content.Server.Construction.Commands return; } - gridId = player.AttachedEntity.Transform.GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; break; case 1: if (!int.TryParse(args[0], out var id)) @@ -67,7 +67,7 @@ namespace Content.Server.Construction.Commands var underplating = tileDefinitionManager["underplating"]; var underplatingTile = new Robust.Shared.Map.Tile(underplating.TileId); var changed = 0; - foreach (var childUid in gridEntity.Transform.ChildEntityUids) + foreach (var childUid in IoCManager.Resolve().GetComponent(gridEntity.Uid).ChildEntityUids) { if (!entityManager.TryGetEntity(childUid, out var childEntity)) { @@ -90,12 +90,12 @@ namespace Content.Server.Construction.Commands continue; } - if (!childEntity.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(childEntity.Uid).Anchored) { continue; } - var tile = grid.GetTileRef(childEntity.Transform.Coordinates); + var tile = grid.GetTileRef(IoCManager.Resolve().GetComponent(childEntity.Uid).Coordinates); var tileDef = (ContentTileDefinition) tileDefinitionManager[tile.Tile.TypeId]; if (tileDef.Name == "underplating") @@ -103,7 +103,7 @@ namespace Content.Server.Construction.Commands continue; } - grid.SetTile(childEntity.Transform.Coordinates, underplatingTile); + grid.SetTile(IoCManager.Resolve().GetComponent(childEntity.Uid).Coordinates, underplatingTile); changed++; } diff --git a/Content.Server/Construction/Completions/BuildComputer.cs b/Content.Server/Construction/Completions/BuildComputer.cs index 883e3a6a8a..567b791143 100644 --- a/Content.Server/Construction/Completions/BuildComputer.cs +++ b/Content.Server/Construction/Completions/BuildComputer.cs @@ -51,7 +51,7 @@ namespace Content.Server.Construction.Completions var transform = entityManager.GetComponent(uid); var computer = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates); - computer.Transform.LocalRotation = transform.LocalRotation; + IoCManager.Resolve().GetComponent(computer.Uid).LocalRotation = transform.LocalRotation; var computerContainer = containerSystem.EnsureContainer(computer.Uid, Container); diff --git a/Content.Server/Construction/Completions/BuildMachine.cs b/Content.Server/Construction/Completions/BuildMachine.cs index b6e24e6d5d..c4cc64b79a 100644 --- a/Content.Server/Construction/Completions/BuildMachine.cs +++ b/Content.Server/Construction/Completions/BuildMachine.cs @@ -64,7 +64,7 @@ namespace Content.Server.Construction.Completions var transform = entityManager.GetComponent(uid); var machine = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates); - machine.Transform.LocalRotation = transform.LocalRotation; + IoCManager.Resolve().GetComponent(machine.Uid).LocalRotation = transform.LocalRotation; var boardContainer = machine.EnsureContainer(MachineFrameComponent.BoardContainer, out var existed); diff --git a/Content.Server/Construction/Completions/EmptyContainer.cs b/Content.Server/Construction/Completions/EmptyContainer.cs index 7cb0c7791f..ea565fbdff 100644 --- a/Content.Server/Construction/Completions/EmptyContainer.cs +++ b/Content.Server/Construction/Completions/EmptyContainer.cs @@ -25,8 +25,8 @@ namespace Content.Server.Construction.Completions foreach (var contained in container.ContainedEntities.ToArray()) { container.ForceRemove(contained); - contained.Transform.Coordinates = transform.Coordinates; - contained.Transform.AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(contained.Uid).Coordinates = transform.Coordinates; + IoCManager.Resolve().GetComponent(contained.Uid).AttachToGridOrMap(); } } } diff --git a/Content.Server/Construction/Components/MachineComponent.cs b/Content.Server/Construction/Components/MachineComponent.cs index 7f2534a65c..f4cd9a6e04 100644 --- a/Content.Server/Construction/Components/MachineComponent.cs +++ b/Content.Server/Construction/Components/MachineComponent.cs @@ -63,7 +63,7 @@ namespace Content.Server.Construction.Components return; } - var board = entityManager.SpawnEntity(BoardPrototype, Owner.Transform.Coordinates); + var board = entityManager.SpawnEntity(BoardPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if (!_boardContainer.Insert(board)) { @@ -79,7 +79,7 @@ namespace Content.Server.Construction.Components { for (var i = 0; i < amount; i++) { - var p = entityManager.SpawnEntity(MachinePartComponent.Prototypes[part], Owner.Transform.Coordinates); + var p = entityManager.SpawnEntity(MachinePartComponent.Prototypes[part], IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if (!partContainer.Insert(p)) throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}!"); @@ -88,7 +88,7 @@ namespace Content.Server.Construction.Components foreach (var (stackType, amount) in machineBoard.MaterialRequirements) { - var stack = EntitySystem.Get().Spawn(amount, stackType, Owner.Transform.Coordinates); + var stack = EntitySystem.Get().Spawn(amount, stackType, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if (!partContainer.Insert(IoCManager.Resolve().GetEntity(stack))) throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}"); @@ -98,7 +98,7 @@ namespace Content.Server.Construction.Components { for (var i = 0; i < info.Amount; i++) { - var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates); + var c = entityManager.SpawnEntity(info.DefaultPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if(!partContainer.Insert(c)) throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}"); @@ -109,7 +109,7 @@ namespace Content.Server.Construction.Components { for (var i = 0; i < info.Amount; i++) { - var c = entityManager.SpawnEntity(info.DefaultPrototype, Owner.Transform.Coordinates); + var c = entityManager.SpawnEntity(info.DefaultPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if(!partContainer.Insert(c)) throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}"); diff --git a/Content.Server/Construction/Components/MachineFrameComponent.cs b/Content.Server/Construction/Components/MachineFrameComponent.cs index 9226cc876a..8b53f2dec3 100644 --- a/Content.Server/Construction/Components/MachineFrameComponent.cs +++ b/Content.Server/Construction/Components/MachineFrameComponent.cs @@ -314,7 +314,7 @@ namespace Content.Server.Construction.Components return true; } - var splitStack = EntitySystem.Get().Split(eventArgs.Using.Uid, needed, Owner.Transform.Coordinates, stack); + var splitStack = EntitySystem.Get().Split(eventArgs.Using.Uid, needed, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, stack); if (splitStack == null) return false; diff --git a/Content.Server/Construction/Components/WelderRefinableComponent.cs b/Content.Server/Construction/Components/WelderRefinableComponent.cs index fc52577b39..0c06e61208 100644 --- a/Content.Server/Construction/Components/WelderRefinableComponent.cs +++ b/Content.Server/Construction/Components/WelderRefinableComponent.cs @@ -60,7 +60,7 @@ namespace Content.Server.Construction.Components } // get last owner coordinates and delete it - var resultPosition = Owner.Transform.Coordinates; + var resultPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; IoCManager.Resolve().DeleteEntity(Owner.Uid); // spawn each result after refine diff --git a/Content.Server/Construction/Conditions/EntityAnchored.cs b/Content.Server/Construction/Conditions/EntityAnchored.cs index e1b503c440..38a15bf104 100644 --- a/Content.Server/Construction/Conditions/EntityAnchored.cs +++ b/Content.Server/Construction/Conditions/EntityAnchored.cs @@ -4,6 +4,7 @@ using Content.Shared.Construction; using Content.Shared.Examine; using JetBrains.Annotations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Physics; using Robust.Shared.Serialization.Manager.Attributes; @@ -29,10 +30,10 @@ namespace Content.Server.Construction.Conditions switch (Anchored) { - case true when !entity.Transform.Anchored: + case true when !IoCManager.Resolve().GetComponent(entity.Uid).Anchored: args.PushMarkup(Loc.GetString("construction-examine-condition-entity-anchored")); return true; - case false when entity.Transform.Anchored: + case false when IoCManager.Resolve().GetComponent(entity.Uid).Anchored: args.PushMarkup(Loc.GetString("construction-examine-condition-entity-unanchored")); return true; } diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index 471ec63d13..eb491bf9fc 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -235,7 +235,7 @@ namespace Content.Server.Construction return null; } - var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates); + var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, IoCManager.Resolve().GetComponent(user.Uid).Coordinates); // Yes, this should throw if it's missing the component. var construction = IoCManager.Resolve().GetComponent(newEntity.Uid); @@ -457,13 +457,13 @@ namespace Content.Server.Construction // We do this to be able to move the construction to its proper position in case it's anchored... // Oh wow transform anchoring is amazing wow I love it!!!! - var wasAnchored = structure.Transform.Anchored; - structure.Transform.Anchored = false; + var wasAnchored = IoCManager.Resolve().GetComponent(structure.Uid).Anchored; + IoCManager.Resolve().GetComponent(structure.Uid).Anchored = false; - structure.Transform.Coordinates = ev.Location; - structure.Transform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero; + IoCManager.Resolve().GetComponent(structure.Uid).Coordinates = ev.Location; + IoCManager.Resolve().GetComponent(structure.Uid).LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero; - structure.Transform.Anchored = wasAnchored; + IoCManager.Resolve().GetComponent(structure.Uid).Anchored = wasAnchored; RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); diff --git a/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs b/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs index 14e495edee..43d87404c1 100644 --- a/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs +++ b/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs @@ -3,6 +3,7 @@ using JetBrains.Annotations; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Content.Shared.Containers.ItemSlots; +using Robust.Shared.IoC; namespace Content.Server.Containers { @@ -34,7 +35,7 @@ namespace Content.Server.Containers { if (!EntityManager.TryGetComponent(uid, out var mComp)) return; - var baseCoords = component.Owner.Transform.Coordinates; + var baseCoords = IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates; foreach (var v in component.Containers) { if (mComp.TryGetContainer(v, out var container)) diff --git a/Content.Server/Conveyor/ConveyorSystem.cs b/Content.Server/Conveyor/ConveyorSystem.cs index a4b445d45d..b2271be56b 100644 --- a/Content.Server/Conveyor/ConveyorSystem.cs +++ b/Content.Server/Conveyor/ConveyorSystem.cs @@ -126,7 +126,7 @@ namespace Content.Server.Conveyor var adjustment = component.State == ConveyorState.Reversed ? MathHelper.Pi/2 : -MathHelper.Pi/2; var radians = MathHelper.DegreesToRadians(component.Angle); - return new Angle(component.Owner.Transform.LocalRotation.Theta + radians + adjustment); + return new Angle(IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation.Theta + radians + adjustment); } public IEnumerable<(IEntity, IPhysBody)> GetEntitiesToMove(ConveyorComponent comp) diff --git a/Content.Server/Coordinates/Helpers/SnapgridHelper.cs b/Content.Server/Coordinates/Helpers/SnapgridHelper.cs index c2ab7f3124..8797ec13a8 100644 --- a/Content.Server/Coordinates/Helpers/SnapgridHelper.cs +++ b/Content.Server/Coordinates/Helpers/SnapgridHelper.cs @@ -9,7 +9,7 @@ namespace Content.Server.Coordinates.Helpers { public static void SnapToGrid(this IEntity entity, IEntityManager? entityManager = null, IMapManager? mapManager = null) { - entity.Transform.Coordinates = entity.Transform.Coordinates.SnapToGrid(entityManager, mapManager); + IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.SnapToGrid(entityManager, mapManager); } public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entityManager = null, IMapManager? mapManager = null) diff --git a/Content.Server/Cuffs/Components/CuffableComponent.cs b/Content.Server/Cuffs/Components/CuffableComponent.cs index 896ffc282a..9dca5809ec 100644 --- a/Content.Server/Cuffs/Components/CuffableComponent.cs +++ b/Content.Server/Cuffs/Components/CuffableComponent.cs @@ -260,8 +260,8 @@ namespace Content.Server.Cuffs.Components SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound.GetSound(), Owner); Container.ForceRemove(cuffsToRemove); - cuffsToRemove.Transform.AttachToGridOrMap(); - cuffsToRemove.Transform.WorldPosition = Owner.Transform.WorldPosition; + IoCManager.Resolve().GetComponent(cuffsToRemove.Uid).AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(cuffsToRemove.Uid).WorldPosition = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; if (cuff.BreakOnRemove) { diff --git a/Content.Server/Cuffs/CuffableSystem.cs b/Content.Server/Cuffs/CuffableSystem.cs index 11db2b62d0..2ec1a213bd 100644 --- a/Content.Server/Cuffs/CuffableSystem.cs +++ b/Content.Server/Cuffs/CuffableSystem.cs @@ -115,7 +115,7 @@ namespace Content.Server.Cuffs var entity = container.ContainedEntities[^1]; container.Remove(entity); - entity.Transform.WorldPosition = owner.Transform.WorldPosition; + IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition = IoCManager.Resolve().GetComponent(owner.Uid).WorldPosition; } if (dirty) diff --git a/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs index 11eda63575..931be2d703 100644 --- a/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs @@ -5,6 +5,7 @@ using Content.Server.Power.Components; using JetBrains.Annotations; using Robust.Shared.GameObjects; using System.Diagnostics.CodeAnalysis; +using Robust.Shared.IoC; namespace Content.Server.DeviceNetwork.Systems { @@ -25,7 +26,7 @@ namespace Content.Server.DeviceNetwork.Systems IEntity sender = EntityManager.GetEntity(args.Sender); IEntity receiver = EntityManager.GetEntity(uid); - if (receiver.Transform.GridID != sender.Transform.GridID) + if (IoCManager.Resolve().GetComponent(receiver.Uid).GridID != IoCManager.Resolve().GetComponent(sender.Uid).GridID) { args.Cancel(); } diff --git a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs index 9d3873fdee..72bb0a2228 100644 --- a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs @@ -21,8 +21,8 @@ namespace Content.Server.DeviceNetwork.Systems { var sender = EntityManager.GetEntity(args.Sender); - var ownPosition = component.Owner.Transform.WorldPosition; - var position = sender.Transform.WorldPosition; + var ownPosition = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldPosition; + var position = IoCManager.Resolve().GetComponent(sender.Uid).WorldPosition; var distance = (ownPosition - position).Length; if(IoCManager.Resolve().TryGetComponent(sender.Uid, out var sendingComponent) && distance > sendingComponent.Range) diff --git a/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs index 5475e14510..532410489b 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs @@ -1,5 +1,6 @@ using Content.Server.Disposal.Unit.Components; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Serialization.Manager.Attributes; @@ -16,7 +17,7 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - var direction = Owner.Transform.LocalRotation; + var direction = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation; var side = new Angle(MathHelper.DegreesToRadians(direction.Degrees + _sideDegrees)); return new[] {direction.GetDir(), side.GetDir()}; diff --git a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs index ea0db3768a..054a88472a 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs @@ -21,7 +21,7 @@ namespace Content.Server.Disposal.Tube.Components public bool TryInsert(DisposalUnitComponent from) { - var holder = IoCManager.Resolve().SpawnEntity(HolderPrototypeId, Owner.Transform.MapPosition); + var holder = IoCManager.Resolve().SpawnEntity(HolderPrototypeId, IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); var holderComponent = IoCManager.Resolve().GetComponent(holder.Uid); foreach (var entity in from.ContainedEntities.ToArray()) @@ -37,7 +37,7 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - return new[] {Owner.Transform.LocalRotation.GetDir()}; + return new[] {IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir()}; } /// diff --git a/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs index 73eb40a516..c9f5c26efb 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs @@ -27,14 +27,14 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - var direction = Owner.Transform.LocalRotation; + var direction = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation; return _degrees.Select(degree => new Angle(degree.Theta + direction.Theta).GetDir()).ToArray(); } public override Direction NextDirection(DisposalHolderComponent holder) { - var next = Owner.Transform.LocalRotation.GetDir(); + var next = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir(); var directions = ConnectableDirections().Skip(1).ToArray(); if (holder.PreviousDirectionFrom == Direction.Invalid || diff --git a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs index 5c832cb9b8..23fcf34ed6 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs @@ -52,7 +52,7 @@ namespace Content.Server.Disposal.Tube.Components return directions[1]; } - return Owner.Transform.LocalRotation.GetDir(); + return IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir(); } protected override void Initialize() diff --git a/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs index e67b92d774..904131e2e1 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs @@ -1,6 +1,7 @@ using System; using Content.Server.Disposal.Unit.Components; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Server.Disposal.Tube.Components @@ -14,7 +15,7 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - var rotation = Owner.Transform.LocalRotation; + var rotation = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation; var opposite = new Angle(rotation.Theta + Math.PI); return new[] {rotation.GetDir(), opposite.GetDir()}; diff --git a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs index 0c6c8ce28f..e647a9b0d3 100644 --- a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs +++ b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs @@ -87,8 +87,8 @@ namespace Content.Server.Disposal.Tube return null; var oppositeDirection = nextDirection.GetOpposite(); - var grid = _mapManager.GetGrid(targetTube.Owner.Transform.GridID); - var position = targetTube.Owner.Transform.Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(targetTube.Owner.Uid).GridID); + var position = IoCManager.Resolve().GetComponent(targetTube.Owner.Uid).Coordinates; foreach (var entity in grid.GetInDir(position, nextDirection)) { if (!EntityManager.TryGetComponent(entity, out IDisposalTubeComponent? tube)) diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs index 0f95740e0d..5ab5118809 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs @@ -54,17 +54,17 @@ namespace Content.Server.Disposal.Unit.EntitySystems holder.Container.ForceRemove(entity); - if (entity.Transform.Parent == holderTransform) + if (IoCManager.Resolve().GetComponent(entity.Uid).Parent == holderTransform) { if (duc != null) { // Insert into disposal unit - entity.Transform.Coordinates = new EntityCoordinates(duc.OwnerUid, Vector2.Zero); + IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = new EntityCoordinates(duc.OwnerUid, Vector2.Zero); duc.Container.Insert(entity); } else { - entity.Transform.AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(entity.Uid).AttachParentToContainerOrGrid(); } } } @@ -161,11 +161,11 @@ namespace Content.Server.Disposal.Unit.EntitySystems if (holder.TimeLeft > 0) { var progress = 1 - holder.TimeLeft / holder.StartingTime; - var origin = currentTube.Owner.Transform.Coordinates; + var origin = IoCManager.Resolve().GetComponent(currentTube.Owner.Uid).Coordinates; var destination = holder.CurrentDirection.ToVec(); var newPosition = destination * progress; - holder.Owner.Transform.Coordinates = origin.Offset(newPosition); + IoCManager.Resolve().GetComponent(holder.Owner.Uid).Coordinates = origin.Offset(newPosition); continue; } diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index ff491f4248..dbedcfe51a 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -444,8 +444,8 @@ namespace Content.Server.Disposal.Unit.EntitySystems return false; } - var grid = _mapManager.GetGrid(component.Owner.Transform.GridID); - var coords = component.Owner.Transform.Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(component.Owner.Uid).GridID); + var coords = IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates; var entry = grid.GetLocal(coords) .FirstOrDefault(entity => EntityManager.HasComponent(entity)); @@ -457,7 +457,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems var air = component.Air; var entryComponent = EntityManager.GetComponent(entry); - if (_atmosSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is {Temperature: > 0} environment) + if (_atmosSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates, true) is {Temperature: > 0} environment) { var transferMoles = 0.1f * (0.05f * Atmospherics.OneAtmosphere * 1.01f - air.Pressure) * air.Volume / (environment.Temperature * Atmospherics.R); @@ -509,7 +509,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems return; } - if (!component.Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) { appearance.SetData(SharedDisposalUnitComponent.Visuals.VisualState, SharedDisposalUnitComponent.VisualState.UnAnchored); appearance.SetData(SharedDisposalUnitComponent.Visuals.Handle, SharedDisposalUnitComponent.HandleState.Normal); @@ -567,7 +567,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems public bool CanFlush(DisposalUnitComponent component) { - return component.State == SharedDisposalUnitComponent.PressureState.Ready && component.Powered && component.Owner.Transform.Anchored; + return component.State == SharedDisposalUnitComponent.PressureState.Ready && component.Powered && IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored; } public void Engage(DisposalUnitComponent component) diff --git a/Content.Server/Doors/Components/FirelockComponent.cs b/Content.Server/Doors/Components/FirelockComponent.cs index 7b66c55db4..3565e9386f 100644 --- a/Content.Server/Doors/Components/FirelockComponent.cs +++ b/Content.Server/Doors/Components/FirelockComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.Doors.Components var minMoles = float.MaxValue; var maxMoles = 0f; - foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(Owner.Transform.Coordinates)) + foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)) { var moles = adjacent.TotalMoles; if (moles < minMoles) @@ -63,7 +63,7 @@ namespace Content.Server.Doors.Components { var atmosphereSystem = EntitySystem.Get(); - if (!atmosphereSystem.TryGetGridAndTile(Owner.Transform.Coordinates, out var tuple)) + if (!atmosphereSystem.TryGetGridAndTile(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, out var tuple)) return false; if (atmosphereSystem.GetTileMixture(tuple.Value.Grid, tuple.Value.Tile) == null) @@ -72,7 +72,7 @@ namespace Content.Server.Doors.Components if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, tuple.Value.Tile)) return true; - foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(Owner.Transform.Coordinates)) + foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)) { if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, adjacent)) return true; diff --git a/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs b/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs index 4bb25a43e6..c59fc4fc85 100644 --- a/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs +++ b/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs @@ -44,7 +44,7 @@ namespace Content.Server.Engineering.EntitySystems if (component.Deleted || (!IoCManager.Resolve().EntityExists(component.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) return; - var entity = EntityManager.SpawnEntity(component.Prototype, component.Owner.Transform.Coordinates); + var entity = EntityManager.SpawnEntity(component.Prototype, IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates); if (IoCManager.Resolve().TryGetComponent(args.User.Uid, out var hands) && IoCManager.Resolve().TryGetComponent(entity.Uid, out var item)) diff --git a/Content.Server/EntityList/SpawnEntityListCommand.cs b/Content.Server/EntityList/SpawnEntityListCommand.cs index aaf85a2171..cd57605bb7 100644 --- a/Content.Server/EntityList/SpawnEntityListCommand.cs +++ b/Content.Server/EntityList/SpawnEntityListCommand.cs @@ -49,7 +49,7 @@ namespace Content.Server.EntityList foreach (var entity in prototype.Entities(prototypeManager)) { - entityManager.SpawnEntity(entity.ID, player.AttachedEntity.Transform.Coordinates); + entityManager.SpawnEntity(entity.ID, IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates); i++; } diff --git a/Content.Server/Explosion/Components/ClusterFlashComponent.cs b/Content.Server/Explosion/Components/ClusterFlashComponent.cs index ac21046678..ef9bd9a50a 100644 --- a/Content.Server/Explosion/Components/ClusterFlashComponent.cs +++ b/Content.Server/Explosion/Components/ClusterFlashComponent.cs @@ -135,7 +135,7 @@ namespace Content.Server.Explosion.Components if (_unspawnedCount > 0) { _unspawnedCount--; - grenade = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.MapPosition); + grenade = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); return true; } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 06d1861a9b..987b8c5d6a 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -87,7 +87,7 @@ namespace Content.Server.Explosion.EntitySystems continue; } - var playerPos = player.AttachedEntity.Transform.WorldPosition; + var playerPos = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).WorldPosition; var delta = epicenter.ToMapPos(EntityManager) - playerPos; //Change if zero. Will result in a NaN later breaking camera shake if not changed @@ -135,7 +135,7 @@ namespace Content.Server.Explosion.EntitySystems continue; } - if (!entity.Transform.Coordinates.TryDistance(EntityManager, epicenter, out var distance) || + if (!IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(EntityManager, epicenter, out var distance) || distance > maxRange) { continue; diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index 30e2221ef4..04341050a1 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -77,7 +77,7 @@ namespace Content.Server.Flash return; } - foreach (var entity in _entityLookup.GetEntitiesInRange(comp.Owner.Transform.Coordinates, comp.Range)) + foreach (var entity in _entityLookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates, comp.Range)) { Flash(entity.Uid, args.User.Uid, uid, comp.AoeFlashDuration, comp.SlowTo); } diff --git a/Content.Server/Fluids/Components/SpillExtensions.cs b/Content.Server/Fluids/Components/SpillExtensions.cs index c31c9c12e6..357f0d2ac5 100644 --- a/Content.Server/Fluids/Components/SpillExtensions.cs +++ b/Content.Server/Fluids/Components/SpillExtensions.cs @@ -31,7 +31,7 @@ namespace Content.Server.Fluids.Components public static PuddleComponent? SpillAt(this Solution solution, IEntity entity, string prototype, bool sound = true, bool combine = true) { - return solution.SpillAt(entity.Transform.Coordinates, prototype, sound, combine: combine); + return solution.SpillAt(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, prototype, sound, combine: combine); } /// diff --git a/Content.Server/Fluids/Components/SprayComponent.cs b/Content.Server/Fluids/Components/SprayComponent.cs index 955789fdcb..8325f1f79e 100644 --- a/Content.Server/Fluids/Components/SprayComponent.cs +++ b/Content.Server/Fluids/Components/SprayComponent.cs @@ -99,7 +99,7 @@ namespace Content.Server.Fluids.Components if(curTime < _cooldownEnd) return true; - var playerPos = eventArgs.User.Transform.Coordinates; + var playerPos = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates; var entManager = IoCManager.Resolve(); if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager)) @@ -124,10 +124,10 @@ namespace Content.Server.Fluids.Components var diffNorm = diffPos.Normalized; var diffLength = diffPos.Length; - var target = eventArgs.User.Transform.Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter); + var target = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter); if (target.TryDistance(IoCManager.Resolve(), playerPos, out var distance) && distance > SprayDistance) - target = eventArgs.User.Transform.Coordinates.Offset(diffNorm * SprayDistance); + target = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates.Offset(diffNorm * SprayDistance); var solution = EntitySystem.Get().SplitSolution(Owner.Uid, contents, _transferAmount); @@ -135,7 +135,7 @@ namespace Content.Server.Fluids.Components break; var vapor = entManager.SpawnEntity(_vaporPrototype, playerPos.Offset(distance < 1 ? quarter : threeQuarters)); - vapor.Transform.LocalRotation = rotation; + IoCManager.Resolve().GetComponent(vapor.Uid).LocalRotation = rotation; if (IoCManager.Resolve().TryGetComponent(vapor.Uid, out AppearanceComponent? appearance)) { @@ -149,7 +149,7 @@ namespace Content.Server.Fluids.Components vaporSystem.TryAddSolution(vaporComponent, solution); // impulse direction is defined in world-coordinates, not local coordinates - var impulseDirection = vapor.Transform.WorldRotation.ToVec(); + var impulseDirection = IoCManager.Resolve().GetComponent(vapor.Uid).WorldRotation.ToVec(); vaporSystem.Start(vaporComponent, impulseDirection, _sprayVelocity, target, _sprayAliveTime); if (_impulse > 0f && IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out IPhysBody? body)) diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index d881bbc157..92d9252c45 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -106,7 +106,7 @@ namespace Content.Server.Fluids.EntitySystems verb.Text = Loc.GetString("spill-target-verb-get-data-text"); // TODO VERB ICONS spill icon? pouring out a glass/beaker? verb.Act = () => _solutionContainerSystem.SplitSolution(args.Target.Uid, - solution, solution.DrainAvailable).SpillAt(args.Target.Transform.Coordinates, "PuddleSmear"); + solution, solution.DrainAvailable).SpillAt(IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates, "PuddleSmear"); verb.Impact = LogImpact.Medium; // dangerous reagent reaction are logged separately. args.Verbs.Add(verb); } @@ -121,7 +121,7 @@ namespace Content.Server.Fluids.EntitySystems private void OnUnanchored(EntityUid uid, PuddleComponent puddle, UnanchoredEvent unanchoredEvent) { - if (!puddle.Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(puddle.Owner.Uid).Anchored) return; IoCManager.Resolve().QueueDeleteEntity(puddle.Owner.Uid); @@ -288,11 +288,11 @@ namespace Content.Server.Fluids.EntitySystems puddle = default; // We're most likely in space, do nothing. - if (!puddleComponent.Owner.Transform.GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).GridID.IsValid()) return false; - var mapGrid = _mapManager.GetGrid(puddleComponent.Owner.Transform.GridID); - var coords = puddleComponent.Owner.Transform.Coordinates; + var mapGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).GridID); + var coords = IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).Coordinates; if (!coords.Offset(direction).TryGetTileRef(out var tile)) { @@ -305,7 +305,7 @@ namespace Content.Server.Fluids.EntitySystems return false; } - if (!puddleComponent.Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).Anchored) return false; foreach (var entity in mapGrid.GetInDir(coords, direction)) diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 158b8419c9..812acfd148 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -237,7 +237,7 @@ namespace Content.Server.GameTicking var equipmentStr = startingGear.GetGear(slot, profile); if (!string.IsNullOrEmpty(equipmentStr)) { - var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates); + var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); inventory.Equip(slot, IoCManager.Resolve().GetComponent(equipmentEntity.Uid)); } } @@ -248,7 +248,7 @@ namespace Content.Server.GameTicking var inhand = startingGear.Inhand; foreach (var (hand, prototype) in inhand) { - var inhandEntity = EntityManager.SpawnEntity(prototype, entity.Transform.Coordinates); + var inhandEntity = EntityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); handsComponent.TryPickupEntity(hand, inhandEntity, checkActionBlocker: false); } } diff --git a/Content.Server/GameTicking/Presets/GamePreset.cs b/Content.Server/GameTicking/Presets/GamePreset.cs index 63da616ee4..8985ecba42 100644 --- a/Content.Server/GameTicking/Presets/GamePreset.cs +++ b/Content.Server/GameTicking/Presets/GamePreset.cs @@ -47,7 +47,7 @@ namespace Content.Server.GameTicking.Presets mind.UnVisit(); } - var position = playerEntity?.Transform.Coordinates ?? EntitySystem.Get().GetObserverSpawnPoint(); + var position = (playerEntity != null ? IoCManager.Resolve().GetComponent(playerEntity.Uid) : null).Coordinates ?? EntitySystem.Get().GetObserverSpawnPoint(); // Ok, so, this is the master place for the logic for if ghosting is "too cheaty" to allow returning. // There's no reason at this time to move it to any other place, especially given that the 'side effects required' situations would also have to be moved. // + If CharacterDeadPhysically applies, we're physically dead. Therefore, ghosting OK, and we can return (this is critical for gibbing) diff --git a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs index 785eba5cc5..6ec6ed4454 100644 --- a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs +++ b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs @@ -92,15 +92,15 @@ namespace Content.Server.GameTicking.Presets // Replace their items: // pda - var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, mind.OwnedEntity.Transform.Coordinates); + var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates); inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, IoCManager.Resolve().GetComponent(newPDA.Uid)); // belt - var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, mind.OwnedEntity.Transform.Coordinates); + var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates); inventory.Equip(EquipmentSlotDefines.Slots.BELT, IoCManager.Resolve().GetComponent(newTmp.Uid)); // backpack - newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, mind.OwnedEntity.Transform.Coordinates); + newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates); inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, IoCManager.Resolve().GetComponent(newTmp.Uid)); // Like normal traitors, they need access to a traitor account. @@ -123,7 +123,7 @@ namespace Content.Server.GameTicking.Presets // Finally, it would be preferrable if they spawned as far away from other players as reasonably possible. if (mind.OwnedEntity != null && FindAnyIsolatedSpawnLocation(mind, out var bestTarget)) { - mind.OwnedEntity.Transform.Coordinates = bestTarget; + IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates = bestTarget; } else { @@ -162,7 +162,7 @@ namespace Content.Server.GameTicking.Presets // Doesn't have mob state component. Assume something interesting is going on and don't count this as someone to avoid. continue; } - existingPlayerPoints.Add(avoidMeEntity.Transform.Coordinates); + existingPlayerPoints.Add(IoCManager.Resolve().GetComponent(avoidMeEntity.Uid).Coordinates); } // Iterate over each possible spawn point, comparing to the existing player points. @@ -176,18 +176,18 @@ namespace Content.Server.GameTicking.Presets var atmosphereSystem = EntitySystem.Get(); foreach (var entity in ents) { - if (!atmosphereSystem.IsTileMixtureProbablySafe(entity.Transform.Coordinates)) + if (!atmosphereSystem.IsTileMixtureProbablySafe(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates)) continue; var distanceFromNearest = float.PositiveInfinity; foreach (var existing in existingPlayerPoints) { - if (entity.Transform.Coordinates.TryDistance(_entityManager, existing, out var dist)) + if (IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(_entityManager, existing, out var dist)) distanceFromNearest = Math.Min(distanceFromNearest, dist); } if (bestTargetDistanceFromNearest < distanceFromNearest) { - bestTarget = entity.Transform.Coordinates; + bestTarget = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; bestTargetDistanceFromNearest = distanceFromNearest; foundATarget = true; } diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 7f8269e2bd..cb62be1013 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -154,7 +154,7 @@ namespace Content.Server.Ghost if (FindLocation(msg.Name) is { } warp) { - ghost.Owner.Transform.Coordinates = warp.Owner.Transform.Coordinates; + IoCManager.Resolve().GetComponent(ghost.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(warp.Owner.Uid).Coordinates; } Logger.Warning($"User {args.SenderSession.Name} tried to warp to an invalid warp: {msg.Name}"); @@ -175,7 +175,7 @@ namespace Content.Server.Ghost return; } - ghost.Owner.Transform.Coordinates = entity.Transform.Coordinates; + IoCManager.Resolve().GetComponent(ghost.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; } private void DeleteEntity(EntityUid uid) diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs index 2d9e36ad08..7851b306a6 100644 --- a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs @@ -42,7 +42,7 @@ namespace Content.Server.Ghost.Roles.Components if (string.IsNullOrEmpty(Prototype)) throw new NullReferenceException("Prototype string cannot be null or empty!"); - var mob = IoCManager.Resolve().SpawnEntity(Prototype, Owner.Transform.Coordinates); + var mob = IoCManager.Resolve().SpawnEntity(Prototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if (MakeSentient) MakeSentientCommand.MakeSentient(mob.Uid, IoCManager.Resolve()); diff --git a/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs b/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs index 6cc53d8137..edefb66c21 100644 --- a/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs @@ -184,7 +184,7 @@ namespace Content.Server.Gravity.EntitySystems private void UpdateGravityActive(GravityGeneratorComponent grav, bool shake) { - var gridId = grav.Owner.Transform.GridID; + var gridId = IoCManager.Resolve().GetComponent(grav.Owner.Uid).GridID; if (gridId == GridId.Invalid) return; diff --git a/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs b/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs index f24d511961..59ea4fd331 100644 --- a/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs @@ -80,7 +80,7 @@ namespace Content.Server.Gravity.EntitySystems foreach (var player in _playerManager.Sessions) { if (player.AttachedEntity == null - || player.AttachedEntity.Transform.GridID != gridId + || IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID != gridId || !IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out CameraRecoilComponent? recoil)) { continue; diff --git a/Content.Server/Gravity/EntitySystems/GravitySystem.cs b/Content.Server/Gravity/EntitySystems/GravitySystem.cs index 011ad8f633..2c55b0e15f 100644 --- a/Content.Server/Gravity/EntitySystems/GravitySystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravitySystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Gravity; using JetBrains.Annotations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Server.Gravity.EntitySystems { @@ -16,12 +17,12 @@ namespace Content.Server.Gravity.EntitySystems private void HandleGravityInitialize(EntityUid uid, GravityComponent component, ComponentInit args) { // Incase there's already a generator on the grid we'll just set it now. - var gridId = component.Owner.Transform.GridID; + var gridId = IoCManager.Resolve().GetComponent(component.Owner.Uid).GridID; GravityChangedMessage message; foreach (var generator in EntityManager.EntityQuery()) { - if (generator.Owner.Transform.GridID == gridId && generator.GravityActive) + if (IoCManager.Resolve().GetComponent(generator.Owner.Uid).GridID == gridId && generator.GravityActive) { component.Enabled = true; message = new GravityChangedMessage(gridId, true); @@ -40,7 +41,7 @@ namespace Content.Server.Gravity.EntitySystems if (comp.Enabled) return; comp.Enabled = true; - var gridId = comp.Owner.Transform.GridID; + var gridId = IoCManager.Resolve().GetComponent(comp.Owner.Uid).GridID; var message = new GravityChangedMessage(gridId, true); RaiseLocalEvent(message); } @@ -50,7 +51,7 @@ namespace Content.Server.Gravity.EntitySystems if (!comp.Enabled) return; comp.Enabled = false; - var gridId = comp.Owner.Transform.GridID; + var gridId = IoCManager.Resolve().GetComponent(comp.Owner.Uid).GridID; var message = new GravityChangedMessage(gridId, false); RaiseLocalEvent(message); } diff --git a/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs b/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs index c660bed6e0..99ff25a4d3 100644 --- a/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs +++ b/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs @@ -34,12 +34,12 @@ namespace Content.Server.Gravity.EntitySystems public void AddAlert(ServerAlertsComponent status) { - var gridId = status.Owner.Transform.GridID; + var gridId = IoCManager.Resolve().GetComponent(status.Owner.Uid).GridID; var alerts = _alerts.GetOrNew(gridId); alerts.Add(status); - if (_mapManager.TryGetGrid(status.Owner.Transform.GridID, out var grid)) + if (_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(status.Owner.Uid).GridID, out var grid)) { var gridEntity = EntityManager.GetEntity(grid.GridEntityId); if (IoCManager.Resolve().GetComponent(gridEntity.Uid).Enabled) @@ -55,7 +55,7 @@ namespace Content.Server.Gravity.EntitySystems public void RemoveAlert(ServerAlertsComponent status) { - var grid = status.Owner.Transform.GridID; + var grid = IoCManager.Resolve().GetComponent(status.Owner.Uid).GridID; if (!_alerts.TryGetValue(grid, out var statuses)) { return; @@ -115,7 +115,7 @@ namespace Content.Server.Gravity.EntitySystems } } - var newGrid = ev.Entity.Transform.GridID; + var newGrid = IoCManager.Resolve().GetComponent(ev.Entity.Uid).GridID; var newStatuses = _alerts.GetOrNew(newGrid); newStatuses.Add(status); diff --git a/Content.Server/Hands/Components/HandsComponent.cs b/Content.Server/Hands/Components/HandsComponent.cs index caae8f95a2..266580dfcc 100644 --- a/Content.Server/Hands/Components/HandsComponent.cs +++ b/Content.Server/Hands/Components/HandsComponent.cs @@ -51,9 +51,9 @@ namespace Content.Server.Hands.Components protected override void HandlePickupAnimation(IEntity entity) { - var initialPosition = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, entity.Transform.MapPosition); + var initialPosition = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(entity.Uid).MapPosition); - var finalPosition = Owner.Transform.LocalPosition; + var finalPosition = IoCManager.Resolve().GetComponent(Owner.Uid).LocalPosition; if (finalPosition.EqualsApprox(initialPosition.Position)) return; diff --git a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs index e1978038c6..667ca166eb 100644 --- a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs +++ b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Hands.Systems if (!hand.IsEmpty) continue; - var pos = hands.Owner.Transform.Coordinates; + var pos = IoCManager.Resolve().GetComponent(hands.Owner.Uid).Coordinates; var virtualItem = EntityManager.SpawnEntity("HandVirtualItem", pos); var virtualItemComp = IoCManager.Resolve().GetComponent(virtualItem.Uid); virtualItemComp.BlockingEntity = blockingEnt; diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 291506991c..22864b7393 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -230,7 +230,7 @@ namespace Content.Server.Hands.Systems if (IoCManager.Resolve().TryGetComponent(throwEnt.Uid, out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually) { - var splitStack = _stackSystem.Split(throwEnt.Uid, 1, playerEnt.Transform.Coordinates, stack); + var splitStack = _stackSystem.Split(throwEnt.Uid, 1, IoCManager.Resolve().GetComponent(playerEnt.Uid).Coordinates, stack); if (splitStack == null) return false; @@ -240,7 +240,7 @@ namespace Content.Server.Hands.Systems else if (!hands.Drop(throwEnt)) return false; - var direction = coords.ToMapPos(EntityManager) - playerEnt.Transform.WorldPosition; + var direction = coords.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(playerEnt.Uid).WorldPosition; if (direction == Vector2.Zero) return true; @@ -299,7 +299,7 @@ namespace Content.Server.Hands.Systems if (storageComponent.Remove(lastStoredEntity)) { if (!hands.TryPickupEntityToActiveHand(lastStoredEntity)) - lastStoredEntity.Transform.Coordinates = plyEnt.Transform.Coordinates; + IoCManager.Resolve().GetComponent(lastStoredEntity.Uid).Coordinates = IoCManager.Resolve().GetComponent(plyEnt.Uid).Coordinates; } } } diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index 979dcbe68c..64ee823260 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -137,7 +137,7 @@ namespace Content.Server.Interaction } // client sanitization - if (!ValidateClientInput(args.SenderSession, item.Transform.Coordinates, msg.ItemUid, out var userEntity)) + if (!ValidateClientInput(args.SenderSession, IoCManager.Resolve().GetComponent(item.Uid).Coordinates, msg.ItemUid, out var userEntity)) { Logger.InfoS("system.interaction", $"Inventory interaction validation failed. Session={args.SenderSession}"); return; @@ -145,7 +145,7 @@ namespace Content.Server.Interaction if (msg.AltInteract) // Use 'UserInteraction' function - behaves as if the user alt-clicked the item in the world. - UserInteraction(userEntity, item.Transform.Coordinates, msg.ItemUid, msg.AltInteract); + UserInteraction(userEntity, IoCManager.Resolve().GetComponent(item.Uid).Coordinates, msg.ItemUid, msg.AltInteract); else // User used 'E'. We want to activate it, not simulate clicking on the item InteractionActivate(userEntity, item); @@ -374,7 +374,7 @@ namespace Content.Server.Interaction private bool ValidateInteractAndFace(IEntity user, EntityCoordinates coordinates) { // Verify user is on the same map as the entity they clicked on - if (coordinates.GetMapId(_entityManager) != user.Transform.MapID) + if (coordinates.GetMapId(_entityManager) != IoCManager.Resolve().GetComponent(user.Uid).MapID) { Logger.WarningS("system.interaction", $"User entity named {user.Name} clicked on a map they aren't located on"); diff --git a/Content.Server/Interaction/TilePryCommand.cs b/Content.Server/Interaction/TilePryCommand.cs index 39fa5f8de3..33bc7dd942 100644 --- a/Content.Server/Interaction/TilePryCommand.cs +++ b/Content.Server/Interaction/TilePryCommand.cs @@ -4,6 +4,7 @@ using Content.Shared.Administration; using Content.Shared.Maps; using Robust.Server.Player; using Robust.Shared.Console; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; @@ -46,9 +47,9 @@ namespace Content.Server.Interaction } var mapManager = IoCManager.Resolve(); - var playerGrid = player.AttachedEntity.Transform.GridID; + var playerGrid = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; var mapGrid = mapManager.GetGrid(playerGrid); - var playerPosition = player.AttachedEntity.Transform.Coordinates; + var playerPosition = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates; var tileDefinitionManager = IoCManager.Resolve(); for (var i = -radius; i <= radius; i++) diff --git a/Content.Server/Inventory/Components/InventoryComponent.cs b/Content.Server/Inventory/Components/InventoryComponent.cs index 1df18d760a..2559a40cc4 100644 --- a/Content.Server/Inventory/Components/InventoryComponent.cs +++ b/Content.Server/Inventory/Components/InventoryComponent.cs @@ -280,7 +280,7 @@ namespace Content.Server.Inventory.Components } // TODO: The item should be dropped to the container our owner is in, if any. - entity.Transform.AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(entity.Uid).AttachParentToContainerOrGrid(); _entitySystemManager.GetEntitySystem().UnequippedInteraction(Owner, entity, slot); @@ -310,7 +310,7 @@ namespace Content.Server.Inventory.Components var item = IoCManager.Resolve().GetComponent(entity.Uid); inventorySlot.ForceRemove(entity); - var itemTransform = entity.Transform; + var itemTransform = IoCManager.Resolve().GetComponent(entity.Uid); itemTransform.AttachParentToContainerOrGrid(); diff --git a/Content.Server/Inventory/InventoryHelpers.cs b/Content.Server/Inventory/InventoryHelpers.cs index f91e67ce31..c28e4c4c4a 100644 --- a/Content.Server/Inventory/InventoryHelpers.cs +++ b/Content.Server/Inventory/InventoryHelpers.cs @@ -28,7 +28,7 @@ namespace Content.Server.Inventory return false; // Let's spawn this first... - var item = entityManager.SpawnEntity(prototype, user.Transform.MapPosition); + var item = entityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(user.Uid).MapPosition); // Helper method that deletes the item and returns false. bool DeleteItem() diff --git a/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs b/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs index 1629bdc08c..602254a91a 100644 --- a/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs +++ b/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs @@ -30,7 +30,7 @@ namespace Content.Server.Jobs if (!EntitySystem.Get().IsCurrentlyHoliday(Holiday)) return; - var entity = IoCManager.Resolve().SpawnEntity(Prototype, mob.Transform.Coordinates); + var entity = IoCManager.Resolve().SpawnEntity(Prototype, IoCManager.Resolve().GetComponent(mob.Uid).Coordinates); if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemComponent? item) || !IoCManager.Resolve().TryGetComponent(mob.Uid, out HandsComponent? hands)) return; diff --git a/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs b/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs index 1f0f0b00a5..0180fbae29 100644 --- a/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs +++ b/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs @@ -40,7 +40,7 @@ namespace Content.Server.Kitchen.Components if (!string.IsNullOrEmpty(_meatPrototype)) { - var meat = IoCManager.Resolve().SpawnEntity(_meatPrototype, Owner.Transform.Coordinates); + var meat = IoCManager.Resolve().SpawnEntity(_meatPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); meat.Name = _meatName; } diff --git a/Content.Server/Kitchen/Components/MicrowaveComponent.cs b/Content.Server/Kitchen/Components/MicrowaveComponent.cs index 4f4467ad70..013f8be7dc 100644 --- a/Content.Server/Kitchen/Components/MicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/MicrowaveComponent.cs @@ -366,13 +366,13 @@ namespace Content.Server.Kitchen.Components if (recipeToCook != null) { SubtractContents(recipeToCook); - IoCManager.Resolve().SpawnEntity(recipeToCook.Result, Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(recipeToCook.Result, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } else { VaporizeReagents(); VaporizeSolids(); - IoCManager.Resolve().SpawnEntity(_badRecipeName, Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(_badRecipeName, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } } diff --git a/Content.Server/Lathe/Components/LatheComponent.cs b/Content.Server/Lathe/Components/LatheComponent.cs index 59d22ba347..2aa78c7dea 100644 --- a/Content.Server/Lathe/Components/LatheComponent.cs +++ b/Content.Server/Lathe/Components/LatheComponent.cs @@ -123,7 +123,7 @@ namespace Content.Server.Lathe.Components { Producing = false; _producingRecipe = null; - IoCManager.Resolve().SpawnEntity(recipe.Result, Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(recipe.Result, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage()); State = LatheState.Base; SetAppearance(LatheVisualState.Idle); diff --git a/Content.Server/Light/EntitySystems/LightReplacerSystem.cs b/Content.Server/Light/EntitySystems/LightReplacerSystem.cs index 5c0424a579..17e88d7b75 100644 --- a/Content.Server/Light/EntitySystems/LightReplacerSystem.cs +++ b/Content.Server/Light/EntitySystems/LightReplacerSystem.cs @@ -125,7 +125,7 @@ namespace Content.Server.Light.EntitySystems // found right bulb, let's spawn it if (bulbEnt != null) { - bulb = EntityManager.SpawnEntity(bulbEnt.PrototypeName, replacer.Owner.Transform.Coordinates); + bulb = EntityManager.SpawnEntity(bulbEnt.PrototypeName, IoCManager.Resolve().GetComponent(replacer.Owner.Uid).Coordinates); bulbEnt.Amount--; } // not found any light bulbs diff --git a/Content.Server/Light/EntitySystems/MatchstickSystem.cs b/Content.Server/Light/EntitySystems/MatchstickSystem.cs index 446c0fb25f..bbbf734ed8 100644 --- a/Content.Server/Light/EntitySystems/MatchstickSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchstickSystem.cs @@ -34,7 +34,7 @@ namespace Content.Server.Light.EntitySystems if (match.CurrentState != SmokableState.Lit) continue; - _atmosphereSystem.HotspotExpose(match.Owner.Transform.Coordinates, 400, 50, true); + _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(match.Owner.Uid).Coordinates, 400, 50, true); } } diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index bf7488fcd1..44b09cf989 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -75,7 +75,7 @@ namespace Content.Server.Light.EntitySystems _ => throw new ArgumentOutOfRangeException() }; - var entity = EntityManager.SpawnEntity(prototype, light.Owner.Transform.Coordinates); + var entity = EntityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(light.Owner.Uid).Coordinates); light.LightBulbContainer.Insert(entity); } diff --git a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs index c50dbb97ca..74051e72d0 100644 --- a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs +++ b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs @@ -284,8 +284,8 @@ namespace Content.Server.MachineLinking.System return true; } - return transmitterComponent.Owner.Transform.MapPosition.InRange( - receiverComponent.Owner.Transform.MapPosition, 30f); + return IoCManager.Resolve().GetComponent(transmitterComponent.Owner.Uid).MapPosition.InRange( + IoCManager.Resolve().GetComponent(receiverComponent.Owner.Uid).MapPosition, 30f); } } } diff --git a/Content.Server/Mind/Components/MindComponent.cs b/Content.Server/Mind/Components/MindComponent.cs index eb7ce71bb6..4a6a470a75 100644 --- a/Content.Server/Mind/Components/MindComponent.cs +++ b/Content.Server/Mind/Components/MindComponent.cs @@ -96,7 +96,7 @@ namespace Content.Server.Mind.Components } else if (GhostOnShutdown) { - var spawnPosition = Owner.Transform.Coordinates; + var spawnPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; // Use a regular timer here because the entity has probably been deleted. Timer.Spawn(0, () => { diff --git a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs index 74e6dbb8e5..30d0160f46 100644 --- a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs @@ -120,7 +120,7 @@ namespace Content.Server.Morgue.Components IoCManager.Resolve().DeleteEntity(item.Uid); } - var ash = IoCManager.Resolve().SpawnEntity("Ash", Owner.Transform.Coordinates); + var ash = IoCManager.Resolve().SpawnEntity("Ash", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); Contents.Insert(ash); } diff --git a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs index b264e76462..b41a8173e6 100644 --- a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs @@ -65,7 +65,7 @@ namespace Content.Server.Morgue.Components public override Vector2 ContentsDumpPosition() { if (_tray != null) - return _tray.Transform.WorldPosition; + return IoCManager.Resolve().GetComponent(_tray.Uid).WorldPosition; return base.ContentsDumpPosition(); } @@ -79,7 +79,7 @@ namespace Content.Server.Morgue.Components public override bool CanOpen(IEntity user, bool silent = false) { if (!Owner.InRangeUnobstructed( - Owner.Transform.Coordinates.Offset(Owner.Transform.LocalRotation.GetCardinalDir()), + IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.Offset(IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetCardinalDir()), collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable )) { @@ -100,7 +100,7 @@ namespace Content.Server.Morgue.Components if (_tray == null) { - _tray = IoCManager.Resolve().SpawnEntity(_trayPrototypeId, Owner.Transform.Coordinates); + _tray = IoCManager.Resolve().SpawnEntity(_trayPrototypeId, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); var trayComp = _tray.EnsureComponent(); trayComp.Morgue = Owner; } @@ -109,7 +109,7 @@ namespace Content.Server.Morgue.Components TrayContainer?.Remove(_tray); } - _tray.Transform.Coordinates = new EntityCoordinates(Owner.Uid, 0, -1); + IoCManager.Resolve().GetComponent(_tray.Uid).Coordinates = new EntityCoordinates(Owner.Uid, 0, -1); base.OpenStorage(); } diff --git a/Content.Server/Movement/Components/FootstepModifierComponent.cs b/Content.Server/Movement/Components/FootstepModifierComponent.cs index fd09533153..d0791571d5 100644 --- a/Content.Server/Movement/Components/FootstepModifierComponent.cs +++ b/Content.Server/Movement/Components/FootstepModifierComponent.cs @@ -2,6 +2,7 @@ using Content.Shared.Audio; using Content.Shared.Sound; using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; @@ -24,7 +25,7 @@ namespace Content.Server.Movement.Components public void PlayFootstep() { - SoundSystem.Play(Filter.Pvs(Owner), SoundCollection.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(Variation).WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), SoundCollection.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioHelpers.WithVariation(Variation).WithVolume(-2f)); } } } diff --git a/Content.Server/Movement/Components/StressTestMovementComponent.cs b/Content.Server/Movement/Components/StressTestMovementComponent.cs index b6081a3b91..cc7ed70853 100644 --- a/Content.Server/Movement/Components/StressTestMovementComponent.cs +++ b/Content.Server/Movement/Components/StressTestMovementComponent.cs @@ -1,4 +1,5 @@ using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Server.Movement.Components @@ -15,7 +16,7 @@ namespace Content.Server.Movement.Components { base.Startup(); - Origin = Owner.Transform.WorldPosition; + Origin = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; } } } diff --git a/Content.Server/Movement/StressTestMovementSystem.cs b/Content.Server/Movement/StressTestMovementSystem.cs index 7d48754dfd..622ded56cc 100644 --- a/Content.Server/Movement/StressTestMovementSystem.cs +++ b/Content.Server/Movement/StressTestMovementSystem.cs @@ -2,6 +2,7 @@ using System; using Content.Server.Movement.Components; using JetBrains.Annotations; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Maths; namespace Content.Server.Movement @@ -15,7 +16,7 @@ namespace Content.Server.Movement foreach (var stressTest in EntityManager.EntityQuery(true)) { - var transform = stressTest.Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(stressTest.Owner.Uid); stressTest.Progress += frameTime; diff --git a/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs b/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs index b65700b7e7..d19296936e 100644 --- a/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs +++ b/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs @@ -3,6 +3,7 @@ using System.Linq; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.Nodes; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.ViewVariables; @@ -76,7 +77,7 @@ namespace Content.Server.NodeContainer.NodeGroups public virtual void Initialize(Node sourceNode) { // TODO: Can we get rid of this GridId? - GridId = sourceNode.Owner.Transform.GridID; + GridId = IoCManager.Resolve().GetComponent(sourceNode.Owner.Uid).GridID; } /// diff --git a/Content.Server/NodeContainer/Nodes/AdjacentNode.cs b/Content.Server/NodeContainer/Nodes/AdjacentNode.cs index c94206aa44..fd6c6582f9 100644 --- a/Content.Server/NodeContainer/Nodes/AdjacentNode.cs +++ b/Content.Server/NodeContainer/Nodes/AdjacentNode.cs @@ -14,12 +14,12 @@ namespace Content.Server.NodeContainer.Nodes { public override IEnumerable GetReachableNodes() { - if (!Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) yield break; var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); - var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); foreach (var (_, node) in NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex)) { diff --git a/Content.Server/NodeContainer/Nodes/Node.cs b/Content.Server/NodeContainer/Nodes/Node.cs index f544490d7e..adca0ea852 100644 --- a/Content.Server/NodeContainer/Nodes/Node.cs +++ b/Content.Server/NodeContainer/Nodes/Node.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.NodeGroups; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -37,7 +38,7 @@ namespace Content.Server.NodeContainer.Nodes /// public bool Connectable => !Deleting && Anchored; - protected bool Anchored => !NeedAnchored || Owner.Transform.Anchored; + protected bool Anchored => !NeedAnchored || IoCManager.Resolve().GetComponent(Owner.Uid).Anchored; [ViewVariables(VVAccess.ReadWrite)] [DataField("needAnchored")] diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs index 5e4c3ca375..bbd5106acd 100644 --- a/Content.Server/NodeContainer/Nodes/PipeNode.cs +++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs @@ -166,11 +166,11 @@ namespace Content.Server.NodeContainer.Nodes /// protected IEnumerable PipesInDirection(PipeDirection pipeDir) { - if (!Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) yield break; - var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); - var position = Owner.Transform.Coordinates; + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; foreach (var entity in grid.GetInDir(position, pipeDir.ToDirection())) { if (!IoCManager.Resolve().TryGetComponent(entity, out var container)) @@ -189,11 +189,11 @@ namespace Content.Server.NodeContainer.Nodes /// protected IEnumerable PipesInTile() { - if (!Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) yield break; - var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); - var position = Owner.Transform.Coordinates; + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; foreach (var entity in grid.GetLocal(position)) { if (!IoCManager.Resolve().TryGetComponent(entity, out var container)) @@ -215,7 +215,7 @@ namespace Content.Server.NodeContainer.Nodes { if (RotationsEnabled) { - CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(Owner.Transform.LocalRotation); + CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation); } else { diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index 39498fce8a..c91eb56d4a 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -196,7 +196,7 @@ namespace Content.Server.Nutrition.EntitySystems private void DeleteAndSpawnTrash(FoodComponent component, EntityUid? userUid = null) { //We're empty. Become trash. - var position = component.Owner.Transform.Coordinates; + var position = IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates; var finisher = IoCManager.Resolve().SpawnEntity(component.TrashPrototype, position); // If the user is holding the item diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs index 7c2530b8c2..e75f0c7a00 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs @@ -384,10 +384,10 @@ namespace Content.Server.ParticleAccelerator.Components _partEmitterRight = null; // Find fuel chamber first by scanning cardinals. - if (Owner.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) { - var grid = _mapManager.GetGrid(Owner.Transform.GridID); - var coords = Owner.Transform.Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; foreach (var maybeFuel in grid.GetCardinalNeighborCells(coords)) { if (IoCManager.Resolve().TryGetComponent(maybeFuel, out _partFuelChamber)) @@ -406,7 +406,7 @@ namespace Content.Server.ParticleAccelerator.Components // Align ourselves to match fuel chamber orientation. // This means that if you mess up the orientation of the control box it's not a big deal, // because the sprite is far from obvious about the orientation. - Owner.Transform.LocalRotation = _partFuelChamber.Owner.Transform.LocalRotation; + IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation = IoCManager.Resolve().GetComponent(_partFuelChamber.Owner.Uid).LocalRotation; var offsetEndCap = RotateOffset((1, 1)); var offsetPowerBox = RotateOffset((1, -1)); @@ -452,7 +452,7 @@ namespace Content.Server.ParticleAccelerator.Components Vector2i RotateOffset(in Vector2i vec) { - var rot = new Angle(Owner.Transform.LocalRotation); + var rot = new Angle(IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation); return (Vector2i) rot.RotateVec(vec); } } @@ -460,8 +460,8 @@ namespace Content.Server.ParticleAccelerator.Components private bool ScanPart(Vector2i offset, [NotNullWhen(true)] out T? part) where T : ParticleAcceleratorPartComponent { - var grid = _mapManager.GetGrid(Owner.Transform.GridID); - var coords = Owner.Transform.Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; foreach (var ent in grid.GetOffset(coords, offset)) { if (IoCManager.Resolve().TryGetComponent(ent, out part) && !part.Deleted) diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs index 420829bfce..9b7389e9a4 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs @@ -16,14 +16,14 @@ namespace Content.Server.ParticleAccelerator.Components public void Fire(ParticleAcceleratorPowerState strength) { - var projectile = IoCManager.Resolve().SpawnEntity("ParticlesProjectile", Owner.Transform.Coordinates); + var projectile = IoCManager.Resolve().SpawnEntity("ParticlesProjectile", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); if (!IoCManager.Resolve().TryGetComponent(projectile.Uid, out var particleProjectileComponent)) { Logger.Error("ParticleAcceleratorEmitter tried firing particles, but they was spawned without a ParticleProjectileComponent"); return; } - particleProjectileComponent.Fire(strength, Owner.Transform.WorldRotation, Owner); + particleProjectileComponent.Fire(strength, IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation, Owner); } public override string ToString() diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs index 17c9a53035..6e76d25fd4 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs @@ -1,4 +1,5 @@ using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.ViewVariables; namespace Content.Server.ParticleAccelerator.Components @@ -12,7 +13,7 @@ namespace Content.Server.ParticleAccelerator.Components base.Initialize(); // FIXME: this has to be an entity system, full stop. - Owner.Transform.Anchored = true; + IoCManager.Resolve().GetComponent(Owner.Uid).Anchored = true; } public void OnAnchorChanged() diff --git a/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs index 5358d9a94d..f8432d11ca 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs @@ -71,7 +71,7 @@ namespace Content.Server.ParticleAccelerator.Components physicsComponent .LinearVelocity = angle.ToWorldVec() * 20f; - Owner.Transform.LocalRotation = angle; + IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation = angle; Timer.Spawn(3000, () => IoCManager.Resolve().DeleteEntity(Owner.Uid)); } } diff --git a/Content.Server/Physics/Controllers/ConveyorController.cs b/Content.Server/Physics/Controllers/ConveyorController.cs index ca7d695349..f1806fbef2 100644 --- a/Content.Server/Physics/Controllers/ConveyorController.cs +++ b/Content.Server/Physics/Controllers/ConveyorController.cs @@ -41,11 +41,11 @@ namespace Content.Server.Physics.Controllers } var direction = system.GetAngle(comp).ToVec(); - var ownerPos = comp.Owner.Transform.WorldPosition; + var ownerPos = IoCManager.Resolve().GetComponent(comp.Owner.Uid).WorldPosition; foreach (var (entity, physics) in EntitySystem.Get().GetEntitiesToMove(comp)) { - var itemRelativeToConveyor = entity.Transform.WorldPosition - ownerPos; + var itemRelativeToConveyor = IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition - ownerPos; physics.LinearVelocity += Convey(direction, comp.Speed, frameTime, itemRelativeToConveyor); } } diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index f5480af77e..48cc2cec10 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -271,7 +271,7 @@ namespace Content.Server.Physics.Controllers { if (!mover.Owner.HasTag("FootstepSound")) return; - var transform = mover.Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(mover.Owner.Uid); var coordinates = transform.Coordinates; var gridId = coordinates.GetGridId(EntityManager); var distanceNeeded = mover.Sprinting ? StepSoundMoveDistanceRunning : StepSoundMoveDistanceWalking; @@ -352,7 +352,7 @@ namespace Content.Server.Physics.Controllers SoundSystem.Play( Filter.Pvs(coordinates), soundToPlay, - mover.Transform.Coordinates, + IoCManager.Resolve().GetComponent(mover.Uid).Coordinates, sprinting ? AudioParams.Default.WithVolume(0.75f) : null); } } diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index dc240129c5..16d0c835f5 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -74,7 +74,7 @@ namespace Content.Server.Physics.Controllers // Now that's over with... - var pullerPosition = puller.Transform.MapPosition; + var pullerPosition = IoCManager.Resolve().GetComponent(puller.Uid).MapPosition; var movingTo = pullable.MovingTo.Value.ToMap(IoCManager.Resolve()); if (movingTo.MapId != pullerPosition.MapId) { @@ -84,14 +84,14 @@ namespace Content.Server.Physics.Controllers if (!IoCManager.Resolve().TryGetComponent(pullable.Owner.Uid, out var physics) || physics.BodyType == BodyType.Static || - movingTo.MapId != pullable.Owner.Transform.MapID) + movingTo.MapId != IoCManager.Resolve().GetComponent(pullable.Owner.Uid).MapID) { _pullableSystem.StopMoveTo(pullable); continue; } var movingPosition = movingTo.Position; - var ownerPosition = pullable.Owner.Transform.MapPosition.Position; + var ownerPosition = IoCManager.Resolve().GetComponent(pullable.Owner.Uid).MapPosition.Position; var diff = movingPosition - ownerPosition; var diffLength = diff.Length; diff --git a/Content.Server/Pinpointer/ServerPinpointerSystem.cs b/Content.Server/Pinpointer/ServerPinpointerSystem.cs index 15d5a1ecaa..726df79b10 100644 --- a/Content.Server/Pinpointer/ServerPinpointerSystem.cs +++ b/Content.Server/Pinpointer/ServerPinpointerSystem.cs @@ -62,7 +62,7 @@ namespace Content.Server.Pinpointer { if (whitelist.IsValid(e.Uid)) { - var dist = (e.Transform.WorldPosition - transform.WorldPosition).LengthSquared; + var dist = (IoCManager.Resolve().GetComponent(e.Uid).WorldPosition - transform.WorldPosition).LengthSquared; l.TryAdd(dist, e.Uid); } } diff --git a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs index c31c025447..a67c00cc49 100644 --- a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs +++ b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs @@ -195,7 +195,7 @@ namespace Content.Server.PneumaticCannon for (int i = 0; i < entCounts; i++) { - var dir = (click.ToMapPos(EntityManager) - user.Transform.WorldPosition).Normalized; + var dir = (click.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(user.Uid).WorldPosition).Normalized; var randomAngle = GetRandomFireAngleFromPower(comp.Power).RotateVec(dir); var randomStrengthMult = _random.NextFloat(0.75f, 1.25f); @@ -256,7 +256,7 @@ namespace Content.Server.PneumaticCannon { // we checked for this earlier in HasGas so a GetComp is okay var gas = IoCManager.Resolve().GetComponent(comp.GasTankSlot.ContainedEntity.Uid); - var environment = _atmos.GetTileMixture(comp.Owner.Transform.Coordinates, true); + var environment = _atmos.GetTileMixture(IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates, true); var removed = gas.RemoveAir(GetMoleUsageFromPower(comp.Power)); if (environment != null && removed != null) { diff --git a/Content.Server/Pointing/Components/PointingArrowComponent.cs b/Content.Server/Pointing/Components/PointingArrowComponent.cs index bbd416b90d..76e419b136 100644 --- a/Content.Server/Pointing/Components/PointingArrowComponent.cs +++ b/Content.Server/Pointing/Components/PointingArrowComponent.cs @@ -67,7 +67,7 @@ namespace Content.Server.Pointing.Components public void Update(float frameTime) { var movement = _speed * frameTime * (_up ? 1 : -1); - Owner.Transform.LocalPosition += (0, movement); + IoCManager.Resolve().GetComponent(Owner.Uid).LocalPosition += (0, movement); _duration -= frameTime; _currentStep -= frameTime; diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index 080b762375..d8e30ca153 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -82,7 +82,7 @@ namespace Content.Server.Pointing.EntitySystems { if (IoCManager.Resolve().HasComponent(pointer.Uid)) { - return pointer.Transform.Coordinates.InRange(EntityManager, coordinates, 15); + return IoCManager.Resolve().GetComponent(pointer.Uid).Coordinates.InRange(EntityManager, coordinates, 15); } else { @@ -135,7 +135,7 @@ namespace Content.Server.Pointing.EntitySystems if (ent is null || (!IoCManager.Resolve().TryGetComponent(ent.Uid, out var eyeComp) || (eyeComp.VisibilityMask & layer) == 0)) return false; - return ent.Transform.MapPosition.InRange(player.Transform.MapPosition, PointingRange); + return IoCManager.Resolve().GetComponent(ent.Uid).MapPosition.InRange(IoCManager.Resolve().GetComponent(player.Uid).MapPosition, PointingRange); } var viewers = Filter.Empty() @@ -204,13 +204,13 @@ namespace Content.Server.Pointing.EntitySystems return; if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor) || - !InRange(args.User, args.Target.Transform.Coordinates)) + !InRange(args.User, IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates)) return; Verb verb = new(); verb.Text = Loc.GetString("pointing-verb-get-data-text"); verb.IconTexture = "/Textures/Interface/VerbIcons/point.svg.192dpi.png"; - verb.Act = () => TryPoint(actor.PlayerSession, args.Target.Transform.Coordinates, args.Target.Uid); ; + verb.Act = () => TryPoint(actor.PlayerSession, IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates, args.Target.Uid); ; args.Verbs.Add(verb); } diff --git a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs index c8706537d9..2814c22ff4 100644 --- a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs @@ -78,7 +78,7 @@ namespace Content.Server.Pointing.EntitySystems if (component.TurningDelay > 0) { - var difference = component.Chasing.Transform.WorldPosition - transform.WorldPosition; + var difference = IoCManager.Resolve().GetComponent(component.Chasing.Uid).WorldPosition - transform.WorldPosition; var angle = difference.ToAngle(); var adjusted = angle.Degrees + 90; var newAngle = Angle.FromDegrees(adjusted); @@ -93,7 +93,7 @@ namespace Content.Server.Pointing.EntitySystems UpdateAppearance(uid, component, transform); - var toChased = component.Chasing.Transform.WorldPosition - transform.WorldPosition; + var toChased = IoCManager.Resolve().GetComponent(component.Chasing.Uid).WorldPosition - transform.WorldPosition; transform.WorldPosition += toChased * frameTime * component.ChasingSpeed; diff --git a/Content.Server/Power/EntitySystems/CableVisSystem.cs b/Content.Server/Power/EntitySystems/CableVisSystem.cs index 65bfdeeebc..e6df04f5dc 100644 --- a/Content.Server/Power/EntitySystems/CableVisSystem.cs +++ b/Content.Server/Power/EntitySystems/CableVisSystem.cs @@ -63,7 +63,7 @@ namespace Content.Server.Power.EntitySystems if (reachable is not CableNode) continue; - var otherTransform = reachable.Owner.Transform; + var otherTransform = IoCManager.Resolve().GetComponent(reachable.Owner.Uid); if (otherTransform.GridID != grid.Index) continue; diff --git a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs index e24d91b373..2130aaf564 100644 --- a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs +++ b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs @@ -87,7 +87,7 @@ namespace Content.Server.Power.EntitySystems if (EntityManager.TryGetComponent(entity.Uid, out var receiver) && receiver.Connectable && receiver.Provider == null && - entity.Transform.Coordinates.TryDistance(IoCManager.Resolve(), owner.Transform.Coordinates, out var distance) && + IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(IoCManager.Resolve(), IoCManager.Resolve().GetComponent(owner.Uid).Coordinates, out var distance) && distance < Math.Min(range, receiver.ReceptionRange)) { yield return receiver; @@ -185,7 +185,7 @@ namespace Content.Server.Power.EntitySystems if (!provider.Connectable) continue; - if (!entity.Transform.Coordinates.TryDistance(IoCManager.Resolve(), owner.Transform.Coordinates, out var distance)) continue; + if (!IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(IoCManager.Resolve(), IoCManager.Resolve().GetComponent(owner.Uid).Coordinates, out var distance)) continue; if (!(distance < Math.Min(range, provider.TransferRange))) continue; diff --git a/Content.Server/Power/Nodes/CableDeviceNode.cs b/Content.Server/Power/Nodes/CableDeviceNode.cs index 96ccdc8d1a..f6d2e2d136 100644 --- a/Content.Server/Power/Nodes/CableDeviceNode.cs +++ b/Content.Server/Power/Nodes/CableDeviceNode.cs @@ -18,10 +18,10 @@ namespace Content.Server.Power.Nodes var entMan = IoCManager.Resolve(); // If we're in an invalid grid, such as grid 0, we cannot connect to anything. - if(!IoCManager.Resolve().TryGetGrid(Owner.Transform.GridID, out var grid)) + if(!IoCManager.Resolve().TryGetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID, out var grid)) yield break; - var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, gridIndex)) { diff --git a/Content.Server/Power/Nodes/CableNode.cs b/Content.Server/Power/Nodes/CableNode.cs index bfb0c44629..2eb124038e 100644 --- a/Content.Server/Power/Nodes/CableNode.cs +++ b/Content.Server/Power/Nodes/CableNode.cs @@ -18,8 +18,8 @@ namespace Content.Server.Power.Nodes yield break; var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); - var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); // While we go over adjacent nodes, we build a list of blocked directions due to // incoming or outgoing wire terminals. @@ -44,11 +44,11 @@ namespace Content.Server.Power.Nodes if (dir == Direction.Invalid) { // On own tile, block direction it faces - terminalDirs |= 1 << (int) node.Owner.Transform.LocalRotation.GetCardinalDir(); + terminalDirs |= 1 << (int) IoCManager.Resolve().GetComponent(node.Owner.Uid).LocalRotation.GetCardinalDir(); } else { - var terminalDir = node.Owner.Transform.LocalRotation.GetCardinalDir(); + var terminalDir = IoCManager.Resolve().GetComponent(node.Owner.Uid).LocalRotation.GetCardinalDir(); if (terminalDir.GetOpposite() == dir) { // Target tile has a terminal towards us, block the direction. diff --git a/Content.Server/Power/Nodes/CableTerminalNode.cs b/Content.Server/Power/Nodes/CableTerminalNode.cs index eeb63c670b..9c43ef1342 100644 --- a/Content.Server/Power/Nodes/CableTerminalNode.cs +++ b/Content.Server/Power/Nodes/CableTerminalNode.cs @@ -12,15 +12,15 @@ namespace Content.Server.Power.Nodes { public override IEnumerable GetReachableNodes() { - if (Owner.Transform.GridID == GridId.Invalid) + if (IoCManager.Resolve().GetComponent(Owner.Uid).GridID == GridId.Invalid) yield break; // No funny nodes in spess. var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); - var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); - var dir = Owner.Transform.LocalRotation.GetDir(); + var dir = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir(); var targetIdx = gridIndex + NodeHelpers.TileOffsetForDir(dir); foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, targetIdx)) diff --git a/Content.Server/Power/Nodes/CableTerminalPortNode.cs b/Content.Server/Power/Nodes/CableTerminalPortNode.cs index ba7cda71d5..bed5c64aa9 100644 --- a/Content.Server/Power/Nodes/CableTerminalPortNode.cs +++ b/Content.Server/Power/Nodes/CableTerminalPortNode.cs @@ -12,12 +12,12 @@ namespace Content.Server.Power.Nodes { public override IEnumerable GetReachableNodes() { - if (Owner.Transform.GridID == GridId.Invalid) + if (IoCManager.Resolve().GetComponent(Owner.Uid).GridID == GridId.Invalid) yield break; // No funny nodes in spess. var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(Owner.Transform.GridID); - var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); var nodes = NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex, includeSameTile: false); foreach (var (_, node) in nodes) diff --git a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs index f50443701c..f0d0f8b604 100644 --- a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs @@ -136,12 +136,12 @@ namespace Content.Server.PowerCell.Components { if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands) || !hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner.Uid))) { - cell.Owner.Transform.Coordinates = user.Transform.Coordinates; + IoCManager.Resolve().GetComponent(cell.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; } } else { - cell.Owner.Transform.Coordinates = Owner.Transform.Coordinates; + IoCManager.Resolve().GetComponent(cell.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; } if (playSound) @@ -199,7 +199,7 @@ namespace Content.Server.PowerCell.Components }; } - var cell = IoCManager.Resolve().SpawnEntity(type, Owner.Transform.Coordinates); + var cell = IoCManager.Resolve().SpawnEntity(type, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _cellContainer.Insert(cell); } } diff --git a/Content.Server/Projectiles/Components/HitscanComponent.cs b/Content.Server/Projectiles/Components/HitscanComponent.cs index 5fa09caccf..d05395c993 100644 --- a/Content.Server/Projectiles/Components/HitscanComponent.cs +++ b/Content.Server/Projectiles/Components/HitscanComponent.cs @@ -56,12 +56,12 @@ namespace Content.Server.Projectiles.Components var mapManager = IoCManager.Resolve(); // We'll get the effects relative to the grid / map of the firer - var gridOrMap = user.Transform.GridID == GridId.Invalid ? mapManager.GetMapEntityId(user.Transform.MapID) : - mapManager.GetGrid(user.Transform.GridID).GridEntityId; + var gridOrMap = IoCManager.Resolve().GetComponent(user.Uid).GridID == GridId.Invalid ? mapManager.GetMapEntityId(IoCManager.Resolve().GetComponent(user.Uid).MapID) : + mapManager.GetGrid(IoCManager.Resolve().GetComponent(user.Uid).GridID).GridEntityId; var parentXform = IoCManager.Resolve().GetComponent(gridOrMap); - var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(user.Transform.WorldPosition)); + var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(IoCManager.Resolve().GetComponent(user.Uid).WorldPosition)); var localAngle = angle - parentXform.WorldRotation; var afterEffect = AfterEffects(localCoordinates, localAngle, distance, 1.0f); @@ -161,7 +161,7 @@ namespace Content.Server.Projectiles.Components EffectSprite = _impactFlash, Born = _startTime, DeathTime = _deathTime, - Coordinates = Owner.Transform.Coordinates.Offset(angle.ToVec() * distance), + Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.Offset(angle.ToVec() * distance), //Rotated from east facing Rotation = (float) angle.FlipPositive(), Color = Vector4.Multiply(new Vector4(255, 255, 255, 750), ColorModifier), diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index 65b8ab2c86..dda2442e11 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -36,7 +36,7 @@ namespace Content.Server.Projectiles var otherEntity = args.OtherFixture.Body.Owner; - var coordinates = args.OtherFixture.Body.Owner.Transform.Coordinates; + var coordinates = IoCManager.Resolve().GetComponent(args.OtherFixture.Body.Owner.Uid).Coordinates; var playerFilter = Filter.Pvs(coordinates); if (!((!IoCManager.Resolve().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && component.SoundHitSpecies != null && diff --git a/Content.Server/RCD/Systems/RCDSystem.cs b/Content.Server/RCD/Systems/RCDSystem.cs index 8ac21a4508..4dfc98cec0 100644 --- a/Content.Server/RCD/Systems/RCDSystem.cs +++ b/Content.Server/RCD/Systems/RCDSystem.cs @@ -129,11 +129,11 @@ namespace Content.Server.RCD.Systems // thus we early return to avoid the tile set code. case RcdMode.Walls: var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos)); - ent.Transform.LocalRotation = Angle.Zero; // Walls always need to point south. + IoCManager.Resolve().GetComponent(ent.Uid).LocalRotation = Angle.Zero; // Walls always need to point south. break; case RcdMode.Airlock: var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos)); - airlock.Transform.LocalRotation = rcd.Owner.Transform.LocalRotation; //Now apply icon smoothing. + IoCManager.Resolve().GetComponent(airlock.Uid).LocalRotation = IoCManager.Resolve().GetComponent(rcd.Owner.Uid).LocalRotation; //Now apply icon smoothing. break; default: args.Handled = true; diff --git a/Content.Server/Radiation/RadiationPulseSystem.cs b/Content.Server/Radiation/RadiationPulseSystem.cs index 39588c0dbc..9d1a68122b 100644 --- a/Content.Server/Radiation/RadiationPulseSystem.cs +++ b/Content.Server/Radiation/RadiationPulseSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Radiation if ((!IoCManager.Resolve().EntityExists(ent.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(ent.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) continue; - foreach (var entity in _lookup.GetEntitiesInRange(ent.Transform.Coordinates, comp.Range)) + foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(ent.Uid).Coordinates, comp.Range)) { // For now at least still need this because it uses a list internally then returns and this may be deleted before we get to it. if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) continue; diff --git a/Content.Server/Radio/Components/HandheldRadioComponent.cs b/Content.Server/Radio/Components/HandheldRadioComponent.cs index 412909ad55..b22cd467f8 100644 --- a/Content.Server/Radio/Components/HandheldRadioComponent.cs +++ b/Content.Server/Radio/Components/HandheldRadioComponent.cs @@ -82,7 +82,7 @@ namespace Content.Server.Radio.Components public bool CanListen(string message, IEntity source) { return RadioOn && - Owner.InRangeUnobstructed(source.Transform.Coordinates, range: ListenRange); + Owner.InRangeUnobstructed(IoCManager.Resolve().GetComponent(source.Uid).Coordinates, range: ListenRange); } public void Receive(string message, int channel, IEntity speaker) diff --git a/Content.Server/Recycling/Components/RecyclableComponent.cs b/Content.Server/Recycling/Components/RecyclableComponent.cs index 31f070736e..ce932f73f8 100644 --- a/Content.Server/Recycling/Components/RecyclableComponent.cs +++ b/Content.Server/Recycling/Components/RecyclableComponent.cs @@ -33,7 +33,7 @@ namespace Content.Server.Recycling.Components { for (var i = 0; i < Math.Max(_amount * efficiency, 1); i++) { - IoCManager.Resolve().SpawnEntity(_prototype, Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(_prototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } } diff --git a/Content.Server/Rotatable/RotatableSystem.cs b/Content.Server/Rotatable/RotatableSystem.cs index 1d2d80d672..6fa8269b48 100644 --- a/Content.Server/Rotatable/RotatableSystem.cs +++ b/Content.Server/Rotatable/RotatableSystem.cs @@ -44,7 +44,7 @@ namespace Content.Server.Rotatable return; Verb resetRotation = new(); - resetRotation.Act = () => component.Owner.Transform.LocalRotation = Angle.Zero; + resetRotation.Act = () => IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation = Angle.Zero; resetRotation.Category = VerbCategory.Rotate; resetRotation.IconTexture = "/Textures/Interface/VerbIcons/refresh.svg.192dpi.png"; resetRotation.Text = "Reset"; @@ -54,7 +54,7 @@ namespace Content.Server.Rotatable // rotate clockwise Verb rotateCW = new(); - rotateCW.Act = () => component.Owner.Transform.LocalRotation += Angle.FromDegrees(-90); + rotateCW.Act = () => IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation += Angle.FromDegrees(-90); rotateCW.Category = VerbCategory.Rotate; rotateCW.IconTexture = "/Textures/Interface/VerbIcons/rotate_cw.svg.192dpi.png"; rotateCW.Priority = -1; @@ -63,7 +63,7 @@ namespace Content.Server.Rotatable // rotate counter-clockwise Verb rotateCCW = new(); - rotateCCW.Act = () => component.Owner.Transform.LocalRotation += Angle.FromDegrees(90); + rotateCCW.Act = () => IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation += Angle.FromDegrees(90); rotateCCW.Category = VerbCategory.Rotate; rotateCCW.IconTexture = "/Textures/Interface/VerbIcons/rotate_ccw.svg.192dpi.png"; rotateCCW.Priority = 0; @@ -83,9 +83,9 @@ namespace Content.Server.Rotatable return; } - var oldTransform = component.Owner.Transform; + var oldTransform = IoCManager.Resolve().GetComponent(component.Owner.Uid); var entity = IoCManager.Resolve().SpawnEntity(component.MirrorEntity, oldTransform.Coordinates); - var newTransform = entity.Transform; + var newTransform = IoCManager.Resolve().GetComponent(entity.Uid); newTransform.LocalRotation = oldTransform.LocalRotation; newTransform.Anchored = false; IoCManager.Resolve().DeleteEntity(component.Owner.Uid); diff --git a/Content.Server/Sandbox/SandboxManager.cs b/Content.Server/Sandbox/SandboxManager.cs index 6b2119ba7b..3825323e0b 100644 --- a/Content.Server/Sandbox/SandboxManager.cs +++ b/Content.Server/Sandbox/SandboxManager.cs @@ -170,7 +170,7 @@ namespace Content.Server.Sandbox IEntity CreateFreshId() { - var card = _entityManager.SpawnEntity("CaptainIDCard", player.AttachedEntity.Transform.Coordinates); + var card = _entityManager.SpawnEntity("CaptainIDCard", IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates); UpgradeId(card); IoCManager.Resolve().GetComponent(card.Uid).FullName = player.AttachedEntity.Name; diff --git a/Content.Server/Security/Systems/DeployableBarrierSystem.cs b/Content.Server/Security/Systems/DeployableBarrierSystem.cs index 445cebb234..02fedccb1f 100644 --- a/Content.Server/Security/Systems/DeployableBarrierSystem.cs +++ b/Content.Server/Security/Systems/DeployableBarrierSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Security.Systems private void ToggleBarrierDeploy(DeployableBarrierComponent component, bool isDeployed) { - component.Owner.Transform.Anchored = isDeployed; + IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored = isDeployed; if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearanceComponent)) return; diff --git a/Content.Server/Singularity/Components/ContainmentFieldConnection.cs b/Content.Server/Singularity/Components/ContainmentFieldConnection.cs index 1eee6a5fab..c9842e0737 100644 --- a/Content.Server/Singularity/Components/ContainmentFieldConnection.cs +++ b/Content.Server/Singularity/Components/ContainmentFieldConnection.cs @@ -36,8 +36,8 @@ namespace Content.Server.Singularity.Components Generator2 = generator2; //generateFields - var pos1 = generator1.Owner.Transform.Coordinates; - var pos2 = generator2.Owner.Transform.Coordinates; + var pos1 = IoCManager.Resolve().GetComponent(generator1.Owner.Uid).Coordinates; + var pos2 = IoCManager.Resolve().GetComponent(generator2.Owner.Uid).Coordinates; if (pos1 == pos2) { Dispose(); @@ -62,7 +62,7 @@ namespace Content.Server.Singularity.Components } containmentFieldComponent.Parent = this; - newEnt.Transform.WorldRotation = generator1.Owner.Transform.WorldRotation + dirVec.ToWorldAngle(); + IoCManager.Resolve().GetComponent(newEnt.Uid).WorldRotation = IoCManager.Resolve().GetComponent(generator1.Owner.Uid).WorldRotation + dirVec.ToWorldAngle(); _fields.Add(newEnt); currentOffset += dirVec; diff --git a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs b/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs index 7e0a035c8e..8673dd1f88 100644 --- a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs +++ b/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs @@ -96,9 +96,9 @@ namespace Content.Server.Singularity.Components { if (_connection1?.Item1 == direction || _connection2?.Item1 == direction) continue; - var dirVec = Owner.Transform.WorldRotation.RotateVec(direction.ToVec()); - var ray = new CollisionRay(Owner.Transform.WorldPosition, dirVec, (int) CollisionGroup.MobMask); - var rawRayCastResults = EntitySystem.Get().IntersectRay(Owner.Transform.MapID, ray, 4.5f, Owner, false); + var dirVec = IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation.RotateVec(direction.ToVec()); + var ray = new CollisionRay(IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition, dirVec, (int) CollisionGroup.MobMask); + var rawRayCastResults = EntitySystem.Get().IntersectRay(IoCManager.Resolve().GetComponent(Owner.Uid).MapID, ray, 4.5f, Owner, false); var rayCastResults = rawRayCastResults as RayCastResults[] ?? rawRayCastResults.ToArray(); if(!rayCastResults.Any()) continue; diff --git a/Content.Server/Singularity/Components/ServerSingularityComponent.cs b/Content.Server/Singularity/Components/ServerSingularityComponent.cs index 4ec8069968..42f591b45b 100644 --- a/Content.Server/Singularity/Components/ServerSingularityComponent.cs +++ b/Content.Server/Singularity/Components/ServerSingularityComponent.cs @@ -97,7 +97,7 @@ namespace Content.Server.Singularity.Components protected override void Shutdown() { base.Shutdown(); - SoundSystem.Play(Filter.Pvs(Owner), _singularityCollapsingSound.GetSound(), Owner.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(Owner), _singularityCollapsingSound.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } } } diff --git a/Content.Server/Singularity/Components/SingularityGenerator.cs b/Content.Server/Singularity/Components/SingularityGenerator.cs index c9bf0bb192..b2deb0a017 100644 --- a/Content.Server/Singularity/Components/SingularityGenerator.cs +++ b/Content.Server/Singularity/Components/SingularityGenerator.cs @@ -22,7 +22,7 @@ namespace Content.Server.Singularity.Components if (_power > 15) { var entityManager = IoCManager.Resolve(); - entityManager.SpawnEntity("Singularity", Owner.Transform.Coordinates); + entityManager.SpawnEntity("Singularity", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); //dont delete ourselves, just wait to get eaten } } diff --git a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs index 4aab1ed70c..9b97acbcc7 100644 --- a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs @@ -166,7 +166,7 @@ namespace Content.Server.Singularity.EntitySystems private void Fire(EmitterComponent component) { - var projectile = IoCManager.Resolve().SpawnEntity(component.BoltType, component.Owner.Transform.Coordinates); + var projectile = IoCManager.Resolve().SpawnEntity(component.BoltType, IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates); if (!IoCManager.Resolve().TryGetComponent(projectile.Uid, out var physicsComponent)) { @@ -185,8 +185,8 @@ namespace Content.Server.Singularity.EntitySystems projectileComponent.IgnoreEntity(component.Owner); physicsComponent - .LinearVelocity = component.Owner.Transform.WorldRotation.ToWorldVec() * 20f; - projectile.Transform.WorldRotation = component.Owner.Transform.WorldRotation; + .LinearVelocity = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldRotation.ToWorldVec() * 20f; + IoCManager.Resolve().GetComponent(projectile.Uid).WorldRotation = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldRotation; // TODO: Move to projectile's code. Timer.Spawn(3000, () => IoCManager.Resolve().DeleteEntity(projectile.Uid)); diff --git a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs index e5f4e55583..c264ba838c 100644 --- a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs @@ -82,7 +82,7 @@ namespace Content.Server.Singularity.EntitySystems { if (component.BeingDeletedByAnotherSingularity) return; - var worldPos = component.Owner.Transform.WorldPosition; + var worldPos = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldPosition; DestroyEntities(component, worldPos); DestroyTiles(component, worldPos); PullEntities(component, worldPos); @@ -141,7 +141,7 @@ namespace Content.Server.Singularity.EntitySystems // The reason we don't /just/ use collision is because we'll be deleting stuff that may not necessarily have physics (e.g. carpets). var destroyRange = DestroyTileRange(component); - foreach (var entity in _lookup.GetEntitiesInRange(component.Owner.Transform.MapID, worldPos, destroyRange)) + foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID, worldPos, destroyRange)) { HandleDestroy(component, entity); } @@ -162,7 +162,7 @@ namespace Content.Server.Singularity.EntitySystems var pullRange = PullRange(component); var destroyRange = DestroyTileRange(component); - foreach (var entity in _lookup.GetEntitiesInRange(component.Owner.Transform.MapID, worldPos, pullRange)) + foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID, worldPos, pullRange)) { // I tried having it so level 6 can de-anchor. BAD IDEA, MASSIVE LAG. if (entity == component.Owner || @@ -171,7 +171,7 @@ namespace Content.Server.Singularity.EntitySystems if (!CanPull(entity)) continue; - var vec = worldPos - entity.Transform.WorldPosition; + var vec = worldPos - IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition; if (vec.Length < destroyRange - 0.01f) continue; @@ -192,7 +192,7 @@ namespace Content.Server.Singularity.EntitySystems var circle = new Circle(worldPos, radius); var box = new Box2(worldPos - radius, worldPos + radius); - foreach (var grid in _mapManager.FindGridsIntersecting(component.Owner.Transform.MapID, box)) + foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID, box)) { foreach (var tile in grid.GetTilesIntersecting(circle)) { diff --git a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs index bef808674a..17e876c443 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs @@ -115,7 +115,7 @@ namespace Content.Server.Solar.EntitySystems foreach (var panel in EntityManager.EntityQuery()) { TotalPanelPower += panel.MaxSupply * panel.Coverage; - panel.Owner.Transform.WorldRotation = TargetPanelRotation; + IoCManager.Resolve().GetComponent(panel.Owner.Uid).WorldRotation = TargetPanelRotation; _updateQueue.Enqueue(panel); } } @@ -136,7 +136,7 @@ namespace Content.Server.Solar.EntitySystems // directly downwards (abs(theta) = pi) = coverage -1 // as TowardsSun + = CCW, // panelRelativeToSun should - = CW - var panelRelativeToSun = entity.Transform.WorldRotation - TowardsSun; + var panelRelativeToSun = IoCManager.Resolve().GetComponent(entity.Uid).WorldRotation - TowardsSun; // essentially, given cos = X & sin = Y & Y is 'downwards', // then for the first 90 degrees of rotation in either direction, // this plots the lower-right quadrant of a circle. @@ -154,12 +154,12 @@ namespace Content.Server.Solar.EntitySystems if (coverage > 0) { // Determine if the solar panel is occluded, and zero out coverage if so. - var ray = new CollisionRay(entity.Transform.WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); + var ray = new CollisionRay(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); var rayCastResults = _physicsSystem.IntersectRayWithPredicate( - entity.Transform.MapID, + IoCManager.Resolve().GetComponent(entity.Uid).MapID, ray, SunOcclusionCheckDistance, - e => !e.Transform.Anchored || e == entity); + e => !IoCManager.Resolve().GetComponent(e.Uid).Anchored || e == entity); if (rayCastResults.Any()) coverage = 0; } diff --git a/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs b/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs index c2e202be82..f8b9bb3808 100644 --- a/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs @@ -62,7 +62,7 @@ namespace Content.Server.Spawners.Components } if(!((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) - IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } public virtual void MapInit() diff --git a/Content.Server/Spawners/Components/RandomSpawnerComponent.cs b/Content.Server/Spawners/Components/RandomSpawnerComponent.cs index 5d38b95fa8..bbe3bf5f7d 100644 --- a/Content.Server/Spawners/Components/RandomSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/RandomSpawnerComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.Spawners.Components { if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance))) { - IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(RarePrototypes), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); return; } @@ -54,8 +54,8 @@ namespace Content.Server.Spawners.Components var x_negative = random.Prob(0.5f) ? -1 : 1; var y_negative = random.Prob(0.5f) ? -1 : 1; - var entity = IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates); - entity.Transform.LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative); + var entity = IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative); } } diff --git a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs index 99d7b90c6c..e445ddd8b3 100644 --- a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs @@ -76,7 +76,7 @@ namespace Content.Server.Spawners.Components for (int i = 0; i < number; i++) { var entity = _robustRandom.Pick(Prototypes); - IoCManager.Resolve().SpawnEntity(entity, Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(entity, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } } } diff --git a/Content.Server/Stack/StackSystem.cs b/Content.Server/Stack/StackSystem.cs index 0de34e4021..6c68be596d 100644 --- a/Content.Server/Stack/StackSystem.cs +++ b/Content.Server/Stack/StackSystem.cs @@ -103,7 +103,7 @@ namespace Content.Server.Stack if (!popupPos.IsValid(EntityManager)) { - popupPos = args.User.Transform.Coordinates; + popupPos = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; } var filter = Filter.Entities(args.User.Uid); diff --git a/Content.Server/Standing/StandingStateSystem.cs b/Content.Server/Standing/StandingStateSystem.cs index d92da48a8a..410d5675bf 100644 --- a/Content.Server/Standing/StandingStateSystem.cs +++ b/Content.Server/Standing/StandingStateSystem.cs @@ -22,9 +22,10 @@ public class StandingStateSystem : EntitySystem { if (hands.Drop(heldItem.Owner)) { + IEntity tempQualifier = EntityManager.GetEntity(uid); Throwing.ThrowHelper.TryThrow(heldItem.Owner, _random.NextAngle().RotateVec(direction / dropAngle + - EntityManager.GetEntity(uid).Transform.WorldRotation.ToVec() / 50), + IoCManager.Resolve().GetComponent(tempQualifier.Uid).WorldRotation.ToVec() / 50), 0.5f * dropAngle * _random.NextFloat(-0.9f, 1.1f), EntityManager.GetEntity(uid), 0); } diff --git a/Content.Server/StationEvents/Events/GasLeak.cs b/Content.Server/StationEvents/Events/GasLeak.cs index aa4e1540a4..e41be7ef0b 100644 --- a/Content.Server/StationEvents/Events/GasLeak.cs +++ b/Content.Server/StationEvents/Events/GasLeak.cs @@ -124,13 +124,13 @@ namespace Content.Server.StationEvents.Events if (!_foundTile || _targetGrid == null || (!IoCManager.Resolve().EntityExists(_targetGrid.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_targetGrid.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !atmosphereSystem.IsSimulatedGrid(_targetGrid.Transform.GridID)) + !atmosphereSystem.IsSimulatedGrid(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID)) { Running = false; return; } - var environment = atmosphereSystem.GetTileMixture(_targetGrid.Transform.GridID, _targetTile, true); + var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID, _targetTile, true); environment?.AdjustMoles(_leakGas, LeakCooldown * _molesPerSecond); } @@ -157,14 +157,14 @@ namespace Content.Server.StationEvents.Events if (!_foundTile || _targetGrid == null || (!IoCManager.Resolve().EntityExists(_targetGrid.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_targetGrid.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !atmosphereSystem.IsSimulatedGrid(_targetGrid.Transform.GridID)) + !atmosphereSystem.IsSimulatedGrid(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID)) { return; } // Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that // it COULD start potentially start a bigger fire. - atmosphereSystem.HotspotExpose(_targetGrid.Transform.GridID, _targetTile, 700f, 50f, true); + atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID, _targetTile, 700f, 50f, true); SoundSystem.Play(Filter.Pvs(_targetCoords), "/Audio/Effects/sparks4.ogg", _targetCoords); } } diff --git a/Content.Server/Storage/Components/EntityStorageComponent.cs b/Content.Server/Storage/Components/EntityStorageComponent.cs index 70192007d5..055e76ef8c 100644 --- a/Content.Server/Storage/Components/EntityStorageComponent.cs +++ b/Content.Server/Storage/Components/EntityStorageComponent.cs @@ -325,7 +325,7 @@ namespace Content.Server.Storage.Components public virtual Vector2 ContentsDumpPosition() { - return Owner.Transform.WorldPosition; + return IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; } private void EmptyContents() @@ -334,7 +334,7 @@ namespace Content.Server.Storage.Components { if (Contents.Remove(contained)) { - contained.Transform.WorldPosition = ContentsDumpPosition(); + IoCManager.Resolve().GetComponent(contained.Uid).WorldPosition = ContentsDumpPosition(); if (IoCManager.Resolve().TryGetComponent(contained.Uid, out var physics)) { physics.CanCollide = true; @@ -369,13 +369,13 @@ namespace Content.Server.Storage.Components // Trying to add while open just dumps it on the ground below us. if (Open) { - entity.Transform.WorldPosition = Owner.Transform.WorldPosition; + IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; return true; } if (!Contents.Insert(entity)) return false; - entity.Transform.LocalPosition = Vector2.Zero; + IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition = Vector2.Zero; if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? body)) { body.CanCollide = false; diff --git a/Content.Server/Storage/Components/SecretStashComponent.cs b/Content.Server/Storage/Components/SecretStashComponent.cs index 5033478a66..fa6af7a848 100644 --- a/Content.Server/Storage/Components/SecretStashComponent.cs +++ b/Content.Server/Storage/Components/SecretStashComponent.cs @@ -91,7 +91,7 @@ namespace Content.Server.Storage.Components } else if (_itemContainer.Remove(_itemContainer.ContainedEntity)) { - _itemContainer.ContainedEntity.Transform.Coordinates = Owner.Transform.Coordinates; + IoCManager.Resolve().GetComponent(_itemContainer.ContainedEntity.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; } return true; @@ -111,7 +111,7 @@ namespace Content.Server.Storage.Components // drop item inside if (_itemContainer.ContainedEntity != null) { - _itemContainer.ContainedEntity.Transform.Coordinates = Owner.Transform.Coordinates; + IoCManager.Resolve().GetComponent(_itemContainer.ContainedEntity.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; } } } diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index f66b4a71e2..022ef89317 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -160,7 +160,7 @@ namespace Content.Server.Storage.Components return false; } - if (entity.Transform.Anchored) + if (IoCManager.Resolve().GetComponent(entity.Uid).Anchored) { return false; } @@ -219,7 +219,7 @@ namespace Content.Server.Storage.Components if (!_sizeCache.TryGetValue(message.Entity, out var size)) { - Logger.WarningS(LoggerName, $"Removed entity {message.Entity} without a cached size from storage {Owner} at {Owner.Transform.MapPosition}"); + Logger.WarningS(LoggerName, $"Removed entity {message.Entity} without a cached size from storage {Owner} at {IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition}"); RecalculateStorageUsed(); return; @@ -459,8 +459,8 @@ namespace Content.Server.Storage.Components break; } - var ownerTransform = Owner.Transform; - var playerTransform = player.Transform; + var ownerTransform = IoCManager.Resolve().GetComponent(Owner.Uid); + var playerTransform = IoCManager.Resolve().GetComponent(player.Uid); if (!playerTransform.Coordinates.InRange(IoCManager.Resolve(), ownerTransform.Coordinates, 2) || Owner.IsInContainer() && !playerTransform.ContainsEntity(ownerTransform)) @@ -607,7 +607,7 @@ namespace Content.Server.Storage.Components || entity == eventArgs.User || !IoCManager.Resolve().HasComponent(entity.Uid)) continue; - var position = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, entity.Transform.MapPosition); + var position = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(entity.Uid).MapPosition); if (PlayerInsertEntityInWorld(eventArgs.User, entity)) { successfullyInserted.Add(entity.Uid); @@ -638,7 +638,7 @@ namespace Content.Server.Storage.Components || eventArgs.Target == eventArgs.User || !IoCManager.Resolve().HasComponent(eventArgs.Target.Uid)) return false; - var position = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, eventArgs.Target.Transform.MapPosition); + var position = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(eventArgs.Target.Uid).MapPosition); if (PlayerInsertEntityInWorld(eventArgs.User, eventArgs.Target)) { #pragma warning disable 618 diff --git a/Content.Server/Storage/Components/StorageFillComponent.cs b/Content.Server/Storage/Components/StorageFillComponent.cs index c9dd9330c9..c7fe7378a8 100644 --- a/Content.Server/Storage/Components/StorageFillComponent.cs +++ b/Content.Server/Storage/Components/StorageFillComponent.cs @@ -51,7 +51,7 @@ namespace Content.Server.Storage.Components for (var i = 0; i < storageItem.Amount; i++) { storage.Insert( - IoCManager.Resolve().SpawnEntity(storageItem.PrototypeId, Owner.Transform.Coordinates)); + IoCManager.Resolve().SpawnEntity(storageItem.PrototypeId, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)); } if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId); diff --git a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs index 5c521a8125..121329185b 100644 --- a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs +++ b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs @@ -42,7 +42,7 @@ namespace Content.Server.Storage.EntitySystems for (var i = 0; i < storageItem.Amount; i++) { - entityToPlaceInHands = EntityManager.SpawnEntity(storageItem.PrototypeId, args.User.Transform.Coordinates); + entityToPlaceInHands = EntityManager.SpawnEntity(storageItem.PrototypeId, IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates); } if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId); diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index 91fe177611..ed817456ef 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -143,8 +143,8 @@ namespace Content.Server.Storage.EntitySystems if (_sessionCache.Count == 0) return; - var storagePos = storageComp.Owner.Transform.WorldPosition; - var storageMap = storageComp.Owner.Transform.MapID; + var storagePos = IoCManager.Resolve().GetComponent(storageComp.Owner.Uid).WorldPosition; + var storageMap = IoCManager.Resolve().GetComponent(storageComp.Owner.Uid).MapID; foreach (var session in _sessionCache) { @@ -154,10 +154,10 @@ namespace Content.Server.Storage.EntitySystems if (attachedEntity == null || !IoCManager.Resolve().EntityExists(attachedEntity.Uid)) continue; - if (storageMap != attachedEntity.Transform.MapID) + if (storageMap != IoCManager.Resolve().GetComponent(attachedEntity.Uid).MapID) continue; - var distanceSquared = (storagePos - attachedEntity.Transform.WorldPosition).LengthSquared; + var distanceSquared = (storagePos - IoCManager.Resolve().GetComponent(attachedEntity.Uid).WorldPosition).LengthSquared; if (distanceSquared > InteractionSystem.InteractionRangeSquared) { storageComp.UnsubscribeSession(session); diff --git a/Content.Server/Throwing/ThrowHelper.cs b/Content.Server/Throwing/ThrowHelper.cs index dd8f2212bf..82c8c72e04 100644 --- a/Content.Server/Throwing/ThrowHelper.cs +++ b/Content.Server/Throwing/ThrowHelper.cs @@ -63,7 +63,7 @@ namespace Content.Server.Throwing } else if(direction != Vector2.Zero) { - entity.Transform.LocalRotation = direction.ToWorldAngle() - Math.PI; + IoCManager.Resolve().GetComponent(entity.Uid).LocalRotation = direction.ToWorldAngle() - Math.PI; } if (user != null) diff --git a/Content.Server/Tools/ToolSystem.Welder.cs b/Content.Server/Tools/ToolSystem.Welder.cs index d4552a0fad..22f4338f5f 100644 --- a/Content.Server/Tools/ToolSystem.Welder.cs +++ b/Content.Server/Tools/ToolSystem.Welder.cs @@ -115,7 +115,7 @@ namespace Content.Server.Tools SoundSystem.Play(Filter.Pvs(uid), welder.WelderOnSounds.GetSound(), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f)); // TODO: Use TransformComponent directly. - _atmosphereSystem.HotspotExpose(welder.Owner.Transform.Coordinates, 700, 50, true); + _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(welder.Owner.Uid).Coordinates, 700, 50, true); welder.Dirty(); @@ -318,7 +318,7 @@ namespace Content.Server.Tools continue; // TODO: Use TransformComponent directly. - _atmosphereSystem.HotspotExpose(welder.Owner.Transform.Coordinates, 700, 50, true); + _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(welder.Owner.Uid).Coordinates, 700, 50, true); solution.RemoveReagent(welder.FuelReagent, welder.FuelConsumption * _welderTimer); diff --git a/Content.Server/Traitor/Uplink/UplinkSystem.cs b/Content.Server/Traitor/Uplink/UplinkSystem.cs index 4f3416f18d..a8b90a4833 100644 --- a/Content.Server/Traitor/Uplink/UplinkSystem.cs +++ b/Content.Server/Traitor/Uplink/UplinkSystem.cs @@ -118,7 +118,7 @@ namespace Content.Server.Traitor.Uplink if (uplink.UplinkAccount == null) return; if (!_accounts.TryPurchaseItem(uplink.UplinkAccount, message.ItemId, - player.Transform.Coordinates, out var entity)) + IoCManager.Resolve().GetComponent(player.Uid).Coordinates, out var entity)) { SoundSystem.Play(Filter.SinglePlayer(message.Session), uplink.InsufficientFundsSound.GetSound(), uplink.Owner, AudioParams.Default); @@ -146,7 +146,7 @@ namespace Content.Server.Traitor.Uplink var player = args.Session.AttachedEntity; if (player == null) return; - var cords = player.Transform.Coordinates; + var cords = IoCManager.Resolve().GetComponent(player.Uid).Coordinates; // try to withdraw TCs from account if (!_accounts.TryWithdrawTC(acc, args.TC, cords, out var tcUid)) diff --git a/Content.Server/VendingMachines/VendingMachineComponent.cs b/Content.Server/VendingMachines/VendingMachineComponent.cs index 8de515d3f1..6a977fcf80 100644 --- a/Content.Server/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/VendingMachines/VendingMachineComponent.cs @@ -185,7 +185,7 @@ namespace Content.Server.VendingMachines { _ejecting = false; TrySetVisualState(VendingMachineVisualState.Normal); - IoCManager.Resolve().SpawnEntity(id, Owner.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(id, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); }); SoundSystem.Play(Filter.Pvs(Owner), _soundVend.GetSound(), Owner, AudioParams.Default.WithVolume(-2f)); diff --git a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs index 61ef5b3329..81d1881801 100644 --- a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs @@ -81,7 +81,7 @@ namespace Content.Server.Weapon.Melee var owner = EntityManager.GetEntity(uid); var target = args.TargetEntity; - var location = args.User.Transform.Coordinates; + var location = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve()) - location.ToMapPos(IoCManager.Resolve()); var angle = Angle.FromWorldVec(diff); @@ -138,12 +138,12 @@ namespace Content.Server.Weapon.Melee var owner = EntityManager.GetEntity(uid); - var location = args.User.Transform.Coordinates; + var location = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve()) - location.ToMapPos(IoCManager.Resolve()); var angle = Angle.FromWorldVec(diff); // This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes. - var entities = ArcRayCast(args.User.Transform.WorldPosition, angle, comp.ArcWidth, comp.Range, owner.Transform.MapID, args.User); + var entities = ArcRayCast(IoCManager.Resolve().GetComponent(args.User.Uid).WorldPosition, angle, comp.ArcWidth, comp.Range, IoCManager.Resolve().GetComponent(owner.Uid).MapID, args.User); var hitEntities = new List(); foreach (var entity in entities) @@ -166,11 +166,11 @@ namespace Content.Server.Weapon.Melee { if (entities.Count != 0) { - SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), entities.First().Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), IoCManager.Resolve().GetComponent(entities.First().Uid).Coordinates); } else { - SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), args.User.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates); } foreach (var entity in hitEntities) @@ -219,7 +219,7 @@ namespace Content.Server.Weapon.Melee if (args.Target == null) return; - var location = args.User.Transform.Coordinates; + var location = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve()) - location.ToMapPos(IoCManager.Resolve()); var angle = Angle.FromWorldVec(diff); diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs index 8ee3808ee3..e5b6806096 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs @@ -91,10 +91,10 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components if (_unspawnedCount > 0) { - ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates); + ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); // when dumping from held ammo box, this detaches the spawned ammo from the player. - ammo.Transform.AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(ammo.Uid).AttachParentToContainerOrGrid(); _unspawnedCount--; } diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs index b9eba32b17..5baa875aca 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs @@ -128,7 +128,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components else if (_unspawnedCount > 0) { _unspawnedCount--; - ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates); + ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } UpdateAppearance(); @@ -156,7 +156,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components var itemComponent = IoCManager.Resolve().GetComponent(ammo.Uid); if (!handsComponent.CanPutInHand(itemComponent)) { - ammo.Transform.Coordinates = eventArgs.User.Transform.Coordinates; + IoCManager.Resolve().GetComponent(ammo.Uid).Coordinates = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates; ServerRangedBarrelComponent.EjectCasing(ammo); } else diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs index 97b4f51436..3d7e14a13e 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs @@ -130,7 +130,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components if (_unspawnedCount > 0) { - entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates); + entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _unspawnedCount--; } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs index d69d79f283..7acaeab14e 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs @@ -111,7 +111,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (_unspawnedCount > 0) { _unspawnedCount--; - var chamberEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates); + var chamberEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _chamberContainer.Insert(chamberEntity); } } @@ -323,7 +323,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components else if (_unspawnedCount > 0) { _unspawnedCount--; - var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates); + var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _chamberContainer.Insert(ammoEntity); return true; } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs index a0a7a45023..8f825e2a72 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs @@ -183,7 +183,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (_unspawnedCount > 0) { _unspawnedCount--; - var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates); + var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _chamberContainer.Insert(ammoEntity); } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs index 0f3ad4298f..bd75feb5bb 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs @@ -114,7 +114,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components for (var i = 0; i < _unspawnedCount; i++) { - var entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates); + var entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _ammoSlots[idx] = entity; _ammoContainer.Insert(entity); idx++; diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs index d2d1b74de1..97bac668e9 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs @@ -97,7 +97,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _powerCellContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-powercell-container", out var existing); if (!existing && _powerCellPrototype != null) { - var powerCellEntity = IoCManager.Resolve().SpawnEntity(_powerCellPrototype, Owner.Transform.Coordinates); + var powerCellEntity = IoCManager.Resolve().SpawnEntity(_powerCellPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _powerCellContainer.Insert(powerCellEntity); } @@ -134,7 +134,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var ammo = _ammoContainer.ContainedEntity; if (ammo == null) { - ammo = IoCManager.Resolve().SpawnEntity(_ammoPrototype, Owner.Transform.Coordinates); + ammo = IoCManager.Resolve().SpawnEntity(_ammoPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); _ammoContainer.Insert(ammo); } @@ -171,7 +171,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { entity = _ammoContainer.ContainedEntity; _ammoContainer.Remove(entity); - entity.Transform.Coordinates = spawnAt; + IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = spawnAt; } else { @@ -258,7 +258,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (!hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner.Uid))) { - cell.Owner.Transform.Coordinates = user.Transform.Coordinates; + IoCManager.Resolve().GetComponent(cell.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; } SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2)); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs index 0146781c60..00362579fd 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs @@ -180,7 +180,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (!existing && _magFillPrototype != null) { - var magEntity = IoCManager.Resolve().SpawnEntity(_magFillPrototype, Owner.Transform.Coordinates); + var magEntity = IoCManager.Resolve().SpawnEntity(_magFillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); MagazineContainer.Insert(magEntity); } Dirty(); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs index 5bebf49382..bb50a89a10 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs @@ -204,7 +204,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components } var ammo = PeekAmmo(); - var projectile = TakeProjectile(shooter.Transform.Coordinates); + var projectile = TakeProjectile(IoCManager.Resolve().GetComponent(shooter.Uid).Coordinates); if (projectile == null) { SoundSystem.Play(Filter.Broadcast(), SoundEmpty.GetSound(), Owner); @@ -212,7 +212,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components } // At this point firing is confirmed - var direction = (targetPos - shooter.Transform.WorldPosition).ToAngle(); + var direction = (targetPos - IoCManager.Resolve().GetComponent(shooter.Uid).WorldPosition).ToAngle(); var angle = GetRecoilAngle(direction); // This should really be client-side but for now we'll just leave it here if (IoCManager.Resolve().TryGetComponent(shooter.Uid, out CameraRecoilComponent? recoilComponent)) @@ -275,10 +275,10 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components const float ejectOffset = 1.8f; var ammo = IoCManager.Resolve().GetComponent(entity.Uid); var offsetPos = ((robustRandom.NextFloat() - 0.5f) * ejectOffset, (robustRandom.NextFloat() - 0.5f) * ejectOffset); - entity.Transform.Coordinates = entity.Transform.Coordinates.Offset(offsetPos); - entity.Transform.LocalRotation = robustRandom.Pick(ejectDirections).ToAngle(); + IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Offset(offsetPos); + IoCManager.Resolve().GetComponent(entity.Uid).LocalRotation = robustRandom.Pick(ejectDirections).ToAngle(); - SoundSystem.Play(Filter.Broadcast(), ammo.SoundCollectionEject.GetSound(), entity.Transform.Coordinates, AudioParams.Default.WithVolume(-1)); + SoundSystem.Play(Filter.Broadcast(), ammo.SoundCollectionEject.GetSound(), IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, AudioParams.Default.WithVolume(-1)); } /// @@ -330,7 +330,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components else { projectile = - IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(baseProjectile.Uid).EntityPrototype?.ID, baseProjectile.Transform.Coordinates); + IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(baseProjectile.Uid).EntityPrototype?.ID, IoCManager.Resolve().GetComponent(baseProjectile.Uid).Coordinates); } firedProjectiles[i] = projectile.Uid; @@ -362,7 +362,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components }); - projectile.Transform.WorldRotation = projectileAngle + MathHelper.PiOver2; + IoCManager.Resolve().GetComponent(projectile.Uid).WorldRotation = projectileAngle + MathHelper.PiOver2; } IoCManager.Resolve().EventBus.RaiseLocalEvent(OwnerUid, new GunShotEvent(firedProjectiles)); @@ -390,9 +390,9 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components /// private void FireHitscan(IEntity shooter, HitscanComponent hitscan, Angle angle) { - var ray = new CollisionRay(Owner.Transform.Coordinates.ToMapPos(IoCManager.Resolve()), angle.ToVec(), (int) hitscan.CollisionMask); + var ray = new CollisionRay(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.ToMapPos(IoCManager.Resolve()), angle.ToVec(), (int) hitscan.CollisionMask); var physicsManager = EntitySystem.Get(); - var rayCastResults = physicsManager.IntersectRay(Owner.Transform.MapID, ray, hitscan.MaxLength, shooter, false).ToList(); + var rayCastResults = physicsManager.IntersectRay(IoCManager.Resolve().GetComponent(Owner.Uid).MapID, ray, hitscan.MaxLength, shooter, false).ToList(); if (rayCastResults.Count >= 1) { diff --git a/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs b/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs index 256eedbcbb..dfbcc63761 100644 --- a/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs +++ b/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs @@ -179,11 +179,11 @@ namespace Content.Server.Weapon.Ranged // Apply salt to the wound ("Honk!") SoundSystem.Play( Filter.Pvs(Owner), _clumsyWeaponHandlingSound.GetSound(), - Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5)); + IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioParams.Default.WithMaxDistance(5)); SoundSystem.Play( Filter.Pvs(Owner), _clumsyWeaponShotSound.GetSound(), - Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5)); + IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioParams.Default.WithMaxDistance(5)); user.PopupMessage(Loc.GetString("server-ranged-weapon-component-try-fire-clumsy")); @@ -193,7 +193,7 @@ namespace Content.Server.Weapon.Ranged if (_canHotspot) { - EntitySystem.Get().HotspotExpose(user.Transform.Coordinates, 700, 50); + EntitySystem.Get().HotspotExpose(IoCManager.Resolve().GetComponent(user.Uid).Coordinates, 700, 50); } FireHandler?.Invoke(user, targetPos); } diff --git a/Content.Server/Window/WindowComponent.cs b/Content.Server/Window/WindowComponent.cs index cfb6093237..ce5eccf858 100644 --- a/Content.Server/Window/WindowComponent.cs +++ b/Content.Server/Window/WindowComponent.cs @@ -105,7 +105,7 @@ namespace Content.Server.Window SoundSystem.Play( Filter.Pvs(eventArgs.Target), _knockSound.GetSound(), - eventArgs.Target.Transform.Coordinates, AudioHelpers.WithVariation(0.05f)); + IoCManager.Resolve().GetComponent(eventArgs.Target.Uid).Coordinates, AudioHelpers.WithVariation(0.05f)); eventArgs.Target.PopupMessageEveryone(Loc.GetString("comp-window-knock")); _lastKnockTime = _gameTiming.CurTime; diff --git a/Content.Shared/Body/Components/SharedBodyPartComponent.cs b/Content.Shared/Body/Components/SharedBodyPartComponent.cs index 4c03aace80..15ed11df17 100644 --- a/Content.Shared/Body/Components/SharedBodyPartComponent.cs +++ b/Content.Shared/Body/Components/SharedBodyPartComponent.cs @@ -268,7 +268,7 @@ namespace Content.Shared.Body.Components { if (RemoveMechanism(mechanism)) { - mechanism.Owner.Transform.Coordinates = coordinates; + IoCManager.Resolve().GetComponent(mechanism.Owner.Uid).Coordinates = coordinates; return true; } @@ -299,8 +299,8 @@ namespace Content.Shared.Body.Components private void AddedToBody(SharedBodyComponent body) { - Owner.Transform.LocalRotation = 0; - Owner.Transform.AttachParent(body.Owner); + IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation = 0; + IoCManager.Resolve().GetComponent(Owner.Uid).AttachParent(body.Owner); OnAddedToBody(body); foreach (var mechanism in _mechanisms) @@ -311,9 +311,9 @@ namespace Content.Shared.Body.Components private void RemovedFromBody(SharedBodyComponent old) { - if (!Owner.Transform.Deleted) + if (!IoCManager.Resolve().GetComponent(Owner.Uid).Deleted) { - Owner.Transform.AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(Owner.Uid).AttachToGridOrMap(); } OnRemovedFromBody(old); diff --git a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs index ac7122af1f..3148ef3173 100644 --- a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs @@ -187,7 +187,7 @@ namespace Content.Shared.Chemistry.Reaction { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {entity.Transform.Coordinates}"); + $"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); } effect.Effect(args); diff --git a/Content.Shared/Chemistry/ReactiveSystem.cs b/Content.Shared/Chemistry/ReactiveSystem.cs index 837d5f4d51..ea4f71cfba 100644 --- a/Content.Shared/Chemistry/ReactiveSystem.cs +++ b/Content.Shared/Chemistry/ReactiveSystem.cs @@ -66,7 +66,7 @@ namespace Content.Shared.Chemistry { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {entity.Transform.Coordinates}"); + $"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); } effect.Effect(args); @@ -94,7 +94,7 @@ namespace Content.Shared.Chemistry { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {entity.Transform.Coordinates}"); + $"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); } effect.Effect(args); diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index 733ce02709..689d250d1d 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -125,7 +125,7 @@ namespace Content.Shared.Chemistry.Reagent { var entity = entMan.GetEntity(args.SolutionEntity); EntitySystem.Get().Add(LogType.ReagentEffect, plantMetabolizable.LogImpact, - $"Plant metabolism effect {plantMetabolizable.GetType().Name:effect} of reagent {ID} applied on entity {entity} at {entity.Transform.Coordinates}"); + $"Plant metabolism effect {plantMetabolizable.GetType().Name:effect} of reagent {ID} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); plantMetabolizable.Effect(args); } } diff --git a/Content.Shared/Construction/Conditions/WallmountCondition.cs b/Content.Shared/Construction/Conditions/WallmountCondition.cs index 1a29d6a4bb..0d17b9be5f 100644 --- a/Content.Shared/Construction/Conditions/WallmountCondition.cs +++ b/Content.Shared/Construction/Conditions/WallmountCondition.cs @@ -21,7 +21,7 @@ namespace Content.Shared.Construction.Conditions var entManager = IoCManager.Resolve(); // get blueprint and user position - var userWorldPosition = user.Transform.WorldPosition; + var userWorldPosition = IoCManager.Resolve().GetComponent(user.Uid).WorldPosition; var objWorldPosition = location.ToMap(entManager).Position; // find direction from user to blueprint @@ -36,7 +36,7 @@ namespace Content.Shared.Construction.Conditions var physics = EntitySystem.Get(); var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized, (int) CollisionGroup.Impassable); var length = userToObject.Length; - var userToObjRaycastResults = physics.IntersectRayWithPredicate(user.Transform.MapID, rUserToObj, maxLength: length, + var userToObjRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user.Uid).MapID, rUserToObj, maxLength: length, predicate: (e) => !e.HasTag("Wall")); if (!userToObjRaycastResults.Any()) return false; @@ -46,7 +46,7 @@ namespace Content.Shared.Construction.Conditions // check that we didn't try to build wallmount that facing another adjacent wall var rAdjWall = new CollisionRay(objWorldPosition, direction.ToVec(), (int) CollisionGroup.Impassable); - var adjWallRaycastResults = physics.IntersectRayWithPredicate(user.Transform.MapID, rAdjWall, maxLength: 0.5f, + var adjWallRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user.Uid).MapID, rAdjWall, maxLength: 0.5f, predicate: (e) => e == targetWall || !e.HasTag("Wall")); return !adjWallRaycastResults.Any(); } diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 7150f409e0..c73cd8b605 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -56,7 +56,7 @@ namespace Content.Shared.Containers.ItemSlots if (slot.HasItem || string.IsNullOrEmpty(slot.StartingItem)) continue; - var item = EntityManager.SpawnEntity(slot.StartingItem, itemSlots.Owner.Transform.Coordinates); + var item = EntityManager.SpawnEntity(slot.StartingItem, IoCManager.Resolve().GetComponent(itemSlots.Owner.Uid).Coordinates); slot.ContainerSlot.Insert(item); } } diff --git a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs index 2a685d96f3..426b15ad80 100644 --- a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs +++ b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs @@ -49,7 +49,7 @@ namespace Content.Shared.Disposal public virtual bool CanInsert(SharedDisposalUnitComponent component, IEntity entity) { - if (!component.Owner.Transform.Anchored) + if (!IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) return false; // TODO: Probably just need a disposable tag. diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index 5d921482c0..cb136cf4a0 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -64,7 +64,7 @@ namespace Content.Shared.Examine [Pure] public bool CanExamine(IEntity examiner, IEntity examined) { - return CanExamine(examiner, examined.Transform.MapPosition, + return CanExamine(examiner, IoCManager.Resolve().GetComponent(examined.Uid).MapPosition, entity => entity == examiner || entity == examined); } @@ -77,11 +77,11 @@ namespace Content.Shared.Examine if (!examinerComponent.DoRangeCheck) return true; - if (examiner.Transform.MapID != target.MapId) + if (IoCManager.Resolve().GetComponent(examiner.Uid).MapID != target.MapId) return false; return InRangeUnOccluded( - examiner.Transform.MapPosition, + IoCManager.Resolve().GetComponent(examiner.Uid).MapPosition, target, GetExaminerRange(examiner.Uid), predicate: predicate, @@ -133,7 +133,7 @@ namespace Content.Shared.Examine continue; } - var bBox = o.BoundingBox.Translated(o.Owner.Transform.WorldPosition); + var bBox = o.BoundingBox.Translated(IoCManager.Resolve().GetComponent(o.Owner.Uid).WorldPosition); if (bBox.Contains(origin.Position) || bBox.Contains(other.Position)) { @@ -148,23 +148,23 @@ namespace Content.Shared.Examine public static bool InRangeUnOccluded(IEntity origin, IEntity other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = origin.Transform.MapPosition; - var otherPos = other.Transform.MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; + var otherPos = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(IEntity origin, IComponent other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = origin.Transform.MapPosition; - var otherPos = other.Owner.Transform.MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; + var otherPos = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(IEntity origin, EntityCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = origin.Transform.MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; var otherPos = other.ToMap(IoCManager.Resolve()); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); @@ -172,22 +172,22 @@ namespace Content.Shared.Examine public static bool InRangeUnOccluded(IEntity origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = origin.Transform.MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; return InRangeUnOccluded(originPos, other, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(ITargetedInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = args.User.Transform.MapPosition; - var otherPos = args.Target.Transform.MapPosition; + var originPos = IoCManager.Resolve().GetComponent(args.User.Uid).MapPosition; + var otherPos = IoCManager.Resolve().GetComponent(args.Target.Uid).MapPosition; return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(DragDropEvent args, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = args.User.Transform.MapPosition; + var originPos = IoCManager.Resolve().GetComponent(args.User.Uid).MapPosition; var otherPos = args.DropLocation.ToMap(IoCManager.Resolve()); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); @@ -195,8 +195,9 @@ namespace Content.Shared.Examine public static bool InRangeUnOccluded(AfterInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = args.User.Transform.MapPosition; - var otherPos = args.Target?.Transform.MapPosition ?? args.ClickLocation.ToMap(IoCManager.Resolve()); + var originPos = IoCManager.Resolve().GetComponent(args.User.Uid).MapPosition; + IEntity? tempQualifier = args.Target; + var otherPos = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).MapPosition ?? args.ClickLocation.ToMap(IoCManager.Resolve()); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } diff --git a/Content.Shared/Friction/SharedTileFrictionController.cs b/Content.Shared/Friction/SharedTileFrictionController.cs index 1486f20f62..53ea89a7d2 100644 --- a/Content.Shared/Friction/SharedTileFrictionController.cs +++ b/Content.Shared/Friction/SharedTileFrictionController.cs @@ -132,7 +132,7 @@ namespace Content.Shared.Friction [Pure] private float GetTileFriction(PhysicsComponent body) { - var transform = body.Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(body.Owner.Uid); var coords = transform.Coordinates; // TODO: Make IsWeightless event-based; we already have grid traversals tracked so just raise events diff --git a/Content.Shared/Hands/Components/SharedHandsComponent.cs b/Content.Shared/Hands/Components/SharedHandsComponent.cs index a95c6fce56..73bb871e4b 100644 --- a/Content.Shared/Hands/Components/SharedHandsComponent.cs +++ b/Content.Shared/Hands/Components/SharedHandsComponent.cs @@ -376,7 +376,7 @@ namespace Content.Shared.Hands.Components if (!TryGetHand(handName, out var hand)) return false; - return TryDropHeldEntity(hand, Owner.Transform.Coordinates, checkActionBlocker); + return TryDropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, checkActionBlocker); } /// @@ -387,7 +387,7 @@ namespace Content.Shared.Hands.Components if (!TryGetHandHoldingEntity(entity, out var hand)) return false; - return TryDropHeldEntity(hand, Owner.Transform.Coordinates, checkActionBlocker); + return TryDropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, checkActionBlocker); } /// @@ -480,7 +480,7 @@ namespace Content.Shared.Hands.Components EntitySystem.Get().DroppedInteraction(Owner, heldEntity); - heldEntity.Transform.WorldPosition = GetFinalDropCoordinates(targetDropLocation); + IoCManager.Resolve().GetComponent(heldEntity.Uid).WorldPosition = GetFinalDropCoordinates(targetDropLocation); OnItemChanged?.Invoke(); } @@ -490,7 +490,7 @@ namespace Content.Shared.Hands.Components /// private Vector2 GetFinalDropCoordinates(EntityCoordinates targetCoords) { - var origin = Owner.Transform.MapPosition; + var origin = IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition; var target = targetCoords.ToMap(IoCManager.Resolve()); var dropVector = target.Position - origin.Position; @@ -529,7 +529,7 @@ namespace Content.Shared.Hands.Components /// private void DropHeldEntityToFloor(Hand hand) { - DropHeldEntity(hand, Owner.Transform.Coordinates); + DropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); } private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker) @@ -653,7 +653,7 @@ namespace Content.Shared.Hands.Components if (hand.Name == ActiveHand) SelectActiveHeldEntity(); - entity.Transform.LocalPosition = Vector2.Zero; + IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition = Vector2.Zero; OnItemChanged?.Invoke(); @@ -790,7 +790,7 @@ namespace Content.Shared.Hands.Components var entity = item.Owner; if (!TryPutInActiveHandOrAny(entity, checkActionBlocker)) - entity.Transform.Coordinates = Owner.Transform.Coordinates; + IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; } /// diff --git a/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs b/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs index bd1e1fc3c4..fd37c85656 100644 --- a/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs +++ b/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs @@ -263,7 +263,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = false) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = other.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -278,7 +278,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = false) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -293,7 +293,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = false) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -344,7 +344,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = false) { - var otherPosition = other.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -358,7 +358,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = false) { - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -372,7 +372,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = false) { - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); diff --git a/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs b/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs index bd86041b34..ac7e64c4bc 100644 --- a/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs +++ b/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs @@ -204,7 +204,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = true) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = other.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, predicate, ignoreInsideBlocker); @@ -218,7 +218,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = true) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, predicate, ignoreInsideBlocker); @@ -232,7 +232,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = true) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, predicate, ignoreInsideBlocker); @@ -280,7 +280,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = true) { - var otherPosition = other.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate, ignoreInsideBlocker); @@ -293,7 +293,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = true) { - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate, ignoreInsideBlocker); @@ -306,7 +306,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = true) { - var otherPosition = other.Owner.Transform.MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate, ignoreInsideBlocker); diff --git a/Content.Shared/Interaction/RotateToFaceSystem.cs b/Content.Shared/Interaction/RotateToFaceSystem.cs index 4511dc7b47..91bfa697e7 100644 --- a/Content.Shared/Interaction/RotateToFaceSystem.cs +++ b/Content.Shared/Interaction/RotateToFaceSystem.cs @@ -36,7 +36,7 @@ namespace Content.Shared.Interaction [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; public bool TryFaceCoordinates(IEntity user, Vector2 coordinates) { - var diff = coordinates - user.Transform.MapPosition.Position; + var diff = coordinates - IoCManager.Resolve().GetComponent(user.Uid).MapPosition.Position; if (diff.LengthSquared <= 0.01f) return true; var diffAngle = Angle.FromWorldVec(diff); @@ -47,7 +47,7 @@ namespace Content.Shared.Interaction { if (_actionBlockerSystem.CanChangeDirection(user.Uid)) { - user.Transform.WorldRotation = diffAngle; + IoCManager.Resolve().GetComponent(user.Uid).WorldRotation = diffAngle; return true; } else @@ -64,7 +64,7 @@ namespace Content.Shared.Interaction // (Since the user being buckled to it holds it down with their weight.) // This is logically equivalent to RotateWhileAnchored. // Barstools and office chairs have independent wheels, while regular chairs don't. - rotatable.Owner.Transform.WorldRotation = diffAngle; + IoCManager.Resolve().GetComponent(rotatable.Owner.Uid).WorldRotation = diffAngle; return true; } } diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 325a1d2b8d..df45f2cdb9 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -213,7 +213,7 @@ namespace Content.Shared.Interaction bool popup = false) { predicate ??= e => e == origin || e == other; - return InRangeUnobstructed(origin, other.Transform.MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup); + return InRangeUnobstructed(origin, IoCManager.Resolve().GetComponent(other.Uid).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup); } /// @@ -345,7 +345,7 @@ namespace Content.Shared.Interaction bool ignoreInsideBlocker = false, bool popup = false) { - var originPosition = origin.Transform.MapPosition; + var originPosition = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; predicate ??= e => e == origin; var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker); @@ -678,7 +678,7 @@ namespace Content.Shared.Interaction return; } - item.Transform.LocalRotation = Angle.Zero; + IoCManager.Resolve().GetComponent(item.Uid).LocalRotation = Angle.Zero; var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); diff --git a/Content.Shared/Item/SharedItemComponent.cs b/Content.Shared/Item/SharedItemComponent.cs index 9e6313d961..cc8e6f1d3f 100644 --- a/Content.Shared/Item/SharedItemComponent.cs +++ b/Content.Shared/Item/SharedItemComponent.cs @@ -115,7 +115,7 @@ namespace Content.Shared.Item if (!EntitySystem.Get().CanPickup(user.Uid)) return false; - if (user.Transform.MapID != Owner.Transform.MapID) + if (IoCManager.Resolve().GetComponent(user.Uid).MapID != IoCManager.Resolve().GetComponent(Owner.Uid).MapID) return false; if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out IPhysBody? physics) || physics.BodyType == BodyType.Static) diff --git a/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs b/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs index ed383367e1..e378886ead 100644 --- a/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs +++ b/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs @@ -22,7 +22,7 @@ namespace Content.Shared.Movement.Components if (IoCManager.Resolve().HasComponent(entity.Uid) || (body?.BodyType & (BodyType.Static | BodyType.Kinematic)) != 0) return false; - var transform = entity.Transform; + var transform = IoCManager.Resolve().GetComponent(entity.Uid); var gridId = transform.GridID; if (!gridId.IsValid()) diff --git a/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs b/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs index 88137fd73d..149791b65c 100644 --- a/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs +++ b/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs @@ -119,7 +119,7 @@ namespace Content.Shared.Movement.Components { base.Initialize(); Owner.EnsureComponentWarn(); - LastGridAngle = Owner.Transform.Parent?.WorldRotation ?? new Angle(0); + LastGridAngle = IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.WorldRotation ?? new Angle(0); } /// diff --git a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs index 95f2d03ada..a8292f3f73 100644 --- a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs +++ b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs @@ -58,7 +58,7 @@ namespace Content.Shared.Movement.EntitySystems mobState.IsAlive())) { var relayMoveEvent = new RelayMovementEntityEvent(owner); - IoCManager.Resolve().EventBus.RaiseLocalEvent(owner.Transform.ParentUid, relayMoveEvent); + IoCManager.Resolve().EventBus.RaiseLocalEvent(IoCManager.Resolve().GetComponent(owner.Uid).ParentUid, relayMoveEvent); } } diff --git a/Content.Shared/Movement/SharedMoverController.cs b/Content.Shared/Movement/SharedMoverController.cs index 34e76937f3..459626e6e5 100644 --- a/Content.Shared/Movement/SharedMoverController.cs +++ b/Content.Shared/Movement/SharedMoverController.cs @@ -67,7 +67,7 @@ namespace Content.Shared.Movement { var (walkDir, sprintDir) = mover.VelocityDir; - var transform = mover.Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(mover.Owner.Uid); var parentRotation = transform.Parent!.WorldRotation; // Regular movement. @@ -105,7 +105,7 @@ namespace Content.Shared.Movement } UsedMobMovement[mover.OwnerUid] = true; - var transform = mover.Owner.Transform; + var transform = IoCManager.Resolve().GetComponent(mover.Owner.Uid); var weightless = mover.Owner.IsWeightless(physicsComponent, mapManager: _mapManager, entityManager: _entityManager); var (walkDir, sprintDir) = mover.VelocityDir; diff --git a/Content.Shared/Placeable/PlaceableSurfaceSystem.cs b/Content.Shared/Placeable/PlaceableSurfaceSystem.cs index 5773b20580..486559d369 100644 --- a/Content.Shared/Placeable/PlaceableSurfaceSystem.cs +++ b/Content.Shared/Placeable/PlaceableSurfaceSystem.cs @@ -58,13 +58,13 @@ namespace Content.Shared.Placeable if (!args.ClickLocation.IsValid(IoCManager.Resolve())) return; - if(!handComponent.TryDropEntity(args.Used, surface.Owner.Transform.Coordinates)) + if(!handComponent.TryDropEntity(args.Used, IoCManager.Resolve().GetComponent(surface.Owner.Uid).Coordinates)) return; if (surface.PlaceCentered) - args.Used.Transform.LocalPosition = args.Target.Transform.LocalPosition + surface.PositionOffset; + IoCManager.Resolve().GetComponent(args.Used.Uid).LocalPosition = IoCManager.Resolve().GetComponent(args.Target.Uid).LocalPosition + surface.PositionOffset; else - args.Used.Transform.Coordinates = args.ClickLocation; + IoCManager.Resolve().GetComponent(args.Used.Uid).Coordinates = args.ClickLocation; args.Handled = true; } diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index b1d77d0b74..159fac2a4a 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -259,10 +259,10 @@ namespace Content.Shared.Pulling if (!rotatable.RotateWhilePulling) return; - var dir = puller.Transform.WorldPosition - pulled.Transform.WorldPosition; + var dir = IoCManager.Resolve().GetComponent(puller.Uid).WorldPosition - IoCManager.Resolve().GetComponent(pulled.Uid).WorldPosition; if (dir.LengthSquared > ThresholdRotDistance * ThresholdRotDistance) { - var oldAngle = pulled.Transform.WorldRotation; + var oldAngle = IoCManager.Resolve().GetComponent(pulled.Uid).WorldRotation; var newAngle = Angle.FromWorldVec(dir); var diff = newAngle - oldAngle; @@ -272,10 +272,10 @@ namespace Content.Shared.Pulling // Otherwise PIANO DOOR STUCK! happens. // But it also needs to work with station rotation / align to the local parent. // So... - var baseRotation = pulled.Transform.Parent?.WorldRotation ?? 0f; + var baseRotation = IoCManager.Resolve().GetComponent(pulled.Uid).Parent?.WorldRotation ?? 0f; var localRotation = newAngle - baseRotation; var localRotationSnapped = Angle.FromDegrees(Math.Floor((localRotation.Degrees / ThresholdRotAngle) + 0.5f) * ThresholdRotAngle); - pulled.Transform.LocalRotation = localRotationSnapped; + IoCManager.Resolve().GetComponent(pulled.Uid).LocalRotation = localRotationSnapped; } } } diff --git a/Content.Shared/Random/Helpers/SharedEntityExtensions.cs b/Content.Shared/Random/Helpers/SharedEntityExtensions.cs index bd33c46bd5..b3c427ce7b 100644 --- a/Content.Shared/Random/Helpers/SharedEntityExtensions.cs +++ b/Content.Shared/Random/Helpers/SharedEntityExtensions.cs @@ -20,7 +20,7 @@ namespace Content.Shared.Random.Helpers var randomY = random.NextFloat() * (maxY - minY) + minY; var offset = new Vector2(randomX, randomY); - entity.Transform.LocalPosition += offset; + IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition += offset; } public static void RandomOffset(this IEntity entity, float min, float max) diff --git a/Content.Shared/Storage/SharedStorageComponent.cs b/Content.Shared/Storage/SharedStorageComponent.cs index 83e3eeef1a..da3653a705 100644 --- a/Content.Shared/Storage/SharedStorageComponent.cs +++ b/Content.Shared/Storage/SharedStorageComponent.cs @@ -52,7 +52,7 @@ namespace Content.Shared.Storage { if (Remove(storedEntity)) { - storedEntity.Transform.WorldPosition = eventArgs.DropLocation.Position; + IoCManager.Resolve().GetComponent(storedEntity.Uid).WorldPosition = eventArgs.DropLocation.Position; } } diff --git a/Content.Shared/Transform/TransformExtensions.cs b/Content.Shared/Transform/TransformExtensions.cs index fcc2473b08..349d5afc30 100644 --- a/Content.Shared/Transform/TransformExtensions.cs +++ b/Content.Shared/Transform/TransformExtensions.cs @@ -1,4 +1,5 @@ using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Content.Shared.Transform { @@ -19,7 +20,7 @@ namespace Content.Shared.Transform public static void AttachToGrandparent(this IEntity entity) { - AttachToGrandparent(entity.Transform); + AttachToGrandparent(IoCManager.Resolve().GetComponent(entity.Uid)); } } }