diff --git a/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs b/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs index f90637a649e..5f187cad794 100644 --- a/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs +++ b/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs @@ -22,7 +22,6 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IEntityManager _entMan = default!; - private SharedTransformSystem? _xformSystem = null; private readonly SpawnExplosionEui _eui; @@ -103,13 +102,9 @@ private void SetLocation() if (!_entMan.TryGetComponent(_playerManager.LocalEntity, out TransformComponent? transform)) return; - _xformSystem ??= _entMan.SystemOrNull(); - if (_xformSystem is null) - return; - _pausePreview = true; MapOptions.Select(_mapData.IndexOf(transform.MapID)); - (MapX.Value, MapY.Value) = _xformSystem.GetWorldPosition(transform); + (MapX.Value, MapY.Value) = transform.MapPosition.Position; _pausePreview = false; UpdatePreview(); diff --git a/Content.Client/Atmos/Overlays/GasTileOverlay.cs b/Content.Client/Atmos/Overlays/GasTileOverlay.cs index 4bbc4654fb4..ef65d43fe85 100644 --- a/Content.Client/Atmos/Overlays/GasTileOverlay.cs +++ b/Content.Client/Atmos/Overlays/GasTileOverlay.cs @@ -22,7 +22,6 @@ public sealed class GasTileOverlay : Overlay { private readonly IEntityManager _entManager; private readonly IMapManager _mapManager; - private readonly SharedTransformSystem _xformSystem; public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities; private readonly ShaderInstance _shader; @@ -52,7 +51,6 @@ public GasTileOverlay(GasTileOverlaySystem system, IEntityManager entManager, IR { _entManager = entManager; _mapManager = IoCManager.Resolve(); - _xformSystem = _entManager.System(); _shader = protoMan.Index("unshaded").Instance(); ZIndex = GasOverlayZIndex; @@ -158,8 +156,7 @@ protected override void Draw(in OverlayDrawArgs args) _fireFrameCounter, _shader, overlayQuery, - xformQuery, - _xformSystem); + xformQuery); var mapUid = _mapManager.GetMapEntityId(args.MapId); @@ -197,8 +194,7 @@ protected override void Draw(in OverlayDrawArgs args) int[] fireFrameCounter, ShaderInstance shader, EntityQuery overlayQuery, - EntityQuery xformQuery, - SharedTransformSystem xformSystem) state) => + EntityQuery xformQuery) state) => { if (!state.overlayQuery.TryGetComponent(uid, out var comp) || !state.xformQuery.TryGetComponent(uid, out var gridXform)) @@ -206,7 +202,7 @@ protected override void Draw(in OverlayDrawArgs args) return true; } - var (_, _, worldMatrix, invMatrix) = state.xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); state.drawHandle.SetTransform(worldMatrix); var floatBounds = invMatrix.TransformBox(in state.WorldBounds).Enlarged(grid.TileSize); var localBounds = new Box2i( diff --git a/Content.Client/CardboardBox/CardboardBoxSystem.cs b/Content.Client/CardboardBox/CardboardBoxSystem.cs index fc4f1e079ca..50f9de239d5 100644 --- a/Content.Client/CardboardBox/CardboardBoxSystem.cs +++ b/Content.Client/CardboardBox/CardboardBoxSystem.cs @@ -30,7 +30,7 @@ private void OnBoxEffect(PlayBoxEffectMessage msg) if (!xformQuery.TryGetComponent(source, out var xform)) return; - var sourcePos = _transform.GetMapCoordinates((source, xform)); + var sourcePos = _transform.GetMapCoordinates(source, xform); //Any mob that can move should be surprised? //God mind rework needs to come faster so it can just check for mind diff --git a/Content.Client/Chat/UI/SpeechBubble.cs b/Content.Client/Chat/UI/SpeechBubble.cs index 48b1c9dc42e..82eccbcec84 100644 --- a/Content.Client/Chat/UI/SpeechBubble.cs +++ b/Content.Client/Chat/UI/SpeechBubble.cs @@ -15,7 +15,6 @@ public abstract class SpeechBubble : Control { [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; [Dependency] protected readonly IConfigurationManager ConfigManager = default!; public enum SpeechType : byte @@ -83,7 +82,6 @@ public static SpeechBubble CreateSpeechBubble(SpeechType type, ChatMessage messa public SpeechBubble(ChatMessage message, EntityUid senderEntity, string speechStyleClass, Color? fontColor = null) { IoCManager.InjectDependencies(this); - _xformSystem = _entityManager.System(); _senderEntity = senderEntity; // Use text clipping so new messages don't overlap old ones being pushed up. @@ -142,7 +140,7 @@ protected override void FrameUpdate(FrameEventArgs args) } var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset; - var worldPos = _xformSystem.GetWorldPosition(xform) + offset; + var worldPos = xform.WorldPosition + offset; var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale; var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved); diff --git a/Content.Client/Clickable/ClickableComponent.cs b/Content.Client/Clickable/ClickableComponent.cs index 27b3437a2f5..cfbd1a99d69 100644 --- a/Content.Client/Clickable/ClickableComponent.cs +++ b/Content.Client/Clickable/ClickableComponent.cs @@ -1,27 +1,145 @@ -namespace Content.Client.Clickable; +using System.Numerics; +using Robust.Client.GameObjects; +using Robust.Client.Graphics; +using Robust.Client.Utility; +using Robust.Shared.Graphics; +using static Robust.Client.GameObjects.SpriteComponent; +using Direction = Robust.Shared.Maths.Direction; -/// -/// Makes it possible to click the associated entity. -/// -[RegisterComponent] -public sealed partial class ClickableComponent : Component +namespace Content.Client.Clickable { - /// - /// A set of AABBs used as an approximate check for whether a click could hit this entity. - /// - [DataField("bounds")] - public DirBoundData? Bounds; - - /// - /// A set of AABBs associated with the cardinal directions used for approximate click intersection calculations. - /// - [DataDefinition] - public sealed partial class DirBoundData + [RegisterComponent] + public sealed partial class ClickableComponent : Component { - [DataField("all")] public Box2 All; - [DataField("north")] public Box2 North; - [DataField("south")] public Box2 South; - [DataField("east")] public Box2 East; - [DataField("west")] public Box2 West; + [Dependency] private readonly IClickMapManager _clickMapManager = default!; + + [DataField("bounds")] public DirBoundData? Bounds; + + /// + /// Used to check whether a click worked. Will first check if the click falls inside of some explicit bounding + /// boxes (see ). If that fails, attempts to use automatically generated click maps. + /// + /// The world position that was clicked. + /// + /// The draw depth for the sprite that captured the click. + /// + /// True if the click worked, false otherwise. + public bool CheckClick(SpriteComponent sprite, TransformComponent transform, EntityQuery xformQuery, Vector2 worldPos, IEye eye, out int drawDepth, out uint renderOrder, out float bottom) + { + if (!sprite.Visible) + { + drawDepth = default; + renderOrder = default; + bottom = default; + return false; + } + + drawDepth = sprite.DrawDepth; + renderOrder = sprite.RenderOrder; + var (spritePos, spriteRot) = transform.GetWorldPositionRotation(xformQuery); + var spriteBB = sprite.CalculateRotatedBoundingBox(spritePos, spriteRot, eye.Rotation); + bottom = Matrix3.CreateRotation(eye.Rotation).TransformBox(spriteBB).Bottom; + + var invSpriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix()); + + // This should have been the rotation of the sprite relative to the screen, but this is not the case with no-rot or directional sprites. + var relativeRotation = (spriteRot + eye.Rotation).Reduced().FlipPositive(); + + Angle cardinalSnapping = sprite.SnapCardinals ? relativeRotation.GetCardinalDir().ToAngle() : Angle.Zero; + + // First we get `localPos`, the clicked location in the sprite-coordinate frame. + var entityXform = Matrix3.CreateInverseTransform(transform.WorldPosition, sprite.NoRotation ? -eye.Rotation : spriteRot - cardinalSnapping); + var localPos = invSpriteMatrix.Transform(entityXform.Transform(worldPos)); + + // Check explicitly defined click-able bounds + if (CheckDirBound(sprite, relativeRotation, localPos)) + return true; + + // Next check each individual sprite layer using automatically computed click maps. + foreach (var spriteLayer in sprite.AllLayers) + { + if (!spriteLayer.Visible || spriteLayer is not Layer layer) + continue; + + // Check the layer's texture, if it has one + if (layer.Texture != null) + { + // Convert to image coordinates + var imagePos = (Vector2i) (localPos * EyeManager.PixelsPerMeter * new Vector2(1, -1) + layer.Texture.Size / 2f); + + if (_clickMapManager.IsOccluding(layer.Texture, imagePos)) + return true; + } + + // Either we weren't clicking on the texture, or there wasn't one. In which case: check the RSI next + if (layer.ActualRsi is not { } rsi || !rsi.TryGetState(layer.State, out var rsiState)) + continue; + + var dir = Layer.GetDirection(rsiState.RsiDirections, relativeRotation); + + // convert to layer-local coordinates + layer.GetLayerDrawMatrix(dir, out var matrix); + var inverseMatrix = Matrix3.Invert(matrix); + var layerLocal = inverseMatrix.Transform(localPos); + + // Convert to image coordinates + var layerImagePos = (Vector2i) (layerLocal * EyeManager.PixelsPerMeter * new Vector2(1, -1) + rsiState.Size / 2f); + + // Next, to get the right click map we need the "direction" of this layer that is actually being used to draw the sprite on the screen. + // This **can** differ from the dir defined before, but can also just be the same. + if (sprite.EnableDirectionOverride) + dir = sprite.DirectionOverride.Convert(rsiState.RsiDirections); + dir = dir.OffsetRsiDir(layer.DirOffset); + + if (_clickMapManager.IsOccluding(layer.ActualRsi!, layer.State, dir, layer.AnimationFrame, layerImagePos)) + return true; + } + + drawDepth = default; + renderOrder = default; + bottom = default; + return false; + } + + public bool CheckDirBound(SpriteComponent sprite, Angle relativeRotation, Vector2 localPos) + { + if (Bounds == null) + return false; + + // These explicit bounds only work for either 1 or 4 directional sprites. + + // This would be the orientation of a 4-directional sprite. + var direction = relativeRotation.GetCardinalDir(); + + var modLocalPos = sprite.NoRotation + ? localPos + : direction.ToAngle().RotateVec(localPos); + + // First, check the bounding box that is valid for all orientations + if (Bounds.All.Contains(modLocalPos)) + return true; + + // Next, get and check the appropriate bounding box for the current sprite orientation + var boundsForDir = (sprite.EnableDirectionOverride ? sprite.DirectionOverride : direction) switch + { + Direction.East => Bounds.East, + Direction.North => Bounds.North, + Direction.South => Bounds.South, + Direction.West => Bounds.West, + _ => throw new InvalidOperationException() + }; + + return boundsForDir.Contains(modLocalPos); + } + + [DataDefinition] + public sealed partial class DirBoundData + { + [DataField("all")] public Box2 All; + [DataField("north")] public Box2 North; + [DataField("south")] public Box2 South; + [DataField("east")] public Box2 East; + [DataField("west")] public Box2 West; + } } } diff --git a/Content.Client/Clickable/ClickableSystem.cs b/Content.Client/Clickable/ClickableSystem.cs deleted file mode 100644 index 9a96aef2c0c..00000000000 --- a/Content.Client/Clickable/ClickableSystem.cs +++ /dev/null @@ -1,144 +0,0 @@ -using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using static Robust.Client.GameObjects.SpriteComponent; -using Robust.Client.Utility; -using Robust.Shared.Graphics; -using Direction = Robust.Shared.Maths.Direction; -using System.Numerics; - -namespace Content.Client.Clickable; - -public sealed partial class ClickableSystem : EntitySystem -{ - [Dependency] private readonly IClickMapManager _clickMapManager = default!; - [Dependency] private readonly SharedTransformSystem _transformSystem = default!; - - /// - /// Used to check whether a click worked. Will first check if the click falls inside of some explicit bounding - /// boxes (see ). If that fails, attempts to use automatically generated click maps. - /// - /// The entity that we are trying to click. - /// The world position that was clicked. - /// The PoV the click is originating from. - /// The draw depth for the sprite that captured the click. - /// The render order for the sprite that captured the click. - /// The bottom of the sprite AABB from the perspective of the eye doing the click. - /// True if the click worked, false otherwise. - public bool CheckClick(Entity entity, Vector2 worldPos, IEye eye, out int drawDepth, out uint renderOrder, out float bottom) - { - var (uid, clickable, sprite, xform) = entity; - - if (!sprite.Visible) - { - drawDepth = default; - renderOrder = default; - bottom = default; - return false; - } - - drawDepth = sprite.DrawDepth; - renderOrder = sprite.RenderOrder; - var (spritePos, spriteRot) = _transformSystem.GetWorldPositionRotation(xform); - var spriteBB = sprite.CalculateRotatedBoundingBox(spritePos, spriteRot, eye.Rotation); - bottom = Matrix3.CreateRotation(eye.Rotation).TransformBox(spriteBB).Bottom; - - var invSpriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix()); - - // This should have been the rotation of the sprite relative to the screen, but this is not the case with no-rot or directional sprites. - var relativeRotation = (spriteRot + eye.Rotation).Reduced().FlipPositive(); - - Angle cardinalSnapping = sprite.SnapCardinals ? relativeRotation.GetCardinalDir().ToAngle() : Angle.Zero; - - // First we get `localPos`, the clicked location in the sprite-coordinate frame. - var entityXform = Matrix3.CreateInverseTransform(_transformSystem.GetWorldPosition(xform), sprite.NoRotation ? -eye.Rotation : spriteRot - cardinalSnapping); - var localPos = invSpriteMatrix.Transform(entityXform.Transform(worldPos)); - - // Check explicitly defined click-able bounds - if (CheckDirBound((uid, clickable, sprite), relativeRotation, localPos)) - return true; - - // Next check each individual sprite layer using automatically computed click maps. - foreach (var spriteLayer in sprite.AllLayers) - { - if (!spriteLayer.Visible || spriteLayer is not Layer layer) - continue; - - // Check the layer's texture, if it has one - if (layer.Texture != null) - { - // Convert to image coordinates - var imagePos = (Vector2i) (localPos * EyeManager.PixelsPerMeter * new Vector2(1, -1) + layer.Texture.Size / 2f); - - if (_clickMapManager.IsOccluding(layer.Texture, imagePos)) - return true; - } - - // Either we weren't clicking on the texture, or there wasn't one. In which case: check the RSI next - if (layer.ActualRsi is not { } rsi || !rsi.TryGetState(layer.State, out var rsiState)) - continue; - - var dir = Layer.GetDirection(rsiState.RsiDirections, relativeRotation); - - // convert to layer-local coordinates - layer.GetLayerDrawMatrix(dir, out var matrix); - var inverseMatrix = Matrix3.Invert(matrix); - var layerLocal = inverseMatrix.Transform(localPos); - - // Convert to image coordinates - var layerImagePos = (Vector2i) (layerLocal * EyeManager.PixelsPerMeter * new Vector2(1, -1) + rsiState.Size / 2f); - - // Next, to get the right click map we need the "direction" of this layer that is actually being used to draw the sprite on the screen. - // This **can** differ from the dir defined before, but can also just be the same. - if (sprite.EnableDirectionOverride) - dir = sprite.DirectionOverride.Convert(rsiState.RsiDirections); - dir = dir.OffsetRsiDir(layer.DirOffset); - - if (_clickMapManager.IsOccluding(layer.ActualRsi!, layer.State, dir, layer.AnimationFrame, layerImagePos)) - return true; - } - - drawDepth = default; - renderOrder = default; - bottom = default; - return false; - } - - /// - /// Used to check whether a click worked lands inside of the AABB for the current sprite for a clickable entity. - /// - /// The world position that was clicked. - /// The angle of the entity to check relative to the PoV that the click is coming from. - /// True if the click lands inside the relevant AABB. - public bool CheckDirBound(Entity entity, Angle relativeRotation, Vector2 localPos) - { - var (uid, clickable, sprite) = entity; - - if (clickable.Bounds == null) - return false; - - // These explicit bounds only work for either 1 or 4 directional sprites. - - // This would be the orientation of a 4-directional sprite. - var direction = relativeRotation.GetCardinalDir(); - - var modLocalPos = sprite.NoRotation - ? localPos - : direction.ToAngle().RotateVec(localPos); - - // First, check the bounding box that is valid for all orientations - if (clickable.Bounds.All.Contains(modLocalPos)) - return true; - - // Next, get and check the appropriate bounding box for the current sprite orientation - var boundsForDir = (sprite.EnableDirectionOverride ? sprite.DirectionOverride : direction) switch - { - Direction.East => clickable.Bounds.East, - Direction.North => clickable.Bounds.North, - Direction.South => clickable.Bounds.South, - Direction.West => clickable.Bounds.West, - _ => throw new InvalidOperationException() - }; - - return boundsForDir.Contains(modLocalPos); - } -} diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index cd76778ac6c..ae1724c3bf6 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -27,7 +27,6 @@ public sealed class ConstructionSystem : SharedConstructionSystem [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; private readonly Dictionary _ghosts = new(); @@ -206,7 +205,7 @@ public bool TrySpawnGhost( ghost = EntityManager.SpawnEntity("constructionghost", loc); var comp = EntityManager.GetComponent(ghost.Value); comp.Prototype = prototype; - _xformSystem.SetLocalRotation(ghost.Value, dir.ToAngle()); + EntityManager.GetComponent(ghost.Value).LocalRotation = dir.ToAngle(); _ghosts.Add(ghost.GetHashCode(), ghost.Value); var sprite = EntityManager.GetComponent(ghost.Value); sprite.Color = new Color(48, 255, 48, 128); diff --git a/Content.Client/Explosion/ExplosionOverlay.cs b/Content.Client/Explosion/ExplosionOverlay.cs index a8ffcd98bbc..2d8c15f1b9f 100644 --- a/Content.Client/Explosion/ExplosionOverlay.cs +++ b/Content.Client/Explosion/ExplosionOverlay.cs @@ -16,7 +16,6 @@ public sealed class ExplosionOverlay : Overlay [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IPrototypeManager _proto = default!; - private SharedTransformSystem _xformSystem = default!; public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV; @@ -25,7 +24,6 @@ public sealed class ExplosionOverlay : Overlay public ExplosionOverlay() { IoCManager.InjectDependencies(this); - _xformSystem = _entMan.System(); _shader = _proto.Index("unshaded").Instance(); } @@ -69,7 +67,7 @@ private void DrawExplosion( continue; var xform = xforms.GetComponent(gridId); - var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(xform); + var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms); gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2); drawHandle.SetTransform(worldMatrix); diff --git a/Content.Client/Fluids/PuddleOverlay.cs b/Content.Client/Fluids/PuddleOverlay.cs index 612ea42a251..ac6661cfdd8 100644 --- a/Content.Client/Fluids/PuddleOverlay.cs +++ b/Content.Client/Fluids/PuddleOverlay.cs @@ -13,7 +13,6 @@ public sealed class PuddleOverlay : Overlay [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; private readonly PuddleDebugOverlaySystem _debugOverlaySystem; - private readonly SharedTransformSystem _xformSystem; private readonly Color _heavyPuddle = new(0, 255, 255, 50); private readonly Color _mediumPuddle = new(0, 150, 255, 50); @@ -27,7 +26,6 @@ public PuddleOverlay() { IoCManager.InjectDependencies(this); _debugOverlaySystem = _entitySystemManager.GetEntitySystem(); - _xformSystem = _entitySystemManager.GetEntitySystem(); var cache = IoCManager.Resolve(); _font = new VectorFont(cache.GetResource("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8); } @@ -57,7 +55,7 @@ private void DrawWorld(in OverlayDrawArgs args) continue; var gridXform = xformQuery.GetComponent(gridId); - var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery); gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2); drawHandle.SetTransform(worldMatrix); @@ -90,7 +88,7 @@ private void DrawScreen(in OverlayDrawArgs args) continue; var gridXform = xformQuery.GetComponent(gridId); - var (_, _, matrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery); var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2); foreach (var debugOverlayData in _debugOverlaySystem.GetData(gridId)) diff --git a/Content.Client/GPS/UI/HandheldGpsStatusControl.cs b/Content.Client/GPS/UI/HandheldGpsStatusControl.cs index 8e5aac92f7d..de6a1031bad 100644 --- a/Content.Client/GPS/UI/HandheldGpsStatusControl.cs +++ b/Content.Client/GPS/UI/HandheldGpsStatusControl.cs @@ -13,13 +13,11 @@ public sealed class HandheldGpsStatusControl : Control private readonly RichTextLabel _label; private float _updateDif; private readonly IEntityManager _entMan; - private readonly SharedTransformSystem _xformSystem; public HandheldGpsStatusControl(Entity parent) { _parent = parent; _entMan = IoCManager.Resolve(); - _xformSystem = _entMan.System(); _label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } }; AddChild(_label); UpdateGpsDetails(); @@ -43,7 +41,7 @@ private void UpdateGpsDetails() var posText = "Error"; if (_entMan.TryGetComponent(_parent, out TransformComponent? transComp)) { - var pos = _xformSystem.GetMapCoordinates((_parent, transComp)); + var pos = transComp.MapPosition; var x = (int) pos.X; var y = (int) pos.Y; posText = $"({x}, {y})"; diff --git a/Content.Client/Gameplay/GameplayStateBase.cs b/Content.Client/Gameplay/GameplayStateBase.cs index e44adcfb2f3..bdbd69d1086 100644 --- a/Content.Client/Gameplay/GameplayStateBase.cs +++ b/Content.Client/Gameplay/GameplayStateBase.cs @@ -116,7 +116,7 @@ public IEnumerable GetClickableEntities(MapCoordinates coordinates) // Check the entities against whether or not we can click them var foundEntities = new List<(EntityUid, int, uint, float)>(entities.Count); var clickQuery = _entityManager.GetEntityQuery(); - var clickSystem = _entityManager.System(); + var xformQuery = _entityManager.GetEntityQuery(); // TODO: Smelly var eye = _eyeManager.CurrentEye; @@ -124,7 +124,7 @@ public IEnumerable GetClickableEntities(MapCoordinates coordinates) foreach (var entity in entities) { if (clickQuery.TryGetComponent(entity.Uid, out var component) && - clickSystem.CheckClick((entity.Uid, component, entity.Component, entity.Transform), coordinates.Position, eye, out var drawDepthClicked, out var renderOrder, out var bottom)) + component.CheckClick(entity.Component, entity.Transform, xformQuery, coordinates.Position, eye, out var drawDepthClicked, out var renderOrder, out var bottom)) { foundEntities.Add((entity.Uid, drawDepthClicked, renderOrder, bottom)); } diff --git a/Content.Client/Guidebook/GuidebookSystem.cs b/Content.Client/Guidebook/GuidebookSystem.cs index fabdd47ed35..cb13d4ca6e5 100644 --- a/Content.Client/Guidebook/GuidebookSystem.cs +++ b/Content.Client/Guidebook/GuidebookSystem.cs @@ -30,7 +30,6 @@ public sealed class GuidebookSystem : EntitySystem [Dependency] private readonly RgbLightControllerSystem _rgbLightControllerSystem = default!; [Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!; [Dependency] private readonly TagSystem _tags = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public event Action, List?, string?, bool, string?>? OnGuidebookOpen; public const string GuideEmbedTag = "GuideEmbeded"; @@ -99,9 +98,8 @@ private void OnGuidebookControlsTestGetAlternateVerbs(EntityUid uid, GuidebookCo { Act = () => { - var xform = Transform(uid); - if (xform.LocalRotation != Angle.Zero) - _xformSystem.SetLocalRotation(uid, xform.LocalRotation - Angle.FromDegrees(90), xform); + if (Transform(uid).LocalRotation != Angle.Zero) + Transform(uid).LocalRotation -= Angle.FromDegrees(90); }, Text = Loc.GetString("guidebook-monkey-unspin"), Priority = -9999, @@ -132,8 +130,7 @@ private void OnGuidebookControlsTestGetAlternateVerbs(EntityUid uid, GuidebookCo private void OnGuidebookControlsTestActivateInWorld(EntityUid uid, GuidebookControlsTestComponent component, ActivateInWorldEvent args) { - var xform = Transform(uid); - _xformSystem.SetLocalRotation(uid, xform.LocalRotation + Angle.FromDegrees(90), xform); + Transform(uid).LocalRotation += Angle.FromDegrees(90); } private void OnGuidebookControlsTestInteractHand(EntityUid uid, GuidebookControlsTestComponent component, InteractHandEvent args) diff --git a/Content.Client/HotPotato/HotPotatoSystem.cs b/Content.Client/HotPotato/HotPotatoSystem.cs index a9ded70acca..028a3b70d9f 100644 --- a/Content.Client/HotPotato/HotPotatoSystem.cs +++ b/Content.Client/HotPotato/HotPotatoSystem.cs @@ -22,7 +22,6 @@ public override void Update(float frameTime) { if (_timing.CurTime < comp.TargetTime) continue; - comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown); Spawn("HotPotatoEffect", _transform.GetMapCoordinates(uid).Offset(_random.NextVector2(0.25f))); } diff --git a/Content.Client/Interaction/DragDropSystem.cs b/Content.Client/Interaction/DragDropSystem.cs index 18b3381ba59..8baa4d15fe4 100644 --- a/Content.Client/Interaction/DragDropSystem.cs +++ b/Content.Client/Interaction/DragDropSystem.cs @@ -42,7 +42,6 @@ public sealed class DragDropSystem : SharedDragDropSystem [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; // how often to recheck possible targets (prevents calling expensive // check logic each update) @@ -251,7 +250,7 @@ private void StartDrag() dragSprite.DrawDepth = (int) DrawDepth.Overlays; if (!dragSprite.NoRotation) { - _xformSystem.SetWorldRotation(_dragShadow.Value, _xformSystem.GetWorldRotation(_draggedEntity.Value)); + Transform(_dragShadow.Value).WorldRotation = Transform(_draggedEntity.Value).WorldRotation; } // drag initiated @@ -552,7 +551,7 @@ public override void FrameUpdate(float frameTime) if (Exists(_dragShadow)) { var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition); - _xformSystem.SetWorldPosition(_dragShadow.Value, mousePos.Position); + Transform(_dragShadow.Value).WorldPosition = mousePos.Position; } } } diff --git a/Content.Client/Maps/GridDraggingSystem.cs b/Content.Client/Maps/GridDraggingSystem.cs index a5fa9743711..16357c89838 100644 --- a/Content.Client/Maps/GridDraggingSystem.cs +++ b/Content.Client/Maps/GridDraggingSystem.cs @@ -18,7 +18,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly InputSystem _inputSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public bool Enabled { get; set; } @@ -67,7 +66,7 @@ private void StopDragging() xform.MapID == _lastMousePosition.Value.MapId) { var tickTime = _gameTiming.TickPeriod; - var distance = _lastMousePosition.Value.Position - _xformSystem.GetWorldPosition(xform); + var distance = _lastMousePosition.Value.Position - xform.WorldPosition; RaiseNetworkEvent(new GridDragVelocityRequest() { Grid = GetNetEntity(_dragging.Value), @@ -102,7 +101,7 @@ public override void Update(float frameTime) if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid)) return; - StartDragging(gridUid, _xformSystem.GetInvWorldMatrix(gridUid).Transform(mousePos.Position)); + StartDragging(gridUid, Transform(gridUid).InvWorldMatrix.Transform(mousePos.Position)); } if (!TryComp(_dragging, out var xform)) @@ -117,11 +116,11 @@ public override void Update(float frameTime) return; } - var localToWorld = _xformSystem.GetWorldMatrix(xform).Transform(_localPosition); + var localToWorld = xform.WorldMatrix.Transform(_localPosition); if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) return; - var requestedGridOrigin = mousePos.Position - _xformSystem.GetWorldRotation(xform).RotateVec(_localPosition); + var requestedGridOrigin = mousePos.Position - xform.WorldRotation.RotateVec(_localPosition); _lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId); RaiseNetworkEvent(new GridDragRequestPosition() diff --git a/Content.Client/MouseRotator/MouseRotatorSystem.cs b/Content.Client/MouseRotator/MouseRotatorSystem.cs index 7e70477bb06..44e82053554 100644 --- a/Content.Client/MouseRotator/MouseRotatorSystem.cs +++ b/Content.Client/MouseRotator/MouseRotatorSystem.cs @@ -37,7 +37,7 @@ public override void Update(float frameTime) if (mapPos.MapId == MapId.Nullspace) return; - var angle = (mapPos.Position - _transform.GetMapCoordinates((player.Value, xform)).Position).ToWorldAngle(); + var angle = (mapPos.Position - xform.MapPosition.Position).ToWorldAngle(); var curRot = _transform.GetWorldRotation(xform); diff --git a/Content.Client/NPC/HTN/HTNOverlay.cs b/Content.Client/NPC/HTN/HTNOverlay.cs index 55b98046c81..ad173f3b29c 100644 --- a/Content.Client/NPC/HTN/HTNOverlay.cs +++ b/Content.Client/NPC/HTN/HTNOverlay.cs @@ -9,7 +9,6 @@ public sealed class HTNOverlay : Overlay { private readonly IEntityManager _entManager = default!; private readonly Font _font = default!; - private SharedTransformSystem? _xformSystem = null; public override OverlaySpace Space => OverlaySpace.ScreenSpace; @@ -24,10 +23,6 @@ protected override void Draw(in OverlayDrawArgs args) if (args.ViewportControl == null) return; - _xformSystem ??= _entManager.SystemOrNull(); - if (_xformSystem is null) - return; - var handle = args.ScreenHandle; foreach (var (comp, xform) in _entManager.EntityQuery(true)) @@ -35,7 +30,7 @@ protected override void Draw(in OverlayDrawArgs args) if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId) continue; - var worldPos = _xformSystem.GetWorldPosition(xform); + var worldPos = xform.WorldPosition; if (!args.WorldAABB.Contains(worldPos)) continue; diff --git a/Content.Client/NPC/NPCSteeringSystem.cs b/Content.Client/NPC/NPCSteeringSystem.cs index 4f4663e8c34..bb2145bce0c 100644 --- a/Content.Client/NPC/NPCSteeringSystem.cs +++ b/Content.Client/NPC/NPCSteeringSystem.cs @@ -89,10 +89,6 @@ public NPCSteeringOverlay(IEntityManager entManager) protected override void Draw(in OverlayDrawArgs args) { - var xformSystem = _entManager.SystemOrNull(); - if (xformSystem is null) - return; - foreach (var (comp, mover, xform) in _entManager.EntityQuery(true)) { if (xform.MapID != args.MapId) @@ -100,7 +96,7 @@ protected override void Draw(in OverlayDrawArgs args) continue; } - var (worldPos, worldRot) = xformSystem.GetWorldPositionRotation(xform); + var (worldPos, worldRot) = xform.GetWorldPositionRotation(); if (!args.WorldAABB.Contains(worldPos)) continue; diff --git a/Content.Client/NPC/PathfindingSystem.cs b/Content.Client/NPC/PathfindingSystem.cs index 6ff9e8d249d..548edd601ce 100644 --- a/Content.Client/NPC/PathfindingSystem.cs +++ b/Content.Client/NPC/PathfindingSystem.cs @@ -140,7 +140,6 @@ public sealed class PathfindingOverlay : Overlay private readonly IMapManager _mapManager; private readonly PathfindingSystem _system; private readonly MapSystem _mapSystem; - private readonly SharedTransformSystem _xformSystem; public override OverlaySpace Space => OverlaySpace.ScreenSpace | OverlaySpace.WorldSpace; @@ -162,7 +161,6 @@ public PathfindingOverlay( _mapManager = mapManager; _system = system; _mapSystem = mapSystem; - _xformSystem = _entManager.System(); _font = new VectorFont(cache.GetResource("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10); } @@ -201,7 +199,7 @@ private void DrawScreen(OverlayDrawArgs args, DrawingHandleScreen screenHandle) if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid, out var gridXform)) continue; - var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize)); foreach (var chunk in crumbs) @@ -285,7 +283,7 @@ private void DrawScreen(OverlayDrawArgs args, DrawingHandleScreen screenHandle) return; } - var invGridMatrix = _xformSystem.GetInvWorldMatrix(gridXform); + var invGridMatrix = gridXform.InvWorldMatrix; DebugPathPoly? nearest = null; var nearestDistance = float.MaxValue; @@ -358,7 +356,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) continue; } - var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); worldHandle.SetTransform(worldMatrix); var localAABB = invWorldMatrix.TransformBox(aabb); @@ -418,7 +416,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) !xformQuery.TryGetComponent(grid, out var gridXform)) continue; - var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); worldHandle.SetTransform(worldMatrix); var localAABB = invWorldMatrix.TransformBox(aabb); @@ -457,7 +455,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) !xformQuery.TryGetComponent(grid, out var gridXform)) continue; - var (_, _, worldMatrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); worldHandle.SetTransform(worldMatrix); var localAABB = invMatrix.TransformBox(aabb); @@ -516,7 +514,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) !xformQuery.TryGetComponent(grid, out var gridXform)) continue; - var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform); + var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); worldHandle.SetTransform(worldMatrix); var localAABB = invWorldMatrix.TransformBox(args.WorldBounds); @@ -543,7 +541,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) if (!_entManager.TryGetComponent(_entManager.GetEntity(node.GraphUid), out var graphXform)) continue; - worldHandle.SetTransform(_xformSystem.GetWorldMatrix(graphXform)); + worldHandle.SetTransform(graphXform.WorldMatrix); worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f)); } } @@ -567,7 +565,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) continue; matrix = graph; - worldHandle.SetTransform(_xformSystem.GetWorldMatrix(graphXform)); + worldHandle.SetTransform(graphXform.WorldMatrix); } worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f)); diff --git a/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkOverlay.cs b/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkOverlay.cs index 1cc66e2eac3..4fcdada8684 100644 --- a/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkOverlay.cs +++ b/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkOverlay.cs @@ -12,7 +12,6 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IRobustRandom _random = default!; private readonly DeviceListSystem _deviceListSystem; - private readonly SharedTransformSystem _xformSystem; public Dictionary Colors = new(); public EntityUid? Action; @@ -24,7 +23,6 @@ public NetworkConfiguratorLinkOverlay() IoCManager.InjectDependencies(this); _deviceListSystem = _entityManager.System(); - _xformSystem = _entityManager.System(); } protected override void Draw(in OverlayDrawArgs args) @@ -68,7 +66,7 @@ protected override void Draw(in OverlayDrawArgs args) continue; } - args.WorldHandle.DrawLine(_xformSystem.GetWorldPosition(sourceTransform), _xformSystem.GetWorldPosition(linkTransform), Colors[uid]); + args.WorldHandle.DrawLine(sourceTransform.WorldPosition, linkTransform.WorldPosition, Colors[uid]); } } } diff --git a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs index b43b7542e62..f10eb9ed8b1 100644 --- a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs +++ b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs @@ -20,7 +20,6 @@ public sealed class NodeVisualizationOverlay : Overlay private readonly IMapManager _mapManager; private readonly IInputManager _inputManager; private readonly IEntityManager _entityManager; - private readonly SharedTransformSystem _xformSystem; private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new(); private readonly Dictionary>> _gridIndex = new (); @@ -47,7 +46,6 @@ public NodeVisualizationOverlay( _mapManager = mapManager; _inputManager = inputManager; _entityManager = entityManager; - _xformSystem = _entityManager.System(); _font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12); } @@ -148,7 +146,7 @@ private void DrawWorld(in OverlayDrawArgs overlayDrawArgs) foreach (var (gridId, gridDict) in _gridIndex) { var grid = _mapManager.GetGrid(gridId); - var (_, _, worldMatrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridId); + var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent(gridId).GetWorldPositionRotationMatrixWithInv(); var lCursorBox = invMatrix.TransformBox(cursorBox); foreach (var (pos, list) in gridDict) diff --git a/Content.Client/Outline/TargetOutlineSystem.cs b/Content.Client/Outline/TargetOutlineSystem.cs index b6cb06091ac..2a6867f51f5 100644 --- a/Content.Client/Outline/TargetOutlineSystem.cs +++ b/Content.Client/Outline/TargetOutlineSystem.cs @@ -22,7 +22,6 @@ public sealed class TargetOutlineSystem : EntitySystem [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private bool _enabled = false; @@ -165,8 +164,8 @@ private void HighlightTargets() valid = _interactionSystem.InRangeUnobstructed(player, entity, Range); else if (Range >= 0) { - var origin = _xformSystem.GetWorldPosition(player); - var target = _xformSystem.GetWorldPosition(entity); + var origin = Transform(player).WorldPosition; + var target = Transform(entity).WorldPosition; valid = (origin - target).LengthSquared() <= Range; } diff --git a/Content.Client/Pinpointer/NavMapSystem.cs b/Content.Client/Pinpointer/NavMapSystem.cs index b15c1add308..bd7dfc1117f 100644 --- a/Content.Client/Pinpointer/NavMapSystem.cs +++ b/Content.Client/Pinpointer/NavMapSystem.cs @@ -58,7 +58,6 @@ protected override void Draw(in OverlayDrawArgs args) { var query = _entManager.GetEntityQuery(); var xformQuery = _entManager.GetEntityQuery(); - var xformSystem = _entManager.System(); var scale = Matrix3.CreateScale(new Vector2(1f, 1f)); _grids.Clear(); @@ -70,7 +69,7 @@ protected override void Draw(in OverlayDrawArgs args) continue; // TODO: Faster helper method - var (_, _, matrix, invMatrix) = xformSystem.GetWorldPositionRotationMatrixWithInv(xform); + var (_, _, matrix, invMatrix) = xform.GetWorldPositionRotationMatrixWithInv(); var localAABB = invMatrix.TransformBox(args.WorldBounds); Matrix3.Multiply(in scale, in matrix, out var matty); diff --git a/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs b/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs index 57840f55e79..adc535b2684 100644 --- a/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs +++ b/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs @@ -14,7 +14,6 @@ public sealed class RadiationPulseOverlay : Overlay [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - private SharedTransformSystem? _xformSystem = null; private const float MaxDist = 15.0f; @@ -73,9 +72,7 @@ protected override void Draw(in OverlayDrawArgs args) //Queries all pulses on the map and either adds or removes them from the list of rendered pulses based on whether they should be drawn (in range? on the same z-level/map? pulse entity still exists?) private void RadiationQuery(IEye? currentEye) { - _xformSystem ??= _entityManager.SystemOrNull(); - - if (_xformSystem is null || currentEye is null) + if (currentEye == null) { _pulses.Clear(); return; @@ -94,7 +91,7 @@ private void RadiationQuery(IEye? currentEye) ( _baseShader.Duplicate(), new RadiationShaderInstance( - _xformSystem.GetMapCoordinates(pulseEntity), + _entityManager.GetComponent(pulseEntity).MapPosition, pulse.VisualRange, pulse.StartTime, pulse.VisualDuration @@ -112,7 +109,7 @@ private void RadiationQuery(IEye? currentEye) _entityManager.TryGetComponent(pulseEntity, out RadiationPulseComponent? pulse)) { var shaderInstance = _pulses[pulseEntity]; - shaderInstance.instance.CurrentMapCoords = _xformSystem.GetMapCoordinates(pulseEntity); + shaderInstance.instance.CurrentMapCoords = _entityManager.GetComponent(pulseEntity).MapPosition; shaderInstance.instance.Range = pulse.VisualRange; } else { _pulses[pulseEntity].shd.Dispose(); diff --git a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs index 9baec2eb58a..2ee7e30ec9a 100644 --- a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs +++ b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs @@ -126,18 +126,18 @@ public void SetSpectatorPosition(SpectatorData data) if (data.Local != null && data.Local.Value.Coords.IsValid(EntityManager)) { - var (newUid, newXform) = SpawnSpectatorGhost(data.Local.Value.Coords, false); - _transform.SetLocalRotation(newUid, data.Local.Value.Rot, newXform); + var newXform = SpawnSpectatorGhost(data.Local.Value.Coords, false); + newXform.LocalRotation = data.Local.Value.Rot; } else if (data.World != null && data.World.Value.Coords.IsValid(EntityManager)) { - var (newUid, newXform) = SpawnSpectatorGhost(data.World.Value.Coords, true); - _transform.SetLocalRotation(newUid, data.World.Value.Rot, newXform); + var newXform = SpawnSpectatorGhost(data.World.Value.Coords, true); + newXform.LocalRotation = data.World.Value.Rot; } else if (TryFindFallbackSpawn(out var coords)) { - var (newUid, newXform) = SpawnSpectatorGhost(coords, true); - _transform.SetLocalRotation(newUid, 0, newXform); + var newXform = SpawnSpectatorGhost(coords, true); + newXform.LocalRotation = 0; } else { diff --git a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs index 1bab0436354..27b33b84c52 100644 --- a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs +++ b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs @@ -55,7 +55,7 @@ public void SpectateEntity(EntityUid target) RemComp(old.Value); } - public Entity SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach) + public TransformComponent SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach) { var old = _player.LocalEntity; var session = _player.GetSessionById(DefaultUser); @@ -83,7 +83,7 @@ public Entity SpawnSpectatorGhost(EntityCoordinates coords, _stateMan.RequestStateChange(); _spectatorData = GetSpectatorData(); - return (ent, xform); + return xform; } private void SpectateCommand(IConsoleShell shell, string argStr, string[] args) diff --git a/Content.Client/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs b/Content.Client/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs index 9e6c475176c..7086fd05411 100644 --- a/Content.Client/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs +++ b/Content.Client/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs @@ -58,7 +58,6 @@ private void OnShuttlePosMessage(EmergencyShuttlePositionMessage ev) public sealed class EmergencyShuttleOverlay : Overlay { private IEntityManager _entManager; - private SharedTransformSystem _xformSystem; public override OverlaySpace Space => OverlaySpace.WorldSpace; @@ -68,14 +67,13 @@ public sealed class EmergencyShuttleOverlay : Overlay public EmergencyShuttleOverlay(IEntityManager entManager) { _entManager = entManager; - _xformSystem = _entManager.System(); } protected override void Draw(in OverlayDrawArgs args) { if (Position == null || !_entManager.TryGetComponent(StationUid, out var xform)) return; - args.WorldHandle.SetTransform(_xformSystem.GetWorldMatrix(xform)); + args.WorldHandle.SetTransform(xform.WorldMatrix); args.WorldHandle.DrawRect(Position.Value, Color.Red.WithAlpha(100)); args.WorldHandle.SetTransform(Matrix3.Identity); } diff --git a/Content.Client/Shuttles/UI/DockingControl.cs b/Content.Client/Shuttles/UI/DockingControl.cs index 245eaba454e..c0ddeff86c2 100644 --- a/Content.Client/Shuttles/UI/DockingControl.cs +++ b/Content.Client/Shuttles/UI/DockingControl.cs @@ -18,7 +18,6 @@ public class DockingControl : Control { private readonly IEntityManager _entManager; private readonly IMapManager _mapManager; - private readonly SharedTransformSystem _xformSystem; private float _range = 8f; private float _rangeSquared = 0f; @@ -51,7 +50,6 @@ public DockingControl() { _entManager = IoCManager.Resolve(); _mapManager = IoCManager.Resolve(); - _xformSystem = _entManager.System(); _rangeSquared = _range * _range; MinSize = new Vector2(SizeFull, SizeFull); } @@ -145,8 +143,8 @@ protected override void Draw(DrawingHandleScreen handle) ScalePosition(rotation.Transform(new Vector2(0.5f, -0.5f)))), Color.Green); // Draw nearby grids - var worldPos = _xformSystem.GetWorldMatrix(gridXform).Transform(Coordinates.Value.Position); - var gridInvMatrix = _xformSystem.GetInvWorldMatrix(gridXform); + var worldPos = gridXform.WorldMatrix.Transform(Coordinates.Value.Position); + var gridInvMatrix = gridXform.InvWorldMatrix; Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix); // TODO: Getting some overdraw so need to fix that. @@ -164,7 +162,7 @@ protected override void Draw(DrawingHandleScreen handle) if (!_entManager.TryGetComponent(grid, out var gridFixtures)) continue; - var gridMatrix = _xformSystem.GetWorldMatrix(grid); + var gridMatrix = xformQuery.GetComponent(grid).WorldMatrix; Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty); diff --git a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs index 4e1a2662f39..d67227549a9 100644 --- a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs +++ b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs @@ -21,7 +21,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow, { private readonly IEntityManager _entManager; private readonly IGameTiming _timing; - private SharedTransformSystem? _xformSystem = null; private EntityUid? _shuttleEntity; @@ -310,9 +309,7 @@ protected override void Draw(DrawingHandleScreen handle) { base.Draw(handle); - _xformSystem ??= _entManager.SystemOrNull(); - if (_xformSystem is null || - !_entManager.TryGetComponent(_shuttleEntity, out var gridBody) || + if (!_entManager.TryGetComponent(_shuttleEntity, out var gridBody) || !_entManager.TryGetComponent(_shuttleEntity, out var gridXform)) { return; @@ -325,7 +322,7 @@ protected override void Draw(DrawingHandleScreen handle) FTLTimer.Text = GetFTLText(); - var (_, worldRot, worldMatrix) = _xformSystem.GetWorldPositionRotationMatrix(gridXform); + var (_, worldRot, worldMatrix) = gridXform.GetWorldPositionRotationMatrix(); var worldPos = worldMatrix.Transform(gridBody.LocalCenter); // Get the positive reduced angle. diff --git a/Content.Client/Sprite/SpriteFadeSystem.cs b/Content.Client/Sprite/SpriteFadeSystem.cs index 011a7cd9491..dda3a6c948e 100644 --- a/Content.Client/Sprite/SpriteFadeSystem.cs +++ b/Content.Client/Sprite/SpriteFadeSystem.cs @@ -15,7 +15,6 @@ public sealed class SpriteFadeSystem : EntitySystem [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IStateManager _stateManager = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private readonly HashSet _comps = new(); @@ -49,7 +48,7 @@ _stateManager.CurrentState is GameplayState state && spriteQuery.TryGetComponent(player, out var playerSprite)) { var fadeQuery = GetEntityQuery(); - var mapPos = _xformSystem.GetMapCoordinates((player.Value, playerXform)); + var mapPos = playerXform.MapPosition; // Also want to handle large entities even if they may not be clickable. foreach (var ent in state.GetClickableEntities(mapPos)) diff --git a/Content.Client/Stealth/StealthSystem.cs b/Content.Client/Stealth/StealthSystem.cs index b34de23c26c..b60ffc2a408 100644 --- a/Content.Client/Stealth/StealthSystem.cs +++ b/Content.Client/Stealth/StealthSystem.cs @@ -10,7 +10,6 @@ namespace Content.Client.Stealth; public sealed class StealthSystem : SharedStealthSystem { [Dependency] private readonly IPrototypeManager _protoMan = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private ShaderInstance _shader = default!; @@ -80,7 +79,7 @@ private void OnShaderRender(EntityUid uid, StealthComponent component, BeforePos if (!parent.IsValid()) return; // should never happen, but lets not kill the client. var parentXform = Transform(parent); - var reference = args.Viewport.WorldToLocal(_xformSystem.GetWorldPosition(parentXform)); + var reference = args.Viewport.WorldToLocal(parentXform.WorldPosition); reference.X = -reference.X; var visibility = GetVisibility(uid, component); diff --git a/Content.Client/Tabletop/TabletopSystem.cs b/Content.Client/Tabletop/TabletopSystem.cs index 1002bbe6174..696c1455e0c 100644 --- a/Content.Client/Tabletop/TabletopSystem.cs +++ b/Content.Client/Tabletop/TabletopSystem.cs @@ -27,7 +27,6 @@ public sealed class TabletopSystem : SharedTabletopSystem [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly AppearanceSystem _appearance = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; // Time in seconds to wait until sending the location of a dragged entity to the server again private const float Delay = 1f / 10; // 10 Hz @@ -101,7 +100,7 @@ public override void FrameUpdate(float frameTime) if (clampedCoords.Equals(MapCoordinates.Nullspace)) return; // Move the entity locally every update - _xformSystem.SetWorldPosition(_draggedEntity.Value, clampedCoords.Position); + EntityManager.GetComponent(_draggedEntity.Value).WorldPosition = clampedCoords.Position; // Increment total time passed _timePassed += frameTime; @@ -259,7 +258,7 @@ private void StopDragging(bool broadcast = true) // Set the dragging player on the component to noone if (broadcast && _draggedEntity != null && EntityManager.HasComponent(_draggedEntity.Value)) { - RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transforms.GetMapCoordinates(_draggedEntity.Value), GetNetEntity(_table!.Value))); + RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value))); RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false)); } diff --git a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs index 61decdabb33..bba4d437e3d 100644 --- a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs +++ b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs @@ -62,7 +62,6 @@ public sealed class ChatUIController : UIController [UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default; [UISystemDependency] private readonly ChatSystem? _chatSys = default; [UISystemDependency] private readonly PsionicChatUpdateSystem? _psionic = default!; // backmen: psionic - [UISystemDependency] private readonly SharedTransformSystem? _xformSystem = default!; [ValidatePrototypeId] private const string ChatNamePalette = "ChatNames"; @@ -572,7 +571,7 @@ public override void FrameUpdate(FrameEventArgs delta) private void UpdateQueuedSpeechBubbles(FrameEventArgs delta) { // Update queued speech bubbles. - if (_queuedSpeechBubbles.Count == 0 || _examine is null || _xformSystem is null) + if (_queuedSpeechBubbles.Count == 0 || _examine == null) { return; } @@ -610,7 +609,7 @@ private void UpdateQueuedSpeechBubbles(FrameEventArgs delta) var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data) => uid == data.compOwner || uid == data.attachedEntity; var playerPos = player != null - ? _xformSystem.GetMapCoordinates(player.Value) + ? EntityManager.GetComponent(player.Value).MapPosition : MapCoordinates.Nullspace; var occluded = player != null && _examine.IsOccluded(player.Value); @@ -629,7 +628,7 @@ private void UpdateQueuedSpeechBubbles(FrameEventArgs delta) continue; } - var otherPos = _xformSystem.GetMapCoordinates(ent); + var otherPos = EntityManager.GetComponent(ent).MapPosition; if (occluded && !ExamineSystemShared.InRangeUnOccluded( playerPos, diff --git a/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs b/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs index 2358e87a7e7..d117043f425 100644 --- a/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs +++ b/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs @@ -3,7 +3,6 @@ using Content.Shared.CCVar; using Robust.Client.Graphics; using Robust.Client.Player; -using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controllers; using Robust.Shared.Configuration; using Robust.Shared.Timing; @@ -16,7 +15,6 @@ public sealed class ViewportUIController : UIController [Dependency] private readonly IPlayerManager _playerMan = default!; [Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; - [UISystemDependency] private readonly SharedTransformSystem? _xformSystem = default!; public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15); public const int ViewportHeight = 15; @@ -89,7 +87,7 @@ public override void FrameUpdate(FrameEventArgs e) _entMan.TryGetComponent(ent, out EyeComponent? eye); if (eye?.Eye == _eyeManager.CurrentEye - && (_xformSystem is null || _xformSystem.GetWorldPosition(ent.Value) == default)) + && _entMan.GetComponent(ent.Value).WorldPosition == default) return; // nothing to worry about, the player is just in null space... actually that is probably a problem? // Currently, this shouldn't happen. This likely happened because the main eye was set to null. When this diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index d515006cd1f..329a8977a68 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -25,7 +25,6 @@ public sealed class VerbSystem : SharedVerbSystem [Dependency] private readonly IStateManager _stateManager = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; /// /// When a user right clicks somewhere, how large is the box we use to get entities for the context menu? @@ -141,7 +140,8 @@ public bool TryGetEntityMenuEntities(MapCoordinates targetPos, [NotNullWhen(true // Remove any entities that do not have LOS if ((visibility & MenuVisibility.NoFov) == 0) { - var playerPos = _xformSystem.GetMapCoordinates(player.Value); + var xformQuery = GetEntityQuery(); + var playerPos = xformQuery.GetComponent(player.Value).MapPosition; for (var i = entities.Count - 1; i >= 0; i--) { @@ -149,7 +149,7 @@ public bool TryGetEntityMenuEntities(MapCoordinates targetPos, [NotNullWhen(true if (!ExamineSystemShared.InRangeUnOccluded( playerPos, - _xformSystem.GetMapCoordinates(entity), + xformQuery.GetComponent(entity).MapPosition, ExamineSystemShared.ExamineRange, null)) { diff --git a/Content.Client/Weapons/Melee/MeleeArcOverlay.cs b/Content.Client/Weapons/Melee/MeleeArcOverlay.cs index e25242d7295..dbd68c15e24 100644 --- a/Content.Client/Weapons/Melee/MeleeArcOverlay.cs +++ b/Content.Client/Weapons/Melee/MeleeArcOverlay.cs @@ -20,7 +20,6 @@ public sealed class MeleeArcOverlay : Overlay private readonly IPlayerManager _playerManager; private readonly MeleeWeaponSystem _melee; private readonly SharedCombatModeSystem _combatMode; - private readonly SharedTransformSystem _xformSystem; public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV; @@ -32,7 +31,6 @@ public MeleeArcOverlay(IEntityManager entManager, IEyeManager eyeManager, IInput _playerManager = playerManager; _melee = melee; _combatMode = combatMode; - _xformSystem = _entManager.System(); } protected override void Draw(in OverlayDrawArgs args) @@ -54,7 +52,7 @@ protected override void Draw(in OverlayDrawArgs args) if (mapPos.MapId != args.MapId) return; - var playerPos = _xformSystem.GetMapCoordinates((player.Value, xform)); + var playerPos = xform.MapPosition; if (mapPos.MapId != playerPos.MapId) return; diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs index 132ec0a9b97..0f2f98e7640 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs @@ -80,7 +80,7 @@ public override void DoLunge(EntityUid user, EntityUid weapon, Angle angle, Vect TransformSystem.AttachToGridOrMap(animationUid, xform); var worldPos = mapPos + (mapRot - userXform.LocalRotation).RotateVec(localPos); var newLocalPos = TransformSystem.GetInvWorldMatrix(xform.ParentUid).Transform(worldPos); - TransformSystem.SetLocalPositionNoLerp(animationUid, newLocalPos, xform); + TransformSystem.SetLocalPositionNoLerp(xform, newLocalPos); if (arcComponent.Fadeout) _animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey); break; diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 4c5b5cad027..641d56d3d14 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -136,7 +136,7 @@ public override void Update(float frameTime) // Light attack if (useDown == BoundKeyState.Down) { - var attackerPos = TransformSystem.GetMapCoordinates(entity); + var attackerPos = Transform(entity).MapPosition; if (mousePos.MapId != attackerPos.MapId || (attackerPos.Position - mousePos.Position).Length() > weapon.Range) diff --git a/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs b/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs index c7f8cf647b9..62df764ae50 100644 --- a/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs +++ b/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs @@ -18,7 +18,6 @@ public sealed class GunSpreadOverlay : Overlay private readonly IInputManager _input; private readonly IPlayerManager _player; private readonly GunSystem _guns; - private readonly SharedTransformSystem _xforms; public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system) { @@ -28,7 +27,6 @@ public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGame _timing = timing; _player = player; _guns = system; - _xforms = entManager.System(); } protected override void Draw(in OverlayDrawArgs args) @@ -43,7 +41,7 @@ protected override void Draw(in OverlayDrawArgs args) return; } - var mapPos = _xforms.GetMapCoordinates((player.Value, xform)); + var mapPos = xform.MapPosition; if (mapPos.MapId == MapId.Nullspace) return; diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index 84205fb005a..9e50cab3e10 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -99,7 +99,8 @@ private void OnHitscan(HitscanEvent ev) var ent = Spawn(HitscanProto, coords); var sprite = Comp(ent); - TransformSystem.SetLocalRotation(ent, a.angle); + var xform = Transform(ent); + xform.LocalRotation = a.angle; sprite[EffectLayers.Unshaded].AutoAnimated = false; sprite.LayerSetSprite(EffectLayers.Unshaded, rsi); sprite.LayerSetState(EffectLayers.Unshaded, rsi.RsiState); @@ -277,11 +278,9 @@ protected override void CreateEffect(EntityUid uid, MuzzleFlashEvent message, En var ent = Spawn(message.Prototype, coordinates); var effectXform = Transform(ent); - TransformSystem.SetLocalPositionRotation(ent, + TransformSystem.SetLocalPositionRotation(effectXform, effectXform.LocalPosition + new Vector2(0f, -0.5f), - effectXform.LocalRotation - MathF.PI / 2, - effectXform - ); + effectXform.LocalRotation - MathF.PI / 2); var lifetime = 0.4f; diff --git a/Content.IntegrationTests/Tests/ClickableTest.cs b/Content.IntegrationTests/Tests/ClickableTest.cs index 16860931e1e..76085381852 100644 --- a/Content.IntegrationTests/Tests/ClickableTest.cs +++ b/Content.IntegrationTests/Tests/ClickableTest.cs @@ -53,7 +53,6 @@ public async Task Test(string prototype, float clickPosX, float clickPosY, var eyeManager = client.ResolveDependency(); var spriteQuery = clientEntManager.GetEntityQuery(); var xformQuery = clientEntManager.GetEntityQuery(); - var clickSystem = clientEntManager.System(); var eye = client.ResolveDependency().CurrentEye; var testMap = await pair.CreateTestMap(); @@ -83,7 +82,7 @@ await client.WaitPost(() => var pos = clientEntManager.System().GetWorldPosition(clientEnt); var clickable = clientEntManager.GetComponent(clientEnt); - hit = clickSystem.CheckClick((clientEnt, clickable, sprite, xformQuery.GetComponent(clientEnt)), new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _); + hit = clickable.CheckClick(sprite, xformQuery.GetComponent(clientEnt), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _); }); await server.WaitPost(() => diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index cc66f9369fc..976fc2eceb5 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -171,7 +171,8 @@ await server.WaitAssertion(() => human = entityManager.SpawnEntity("HumanDisposalDummy", coordinates); wrench = entityManager.SpawnEntity("WrenchDummy", coordinates); disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates); - disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", xformSystem.GetMapCoordinates(disposalUnit)); + disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", + entityManager.GetComponent(disposalUnit).MapPosition); // Test for components existing unitUid = disposalUnit; diff --git a/Content.IntegrationTests/Tests/Hands/HandTests.cs b/Content.IntegrationTests/Tests/Hands/HandTests.cs index 874fd1c3dcc..fdcd7f9096f 100644 --- a/Content.IntegrationTests/Tests/Hands/HandTests.cs +++ b/Content.IntegrationTests/Tests/Hands/HandTests.cs @@ -24,7 +24,6 @@ public async Task TestPickupDrop() var playerMan = server.ResolveDependency(); var mapMan = server.ResolveDependency(); var sys = entMan.System(); - var xfm = entMan.System(); var data = await pair.CreateTestMap(); await pair.RunTicksSync(5); @@ -36,7 +35,7 @@ await server.WaitPost(() => { player = playerMan.Sessions.First().AttachedEntity!.Value; var xform = entMan.GetComponent(player); - item = entMan.SpawnEntity("Crowbar", xfm.GetMapCoordinates(xform)); + item = entMan.SpawnEntity("Crowbar", xform.MapPosition); hands = entMan.GetComponent(player); sys.TryPickup(player, item, hands.ActiveHand!); }); diff --git a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs index 04ee98f8106..b8828763a23 100644 --- a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs +++ b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs @@ -32,7 +32,6 @@ public async Task EntityEntityTest() var sEntities = server.ResolveDependency(); var mapManager = server.ResolveDependency(); var conSystem = sEntities.EntitySysManager.GetEntitySystem(); - var xfmSystem = sEntities.EntitySysManager.GetEntitySystem(); EntityUid origin = default; EntityUid other = default; @@ -46,7 +45,7 @@ await server.WaitAssertion(() => origin = sEntities.SpawnEntity(HumanId, coordinates); other = sEntities.SpawnEntity(HumanId, coordinates); conSystem.EnsureContainer(other, "InRangeUnobstructedTestOtherContainer"); - mapCoordinates = xfmSystem.GetMapCoordinates(other); + mapCoordinates = sEntities.GetComponent(other).MapPosition; }); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/Power/PowerTest.cs b/Content.IntegrationTests/Tests/Power/PowerTest.cs index c18e12e16ea..d4e2cde9b0d 100644 --- a/Content.IntegrationTests/Tests/Power/PowerTest.cs +++ b/Content.IntegrationTests/Tests/Power/PowerTest.cs @@ -626,7 +626,6 @@ public async Task TestFullBattery() var entityManager = server.ResolveDependency(); var gameTiming = server.ResolveDependency(); var batterySys = entityManager.System(); - var xformSys = entityManager.System(); PowerConsumerComponent consumer = default!; PowerSupplierComponent supplier = default!; PowerNetworkBatteryComponent netBattery = default!; @@ -645,7 +644,7 @@ await server.WaitAssertion(() => } var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180)); + entityManager.GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); @@ -704,7 +703,6 @@ public async Task TestFullBatteryEfficiencyPassThrough() var entityManager = server.ResolveDependency(); var gameTiming = server.ResolveDependency(); var batterySys = entityManager.System(); - var xformSys = entityManager.System(); PowerConsumerComponent consumer = default!; PowerSupplierComponent supplier = default!; PowerNetworkBatteryComponent netBattery = default!; @@ -723,7 +721,7 @@ await server.WaitAssertion(() => } var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180)); + entityManager.GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); @@ -781,7 +779,6 @@ public async Task TestFullBatteryEfficiencyDemandPassThrough() var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); var batterySys = entityManager.System(); - var xformSys = entityManager.System(); PowerConsumerComponent consumer1 = default!; PowerConsumerComponent consumer2 = default!; PowerSupplierComponent supplier = default!; @@ -808,7 +805,7 @@ await server.WaitAssertion(() => entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); - xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180)); + entityManager.GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt1 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1)); var batteryEnt2 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3)); @@ -976,7 +973,6 @@ public async Task TestBatteriesProportional() var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); var batterySys = entityManager.System(); - var xformSys = entityManager.System(); PowerConsumerComponent consumer1 = default!; PowerConsumerComponent consumer2 = default!; PowerSupplierComponent supplier = default!; @@ -1003,7 +999,7 @@ await server.WaitAssertion(() => entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); - xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180)); + entityManager.GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt1 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1)); var batteryEnt2 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3)); @@ -1064,7 +1060,6 @@ public async Task TestBatteryEngineCut() var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); var batterySys = entityManager.System(); - var xformSys = entityManager.System(); PowerConsumerComponent consumer = default!; PowerSupplierComponent supplier = default!; PowerNetworkBatteryComponent netBattery = default!; @@ -1082,7 +1077,7 @@ await server.WaitPost(() => } var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180)); + entityManager.GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); @@ -1149,7 +1144,6 @@ public async Task TestTerminalNodeGroups() var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); var nodeContainer = entityManager.System(); - var xformSys = entityManager.System(); CableNode leftNode = default!; CableNode rightNode = default!; Node batteryInput = default!; @@ -1172,7 +1166,7 @@ await server.WaitAssertion(() => var rightEnt = entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3)); var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180)); + entityManager.GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var battery = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var batteryNodeContainer = entityManager.GetComponent(battery); diff --git a/Content.IntegrationTests/Tests/Shuttle/DockTest.cs b/Content.IntegrationTests/Tests/Shuttle/DockTest.cs index bf90ccc8ef8..b6fc273570a 100644 --- a/Content.IntegrationTests/Tests/Shuttle/DockTest.cs +++ b/Content.IntegrationTests/Tests/Shuttle/DockTest.cs @@ -60,7 +60,8 @@ await server.WaitAssertion(() => mapSystem.SetTiles(grid1.Owner, grid1.Comp, tiles1); var dock1 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid1Ent, dock1Pos)); - xformSystem.SetLocalRotation(dock1, dock1Angle); + var dock1Xform = entManager.GetComponent(dock1); + dock1Xform.LocalRotation = dock1Angle; var tiles2 = new List<(Vector2i Index, Tile Tile)>() { @@ -73,7 +74,8 @@ await server.WaitAssertion(() => mapSystem.SetTiles(grid2.Owner, grid2.Comp, tiles2); var dock2 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid2Ent, dock2Pos)); - xformSystem.SetLocalRotation(dock2, dock2Angle); + var dock2Xform = entManager.GetComponent(dock2); + dock2Xform.LocalRotation = dock2Angle; var config = dockingSystem.GetDockingConfig(grid1Ent, grid2Ent); diff --git a/Content.Server/Administration/Commands/AGhost.cs b/Content.Server/Administration/Commands/AGhost.cs index ed9b211ca98..d541b1c8840 100644 --- a/Content.Server/Administration/Commands/AGhost.cs +++ b/Content.Server/Administration/Commands/AGhost.cs @@ -47,7 +47,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) ? _entities.GetComponent(player.AttachedEntity.Value).Coordinates : EntitySystem.Get().GetObserverSpawnPoint(); var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates); - _entities.System().AttachToGridOrMap(ghost); + _entities.GetComponent(ghost).AttachToGridOrMap(); if (canReturn) { diff --git a/Content.Server/Administration/Commands/ExplosionCommand.cs b/Content.Server/Administration/Commands/ExplosionCommand.cs index 94185a0248c..56ed78b2e2e 100644 --- a/Content.Server/Administration/Commands/ExplosionCommand.cs +++ b/Content.Server/Administration/Commands/ExplosionCommand.cs @@ -105,7 +105,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) if (args.Length > 4) coords = new MapCoordinates(new Vector2(x, y), xform.MapID); else - coords = entMan.System().GetMapCoordinates(xform); + coords = xform.MapPosition; } ExplosionPrototype? type; diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index 0b15b2687ae..0d6da0d9937 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -118,10 +118,8 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) } var xform = _entManager.GetComponent(playerEntity); - var xformSystem = _entManager.System(); - - xformSystem.SetCoordinates((playerEntity, xform, _entManager.GetComponent(playerEntity)), coords); - xformSystem.AttachToGridOrMap(playerEntity, xform); + xform.Coordinates = coords; + xform.AttachToGridOrMap(); if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics)) { _entManager.System().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics); diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs index ad939b4e22d..158fdcf9b44 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs @@ -103,7 +103,7 @@ private void AddSmiteVerbs(GetVerbsEvent args) Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")), Act = () => { - var coords = _transformSystem.GetMapCoordinates(args.Target); + var coords = Transform(args.Target).MapPosition; Timer.Spawn(_gameTiming.TickPeriod, () => _explosionSystem.QueueExplosion(coords, ExplosionSystem.DefaultExplosionPrototypeId, 4, 1, 2, maxTileBreak: 0), // it gibs, damage doesn't need to be high. @@ -134,8 +134,8 @@ private void AddSmiteVerbs(GetVerbsEvent args) Filter.PvsExcept(args.Target), true, PopupType.MediumCaution); var board = Spawn("ChessBoard", xform.Coordinates); var session = _tabletopSystem.EnsureSession(Comp(board)); - _transformSystem.SetCoordinates((args.Target, xform, MetaData(args.Target)), EntityCoordinates.FromMap(_mapManager, session.Position)); - _transformSystem.SetWorldRotation(xform, Angle.Zero); + xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position); + xform.WorldRotation = Angle.Zero; }, Impact = LogImpact.Extreme, Message = Loc.GetString("admin-smite-chess-dimension-description") @@ -407,7 +407,7 @@ private void AddSmiteVerbs(GetVerbsEvent args) { var xform = Transform(args.Target); var fixtures = Comp(args.Target); - _xformSystem.Unanchor(args.Target, xform); // Just in case. + xform.Anchored = false; // Just in case. _physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics); _physics.SetBodyStatus(physics, BodyStatus.InAir); _physics.WakeBody(args.Target, manager: fixtures, body: physics); @@ -441,7 +441,7 @@ private void AddSmiteVerbs(GetVerbsEvent args) { var xform = Transform(args.Target); var fixtures = Comp(args.Target); - _xformSystem.Unanchor(args.Target, xform); // Just in case. + xform.Anchored = false; // Just in case. _physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics); _physics.SetBodyStatus(physics, BodyStatus.InAir); diff --git a/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs b/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs index 8919822228a..87c0ba4a4ee 100644 --- a/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs @@ -40,7 +40,7 @@ private void OnPulse(EntityUid uid, BluespaceAnomalyComponent component, ref Ano foreach (var ent in allEnts) { if (xformQuery.TryGetComponent(ent, out var xf)) - coords.Add(_xform.GetWorldPosition(xf)); + coords.Add(xf.MapPosition.Position); } _random.Shuffle(coords); diff --git a/Content.Server/Anomaly/Effects/ElectricityAnomalySystem.cs b/Content.Server/Anomaly/Effects/ElectricityAnomalySystem.cs index 85470d17b1a..8b5a72449f3 100644 --- a/Content.Server/Anomaly/Effects/ElectricityAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/ElectricityAnomalySystem.cs @@ -61,7 +61,7 @@ public override void Update(float frameTime) var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity); var duration = elec.MaxElectrocuteDuration * anom.Severity; - foreach (var (ent, comp) in _lookup.GetEntitiesInRange(_transform.GetMapCoordinates((uid, xform)), range)) + foreach (var (ent, comp) in _lookup.GetEntitiesInRange(xform.MapPosition, range)) { _electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true); } diff --git a/Content.Server/Anomaly/Effects/InjectionAnomalySystem.cs b/Content.Server/Anomaly/Effects/InjectionAnomalySystem.cs index 721f23c3aee..2bef32e3228 100644 --- a/Content.Server/Anomaly/Effects/InjectionAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/InjectionAnomalySystem.cs @@ -16,7 +16,6 @@ public sealed class InjectionAnomalySystem : EntitySystem { [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private EntityQuery _injectableQuery; @@ -46,7 +45,7 @@ private void PulseScalableEffect(Entity entity, float //We get all the entity in the radius into which the reagent will be injected. var xformQuery = GetEntityQuery(); var xform = xformQuery.GetComponent(entity); - var allEnts = _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates((entity.Owner, xform)), injectRadius) + var allEnts = _lookup.GetEntitiesInRange(xform.MapPosition, injectRadius) .Select(x => x.Owner).ToList(); //for each matching entity found diff --git a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs index 2c4123ee9ed..416045fc5ed 100644 --- a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs @@ -66,7 +66,7 @@ private void OnFilterUpdate(EntityUid uid, AirFilterComponent filter, ref AtmosD var oxygen = air.GetMoles(filter.Oxygen) / air.TotalMoles; var gases = oxygen >= filter.TargetOxygen ? filter.Gases : filter.OverflowGases; - var coordinates = _transform.GetMapCoordinates(uid); + var coordinates = Transform(uid).MapPosition; GasMixture? destination = null; if (_map.TryFindGridAt(coordinates, out _, out var grid)) { diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index 7462ab1d8f1..97dccbaabb7 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -29,7 +29,7 @@ private void OnAirtightInit(Entity airtight, ref ComponentIni if (airtight.Comp.FixAirBlockedDirectionInitialize) { - var moveEvent = new MoveEvent((airtight, xform, MetaData(airtight)), default, default, Angle.Zero, xform.LocalRotation); + var moveEvent = new MoveEvent(airtight, default, default, Angle.Zero, xform.LocalRotation, xform, false); if (AirtightMove(airtight, ref moveEvent)) return; } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index fdc4568d04b..53035e1ed3c 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -119,7 +119,7 @@ private void HighPressureMovements(Entity gridAtmospher return; // Used by ExperiencePressureDifference to correct push/throw directions from tile-relative to physics world. - var gridWorldRotation = _transformSystem.GetWorldRotation(gridAtmosphere); + var gridWorldRotation = xforms.GetComponent(gridAtmosphere).WorldRotation; // If we're using monstermos, smooth out the yeet direction to follow the flow if (MonstermosEqualization) @@ -238,7 +238,7 @@ public void ExperiencePressureDifference( // TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs. if (throwTarget != EntityCoordinates.Invalid) { - var pos = ((throwTarget.ToMap(EntityManager).Position - _transformSystem.GetWorldPosition(xform)).Normalized() + dirVec).Normalized(); + var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized(); _physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics); } else diff --git a/Content.Server/Beam/BeamSystem.cs b/Content.Server/Beam/BeamSystem.cs index 4a8a0e40b3b..33f2f252d90 100644 --- a/Content.Server/Beam/BeamSystem.cs +++ b/Content.Server/Beam/BeamSystem.cs @@ -19,7 +19,6 @@ public sealed class BeamSystem : SharedBeamSystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedBroadphaseSystem _broadphase = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -145,8 +144,8 @@ public void TryCreateBeam(EntityUid user, EntityUid target, string bodyPrototype if (Deleted(user) || Deleted(target)) return; - var userMapPos = _xformSystem.GetMapCoordinates(user); - var targetMapPos = _xformSystem.GetMapCoordinates(target); + var userMapPos = Transform(user).MapPosition; + var targetMapPos = Transform(target).MapPosition; //The distance between the target and the user. var calculatedDistance = targetMapPos.Position - userMapPos.Position; diff --git a/Content.Server/Botany/Systems/LogSystem.cs b/Content.Server/Botany/Systems/LogSystem.cs index 5c96e533ec9..a0639e3708c 100644 --- a/Content.Server/Botany/Systems/LogSystem.cs +++ b/Content.Server/Botany/Systems/LogSystem.cs @@ -12,7 +12,6 @@ public sealed class LogSystem : EntitySystem [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly RandomHelperSystem _randomHelper = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -40,7 +39,7 @@ private void OnInteractUsing(EntityUid uid, LogComponent component, InteractUsin { var xform = Transform(plank); _containerSystem.AttachParentToContainerOrGrid((plank, xform)); - _xformSystem.SetLocalRotation(plank, 0, xform); + xform.LocalRotation = 0; _randomHelper.RandomOffset(plank, 0.25f); } } diff --git a/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs b/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs index 0f81a79cd3b..e1cdfd20660 100644 --- a/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs @@ -11,7 +11,6 @@ public sealed class RehydratableSystem : EntitySystem { [Dependency] private readonly SharedPopupSystem _popups = default!; [Dependency] private readonly SolutionContainerSystem _solutions = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; public override void Initialize() @@ -41,7 +40,7 @@ private void Expand(Entity entity) var target = Spawn(randomMob, Transform(uid).Coordinates); - _xformSystem.AttachToGridOrMap(target); + Transform(target).AttachToGridOrMap(); var ev = new GotRehydratedEvent(target); RaiseLocalEvent(uid, ref ev); diff --git a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs index 7a2ac44984b..2c23b8f0390 100644 --- a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs @@ -28,7 +28,6 @@ internal sealed class VaporSystem : EntitySystem [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly ReactiveSystem _reactive = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private const float ReactTime = 0.125f; @@ -72,7 +71,7 @@ public void Start(Entity vapor, TransformComponent vaporXform, V _throwing.TryThrow(vapor, dir, speed, user: user); - var distance = (target.Position - _xformSystem.GetWorldPosition(vaporXform)).Length(); + var distance = (target.Position - vaporXform.WorldPosition).Length(); var time = (distance / physics.LinearVelocity.Length()); despawn.Lifetime = MathF.Min(aliveTime, time); } diff --git a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs index 93d7f606286..024558f8de3 100644 --- a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs @@ -57,18 +57,16 @@ public override void Effect(ReagentEffectArgs args) var spreadAmount = (int) Math.Max(0, Math.Ceiling((args.Quantity / OverflowThreshold).Float())); var splitSolution = args.Source.SplitSolution(args.Source.Volume); var transform = args.EntityManager.GetComponent(args.SolutionEntity); - var xformSystem = args.EntityManager.System(); var mapManager = IoCManager.Resolve(); - var mapCoordinates = xformSystem.GetMapCoordinates((args.SolutionEntity, transform)); - if (!mapManager.TryFindGridAt(mapCoordinates, out _, out var grid) || + if (!mapManager.TryFindGridAt(transform.MapPosition, out _, out var grid) || !grid.TryGetTileRef(transform.Coordinates, out var tileRef) || tileRef.Tile.IsSpace()) { return; } - var coords = grid.MapToGrid(mapCoordinates); + var coords = grid.MapToGrid(transform.MapPosition); var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid()); var smoke = args.EntityManager.System(); diff --git a/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs index db89d52696d..f8c0378452b 100644 --- a/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs @@ -34,7 +34,7 @@ public override void Effect(ReagentEffectArgs args) for (var i = 0; i < quantity; i++) { - var uid = args.EntityManager.SpawnEntity(Entity, transformSystem.GetMapCoordinates((args.SolutionEntity, transform))); + var uid = args.EntityManager.SpawnEntity(Entity, transform.MapPosition); transformSystem.AttachToGridOrMap(uid); // TODO figure out how to properly spawn inside of containers diff --git a/Content.Server/Chemistry/ReactionEffects/EmpReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/EmpReactionEffect.cs index cc81ddff164..b6714ca28d0 100644 --- a/Content.Server/Chemistry/ReactionEffects/EmpReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/EmpReactionEffect.cs @@ -41,7 +41,7 @@ public override void Effect(ReagentEffectArgs args) var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange); args.EntityManager.System().EmpPulse( - args.EntityManager.System().GetMapCoordinates((args.SolutionEntity, transform)), + transform.MapPosition, range, EnergyConsumption, DisableDuration); diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index 4eb4a87893a..8a24d9f199e 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -225,7 +225,7 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity(); - var xfmSys = entMan.System(); var transform = entMan.GetComponent(ent); - var worldPosition = xfmSys.GetWorldPosition(transform); // gross, is there a better way to do this? ruleString = ruleString.Replace("$ID", ent.ToString()); - ruleString = ruleString.Replace("$WX", worldPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$WY", worldPosition.Y.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$LX", transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$LY", transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$WX", + transform.WorldPosition.X.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$WY", + transform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$LX", + transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$LY", + transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$NAME", entMan.GetComponent(ent).EntityName); if (shell.Player is { } player) @@ -71,13 +73,16 @@ public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, if (player.AttachedEntity is {Valid: true} p) { var pTransform = entMan.GetComponent(p); - var pPosition = xfmSys.GetWorldPosition(pTransform); ruleString = ruleString.Replace("$PID", ent.ToString()); - ruleString = ruleString.Replace("$PWX", pPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$PWY", pPosition.Y.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$PLX", pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$PLY", pTransform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$PWX", + pTransform.WorldPosition.X.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$PWY", + pTransform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$PLX", + pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$PLY", + pTransform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); } } return ruleString; diff --git a/Content.Server/Construction/Commands/FixRotationsCommand.cs b/Content.Server/Construction/Commands/FixRotationsCommand.cs index 0a37c2f4440..9c99035573a 100644 --- a/Content.Server/Construction/Commands/FixRotationsCommand.cs +++ b/Content.Server/Construction/Commands/FixRotationsCommand.cs @@ -63,7 +63,6 @@ public void Execute(IConsoleShell shell, string argsOther, string[] args) var changed = 0; var tagSystem = _entManager.EntitySysManager.GetEntitySystem(); - var xformSystem = _entManager.System(); var enumerator = xformQuery.GetComponent(gridId.Value).ChildEnumerator; @@ -98,7 +97,7 @@ public void Execute(IConsoleShell shell, string argsOther, string[] args) if (childXform.LocalRotation != Angle.Zero) { - xformSystem.SetLocalRotation(child, Angle.Zero, childXform); + childXform.LocalRotation = Angle.Zero; changed++; } } diff --git a/Content.Server/Construction/Completions/SetAnchor.cs b/Content.Server/Construction/Completions/SetAnchor.cs index 737f07b91da..989ecc99bda 100644 --- a/Content.Server/Construction/Completions/SetAnchor.cs +++ b/Content.Server/Construction/Completions/SetAnchor.cs @@ -12,14 +12,7 @@ public sealed partial class SetAnchor : IGraphAction public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager) { var transform = entityManager.GetComponent(uid); - if (Value == transform.Anchored) - return; - - var xformSystem = entityManager.System(); - if (Value) - xformSystem.AnchorEntity((uid, transform)); - else - xformSystem.Unanchor(uid, transform); + transform.Anchored = Value; } } } diff --git a/Content.Server/Construction/Completions/SnapToGrid.cs b/Content.Server/Construction/Completions/SnapToGrid.cs index dfba91b7cf1..47941108f53 100644 --- a/Content.Server/Construction/Completions/SnapToGrid.cs +++ b/Content.Server/Construction/Completions/SnapToGrid.cs @@ -14,12 +14,13 @@ public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager enti { var transform = entityManager.GetComponent(uid); - var xformSystem = entityManager.System(); if (!transform.Anchored) - xformSystem.SetCoordinates((uid, transform, entityManager.GetComponent(uid)), transform.Coordinates.SnapToGrid(entityManager)); + transform.Coordinates = transform.Coordinates.SnapToGrid(entityManager); if (SouthRotation) - xformSystem.SetLocalRotation(uid, Angle.Zero, transform); + { + transform.LocalRotation = Angle.Zero; + } } } } diff --git a/Content.Server/Construction/ConstructionSystem.Graph.cs b/Content.Server/Construction/ConstructionSystem.Graph.cs index ec5e71e1453..570360bf09a 100644 --- a/Content.Server/Construction/ConstructionSystem.Graph.cs +++ b/Content.Server/Construction/ConstructionSystem.Graph.cs @@ -362,12 +362,9 @@ public bool ChangeNode(EntityUid uid, EntityUid? userUid, string id, bool perfor // Transform transferring. var newTransform = Transform(newUid); - _xformSystem.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container - _xformSystem.SetLocalRotation(newUid, transform.LocalRotation, newTransform); - if (transform.Anchored) - _xformSystem.AnchorEntity((newUid, newTransform)); - else - _xformSystem.Unanchor(newUid, newTransform); + newTransform.AttachToGridOrMap(); // in case in hands or a container + newTransform.LocalRotation = transform.LocalRotation; + newTransform.Anchored = transform.Anchored; // Container transferring. if (containerManager != null) diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index d72a41add25..6c8c07d65ad 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -32,7 +32,6 @@ public sealed partial class ConstructionSystem [Dependency] private readonly EntityLookupSystem _lookupSystem = default!; [Dependency] private readonly StorageSystem _storageSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; // --- WARNING! LEGACY CODE AHEAD! --- // This entire file contains the legacy code for initial construction. @@ -83,7 +82,7 @@ private IEnumerable EnumerateNearby(EntityUid user) } } - var pos = _xformSystem.GetMapCoordinates(user); + var pos = Transform(user).MapPosition; foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate)) { @@ -543,12 +542,10 @@ void Cleanup() // ikr var xform = Transform(structure); var wasAnchored = xform.Anchored; - if (wasAnchored) - _xformSystem.Unanchor(structure, xform); - _xformSystem.SetCoordinates((structure, xform, MetaData(structure)), GetCoordinates(ev.Location)); - _xformSystem.SetLocalRotation(structure, constructionPrototype.CanRotate ? ev.Angle : Angle.Zero, xform); - if (wasAnchored) - _xformSystem.AnchorEntity((structure, xform)); + xform.Anchored = false; + xform.Coordinates = GetCoordinates(ev.Location); + xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero; + xform.Anchored = wasAnchored; RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack, GetNetEntity(structure))); _adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has turned a {ev.PrototypeName} construction ghost into {ToPrettyString(structure)} at {Transform(structure).Coordinates}"); diff --git a/Content.Server/Destructible/DestructibleSystem.cs b/Content.Server/Destructible/DestructibleSystem.cs index e1bbe5bf1ae..16c54fd3b02 100644 --- a/Content.Server/Destructible/DestructibleSystem.cs +++ b/Content.Server/Destructible/DestructibleSystem.cs @@ -42,7 +42,6 @@ public sealed class DestructibleSystem : SharedDestructibleSystem [Dependency] public readonly IPrototypeManager PrototypeManager = default!; [Dependency] public readonly IComponentFactory ComponentFactory = default!; [Dependency] public readonly IAdminLogManager _adminLogger = default!; - [Dependency] public readonly SharedTransformSystem TransformSystem = default!; public override void Initialize() { diff --git a/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs b/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs index 1d28666ea6f..e13fd5e05be 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs @@ -44,14 +44,14 @@ public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause { var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset))); system.StackSystem.SetCount(spawned, toSpawn); - system.TransformSystem.SetLocalRotation(spawned, system.Random.NextAngle()); + system.EntityManager.GetComponent(spawned).LocalRotation = system.Random.NextAngle(); } else { for (var i = 0; i < toSpawn; i++) { var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset))); - system.TransformSystem.SetLocalRotation(spawned, system.Random.NextAngle()); + system.EntityManager.GetComponent(spawned).LocalRotation = system.Random.NextAngle(); } } } diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs index 43204da8d2e..ed5777c42aa 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs @@ -27,7 +27,7 @@ public sealed partial class SpawnEntitiesBehavior : IThresholdBehavior public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null) { - var position = system.TransformSystem.GetMapCoordinates(owner); + var position = system.EntityManager.GetComponent(owner).MapPosition; var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset)); diff --git a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs index 30ffc2d1d2c..b27ef52eca6 100644 --- a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs @@ -6,8 +6,6 @@ namespace Content.Server.DeviceNetwork.Systems [UsedImplicitly] public sealed class WirelessNetworkSystem : EntitySystem { - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; - public override void Initialize() { base.Initialize(); @@ -27,7 +25,7 @@ private void OnBeforePacketSent(EntityUid uid, WirelessNetworkComponent componen return; if (xform.MapID != args.SenderTransform.MapID - || (ownPosition - _xformSystem.GetWorldPosition(xform)).Length() > sendingComponent.Range) + || (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range) { args.Cancel(); } diff --git a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs index 9e69b3d7e9c..b7d8455d85e 100644 --- a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs +++ b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs @@ -37,8 +37,6 @@ public sealed class DisposalTubeSystem : EntitySystem [Dependency] private readonly DisposableSystem _disposableSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; - public override void Initialize() { base.Initialize(); @@ -432,7 +430,8 @@ public bool TryInsert(EntityUid uid, DisposalUnitComponent from, IEnumerable(holder); foreach (var entity in from.Container.ContainedEntities.ToArray()) diff --git a/Content.Server/Dragon/DragonSystem.cs b/Content.Server/Dragon/DragonSystem.cs index 0d996aa281f..93d6bc8db0b 100644 --- a/Content.Server/Dragon/DragonSystem.cs +++ b/Content.Server/Dragon/DragonSystem.cs @@ -28,7 +28,6 @@ public sealed partial class DragonSystem : EntitySystem [Dependency] private readonly RoleSystem _role = default!; [Dependency] private readonly SharedActionsSystem _actions = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private EntityQuery _objQuery; @@ -155,7 +154,7 @@ private void OnSpawnRift(EntityUid uid, DragonComponent component, DragonSpawnRi } // cant put a rift on solars - foreach (var tile in grid.GetTilesIntersecting(new Circle(_xformSystem.GetWorldPosition(xform), RiftTileRadius), false)) + foreach (var tile in grid.GetTilesIntersecting(new Circle(xform.WorldPosition, RiftTileRadius), false)) { if (!tile.IsSpace(_tileDef)) continue; @@ -164,7 +163,7 @@ private void OnSpawnRift(EntityUid uid, DragonComponent component, DragonSpawnRi return; } - var carpUid = Spawn(component.RiftPrototype, _xformSystem.GetMapCoordinates((uid, xform))); + var carpUid = Spawn(component.RiftPrototype, xform.MapPosition); component.Rifts.Add(carpUid); Comp(carpUid).Dragon = uid; } diff --git a/Content.Server/Emp/EmpSystem.cs b/Content.Server/Emp/EmpSystem.cs index fc79961f6d2..7c1a6f9b5db 100644 --- a/Content.Server/Emp/EmpSystem.cs +++ b/Content.Server/Emp/EmpSystem.cs @@ -11,7 +11,6 @@ namespace Content.Server.Emp; public sealed class EmpSystem : SharedEmpSystem { [Dependency] private readonly EntityLookupSystem _lookup = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public const string EmpPulseEffectPrototype = "EffectEmpPulse"; @@ -103,7 +102,7 @@ private void OnExamine(EntityUid uid, EmpDisabledComponent component, ExaminedEv private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args) { - EmpPulse(_xformSystem.GetMapCoordinates(uid), comp.Range, comp.EnergyConsumption, comp.DisableDuration); + EmpPulse(Transform(uid).MapPosition, comp.Range, comp.EnergyConsumption, comp.DisableDuration); args.Handled = true; } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs b/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs index 73b546bcdf7..8d2a699de27 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs @@ -69,15 +69,13 @@ public ExplosionGridTileFlood( return; _needToTransform = true; - var entMan = IoCManager.Resolve(); - var xfmSys = entMan.System(); var transform = IoCManager.Resolve().GetComponent(Grid.Owner); var size = (float) Grid.TileSize; _matrix.R0C2 = size / 2; _matrix.R1C2 = size / 2; - _matrix *= xfmSys.GetWorldMatrix(transform) * Matrix3.Invert(spaceMatrix); - var relativeAngle = xfmSys.GetWorldRotation(transform) - spaceAngle; + _matrix *= transform.WorldMatrix * Matrix3.Invert(spaceMatrix); + var relativeAngle = transform.WorldRotation - spaceAngle; _offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4)); } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs index 6f5b94f63e4..b04642a8db0 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs @@ -70,8 +70,8 @@ private void OnGridRemoved(GridRemovalEvent ev) { var targetGrid = Comp(referenceGrid.Value); var xform = Transform(referenceGrid.Value); - targetAngle = _transformSystem.GetWorldRotation(xform); - targetMatrix = _transformSystem.GetInvWorldMatrix(xform); + targetAngle = xform.WorldRotation; + targetMatrix = xform.InvWorldMatrix; tileSize = targetGrid.TileSize; } @@ -104,7 +104,7 @@ private void OnGridRemoved(GridRemovalEvent ev) var xforms = EntityManager.GetEntityQuery(); var xform = xforms.GetComponent(gridToTransform); - var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform); + var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = xform.GetWorldPositionRotationMatrixWithInv(xforms); var localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position); var matrix = offsetMatrix * gridWorldMatrix * targetMatrix; diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs index d5f756ca749..1b324d924bc 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs @@ -88,8 +88,8 @@ public sealed partial class ExplosionSystem : EntitySystem if (referenceGrid != null) { var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner); - spaceMatrix = _transformSystem.GetWorldMatrix(xform); - spaceAngle = _transformSystem.GetWorldRotation(xform); + spaceMatrix = xform.WorldMatrix; + spaceAngle = xform.WorldRotation; } // is the explosion starting on a grid? diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 6e9b900ecda..b036ea3a10e 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -392,7 +392,7 @@ private void CameraShake(float range, MapCoordinates epicenter, float totalInten if (player.AttachedEntity is not EntityUid uid) continue; - var playerPos = _transformSystem.GetWorldPosition(player.AttachedEntity!.Value); + var playerPos = Transform(player.AttachedEntity!.Value).WorldPosition; var delta = epicenter.Position - playerPos; if (delta.EqualsApprox(Vector2.Zero)) diff --git a/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs b/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs index fc563d51461..c0775947ba4 100644 --- a/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs @@ -15,7 +15,6 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem { [Dependency] private readonly IMapManager _mapMan = default!; [Dependency] private readonly SmokeSystem _smoke = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -27,15 +26,14 @@ public override void Initialize() private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args) { var xform = Transform(uid); - var mapCoords = _xformSystem.GetMapCoordinates((uid, xform)); - if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) || + if (!_mapMan.TryFindGridAt(xform.MapPosition, out _, out var grid) || !grid.TryGetTileRef(xform.Coordinates, out var tileRef) || tileRef.Tile.IsSpace()) { return; } - var coords = grid.MapToGrid(mapCoords); + var coords = grid.MapToGrid(xform.MapPosition); var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid()); if (!TryComp(ent, out var smoke)) { diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 494caeab04f..9b9a042641f 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -186,7 +186,7 @@ private void HandleRattleTrigger(EntityUid uid, RattleComponent component, Trigg // Gets location of the implant var ownerXform = Transform(uid); - var pos = _transformSystem.GetMapCoordinates((uid, ownerXform)); + var pos = ownerXform.MapPosition; var x = (int) pos.X; var y = (int) pos.Y; var posText = $"({x}, {y})"; diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index 64f7add4e86..fe7eb81d1e1 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -37,7 +37,6 @@ internal sealed class FlashSystem : SharedFlashSystem [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly StunSystem _stun = default!; [Dependency] private readonly TagSystem _tag = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { diff --git a/Content.Server/Fluids/EntitySystems/DrainSystem.cs b/Content.Server/Fluids/EntitySystems/DrainSystem.cs index 846eac078b7..19cb650db7c 100644 --- a/Content.Server/Fluids/EntitySystems/DrainSystem.cs +++ b/Content.Server/Fluids/EntitySystems/DrainSystem.cs @@ -33,7 +33,6 @@ public sealed class DrainSystem : SharedDrainSystem [Dependency] private readonly PuddleSystem _puddleSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -156,7 +155,7 @@ public override void Update(float frameTime) puddles.Clear(); - foreach (var entity in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates((uid, xform)), drain.Range)) + foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, drain.Range)) { // No InRangeUnobstructed because there's no collision group that fits right now // and these are placed by mappers and not buildable/movable so shouldnt really be a problem... diff --git a/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs b/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs index 974b2d62208..ac967b3c201 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs @@ -13,7 +13,6 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly PuddleSystem _puddle = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private readonly HashSet _playerObservers = new(); private List> _grids = new(); @@ -56,7 +55,7 @@ public override void Update(float frameTime) var transform = EntityManager.GetComponent(entity); - var worldBounds = Box2.CenteredAround(_xformSystem.GetWorldPosition(transform), + var worldBounds = Box2.CenteredAround(transform.WorldPosition, new Vector2(LocalViewRange, LocalViewRange)); _grids.Clear(); diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 1434a3bfb4e..a411cd0f75a 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -410,7 +410,7 @@ public EntityCoordinates GetObserverSpawnPoint() var gridXform = Transform(gridUid); return new EntityCoordinates(gridUid, - _transform.GetInvWorldMatrix(gridXform).Transform(toMap.Position)); + gridXform.InvWorldMatrix.Transform(toMap.Position)); } return spawn; diff --git a/Content.Server/GameTicking/Rules/DeathMatchRuleSystem.cs b/Content.Server/GameTicking/Rules/DeathMatchRuleSystem.cs index 9c863effee3..82ac755592e 100644 --- a/Content.Server/GameTicking/Rules/DeathMatchRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/DeathMatchRuleSystem.cs @@ -24,7 +24,6 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem().ToList(); - EntityManager.SpawnEntities(_xformSystem.GetMapCoordinates(ev.Entity), spawns); + EntityManager.SpawnEntities(Transform(ev.Entity).MapPosition, spawns); } } diff --git a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs index 5603591825a..eb22ba9ead6 100644 --- a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs @@ -50,8 +50,6 @@ public sealed class PiratesRuleSystem : GameRuleSystem [Dependency] private readonly SharedMindSystem _mindSystem = default!; [Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly MetaDataSystem _metaData = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; - [ValidatePrototypeId] private const string GameRuleId = "Pirates"; @@ -182,7 +180,7 @@ private void OnPlayerSpawningEvent(RulePlayerSpawningEvent ev) var aabbs = EntityQuery().SelectMany(x => x.Grids.Select(x => - _xformSystem.GetWorldMatrix(x).TransformBox(_mapManager.GetGridComp(x).LocalAABB))) + xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).LocalAABB))) .ToArray(); var aabb = aabbs[0]; diff --git a/Content.Server/GameTicking/Rules/VariationPass/BaseEntityReplaceVariationPassSystem.cs b/Content.Server/GameTicking/Rules/VariationPass/BaseEntityReplaceVariationPassSystem.cs index cf8621f4a7c..00b2546e785 100644 --- a/Content.Server/GameTicking/Rules/VariationPass/BaseEntityReplaceVariationPassSystem.cs +++ b/Content.Server/GameTicking/Rules/VariationPass/BaseEntityReplaceVariationPassSystem.cs @@ -19,8 +19,6 @@ public abstract class BaseEntityReplaceVariationPassSystem /// Used so we don't modify while enumerating /// if the replaced entity also has . @@ -57,7 +55,7 @@ protected override void ApplyVariation(Entity ent, ref StationVar { var (spawn, coords, rot) = tup; var newEnt = Spawn(spawn, coords); - _xformSystem.SetLocalRotation(newEnt, rot); + Transform(newEnt).LocalRotation = rot; } Log.Debug($"Entity replacement took {stopwatch.Elapsed} with {Stations.GetTileCount(args.Station)} tiles"); diff --git a/Content.Server/Gatherable/GatherableSystem.cs b/Content.Server/Gatherable/GatherableSystem.cs index 0ee7f207dd7..7fbbf7f4f64 100644 --- a/Content.Server/Gatherable/GatherableSystem.cs +++ b/Content.Server/Gatherable/GatherableSystem.cs @@ -18,7 +18,6 @@ public sealed partial class GatherableSystem : EntitySystem [Dependency] private readonly DestructibleSystem _destructible = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly TagSystem _tagSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -62,7 +61,7 @@ public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, Gatherable if (component.MappedLoot == null) return; - var pos = _xformSystem.GetMapCoordinates(gatheredUid); + var pos = Transform(gatheredUid).MapPosition; foreach (var (tag, table) in component.MappedLoot) { diff --git a/Content.Server/Guardian/GuardianSystem.cs b/Content.Server/Guardian/GuardianSystem.cs index b2ab78f987c..627c336a36b 100644 --- a/Content.Server/Guardian/GuardianSystem.cs +++ b/Content.Server/Guardian/GuardianSystem.cs @@ -34,7 +34,6 @@ public sealed class GuardianSystem : EntitySystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly SharedContainerSystem _container = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -212,7 +211,7 @@ private void OnDoAfter(EntityUid uid, GuardianCreatorComponent component, DoAfte var hostXform = Transform(args.Args.Target.Value); var host = EnsureComp(args.Args.Target.Value); // Use map position so it's not inadvertantly parented to the host + if it's in a container it spawns outside I guess. - var guardian = Spawn(component.GuardianProto, _xformSystem.GetMapCoordinates(hostXform)); + var guardian = Spawn(component.GuardianProto, hostXform.MapPosition); _container.Insert(guardian, host.GuardianContainer); host.HostedGuardian = guardian; diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 2610f4fd5c6..62278064b68 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -38,7 +38,6 @@ public sealed class HandsSystem : SharedHandsSystem [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly PullingSystem _pullingSystem = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -199,7 +198,7 @@ hands.ActiveHandEntity is not { } throwEnt || throwEnt = splitStack.Value; } - var direction = coordinates.ToMapPos(EntityManager) - _xformSystem.GetWorldPosition(player); + var direction = coordinates.ToMapPos(EntityManager) - Transform(player).WorldPosition; if (direction == Vector2.Zero) return true; diff --git a/Content.Server/ImmovableRod/ImmovableRodSystem.cs b/Content.Server/ImmovableRod/ImmovableRodSystem.cs index c0da749ab1f..0fa8f7d292f 100644 --- a/Content.Server/ImmovableRod/ImmovableRodSystem.cs +++ b/Content.Server/ImmovableRod/ImmovableRodSystem.cs @@ -22,7 +22,6 @@ public sealed class ImmovableRodSystem : EntitySystem [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Update(float frameTime) { @@ -65,11 +64,11 @@ private void OnMapInit(EntityUid uid, ImmovableRodComponent component, MapInitEv var vel = component.DirectionOverride.Degrees switch { 0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed), - _ => _xformSystem.GetWorldRotation(xform).RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed) + _ => xform.WorldRotation.RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed) }; _physics.ApplyLinearImpulse(uid, vel, body: phys); - _xformSystem.SetLocalRotation(uid, (vel - _xformSystem.GetWorldPosition(xform)).ToWorldAngle() + MathHelper.PiOver2, xform); + xform.LocalRotation = (vel - xform.WorldPosition).ToWorldAngle() + MathHelper.PiOver2; } } diff --git a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs index 2e336a717fb..f270fe76d2c 100644 --- a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs @@ -26,7 +26,6 @@ public sealed class SharpSystem : EntitySystem [Dependency] private readonly ContainerSystem _containerSystem = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -98,7 +97,7 @@ private void OnDoAfter(EntityUid uid, SharpComponent component, DoAfterEvent arg } var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom); - var coords = _xformSystem.GetMapCoordinates(args.Args.Target.Value); + var coords = Transform(args.Args.Target.Value).MapPosition; EntityUid popupEnt = default!; foreach (var proto in spawnEntities) { diff --git a/Content.Server/Lightning/LightningSystem.cs b/Content.Server/Lightning/LightningSystem.cs index e67d42227e2..4f975a60fda 100644 --- a/Content.Server/Lightning/LightningSystem.cs +++ b/Content.Server/Lightning/LightningSystem.cs @@ -20,7 +20,6 @@ public sealed class LightningSystem : SharedLightningSystem [Dependency] private readonly BeamSystem _beam = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -75,7 +74,7 @@ public void ShootRandomLightnings(EntityUid user, float range, int boltCount, st //To Do: This is still pretty bad for perf but better than before and at least it doesn't re-allocate // several hashsets every time - var targets = _lookup.GetComponentsInRange(_xformSystem.GetMapCoordinates(user), range).ToList(); + var targets = _lookup.GetComponentsInRange(Transform(user).MapPosition, range).ToList(); _random.Shuffle(targets); targets.Sort((x, y) => y.Priority.CompareTo(x.Priority)); diff --git a/Content.Server/Lightning/LightningTargetSystem.cs b/Content.Server/Lightning/LightningTargetSystem.cs index b100c4c2238..ccaa74e9e26 100644 --- a/Content.Server/Lightning/LightningTargetSystem.cs +++ b/Content.Server/Lightning/LightningTargetSystem.cs @@ -12,7 +12,6 @@ public sealed class LightningTargetSystem : EntitySystem { [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly ExplosionSystem _explosionSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -30,7 +29,7 @@ private void OnHitByLightning(Entity uid, ref HitByLig if (uid.Comp.LightningExplode) { _explosionSystem.QueueExplosion( - _xformSystem.GetMapCoordinates(uid), + Transform(uid).MapPosition, uid.Comp.ExplosionPrototype, uid.Comp.TotalIntensity, uid.Comp.Dropoff, uid.Comp.MaxTileIntensity, diff --git a/Content.Server/Magic/MagicSystem.cs b/Content.Server/Magic/MagicSystem.cs index fd0c364a5ab..1bcc01b847d 100644 --- a/Content.Server/Magic/MagicSystem.cs +++ b/Content.Server/Magic/MagicSystem.cs @@ -278,7 +278,7 @@ private void OnTeleportSpell(TeleportSpellEvent args) if (transform.MapID != args.Target.GetMapId(EntityManager)) return; _transformSystem.SetCoordinates(args.Performer, args.Target); - _transformSystem.AttachToGridOrMap(args.Performer, transform); + transform.AttachToGridOrMap(); _audio.PlayPvs(args.BlinkSound, args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume)); Speak(args); args.Handled = true; @@ -321,7 +321,7 @@ private void OnSmiteSpell(SmiteSpellEvent ev) ev.Handled = true; Speak(ev); - var direction = _transformSystem.GetWorldPosition(ev.Target) - _transformSystem.GetWorldPosition(ev.Performer); + var direction = Transform(ev.Target).MapPosition.Position - Transform(ev.Performer).MapPosition.Position; var impulseVector = direction * 10000; _physics.ApplyLinearImpulse(ev.Target, impulseVector); diff --git a/Content.Server/Maps/GridDraggingSystem.cs b/Content.Server/Maps/GridDraggingSystem.cs index 2ad126c10da..76b2e29dea0 100644 --- a/Content.Server/Maps/GridDraggingSystem.cs +++ b/Content.Server/Maps/GridDraggingSystem.cs @@ -12,7 +12,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem { [Dependency] private readonly IConGroupController _admin = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private readonly HashSet _draggers = new(); @@ -79,6 +78,6 @@ private void OnRequestDrag(GridDragRequestPosition msg, EntitySessionEventArgs a var gridXform = Transform(grid); - _xformSystem.SetWorldPosition(gridXform, msg.WorldPosition); + gridXform.WorldPosition = msg.WorldPosition; } } diff --git a/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs b/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs index b1a2de61d5c..fa46792d2af 100644 --- a/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs +++ b/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs @@ -85,7 +85,7 @@ public void RemoveItem(EntityUid uid, EntityUid mech, EntityUid toRemove, MechGr var (mechPos, mechRot) = _transform.GetWorldPositionRotation(mechxform); var offset = mechPos + mechRot.RotateVec(component.DepositOffset); - _transform.SetWorldPositionRotation(toRemove, offset, Angle.Zero, xform); + _transform.SetWorldPositionRotation(xform, offset, Angle.Zero); _mech.UpdateUserInterface(mech); } diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs index fb650ec2cdc..95d5c9c4651 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs @@ -36,7 +36,7 @@ private Vector2 GetDiff(PathPoly start, PathPoly end) return Vector2.Zero; } - endPos = _transform.GetInvWorldMatrix(startXform).Transform(_transform.GetWorldMatrix(endXform).Transform(endPos)); + endPos = startXform.InvWorldMatrix.Transform(endXform.WorldMatrix.Transform(endPos)); } // TODO: Numerics when we changeover. diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs index 201189220a7..95f931cdd6a 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs @@ -405,7 +405,7 @@ public async void GetPathEvent( return null; } - var localPos = _transform.GetInvWorldMatrix(xform).Transform(coordinates.ToMapPos(EntityManager)); + var localPos = xform.InvWorldMatrix.Transform(coordinates.ToMapPos(EntityManager)); var origin = GetOrigin(localPos); if (!TryGetChunk(origin, comp, out var chunk)) diff --git a/Content.Server/NPC/Systems/NPCSteeringSystem.cs b/Content.Server/NPC/Systems/NPCSteeringSystem.cs index 1d8822d0e62..aca2411d8a0 100644 --- a/Content.Server/NPC/Systems/NPCSteeringSystem.cs +++ b/Content.Server/NPC/Systems/NPCSteeringSystem.cs @@ -462,7 +462,7 @@ private async void RequestPath(EntityUid uid, NPCSteeringComponent steering, Tra } var targetPos = steering.Coordinates.ToMap(EntityManager, _transform); - var ourPos = _transform.GetMapCoordinates((uid, xform)); + var ourPos = xform.MapPosition; PrunePath(uid, ourPos, targetPos.Position - ourPos.Position, result.Path); steering.CurrentPath = new Queue(result.Path); diff --git a/Content.Server/NPC/Systems/NPCUtilitySystem.cs b/Content.Server/NPC/Systems/NPCUtilitySystem.cs index 69735f1d8c8..fc483f68c3b 100644 --- a/Content.Server/NPC/Systems/NPCUtilitySystem.cs +++ b/Content.Server/NPC/Systems/NPCUtilitySystem.cs @@ -369,7 +369,7 @@ private void Add(NPCBlackboard blackboard, HashSet entities, UtilityQ if (compQuery.Components.Count == 0) return; - var mapPos = _transform.GetMapCoordinates(owner); + var mapPos = _xformQuery.GetComponent(owner).MapPosition; _compTypes.Clear(); var i = -1; EntityPrototype.ComponentRegistryEntry compZero = default!; diff --git a/Content.Server/NPC/Systems/NpcFactionSystem.cs b/Content.Server/NPC/Systems/NpcFactionSystem.cs index 7258220e807..d2237f0d117 100644 --- a/Content.Server/NPC/Systems/NpcFactionSystem.cs +++ b/Content.Server/NPC/Systems/NpcFactionSystem.cs @@ -12,7 +12,6 @@ namespace Content.Server.NPC.Systems; public sealed partial class NpcFactionSystem : EntitySystem { [Dependency] private readonly EntityLookupSystem _lookup = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; private ISawmill _sawmill = default!; @@ -162,7 +161,7 @@ private IEnumerable GetNearbyFactions(EntityUid entity, float range, if (!xformQuery.TryGetComponent(entity, out var entityXform)) yield break; - foreach (var ent in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates((entity, entityXform)), range)) + foreach (var ent in _lookup.GetEntitiesInRange(entityXform.MapPosition, range)) { if (ent.Owner == entity) continue; diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index fa80749211a..652852ece28 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -452,7 +452,7 @@ public void ArmBomb(EntityUid uid, NukeComponent? component = null) if (stationUid != null) _alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, true, true, true, true); - var pos = _transform.GetMapCoordinates(nukeXform); + var pos = nukeXform.MapPosition; var x = (int) pos.X; var y = (int) pos.Y; var posText = $"({x}, {y})"; diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index ec31d1710ae..2b627151339 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -54,7 +54,6 @@ public sealed class FoodSystem : EntitySystem [Dependency] private readonly StackSystem _stack = default!; [Dependency] private readonly StomachSystem _stomach = default!; [Dependency] private readonly UtensilSystem _utensil = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public const float MaxFeedDistance = 1.0f; @@ -150,7 +149,7 @@ private void OnFeedFood(Entity entity, ref AfterInteractEvent arg return (false, true); // TODO make do-afters account for fixtures in the range check. - if (!_xformSystem.GetMapCoordinates(user).InRange(_xformSystem.GetMapCoordinates(target), MaxFeedDistance)) + if (!Transform(user).MapPosition.InRange(Transform(target).MapPosition, MaxFeedDistance)) { var message = Loc.GetString("interaction-system-user-interaction-cannot-reach"); _popup.PopupEntity(message, user, user); @@ -326,7 +325,7 @@ public void DeleteAndSpawnTrash(FoodComponent component, EntityUid food, EntityU } //We're empty. Become trash. - var position = _xformSystem.GetMapCoordinates(food); + var position = Transform(food).MapPosition; var finisher = Spawn(component.Trash, position); // If the user is holding the item diff --git a/Content.Server/PDA/Ringer/RingerSystem.cs b/Content.Server/PDA/Ringer/RingerSystem.cs index 822be2590db..f95725873ae 100644 --- a/Content.Server/PDA/Ringer/RingerSystem.cs +++ b/Content.Server/PDA/Ringer/RingerSystem.cs @@ -25,7 +25,6 @@ public sealed class RingerSystem : SharedRingerSystem [Dependency] private readonly UserInterfaceSystem _ui = default!; [Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private readonly Dictionary _lastSetRingtoneAt = new(); @@ -210,7 +209,7 @@ public bool ToggleRingerUI(EntityUid uid, ICommonSession session) _audio.PlayEntity( GetSound(ringer.Ringtone[ringer.NoteCount]), - Filter.Empty().AddInRange(_xformSystem.GetMapCoordinates(ringerXform), ringer.Range), + Filter.Empty().AddInRange(ringerXform.MapPosition, ringer.Range), uid, true, AudioParams.Default.WithMaxDistance(ringer.Range).WithVolume(ringer.Volume) diff --git a/Content.Server/Parallax/BiomeSystem.cs b/Content.Server/Parallax/BiomeSystem.cs index 4195b07ee01..d8a841e714e 100644 --- a/Content.Server/Parallax/BiomeSystem.cs +++ b/Content.Server/Parallax/BiomeSystem.cs @@ -797,7 +797,7 @@ private void LoadChunk( // At least for now unless we do lookups or smth, only work with anchoring. if (_xformQuery.TryGetComponent(ent, out var xform) && !xform.Anchored) { - _transform.AnchorEntity((ent, xform), (gridUid, grid), indices); + _transform.AnchorEntity(ent, xform, gridUid, grid, indices); } loadedEntities.Add(ent, indices); diff --git a/Content.Server/Payload/EntitySystems/PayloadSystem.cs b/Content.Server/Payload/EntitySystems/PayloadSystem.cs index c282032bb23..85cf303d5d7 100644 --- a/Content.Server/Payload/EntitySystems/PayloadSystem.cs +++ b/Content.Server/Payload/EntitySystems/PayloadSystem.cs @@ -20,7 +20,6 @@ public sealed class PayloadSystem : EntitySystem [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -159,7 +158,7 @@ private void HandleChemicalPayloadTrigger(Entity entit var solStringB = SolutionContainerSystem.ToPrettyString(solutionB); _adminLogger.Add(LogType.ChemicalReaction, - $"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {_xformSystem.GetMapCoordinates(entity.Owner):location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}"); + $"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {Transform(entity.Owner).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}"); solutionA.MaxVolume += solutionB.MaxVolume; _solutionContainerSystem.TryAddSolution(solnA.Value, solutionB); diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index c575f2a8fa5..8f58f807aae 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -116,7 +116,7 @@ private void UpdatePulledRotation(EntityUid puller, EntityUid pulled) var baseRotation = pulledData.WorldRotation - pulledXform.LocalRotation; var localRotation = newAngle - baseRotation; var localRotationSnapped = Angle.FromDegrees(Math.Floor((localRotation.Degrees / ThresholdRotAngle) + 0.5f) * ThresholdRotAngle); - TransformSystem.SetLocalRotation(pulled, localRotationSnapped, pulledXform); + TransformSystem.SetLocalRotation(pulledXform, localRotationSnapped); } } } @@ -146,7 +146,7 @@ public override void UpdateBeforeSolve(bool prediction, float frameTime) // Now that's over with... - var pullerPosition = TransformSystem.GetMapCoordinates((puller, pullerXform)); + var pullerPosition = pullerXform.MapPosition; var movingTo = pullable.MovingTo.Value.ToMap(EntityManager, _transform); if (movingTo.MapId != pullerPosition.MapId) { @@ -163,7 +163,7 @@ public override void UpdateBeforeSolve(bool prediction, float frameTime) } var movingPosition = movingTo.Position; - var ownerPosition = TransformSystem.GetWorldPosition(pullableXform); + var ownerPosition = pullableXform.MapPosition.Position; var diff = movingPosition - ownerPosition; var diffLength = diff.Length(); diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index bc3132e54f3..a7c455e6a5d 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -37,7 +37,6 @@ internal sealed class PointingSystem : SharedPointingSystem [Dependency] private readonly VisibilitySystem _visibilitySystem = default!; [Dependency] private readonly SharedMindSystem _minds = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f); @@ -182,7 +181,7 @@ bool ViewerPredicate(ICommonSession playerSession) (eyeComp.VisibilityMask & layer) == 0) return false; - return _xformSystem.GetMapCoordinates(ent).InRange(_xformSystem.GetMapCoordinates(player), PointingRange); + return Transform(ent).MapPosition.InRange(Transform(player).MapPosition, PointingRange); } var viewers = Filter.Empty() diff --git a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs index dac6c5ff8fc..be3ceb3b086 100644 --- a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs @@ -12,7 +12,6 @@ internal sealed class RoguePointingSystem : EntitySystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ExplosionSystem _explosion = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null) { @@ -70,25 +69,24 @@ public override void Update(float frameTime) if (component.TurningDelay > 0) { - var difference = _xformSystem.GetWorldPosition(chasing) - _xformSystem.GetWorldPosition(transform); + var difference = Comp(chasing).WorldPosition - transform.WorldPosition; var angle = difference.ToAngle(); var adjusted = angle.Degrees + 90; var newAngle = Angle.FromDegrees(adjusted); - _xformSystem.SetWorldRotation(transform, newAngle); + transform.WorldRotation = newAngle; UpdateAppearance(uid, component, transform); continue; } - _xformSystem.SetWorldRotation(transform, _xformSystem.GetWorldRotation(transform) + Angle.FromDegrees(20)); + transform.WorldRotation += Angle.FromDegrees(20); UpdateAppearance(uid, component, transform); - var worldPosition = _xformSystem.GetWorldPosition(transform); - var toChased = _xformSystem.GetWorldPosition(chasing) - worldPosition; + var toChased = Comp(chasing).WorldPosition - transform.WorldPosition; - _xformSystem.SetWorldPosition(transform, worldPosition + toChased * frameTime * component.ChasingSpeed); + transform.WorldPosition += toChased * frameTime * component.ChasingSpeed; component.ChasingTime -= frameTime; diff --git a/Content.Server/Procedural/DungeonSystem.Rooms.cs b/Content.Server/Procedural/DungeonSystem.Rooms.cs index 648a7b7b15f..03bcc2b4b13 100644 --- a/Content.Server/Procedural/DungeonSystem.Rooms.cs +++ b/Content.Server/Procedural/DungeonSystem.Rooms.cs @@ -177,7 +177,7 @@ public void SpawnRoom( // If the templated entity was anchored then anchor us too. if (anchored && !childXform.Anchored) - _transform.AnchorEntity((ent, childXform), (gridUid, grid)); + _transform.AnchorEntity(ent, childXform, grid); else if (!anchored && childXform.Anchored) _transform.Unanchor(ent, childXform); } diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index 15ea5936e13..0061b16e47c 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -69,9 +69,6 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St component.DamagedEntity = true; - var afterProjectileHitEvent = new AfterProjectileHitEvent(component.Damage, target, args.OtherFixture); - RaiseLocalEvent(uid, ref afterProjectileHitEvent); - if (component.DeleteOnCollide) QueueDel(uid); diff --git a/Content.Server/Respawn/SpecialRespawnSystem.cs b/Content.Server/Respawn/SpecialRespawnSystem.cs index 92b6a95fdf7..51c092be18b 100644 --- a/Content.Server/Respawn/SpecialRespawnSystem.cs +++ b/Content.Server/Respawn/SpecialRespawnSystem.cs @@ -22,7 +22,6 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly TurfSystem _turf = default!; [Dependency] private readonly IChatManager _chat = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -95,7 +94,7 @@ private void OnTermination(EntityUid uid, SpecialRespawnComponent component, ref { var xform = Transform(entityGridUid.Value); var pos = xform.Coordinates; - var mapPos = _xformSystem.GetMapCoordinates((entityGridUid.Value, xform)); + var mapPos = xform.MapPosition; var circle = new Circle(mapPos.Position, 2); var found = false; @@ -157,7 +156,7 @@ public bool TryFindRandomTile(EntityUid targetGrid, EntityUid targetMap, int max var tile = tileRef.GridIndices; var found = false; - var (gridPos, _, gridMatrix) = _xformSystem.GetWorldPositionRotationMatrix(xform); + var (gridPos, _, gridMatrix) = xform.GetWorldPositionRotationMatrix(); var gridBounds = gridMatrix.TransformBox(grid.LocalAABB); //Obviously don't put anything ridiculous in here diff --git a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs index c9043931007..eb6eb5a426f 100644 --- a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs +++ b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs @@ -41,7 +41,6 @@ public sealed partial class RevenantSystem [Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!; [Dependency] private readonly GhostSystem _ghost = default!; [Dependency] private readonly TileSystem _tile = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private void InitializeAbilities() { @@ -216,7 +215,7 @@ private void OnDefileAction(EntityUid uid, RevenantComponent component, Revenant var xform = Transform(uid); if (!_mapManager.TryGetGrid(xform.GridUid, out var map)) return; - var tiles = map.GetTilesIntersecting(Box2.CenteredAround(_xformSystem.GetWorldPosition(xform), + var tiles = map.GetTilesIntersecting(Box2.CenteredAround(xform.WorldPosition, new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray(); _random.Shuffle(tiles); diff --git a/Content.Server/Rotatable/RotatableSystem.cs b/Content.Server/Rotatable/RotatableSystem.cs index 5d2b1a48ae7..a9df60c45b7 100644 --- a/Content.Server/Rotatable/RotatableSystem.cs +++ b/Content.Server/Rotatable/RotatableSystem.cs @@ -14,7 +14,6 @@ namespace Content.Server.Rotatable public sealed class RotatableSystem : EntitySystem { [Dependency] private readonly PopupSystem _popup = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -55,7 +54,7 @@ private void AddRotateVerbs(EntityUid uid, RotatableComponent component, GetVerb Verb resetRotation = new () { DoContactInteraction = true, - Act = () => _xformSystem.SetLocalRotation(uid, Angle.Zero), + Act = () => EntityManager.GetComponent(uid).LocalRotation = Angle.Zero, Category = VerbCategory.Rotate, Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/refresh.svg.192dpi.png")), Text = "Reset", @@ -67,11 +66,7 @@ private void AddRotateVerbs(EntityUid uid, RotatableComponent component, GetVerb // rotate clockwise Verb rotateCW = new() { - Act = () => - { - var xform = Transform(uid); - _xformSystem.SetLocalRotation(uid, xform.LocalRotation - component.Increment, xform); - }, + Act = () => EntityManager.GetComponent(uid).LocalRotation -= component.Increment, Category = VerbCategory.Rotate, Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/rotate_cw.svg.192dpi.png")), Priority = -1, @@ -82,11 +77,7 @@ private void AddRotateVerbs(EntityUid uid, RotatableComponent component, GetVerb // rotate counter-clockwise Verb rotateCCW = new() { - Act = () => - { - var xform = Transform(uid); - _xformSystem.SetLocalRotation(uid, xform.LocalRotation + component.Increment, xform); - }, + Act = () => EntityManager.GetComponent(uid).LocalRotation += component.Increment, Category = VerbCategory.Rotate, Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/rotate_ccw.svg.192dpi.png")), Priority = 0, @@ -110,8 +101,8 @@ public void TryFlip(EntityUid uid, FlippableComponent component, EntityUid user) var oldTransform = EntityManager.GetComponent(uid); var entity = EntityManager.SpawnEntity(component.MirrorEntity, oldTransform.Coordinates); var newTransform = EntityManager.GetComponent(entity); - _xformSystem.SetLocalRotation(entity, oldTransform.LocalRotation, newTransform); - _xformSystem.Unanchor(entity, newTransform); + newTransform.LocalRotation = oldTransform.LocalRotation; + newTransform.Anchored = false; EntityManager.DeleteEntity(uid); } } diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 3373122d76b..d976b634d5b 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -275,9 +275,9 @@ private void UpdateHyperspace(float frameTime) var fromRotation = _transform.GetWorldRotation(xform); var width = Comp(uid).LocalAABB.Width; - _transform.SetCoordinates((uid, xform, MetaData(uid)), new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), - new Vector2(_index + width / 2f, 0f))); - _transform.SetLocalRotation(uid, Angle.Zero, xform); + xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), + new Vector2(_index + width / 2f, 0f)); + xform.LocalRotation = Angle.Zero; _index += width + Buffer; comp.Accumulator += comp.TravelTime - DefaultArrivalTime; @@ -372,7 +372,7 @@ private void UpdateHyperspace(float frameTime) } else { - _transform.SetCoordinates((uid, xform, MetaData(uid)), comp.TargetCoordinates); + xform.Coordinates = comp.TargetCoordinates; mapId = comp.TargetCoordinates.GetMapId(EntityManager); } @@ -574,7 +574,7 @@ public bool TryFTLDock(EntityUid shuttleUid, ShuttleComponent component, EntityU if (config != null) { - FTLDock((shuttleUid, shuttleXform), config); + FTLDock(config, shuttleXform); return true; } @@ -585,11 +585,11 @@ public bool TryFTLDock(EntityUid shuttleUid, ShuttleComponent component, EntityU /// /// Forces an FTL dock. /// - public void FTLDock(Entity shuttle, DockingConfig config) + public void FTLDock(DockingConfig config, TransformComponent shuttleXform) { // Set position - _transform.SetCoordinates((shuttle.Owner, shuttle.Comp, MetaData(shuttle)), config.Coordinates); - _transform.SetWorldRotation(shuttle.Comp, config.Angle); + shuttleXform.Coordinates = config.Coordinates; + _transform.SetWorldRotation(shuttleXform, config.Angle); // Connect everything foreach (var (dockAUid, dockBUid, dockA, dockB) in config.Docks) @@ -702,15 +702,15 @@ public bool TryFTLProximity(EntityUid shuttleUid, ShuttleComponent component, En spawnPos = _transform.GetWorldPosition(targetXform, xformQuery); } - _transform.SetCoordinates((shuttleUid, xform, MetaData(shuttleUid)), new EntityCoordinates(targetXform.MapUid.Value, spawnPos)); + xform.Coordinates = new EntityCoordinates(targetXform.MapUid.Value, spawnPos); if (!HasComp(targetXform.GridUid)) { - _transform.SetLocalRotation(shuttleUid, _random.NextAngle(), xform); + _transform.SetLocalRotation(xform, _random.NextAngle()); } else { - _transform.SetLocalRotation(shuttleUid, Angle.Zero, xform); + _transform.SetLocalRotation(xform, Angle.Zero); } return true; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs index a4871a2dd11..71e02200766 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs @@ -206,7 +206,7 @@ private void OnGridFillMapInit(EntityUid uid, GridFillComponent component, MapIn if (config != null) { - FTLDock((ent[0], shuttleXform), config); + FTLDock(config, shuttleXform); if (TryComp(xform.GridUid, out var stationMember)) { diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs index 2f9c0f8a57d..f346398cdaa 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs @@ -38,8 +38,8 @@ private void OnShuttleCollide(EntityUid uid, ShuttleComponent component, ref Sta var otherXform = Transform(args.OtherEntity); - var ourPoint = _transform.GetInvWorldMatrix(ourXform).Transform(args.WorldPoint); - var otherPoint = _transform.GetInvWorldMatrix(otherXform).Transform(args.WorldPoint); + var ourPoint = ourXform.InvWorldMatrix.Transform(args.WorldPoint); + var otherPoint = otherXform.InvWorldMatrix.Transform(args.WorldPoint); var ourVelocity = _physics.GetLinearVelocity(uid, ourPoint, ourBody, ourXform); var otherVelocity = _physics.GetLinearVelocity(args.OtherEntity, otherPoint, otherBody, otherXform); diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs index f30e4d3f164..d58458527f6 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs @@ -23,7 +23,6 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly SharedPointLightSystem _light = default!; [Dependency] private readonly TagSystem _tags = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -234,7 +233,7 @@ private bool TryGenerateFieldConnection(Direction dir, Entity GenerateFieldConnection(Entity(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard) { - var fieldDir = _xformSystem.GetWorldPosition(uid); - var playerDir = _xformSystem.GetWorldPosition(otherBody); + var fieldDir = Transform(uid).WorldPosition; + var playerDir = Transform(otherBody).WorldPosition; _throwing.TryThrow(otherBody, playerDir-fieldDir, strength: component.ThrowForce); } diff --git a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs index 4914b4d44d6..e346ae93007 100644 --- a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs @@ -165,7 +165,7 @@ public void ConsumeEntitiesInRange(EntityUid uid, float range, TransformComponen var range2 = range * range; var xformQuery = EntityManager.GetEntityQuery(); var epicenter = _xformSystem.GetWorldPosition(xform, xformQuery); - foreach (var entity in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates((uid, xform)), range, flags: LookupFlags.Uncontained)) + foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, range, flags: LookupFlags.Uncontained)) { if (entity == uid) continue; @@ -295,7 +295,7 @@ public void ConsumeTilesInRange(EntityUid uid, float range, TransformComponent? if (!Resolve(uid, ref xform) || !Resolve(uid, ref eventHorizon)) return; - var mapPos = _xformSystem.GetMapCoordinates((uid, xform)); + var mapPos = xform.MapPosition; var box = Box2.CenteredAround(mapPos.Position, new Vector2(range, range)); var circle = new Circle(mapPos.Position, range); var grids = new List>(); diff --git a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs index d80187688d9..6a8fc68d976 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs @@ -18,7 +18,6 @@ internal sealed class PowerSolarSystem : EntitySystem { [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; /// /// Maximum panel angular velocity range - used to stop people rotating panels fast enough that the lag prevention becomes noticable @@ -113,7 +112,7 @@ public override void Update(float frameTime) while (query.MoveNext(out var uid, out var panel, out var xform)) { TotalPanelPower += panel.MaxSupply * panel.Coverage; - _xformSystem.SetWorldRotation(xform, TargetPanelRotation); + xform.WorldRotation = TargetPanelRotation; _updateQueue.Enqueue((uid, panel)); } } @@ -136,7 +135,7 @@ private void UpdatePanelCoverage(Entity panel) // directly downwards (abs(theta) = pi) = coverage -1 // as TowardsSun + = CCW, // panelRelativeToSun should - = CW - var panelRelativeToSun = _xformSystem.GetWorldRotation(xform) - TowardsSun; + var panelRelativeToSun = xform.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,7 +153,7 @@ private void UpdatePanelCoverage(Entity panel) if (coverage > 0) { // Determine if the solar panel is occluded, and zero out coverage if so. - var ray = new CollisionRay(_xformSystem.GetWorldPosition(xform), TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); + var ray = new CollisionRay(xform.WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); var rayCastResults = _physicsSystem.IntersectRayWithPredicate( xform.MapID, ray, diff --git a/Content.Server/Standing/StandingStateSystem.cs b/Content.Server/Standing/StandingStateSystem.cs index 87a25f9e168..e2b64958446 100644 --- a/Content.Server/Standing/StandingStateSystem.cs +++ b/Content.Server/Standing/StandingStateSystem.cs @@ -13,7 +13,6 @@ public sealed class StandingStateSystem : EntitySystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args) { @@ -26,7 +25,7 @@ private void FallOver(EntityUid uid, StandingStateComponent component, DropHandI if (!TryComp(uid, out HandsComponent? handsComp)) return; - var worldRotation = _xformSystem.GetWorldRotation(uid).ToVec(); + var worldRotation = EntityManager.GetComponent(uid).WorldRotation.ToVec(); foreach (var hand in handsComp.Hands.Values) { if (hand.HeldEntity is not EntityUid held) diff --git a/Content.Server/Worldgen/Systems/BaseWorldSystem.cs b/Content.Server/Worldgen/Systems/BaseWorldSystem.cs index 21e125e7084..78326651c9c 100644 --- a/Content.Server/Worldgen/Systems/BaseWorldSystem.cs +++ b/Content.Server/Worldgen/Systems/BaseWorldSystem.cs @@ -12,7 +12,6 @@ namespace Content.Server.Worldgen.Systems; public abstract class BaseWorldSystem : EntitySystem { [Dependency] private readonly WorldControllerSystem _worldController = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; /// /// Gets a chunk's coordinates in chunk space as an integer value. @@ -26,7 +25,7 @@ public Vector2i GetChunkCoords(EntityUid ent, TransformComponent? xform = null) if (!Resolve(ent, ref xform)) throw new Exception("Failed to resolve transform, somehow."); - return WorldGen.WorldToChunkCoords(_xformSystem.GetWorldPosition(xform)).Floored(); + return WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored(); } /// @@ -41,7 +40,7 @@ public Vector2 GetFloatingChunkCoords(EntityUid ent, TransformComponent? xform = if (!Resolve(ent, ref xform)) throw new Exception("Failed to resolve transform, somehow."); - return WorldGen.WorldToChunkCoords(_xformSystem.GetWorldPosition(xform)); + return WorldGen.WorldToChunkCoords(xform.WorldPosition); } /// diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs index f292be7c087..d4ed8272aa3 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs @@ -7,7 +7,6 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; public sealed class EmpArtifactSystem : EntitySystem { [Dependency] private readonly EmpSystem _emp = default!; - [Dependency] private readonly SharedTransformSystem _xform = default!; /// public override void Initialize() @@ -17,6 +16,6 @@ public override void Initialize() private void OnActivate(EntityUid uid, EmpArtifactComponent component, ArtifactActivatedEvent args) { - _emp.EmpPulse(_xform.GetMapCoordinates(uid), component.Range, component.EnergyConsumption, component.DisableDuration); + _emp.EmpPulse(Transform(uid).MapPosition, component.Range, component.EnergyConsumption, component.DisableDuration); } } \ No newline at end of file diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs index c2622837872..fcb33ae41fd 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs @@ -32,7 +32,7 @@ private void OnActivate(EntityUid uid, SpawnArtifactComponent component, Artifac if (component.Spawns is not {} spawns) return; - var artifactCord = _transform.GetMapCoordinates(uid); + var artifactCord = Transform(uid).MapPosition; foreach (var spawn in EntitySpawnCollection.GetSpawns(spawns, _random)) { var dx = _random.NextFloat(-component.Range, component.Range); diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs index 683957865df..85783b552da 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs @@ -19,7 +19,6 @@ public sealed class ThrowArtifactSystem : EntitySystem [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly TileSystem _tile = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; /// public override void Initialize() @@ -33,7 +32,7 @@ private void OnActivated(EntityUid uid, ThrowArtifactComponent component, Artifa if (_map.TryGetGrid(xform.GridUid, out var grid)) { var tiles = grid.GetTilesIntersecting( - Box2.CenteredAround(_xformSystem.GetWorldPosition(xform), new Vector2(component.Range * 2, component.Range))); + Box2.CenteredAround(xform.WorldPosition, new Vector2(component.Range * 2, component.Range))); foreach (var tile in tiles) { @@ -52,7 +51,9 @@ private void OnActivated(EntityUid uid, ThrowArtifactComponent component, Artifa && (phys.CollisionMask & (int) CollisionGroup.GhostImpassable) != 0) continue; - var foo = _xformSystem.GetWorldPosition(ent) - _xformSystem.GetWorldPosition(xform); + var tempXform = Transform(ent); + + var foo = tempXform.MapPosition.Position - xform.MapPosition.Position; _throwing.TryThrow(ent, foo*2, component.ThrowStrength, uid, 0); } } diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index 76fc7bcdd2f..731b2892aa8 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -451,7 +451,7 @@ public bool TryUnbuckle(EntityUid buckleUid, EntityUid userUid, bool force = fal _transform.SetWorldRotation(buckleXform, oldBuckledToWorldRot); if (strapComp.UnbuckleOffset != Vector2.Zero) - _transform.SetCoordinates((buckleUid, buckleXform, MetaData(buckleUid)), oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset)); + buckleXform.Coordinates = oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset); } if (TryComp(buckleUid, out AppearanceComponent? appearance)) diff --git a/Content.Shared/Construction/Conditions/WallmountCondition.cs b/Content.Shared/Construction/Conditions/WallmountCondition.cs index fbb280bd0c7..bf3016d4974 100644 --- a/Content.Shared/Construction/Conditions/WallmountCondition.cs +++ b/Content.Shared/Construction/Conditions/WallmountCondition.cs @@ -17,16 +17,15 @@ public sealed partial class WallmountCondition : IConstructionCondition public bool Condition(EntityUid user, EntityCoordinates location, Direction direction) { var entManager = IoCManager.Resolve(); - var xfmSystem = entManager.System(); // get blueprint and user position - var userWorldPosition = xfmSystem.GetWorldPosition(user); + var userWorldPosition = entManager.GetComponent(user).WorldPosition; var objWorldPosition = location.ToMap(entManager).Position; // find direction from user to blueprint var userToObject = (objWorldPosition - userWorldPosition); // get direction of the grid being placed on as an offset. - var gridRotation = xfmSystem.GetWorldRotation(location.EntityId); + var gridRotation = entManager.GetComponent(location.EntityId).WorldRotation; var directionWithOffset = gridRotation.RotateVec(direction.ToVec()); // dot product will be positive if user direction and blueprint are co-directed diff --git a/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs b/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs index 64faec38d26..b40c0495622 100644 --- a/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs +++ b/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs @@ -127,7 +127,7 @@ private void OnAnchorComplete(EntityUid uid, AnchorableComponent component, TryA // Snap rotation to cardinal (multiple of 90) var rot = xform.LocalRotation; - _transformSystem.SetLocalRotation(uid, Math.Round(rot / (Math.PI / 2)) * (Math.PI / 2), xform); + xform.LocalRotation = Math.Round(rot / (Math.PI / 2)) * (Math.PI / 2); if (TryComp(uid, out var pullable) && pullable.Puller != null) { diff --git a/Content.Shared/Containers/ContainerFillSystem.cs b/Content.Shared/Containers/ContainerFillSystem.cs index 27517c68b2f..e120b6bc883 100644 --- a/Content.Shared/Containers/ContainerFillSystem.cs +++ b/Content.Shared/Containers/ContainerFillSystem.cs @@ -7,7 +7,6 @@ namespace Content.Shared.Containers; public sealed class ContainerFillSystem : EntitySystem { [Dependency] private readonly SharedContainerSystem _containerSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; public override void Initialize() { @@ -37,7 +36,7 @@ private void OnMapInit(EntityUid uid, ContainerFillComponent component, MapInitE if (!_containerSystem.Insert(ent, container, containerXform: xform)) { Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}."); - _xformSystem.AttachToGridOrMap(ent); + Transform(ent).AttachToGridOrMap(); break; } } diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 90f4f2a9006..d832cdfef8c 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -274,7 +274,7 @@ public bool CanInsert(EntityUid uid, EntityUid usedUid, EntityUid? user, ItemSlo if (ev.Cancelled) return false; - return _containers.CanInsert(usedUid, slot.ContainerSlot); + return _containers.CanInsert(usedUid, slot.ContainerSlot, assumeEmpty: true); } /// diff --git a/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs b/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs index 495b7c3415e..2ac525d154d 100644 --- a/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs +++ b/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs @@ -13,8 +13,6 @@ public abstract class SharedDeviceLinkSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; - private ISawmill _sawmill = default!; public const string InvokedPort = "link_port"; @@ -533,7 +531,7 @@ private bool CanLink( private bool InRange(EntityUid sourceUid, EntityUid sinkUid, float range) { // TODO: This should be using an existing method and also coordinates inrange instead. - return _xformSystem.GetMapCoordinates(sourceUid).InRange(_xformSystem.GetMapCoordinates(sinkUid), range); + return Transform(sourceUid).MapPosition.InRange(Transform(sinkUid).MapPosition, range); } private void SendNewLinkEvent(EntityUid? user, EntityUid sourceUid, string source, EntityUid sinkUid, string sink) diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index 7e616829c94..5a3fb872293 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -20,7 +20,6 @@ public abstract partial class ExamineSystemShared : EntitySystem [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; [Dependency] protected readonly MobStateSystem MobStateSystem = default!; public const float MaxRaycastRange = 100; @@ -187,7 +186,6 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinat if (!ignoreInsideBlocker) return false; - var xfmSys = entMan.System(); foreach (var result in rayResults) { if (!entMan.TryGetComponent(result.HitEntity, out OccluderComponent? o)) @@ -196,7 +194,7 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinat } var bBox = o.BoundingBox; - bBox = bBox.Translated(xfmSys.GetWorldPosition(result.HitEntity)); + bBox = bBox.Translated(entMan.GetComponent(result.HitEntity).WorldPosition); if (bBox.Contains(origin.Position) || bBox.Contains(other.Position)) { @@ -212,10 +210,8 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinat public static bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) { var entMan = IoCManager.Resolve(); - var xfmSys = entMan.System(); - - var originPos = xfmSys.GetMapCoordinates(origin); - var otherPos = xfmSys.GetMapCoordinates(other); + var originPos = entMan.GetComponent(origin).MapPosition; + var otherPos = entMan.GetComponent(other).MapPosition; return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } @@ -223,10 +219,8 @@ public static bool InRangeUnOccluded(EntityUid origin, EntityUid other, float ra public static bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) { var entMan = IoCManager.Resolve(); - var xfmSys = entMan.System(); - - var originPos = xfmSys.GetMapCoordinates(origin); - var otherPos = other.ToMap(entMan, xfmSys); + var originPos = entMan.GetComponent(origin).MapPosition; + var otherPos = other.ToMap(entMan); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } @@ -234,9 +228,7 @@ public static bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, public static bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) { var entMan = IoCManager.Resolve(); - var xfmSys = entMan.System(); - - var originPos = xfmSys.GetMapCoordinates(origin); + var originPos = entMan.GetComponent(origin).MapPosition; return InRangeUnOccluded(originPos, other, range, predicate, ignoreInsideBlocker); } diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs index 8382e7d2ee1..e071cdc6938 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs @@ -135,7 +135,7 @@ public bool TryDrop(EntityUid uid, Hand hand, EntityCoordinates? targetDropLocat } var target = targetDropLocation.Value.ToMap(EntityManager, TransformSystem); - TransformSystem.SetWorldPosition(itemXform, GetFinalDropCoordinates(uid, TransformSystem.GetMapCoordinates((uid, userXform)), target)); + TransformSystem.SetWorldPosition(itemXform, GetFinalDropCoordinates(uid, userXform.MapPosition, target)); return true; } diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs index 821f36697be..bbae03e45b3 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs @@ -108,10 +108,10 @@ public bool TryPickup( var xform = Transform(uid); var coordinateEntity = xform.ParentUid.IsValid() ? xform.ParentUid : uid; var itemXform = Transform(entity); - var itemPos = TransformSystem.GetMapCoordinates((entity, itemXform)); + var itemPos = itemXform.MapPosition; if (itemPos.MapId == xform.MapID - && (itemPos.Position - TransformSystem.GetMapCoordinates((uid, xform)).Position).Length() <= MaxAnimationRange + && (itemPos.Position - xform.MapPosition.Position).Length() <= MaxAnimationRange && MetaData(entity).VisibilityMask == MetaData(uid).VisibilityMask) // Don't animate aghost pickups. { var initialPosition = EntityCoordinates.FromMap(coordinateEntity, itemPos, EntityManager); diff --git a/Content.Shared/Interaction/RotateToFaceSystem.cs b/Content.Shared/Interaction/RotateToFaceSystem.cs index 7644727aec9..01dc572a73d 100644 --- a/Content.Shared/Interaction/RotateToFaceSystem.cs +++ b/Content.Shared/Interaction/RotateToFaceSystem.cs @@ -70,7 +70,7 @@ public bool TryFaceCoordinates(EntityUid user, Vector2 coordinates, TransformCom if (!Resolve(user, ref xform)) return false; - var diff = coordinates - _transform.GetMapCoordinates((user, xform)).Position; + var diff = coordinates - xform.MapPosition.Position; if (diff.LengthSquared() <= 0.01f) return true; diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 94d486de391..75063c55503 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -630,7 +630,7 @@ public bool InRangeUnobstructed( fixtureB.FixtureCount > 0 && TryComp(origin, out var xformA)) { - var (worldPosA, worldRotA) = _transform.GetWorldPositionRotation(xformA); + var (worldPosA, worldRotA) = xformA.GetWorldPositionRotation(); var xfA = new Transform(worldPosA, worldRotA); var parentRotB = _transform.GetWorldRotation(otherCoordinates.EntityId); var xfB = new Transform(targetPos.Position, parentRotB + otherAngle); @@ -660,14 +660,14 @@ public bool InRangeUnobstructed( else { // We'll still do the raycast from the centres but we'll bump the range as we know they're in range. - originPos = _transform.GetMapCoordinates(xformA); + originPos = xformA.MapPosition; range = (originPos.Position - targetPos.Position).Length(); } } // No fixtures, e.g. wallmounts. else { - originPos = _transform.GetMapCoordinates(origin); + originPos = Transform(origin).MapPosition; var otherParent = Transform(other).ParentUid; targetRot = otherParent.IsValid() ? Transform(otherParent).LocalRotation + otherAngle : otherAngle; } @@ -696,7 +696,7 @@ public bool InRangeUnobstructed( Ignored? predicate = null) { var transform = Transform(target); - var (position, rotation) = _transform.GetWorldPositionRotation(transform); + var (position, rotation) = transform.GetWorldPositionRotation(); var mapPos = new MapCoordinates(position, transform.MapID); var combinedPredicate = GetPredicate(origin, target, mapPos, rotation, collisionMask, predicate); @@ -821,7 +821,7 @@ public bool InRangeUnobstructed( bool popup = false) { Ignored combinedPredicate = e => e == origin || (predicate?.Invoke(e) ?? false); - var originPosition = _transform.GetMapCoordinates(origin); + var originPosition = Transform(origin).MapPosition; var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, combinedPredicate, ShouldCheckAccess(origin)); if (!inRange && popup && _gameTiming.IsFirstTimePredicted) @@ -1057,7 +1057,7 @@ public void DroppedInteraction(EntityUid user, EntityUid item) rotation = mover.TargetRelativeRotation; } - _transform.SetLocalRotation(item, rotation); + Transform(item).LocalRotation = rotation; } #endregion diff --git a/Content.Shared/Maps/TileSystem.cs b/Content.Shared/Maps/TileSystem.cs index 4b5a0cb860f..d87b3ca50d5 100644 --- a/Content.Shared/Maps/TileSystem.cs +++ b/Content.Shared/Maps/TileSystem.cs @@ -20,7 +20,6 @@ public sealed class TileSystem : EntitySystem [Dependency] private readonly SharedDecalSystem _decal = default!; [Dependency] private readonly SharedMapSystem _maps = default!; [Dependency] private readonly TurfSystem _turf = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; /// /// Returns a weighted pick of a tile variant. @@ -155,7 +154,7 @@ public bool DeconstructTile(TileRef tileRef) //Actually spawn the relevant tile item at the right position and give it some random offset. var tileItem = Spawn(tileDef.ItemDropPrototypeName, coordinates); - _xformSystem.SetLocalRotation(tileItem, _robustRandom.NextDouble() * Math.Tau); + Transform(tileItem).LocalRotation = _robustRandom.NextDouble() * Math.Tau; // Destroy any decals on the tile var decals = _decal.GetDecalsInRange(gridUid, coordinates.SnapToGrid(EntityManager, _mapManager).Position, 0.5f); diff --git a/Content.Shared/Maps/TurfHelpers.cs b/Content.Shared/Maps/TurfHelpers.cs index a0afe184081..a87b8c97d15 100644 --- a/Content.Shared/Maps/TurfHelpers.cs +++ b/Content.Shared/Maps/TurfHelpers.cs @@ -144,12 +144,11 @@ public static bool IsBlockedTurf(this TileRef turf, bool filterMobs, EntityLooku private static bool GetWorldTileBox(TileRef turf, out Box2Rotated res) { var entManager = IoCManager.Resolve(); - var xfmSystem = entManager.System(); var map = IoCManager.Resolve(); if (map.TryGetGrid(turf.GridUid, out var tileGrid)) { - var gridRot = xfmSystem.GetWorldRotation(turf.GridUid); + var gridRot = entManager.GetComponent(turf.GridUid).WorldRotation; // This is scaled to 90 % so it doesn't encompass walls on other tiles. var tileBox = Box2.UnitCentered.Scale(0.9f); diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index d854d5544a6..2c03507f617 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -248,7 +248,7 @@ protected void HandleMobMovement( // TODO apparently this results in a duplicate move event because "This should have its event run during // island solver"??. So maybe SetRotation needs an argument to avoid raising an event? var worldRot = _transform.GetWorldRotation(xform); - _transform.SetLocalRotation(physicsUid, xform.LocalRotation + worldTotal.ToWorldAngle() - worldRot, xform); + _transform.SetLocalRotation(xform, xform.LocalRotation + worldTotal.ToWorldAngle() - worldRot); } if (!weightless && MobMoverQuery.TryGetComponent(uid, out var mobMover) && diff --git a/Content.Shared/Ninja/Systems/DashAbilitySystem.cs b/Content.Shared/Ninja/Systems/DashAbilitySystem.cs index cce0b291757..f9e5d4a1f63 100644 --- a/Content.Shared/Ninja/Systems/DashAbilitySystem.cs +++ b/Content.Shared/Ninja/Systems/DashAbilitySystem.cs @@ -80,7 +80,7 @@ private void OnDash(EntityUid uid, DashAbilityComponent comp, DashEvent args) return; } - var origin = _transform.GetMapCoordinates(user); + var origin = Transform(user).MapPosition; var target = args.Target.ToMap(EntityManager, _transform); // prevent collision with the user duh if (!_interaction.InRangeUnobstructed(origin, target, 0f, CollisionGroup.Opaque, uid => uid == user)) diff --git a/Content.Shared/Physics/Controllers/SharedConveyorController.cs b/Content.Shared/Physics/Controllers/SharedConveyorController.cs index eea64629535..ec17df7a24f 100644 --- a/Content.Shared/Physics/Controllers/SharedConveyorController.cs +++ b/Content.Shared/Physics/Controllers/SharedConveyorController.cs @@ -97,7 +97,7 @@ private void Convey(EntityUid uid, ConveyorComponent comp, EntityQuery(PreventCollision); - SubscribeLocalEvent(AfterProjectileHit); SubscribeLocalEvent(OnEmbedProjectileHit); SubscribeLocalEvent(OnEmbedThrowDoHit); SubscribeLocalEvent(OnEmbedActivate); @@ -163,18 +162,6 @@ private void OnAttemptPacifiedThrow(Entity ent, r { args.Cancel("pacified-cannot-throw-embed"); } - - /// - /// Checks if the projectile is allowed to penetrate the target it hit. - /// - private void AfterProjectileHit(EntityUid uid, ProjectileComponent component, ref AfterProjectileHitEvent args) - { - //Overrides the original DeleteOnCollide if the projectile passes all penetration checks. - //This is to prevent having to set DeleteOnCollide to false on every prototype - //you want to give the ability to penetrate entities. - if(component.DeleteOnCollide) - component.DeleteOnCollide = false; - } } [Serializable, NetSerializable] @@ -201,9 +188,3 @@ public record struct ProjectileReflectAttemptEvent(EntityUid ProjUid, Projectile /// [ByRefEvent] public record struct ProjectileHitEvent(DamageSpecifier Damage, EntityUid Target, EntityUid? Shooter = null); - -/// -/// Raised after a projectile has dealt it's damage. -/// -[ByRefEvent] -public record struct AfterProjectileHitEvent(DamageSpecifier Damage, EntityUid Target, Fixture Fixture); diff --git a/Content.Shared/RCD/Systems/RCDSystem.cs b/Content.Shared/RCD/Systems/RCDSystem.cs index 237d160ceaf..4bcf1835e03 100644 --- a/Content.Shared/RCD/Systems/RCDSystem.cs +++ b/Content.Shared/RCD/Systems/RCDSystem.cs @@ -38,7 +38,6 @@ public sealed class RCDSystem : EntitySystem [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly TurfSystem _turf = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly SharedTransformSystem _xformSystem = default!; private readonly int RcdModeCount = Enum.GetValues(typeof(RcdMode)).Length; @@ -206,7 +205,7 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args) if (_net.IsServer) { var ent = Spawn("WallSolid", mapGrid.GridTileToLocal(snapPos)); - _xformSystem.SetLocalRotation(ent, Angle.Zero); // Walls always need to point south. + Transform(ent).LocalRotation = Angle.Zero; // Walls always need to point south. _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {tile.GridUid}"); } break; @@ -215,7 +214,7 @@ private void OnDoAfter(EntityUid uid, RCDComponent comp, RCDDoAfterEvent args) if (_net.IsServer) { var airlock = Spawn("Airlock", mapGrid.GridTileToLocal(snapPos)); - _xformSystem.SetLocalRotation(airlock, Transform(uid).LocalRotation); //Now apply icon smoothing. + Transform(airlock).LocalRotation = Transform(uid).LocalRotation; //Now apply icon smoothing. _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {tile.GridUid}"); } break; diff --git a/Content.Shared/Random/RandomHelperSystem.cs b/Content.Shared/Random/RandomHelperSystem.cs index 553e28cd659..66ebcc3f78b 100644 --- a/Content.Shared/Random/RandomHelperSystem.cs +++ b/Content.Shared/Random/RandomHelperSystem.cs @@ -20,7 +20,7 @@ public void RandomOffset(EntityUid entity, float minX, float maxX, float minY, f var offset = new Vector2(randomX, randomY); var xform = Transform(entity); - _transform.SetLocalPosition(entity, xform.LocalPosition + offset, xform); + _transform.SetLocalPosition(xform, xform.LocalPosition + offset); } public void RandomOffset(EntityUid entity, float min, float max) diff --git a/Content.Shared/Stealth/SharedStealthSystem.cs b/Content.Shared/Stealth/SharedStealthSystem.cs index 14b3ebbe141..3400a20dcb0 100644 --- a/Content.Shared/Stealth/SharedStealthSystem.cs +++ b/Content.Shared/Stealth/SharedStealthSystem.cs @@ -113,7 +113,7 @@ private void OnStealthHandleState(EntityUid uid, StealthComponent component, ref private void OnMove(EntityUid uid, StealthOnMoveComponent component, ref MoveEvent args) { - if (_timing.ApplyingState) + if (args.FromStateHandling) return; if (args.NewPosition.EntityId != args.OldPosition.EntityId) diff --git a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs index a47488b24fa..21861f57dab 100644 --- a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs +++ b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs @@ -77,7 +77,7 @@ public override void Update(float frameTime) // the problem is that stack pickups delete the original entity, which is fine, but due to // game state handling we can't show a lerp animation for it. var nearXform = Transform(near); - var nearMap = _transform.GetMapCoordinates(nearXform); + var nearMap = nearXform.MapPosition; var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager); if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound)) diff --git a/Content.Shared/Tabletop/SharedTabletopSystem.cs b/Content.Shared/Tabletop/SharedTabletopSystem.cs index 351fe04174c..7bfd9d34572 100644 --- a/Content.Shared/Tabletop/SharedTabletopSystem.cs +++ b/Content.Shared/Tabletop/SharedTabletopSystem.cs @@ -14,9 +14,9 @@ namespace Content.Shared.Tabletop public abstract class SharedTabletopSystem : EntitySystem { [Dependency] protected readonly ActionBlockerSystem ActionBlockerSystem = default!; - [Dependency] protected readonly SharedTransformSystem Transforms = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedTransformSystem _transforms = default!; [Dependency] private readonly IMapManager _mapMan = default!; public override void Initialize() @@ -41,8 +41,8 @@ protected virtual void OnTabletopMove(TabletopMoveEvent msg, EntitySessionEventA // Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map) var transform = EntityManager.GetComponent(moved); - var coordinates = new EntityCoordinates(_mapMan.GetMapEntityId(transform.MapID), msg.Coordinates.Position); - Transforms.SetCoordinates(moved, transform, coordinates); + _transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID)); + _transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position); } private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args) diff --git a/Content.Shared/Throwing/ThrowingSystem.cs b/Content.Shared/Throwing/ThrowingSystem.cs index 2ac71e35f46..54294318315 100644 --- a/Content.Shared/Throwing/ThrowingSystem.cs +++ b/Content.Shared/Throwing/ThrowingSystem.cs @@ -44,7 +44,7 @@ public void TryThrow( float pushbackRatio = PushbackDefault, bool playSound = true) { - var thrownPos = _transform.GetMapCoordinates(uid); + var thrownPos = Transform(uid).MapPosition; var mapPos = coordinates.ToMap(EntityManager, _transform); if (mapPos.MapId != thrownPos.MapId) diff --git a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs index 4d3b0b802bc..177cb310d18 100644 --- a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs @@ -220,7 +220,7 @@ protected virtual void StartTether(EntityUid gunUid, BaseForceGunComponent compo _blocker.UpdateCanMove(target); // Invisible tether entity - var tether = Spawn("TetherEntity", TransformSystem.GetMapCoordinates(target)); + var tether = Spawn("TetherEntity", Transform(target).MapPosition); var tetherPhysics = Comp(tether); component.TetherEntity = tether; _physics.WakeBody(tether); diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs index 3de5ae3144a..a8f7ee23956 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs @@ -35,7 +35,7 @@ private void OnBallisticUse(EntityUid uid, BallisticAmmoProviderComponent compon if (args.Handled) return; - ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User); + ManualCycle(uid, component, Transform(uid).MapPosition, args.User); args.Handled = true; } @@ -162,7 +162,7 @@ private void OnBallisticVerb(EntityUid uid, BallisticAmmoProviderComponent compo { Text = Loc.GetString("gun-ballistic-cycle"), Disabled = GetBallisticShots(component) == 0, - Act = () => ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User), + Act = () => ManualCycle(uid, component, Transform(uid).MapPosition, args.User), }); } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs index dc5dc5b90c8..c421c92a9f7 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs @@ -112,7 +112,10 @@ private void UseChambered(EntityUid uid, ChamberMagazineAmmoProviderComponent co } } - CycleCartridge(uid, component, user); + if (!CycleCartridge(uid, component, user)) + { + UpdateAmmoCount(uid); + } if (component.BoltClosed != false) { @@ -202,11 +205,12 @@ public void SetBoltClosed(EntityUid uid, ChamberMagazineAmmoProviderComponent co /// /// Tries to take ammo from the magazine and insert into the chamber. /// - private void CycleCartridge(EntityUid uid, ChamberMagazineAmmoProviderComponent component, EntityUid? user = null, AppearanceComponent? appearance = null) + private bool CycleCartridge(EntityUid uid, ChamberMagazineAmmoProviderComponent component, EntityUid? user = null, AppearanceComponent? appearance = null) { // Try to put a new round in if possible. var magEnt = GetMagazineEntity(uid); var chambered = GetChamberEntity(uid); + var result = false; // Similar to what takeammo does though that uses an optimised version where // multiple bullets may be fired in a single tick. @@ -243,7 +247,11 @@ private void CycleCartridge(EntityUid uid, ChamberMagazineAmmoProviderComponent { UpdateAmmoCount(uid); } + + result = true; } + + return result; } /// diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 2ad63ad0965..71e3e80764f 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -431,7 +431,8 @@ protected void EjectCartridge( var coordinates = xform.Coordinates; coordinates = coordinates.Offset(offsetPos); - TransformSystem.SetCoordinates(entity, xform, coordinates, Random.NextAngle()); + TransformSystem.SetLocalRotation(xform, Random.NextAngle()); + TransformSystem.SetCoordinates(entity, xform, coordinates); // decides direction the casing ejects and only when not cycling if (angle != null) diff --git a/Resources/Changelog/Changelog.yml b/Resources/Changelog/Changelog.yml index dd5927d825f..9fd4b235d56 100644 --- a/Resources/Changelog/Changelog.yml +++ b/Resources/Changelog/Changelog.yml @@ -1,27 +1,4 @@ Entries: -- author: metalgearsloth - changes: - - message: Salvage magnet now has an interface to choose what you want to do. - type: Add - - message: Magnet asteroids now come in more varieties. - type: Tweak - id: 5545 - time: '2024-01-04T03:25:32.0000000+00:00' - url: https://api.github.com/repos/space-wizards/space-station-14/pulls/23119 -- author: themias - changes: - - message: Added a funny oxygen tank for the clown - type: Add - id: 5546 - time: '2024-01-04T03:29:03.0000000+00:00' - url: https://api.github.com/repos/space-wizards/space-station-14/pulls/23495 -- author: SpeltIncorrectyl - changes: - - message: The flatpacker 1001 can now create flatpacks for computers. - type: Tweak - id: 5547 - time: '2024-01-04T04:23:47.0000000+00:00' - url: https://api.github.com/repos/space-wizards/space-station-14/pulls/23471 - author: Geekyhobo changes: - message: Fixed AGhosts not being able to drop items past the default range. @@ -3834,3 +3811,26 @@ id: 6044 time: '2024-02-27T01:38:00.0000000+00:00' url: https://github.com/space-wizards/space-station-14/pull/19610 +- author: rosieposieeee + changes: + - message: Added lockable wall buttons and decorative frames for differentiating + wall buttons. + type: Add + id: 6045 + time: '2024-02-27T07:57:17.0000000+00:00' + url: https://github.com/space-wizards/space-station-14/pull/25631 +- author: metalgearsloth + changes: + - message: Fix chat bubbles. + type: Fix + id: 6046 + time: '2024-02-27T13:01:24.0000000+00:00' + url: https://github.com/space-wizards/space-station-14/pull/25643 +- author: rosieposieeee + changes: + - message: Added grey stalagmites and made all stalagmites weaker and more fun to + break. + type: Add + id: 6047 + time: '2024-02-27T19:24:17.0000000+00:00' + url: https://github.com/space-wizards/space-station-14/pull/25646 diff --git a/Resources/Prototypes/Entities/Objects/Decoration/flora.yml b/Resources/Prototypes/Entities/Objects/Decoration/flora.yml index 6a622d7beaa..a2dda827be7 100644 --- a/Resources/Prototypes/Entities/Objects/Decoration/flora.yml +++ b/Resources/Prototypes/Entities/Objects/Decoration/flora.yml @@ -173,6 +173,17 @@ parent: BaseRock id: FloraStalagmite1 components: + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 5 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - !type:PlaySoundBehavior + sound: + collection: GlassBreak - type: Sprite sprite: Objects/Decoration/Flora/flora_stalagmite.rsi state: stalagmite1 @@ -217,6 +228,55 @@ sprite: Objects/Decoration/Flora/flora_stalagmite.rsi state: stalagmite6 +- type: entity + parent: FloraStalagmite1 + id: FloraGreyStalagmite1 + components: + - type: Sprite + sprite: Objects/Decoration/Flora/flora_stalagmite.rsi + state: grey_stalagmite1 + +- type: entity + parent: FloraGreyStalagmite1 + id: FloraGreyStalagmite2 + components: + - type: Sprite + sprite: Objects/Decoration/Flora/flora_stalagmite.rsi + state: grey_stalagmite2 + +- type: entity + parent: FloraGreyStalagmite1 + id: FloraGreyStalagmite3 + components: + - type: Sprite + sprite: Objects/Decoration/Flora/flora_stalagmite.rsi + state: grey_stalagmite3 + +- type: entity + parent: FloraGreyStalagmite1 + id: FloraGreyStalagmite4 + components: + - type: Sprite + sprite: Objects/Decoration/Flora/flora_stalagmite.rsi + state: grey_stalagmite4 + +- type: entity + parent: FloraGreyStalagmite1 + id: FloraGreyStalagmite5 + components: + - type: Sprite + sprite: Objects/Decoration/Flora/flora_stalagmite.rsi + state: grey_stalagmite5 + +- type: entity + parent: FloraGreyStalagmite1 + id: FloraGreyStalagmite6 + components: + - type: Sprite + sprite: Objects/Decoration/Flora/flora_stalagmite.rsi + state: grey_stalagmite6 + + - type: entity parent: BaseTree id: FloraTree01 diff --git a/Resources/Prototypes/Entities/Objects/Fun/figurines.yml b/Resources/Prototypes/Entities/Objects/Fun/figurines.yml index 5f23dc4ff78..61ce7079f75 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/figurines.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/figurines.yml @@ -28,7 +28,7 @@ components: - type: Sprite state: hop - + - type: entity parent: BaseFigurine id: ToyFigurinePassenger @@ -37,7 +37,7 @@ components: - type: Sprite state: passenger - + - type: entity parent: BaseFigurine id: ToyFigurineGreytider @@ -159,8 +159,8 @@ - type: entity parent: BaseFigurine id: ToyFigurineSalvage - name: salvage technican figure - description: A figurine depicting a Salvage Technician holding a survival knife. + name: salvage specialist figure + description: A figurine depicting a Salvage Specialist holding a survival knife. components: - type: Sprite state: salvage @@ -317,7 +317,7 @@ components: - type: Sprite state: nukie - + - type: entity parent: BaseFigurine id: ToyFigurineNukieElite @@ -335,7 +335,7 @@ components: - type: Sprite state: nukie_commander - + - type: entity parent: BaseFigurine id: ToyFigurineFootsoldier @@ -344,7 +344,7 @@ components: - type: Sprite state: footsoldier - + - type: entity parent: BaseFigurine id: ToyFigurineWizard @@ -353,7 +353,7 @@ components: - type: Sprite state: wizard - + - type: entity parent: BaseFigurine id: ToyFigurineWizardFake @@ -373,7 +373,7 @@ components: - type: Sprite state: spacedragon - + - type: entity parent: BaseFigurine id: ToyFigurineQueen @@ -409,7 +409,7 @@ components: - type: Sprite state: mouse - + - type: entity parent: BaseFigurine id: ToyFigurineSlime @@ -427,7 +427,7 @@ components: - type: Sprite state: hamlet - + #TODO: Convert these to the new figurine sprite template and rename their sprite name. #Yes, these are humanoids, but they need to be updated first. diff --git a/Resources/Prototypes/Entities/Structures/Walls/asteroid.yml b/Resources/Prototypes/Entities/Structures/Walls/asteroid.yml index e354877612a..a2c160017b6 100644 --- a/Resources/Prototypes/Entities/Structures/Walls/asteroid.yml +++ b/Resources/Prototypes/Entities/Structures/Walls/asteroid.yml @@ -6,7 +6,6 @@ id: AsteroidRock parent: BaseStructure name: asteroid rock - suffix: Low Ore Yield description: A rocky asteroid. components: - type: PlacementReplacement @@ -191,7 +190,7 @@ - map: [ "enum.EdgeLayer.West" ] state: rock_asteroid_west - state: rock_silver - + - type: entity id: AsteroidRockSilverCrab parent: AsteroidRockSilver @@ -223,7 +222,7 @@ - map: [ "enum.EdgeLayer.West" ] state: rock_asteroid_west - state: rock_tin - + - type: entity id: AsteroidRockTinCrab parent: AsteroidRockTin diff --git a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite1.png b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite1.png new file mode 100644 index 00000000000..f3da176d53e Binary files /dev/null and b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite1.png differ diff --git a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite2.png b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite2.png new file mode 100644 index 00000000000..73a494c76ca Binary files /dev/null and b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite2.png differ diff --git a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite3.png b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite3.png new file mode 100644 index 00000000000..afb185352e0 Binary files /dev/null and b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite3.png differ diff --git a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite4.png b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite4.png new file mode 100644 index 00000000000..0c0b6f81dae Binary files /dev/null and b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite4.png differ diff --git a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite5.png b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite5.png new file mode 100644 index 00000000000..5fee678add7 Binary files /dev/null and b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite5.png differ diff --git a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite6.png b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite6.png new file mode 100644 index 00000000000..71598eaea71 Binary files /dev/null and b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/grey_stalagmite6.png differ diff --git a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/meta.json b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/meta.json index 33dc4fa0738..02e5b17b2b0 100644 --- a/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/meta.json +++ b/Resources/Textures/Objects/Decoration/Flora/flora_stalagmite.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from TGMC at commit https://github.com/tgstation/TerraGov-Marine-Corps/commit/4bf5d1aafbcbbb7bd2a7d0f52ef87f28e2bbb384", + "copyright": "Taken from TGMC at commit https://github.com/tgstation/TerraGov-Marine-Corps/commit/4bf5d1aafbcbbb7bd2a7d0f52ef87f28e2bbb384, grey ones recolored by rosieposieeee (github)", "size": { "x": 32, "y": 32 @@ -24,6 +24,24 @@ }, { "name": "stalagmite6" + }, + { + "name": "grey_stalagmite1" + }, + { + "name": "grey_stalagmite2" + }, + { + "name": "grey_stalagmite3" + }, + { + "name": "grey_stalagmite4" + }, + { + "name": "grey_stalagmite5" + }, + { + "name": "grey_stalagmite6" } ] }