Revert "Fix chat bubbles (#25643)" (#25645)

* Revert "Fix chat bubbles (#25643)"

This reverts commit 23d2c4d924.

* Revert "Fixes obsolete Transform warnings in Content. (#25256)"

This reverts commit f284b43ff6.
This commit is contained in:
metalgearsloth
2024-02-28 00:51:20 +11:00
committed by GitHub
parent d204896bf5
commit a9502be29e
154 changed files with 435 additions and 611 deletions

View File

@@ -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 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
if (!_entMan.TryGetComponent(_playerManager.LocalEntity, out TransformComponent? transform))
return;
_xformSystem ??= _entMan.SystemOrNull<SharedTransformSystem>();
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();

View File

@@ -22,7 +22,6 @@ namespace Content.Client.Atmos.Overlays
{
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 @@ namespace Content.Client.Atmos.Overlays
{
_entManager = entManager;
_mapManager = IoCManager.Resolve<IMapManager>();
_xformSystem = _entManager.System<SharedTransformSystem>();
_shader = protoMan.Index<ShaderPrototype>("unshaded").Instance();
ZIndex = GasOverlayZIndex;
@@ -158,8 +156,7 @@ namespace Content.Client.Atmos.Overlays
_fireFrameCounter,
_shader,
overlayQuery,
xformQuery,
_xformSystem);
xformQuery);
var mapUid = _mapManager.GetMapEntityId(args.MapId);
@@ -197,8 +194,7 @@ namespace Content.Client.Atmos.Overlays
int[] fireFrameCounter,
ShaderInstance shader,
EntityQuery<GasTileOverlayComponent> overlayQuery,
EntityQuery<TransformComponent> xformQuery,
SharedTransformSystem xformSystem) state) =>
EntityQuery<TransformComponent> xformQuery) state) =>
{
if (!state.overlayQuery.TryGetComponent(uid, out var comp) ||
!state.xformQuery.TryGetComponent(uid, out var gridXform))
@@ -206,7 +202,7 @@ namespace Content.Client.Atmos.Overlays
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(

View File

@@ -30,7 +30,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
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

View File

@@ -2,7 +2,6 @@ using System.Numerics;
using Content.Client.Chat.Managers;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -17,7 +16,6 @@ namespace Content.Client.Chat.UI
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
private readonly SharedTransformSystem _xformSystem;
public enum SpeechType : byte
{
@@ -84,7 +82,6 @@ namespace Content.Client.Chat.UI
public SpeechBubble(ChatMessage message, EntityUid senderEntity, string speechStyleClass, Color? fontColor = null)
{
IoCManager.InjectDependencies(this);
_xformSystem = _entityManager.System<SharedTransformSystem>();
_senderEntity = senderEntity;
// Use text clipping so new messages don't overlap old ones being pushed up.
@@ -143,7 +140,7 @@ namespace Content.Client.Chat.UI
}
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);

View File

@@ -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;
/// <summary>
/// Makes it possible to click the associated entity.
/// </summary>
[RegisterComponent]
public sealed partial class ClickableComponent : Component
namespace Content.Client.Clickable
{
/// <summary>
/// A set of AABBs used as an approximate check for whether a click could hit this entity.
/// </summary>
[DataField("bounds")]
public DirBoundData? Bounds;
/// <summary>
/// A set of AABBs associated with the cardinal directions used for approximate click intersection calculations.
/// </summary>
[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;
/// <summary>
/// Used to check whether a click worked. Will first check if the click falls inside of some explicit bounding
/// boxes (see <see cref="Bounds"/>). If that fails, attempts to use automatically generated click maps.
/// </summary>
/// <param name="worldPos">The world position that was clicked.</param>
/// <param name="drawDepth">
/// The draw depth for the sprite that captured the click.
/// </param>
/// <returns>True if the click worked, false otherwise.</returns>
public bool CheckClick(SpriteComponent sprite, TransformComponent transform, EntityQuery<TransformComponent> 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;
}
}
}

View File

@@ -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!;
/// <summary>
/// Used to check whether a click worked. Will first check if the click falls inside of some explicit bounding
/// boxes (see <see cref="Bounds"/>). If that fails, attempts to use automatically generated click maps.
/// </summary>
/// <param name="entity">The entity that we are trying to click.</param>
/// <param name="worldPos">The world position that was clicked.</param>
/// <param name="eye">The PoV the click is originating from.</param>
/// <param name="drawDepth">The draw depth for the sprite that captured the click.</param>
/// <param name="renderOrder">The render order for the sprite that captured the click.</param>
/// <param name="bottom">The bottom of the sprite AABB from the perspective of the eye doing the click.</param>
/// <returns>True if the click worked, false otherwise.</returns>
public bool CheckClick(Entity<ClickableComponent, SpriteComponent, TransformComponent> 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;
}
/// <summary>
/// Used to check whether a click worked lands inside of the AABB for the current sprite for a clickable entity.
/// </summary>
/// <param name="localPos">The world position that was clicked.</param>
/// <param name="relativeRotation">The angle of the entity to check relative to the PoV that the click is coming from.</param>
/// <returns>True if the click lands inside the relevant AABB.</returns>
public bool CheckDirBound(Entity<ClickableComponent, SpriteComponent> 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);
}
}

View File

@@ -27,7 +27,6 @@ namespace Content.Client.Construction
[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<int, EntityUid> _ghosts = new();
@@ -206,7 +205,7 @@ namespace Content.Client.Construction
ghost = EntityManager.SpawnEntity("constructionghost", loc);
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
comp.Prototype = prototype;
_xformSystem.SetLocalRotation(ghost.Value, dir.ToAngle());
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
_ghosts.Add(ghost.GetHashCode(), ghost.Value);
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
sprite.Color = new Color(48, 255, 48, 128);

View File

@@ -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<SharedTransformSystem>();
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
}
@@ -69,7 +67,7 @@ public sealed class ExplosionOverlay : Overlay
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);

View File

@@ -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 sealed class PuddleOverlay : Overlay
{
IoCManager.InjectDependencies(this);
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
_xformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
var cache = IoCManager.Resolve<IResourceCache>();
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
}
@@ -57,7 +55,7 @@ public sealed class PuddleOverlay : Overlay
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 @@ public sealed class PuddleOverlay : Overlay
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))

View File

@@ -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<HandheldGPSComponent> parent)
{
_parent = parent;
_entMan = IoCManager.Resolve<IEntityManager>();
_xformSystem = _entMan.System<SharedTransformSystem>();
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
AddChild(_label);
UpdateGpsDetails();
@@ -43,7 +41,7 @@ public sealed class HandheldGpsStatusControl : Control
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})";

View File

@@ -116,7 +116,7 @@ namespace Content.Client.Gameplay
// 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<ClickableComponent>();
var clickSystem = _entityManager.System<ClickableSystem>();
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
// TODO: Smelly
var eye = _eyeManager.CurrentEye;
@@ -124,7 +124,7 @@ namespace Content.Client.Gameplay
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));
}

View File

@@ -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>, List<string>?, string?, bool, string?>? OnGuidebookOpen;
public const string GuideEmbedTag = "GuideEmbeded";
@@ -99,9 +98,8 @@ public sealed class GuidebookSystem : EntitySystem
{
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 @@ public sealed class GuidebookSystem : EntitySystem
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)

View File

@@ -22,7 +22,6 @@ public sealed class HotPotatoSystem : SharedHotPotatoSystem
{
if (_timing.CurTime < comp.TargetTime)
continue;
comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown);
Spawn("HotPotatoEffect", _transform.GetMapCoordinates(uid).Offset(_random.NextVector2(0.25f)));
}

View File

@@ -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 @@ public sealed class DragDropSystem : SharedDragDropSystem
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 sealed class DragDropSystem : SharedDragDropSystem
if (Exists(_dragShadow))
{
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
_xformSystem.SetWorldPosition(_dragShadow.Value, mousePos.Position);
Transform(_dragShadow.Value).WorldPosition = mousePos.Position;
}
}
}

View File

@@ -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 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
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 sealed class GridDraggingSystem : SharedGridDraggingSystem
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<TransformComponent>(_dragging, out var xform))
@@ -117,11 +116,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
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()

View File

@@ -37,7 +37,7 @@ public sealed class MouseRotatorSystem : SharedMouseRotatorSystem
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);

View File

@@ -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 @@ public sealed class HTNOverlay : Overlay
if (args.ViewportControl == null)
return;
_xformSystem ??= _entManager.SystemOrNull<SharedTransformSystem>();
if (_xformSystem is null)
return;
var handle = args.ScreenHandle;
foreach (var (comp, xform) in _entManager.EntityQuery<HTNComponent, TransformComponent>(true))
@@ -35,7 +30,7 @@ public sealed class HTNOverlay : Overlay
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;

View File

@@ -89,10 +89,6 @@ public sealed class NPCSteeringOverlay : Overlay
protected override void Draw(in OverlayDrawArgs args)
{
var xformSystem = _entManager.SystemOrNull<SharedTransformSystem>();
if (xformSystem is null)
return;
foreach (var (comp, mover, xform) in _entManager.EntityQuery<NPCSteeringComponent, InputMoverComponent, TransformComponent>(true))
{
if (xform.MapID != args.MapId)
@@ -100,7 +96,7 @@ public sealed class NPCSteeringOverlay : Overlay
continue;
}
var (worldPos, worldRot) = xformSystem.GetWorldPositionRotation(xform);
var (worldPos, worldRot) = xform.GetWorldPositionRotation();
if (!args.WorldAABB.Contains(worldPos))
continue;

View File

@@ -140,7 +140,6 @@ namespace Content.Client.NPC
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 @@ namespace Content.Client.NPC
_mapManager = mapManager;
_system = system;
_mapSystem = mapSystem;
_xformSystem = _entManager.System<SharedTransformSystem>();
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
}
@@ -201,7 +199,7 @@ namespace Content.Client.NPC
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 @@ namespace Content.Client.NPC
return;
}
var invGridMatrix = _xformSystem.GetInvWorldMatrix(gridXform);
var invGridMatrix = gridXform.InvWorldMatrix;
DebugPathPoly? nearest = null;
var nearestDistance = float.MaxValue;
@@ -358,7 +356,7 @@ namespace Content.Client.NPC
continue;
}
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
worldHandle.SetTransform(worldMatrix);
var localAABB = invWorldMatrix.TransformBox(aabb);
@@ -418,7 +416,7 @@ namespace Content.Client.NPC
!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 @@ namespace Content.Client.NPC
!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 @@ namespace Content.Client.NPC
!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 @@ namespace Content.Client.NPC
if (!_entManager.TryGetComponent<TransformComponent>(_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 @@ namespace Content.Client.NPC
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));

View File

@@ -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<EntityUid, Color> Colors = new();
public EntityUid? Action;
@@ -24,7 +23,6 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
IoCManager.InjectDependencies(this);
_deviceListSystem = _entityManager.System<DeviceListSystem>();
_xformSystem = _entityManager.System<SharedTransformSystem>();
}
protected override void Draw(in OverlayDrawArgs args)
@@ -68,7 +66,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
continue;
}
args.WorldHandle.DrawLine(_xformSystem.GetWorldPosition(sourceTransform), _xformSystem.GetWorldPosition(linkTransform), Colors[uid]);
args.WorldHandle.DrawLine(sourceTransform.WorldPosition, linkTransform.WorldPosition, Colors[uid]);
}
}
}

View File

@@ -20,7 +20,6 @@ namespace Content.Client.NodeContainer
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<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
@@ -47,7 +46,6 @@ namespace Content.Client.NodeContainer
_mapManager = mapManager;
_inputManager = inputManager;
_entityManager = entityManager;
_xformSystem = _entityManager.System<SharedTransformSystem>();
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
}
@@ -148,7 +146,7 @@ namespace Content.Client.NodeContainer
foreach (var (gridId, gridDict) in _gridIndex)
{
var grid = _mapManager.GetGrid(gridId);
var (_, _, worldMatrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridId);
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(gridId).GetWorldPositionRotationMatrixWithInv();
var lCursorBox = invMatrix.TransformBox(cursorBox);
foreach (var (pos, list) in gridDict)

View File

@@ -22,7 +22,6 @@ public sealed class TargetOutlineSystem : EntitySystem
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
private bool _enabled = false;
@@ -165,8 +164,8 @@ public sealed class TargetOutlineSystem : EntitySystem
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;
}

View File

@@ -58,7 +58,6 @@ public sealed class NavMapOverlay : Overlay
{
var query = _entManager.GetEntityQuery<NavMapComponent>();
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
var xformSystem = _entManager.System<SharedTransformSystem>();
var scale = Matrix3.CreateScale(new Vector2(1f, 1f));
_grids.Clear();
@@ -70,7 +69,7 @@ public sealed class NavMapOverlay : Overlay
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);

View File

@@ -14,7 +14,6 @@ namespace Content.Client.Radiation.Overlays
[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 @@ namespace Content.Client.Radiation.Overlays
//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<SharedTransformSystem>();
if (_xformSystem is null || currentEye is null)
if (currentEye == null)
{
_pulses.Clear();
return;
@@ -94,7 +91,7 @@ namespace Content.Client.Radiation.Overlays
(
_baseShader.Duplicate(),
new RadiationShaderInstance(
_xformSystem.GetMapCoordinates(pulseEntity),
_entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition,
pulse.VisualRange,
pulse.StartTime,
pulse.VisualDuration
@@ -112,7 +109,7 @@ namespace Content.Client.Radiation.Overlays
_entityManager.TryGetComponent(pulseEntity, out RadiationPulseComponent? pulse))
{
var shaderInstance = _pulses[pulseEntity];
shaderInstance.instance.CurrentMapCoords = _xformSystem.GetMapCoordinates(pulseEntity);
shaderInstance.instance.CurrentMapCoords = _entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition;
shaderInstance.instance.Range = pulse.VisualRange;
} else {
_pulses[pulseEntity].shd.Dispose();

View File

@@ -126,18 +126,18 @@ public sealed partial class ReplaySpectatorSystem
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
{

View File

@@ -55,7 +55,7 @@ public sealed partial class ReplaySpectatorSystem
RemComp<ReplaySpectatorComponent>(old.Value);
}
public Entity<TransformComponent> 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 sealed partial class ReplaySpectatorSystem
_stateMan.RequestStateChange<ReplayGhostState>();
_spectatorData = GetSpectatorData();
return (ent, xform);
return xform;
}
private void SpectateCommand(IConsoleShell shell, string argStr, string[] args)

View File

@@ -58,7 +58,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
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<SharedTransformSystem>();
}
protected override void Draw(in OverlayDrawArgs args)
{
if (Position == null || !_entManager.TryGetComponent<TransformComponent>(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);
}

View File

@@ -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 class DockingControl : Control
{
_entManager = IoCManager.Resolve<IEntityManager>();
_mapManager = IoCManager.Resolve<IMapManager>();
_xformSystem = _entManager.System<SharedTransformSystem>();
_rangeSquared = _range * _range;
MinSize = new Vector2(SizeFull, SizeFull);
}
@@ -145,8 +143,8 @@ public class DockingControl : Control
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 @@ public class DockingControl : Control
if (!_entManager.TryGetComponent<FixturesComponent>(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);

View File

@@ -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 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
{
base.Draw(handle);
_xformSystem ??= _entManager.SystemOrNull<SharedTransformSystem>();
if (_xformSystem is null ||
!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
!_entManager.TryGetComponent<TransformComponent>(_shuttleEntity, out var gridXform))
{
return;
@@ -325,7 +322,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
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.

View File

@@ -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<FadingSpriteComponent> _comps = new();
@@ -49,7 +48,7 @@ public sealed class SpriteFadeSystem : EntitySystem
spriteQuery.TryGetComponent(player, out var playerSprite))
{
var fadeQuery = GetEntityQuery<SpriteFadeComponent>();
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))

View File

@@ -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 @@ public sealed class StealthSystem : SharedStealthSystem
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);

View File

@@ -27,7 +27,6 @@ namespace Content.Client.Tabletop
[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 @@ namespace Content.Client.Tabletop
if (clampedCoords.Equals(MapCoordinates.Nullspace)) return;
// Move the entity locally every update
_xformSystem.SetWorldPosition(_draggedEntity.Value, clampedCoords.Position);
EntityManager.GetComponent<TransformComponent>(_draggedEntity.Value).WorldPosition = clampedCoords.Position;
// Increment total time passed
_timePassed += frameTime;
@@ -259,7 +258,7 @@ namespace Content.Client.Tabletop
// Set the dragging player on the component to noone
if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_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));
}

View File

@@ -46,6 +46,7 @@ public sealed class ChatUIController : UIController
[Dependency] private readonly IChatManager _manager = default!;
[Dependency] private readonly IConfigurationManager _config = default!;
[Dependency] private readonly IEyeManager _eye = default!;
[Dependency] private readonly IEntityManager _ent = default!;
[Dependency] private readonly IInputManager _input = default!;
[Dependency] private readonly IClientNetManager _net = default!;
[Dependency] private readonly IPlayerManager _player = default!;
@@ -53,12 +54,12 @@ public sealed class ChatUIController : UIController
[Dependency] private readonly IStateManager _state = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IReplayRecordingManager _replayRecording = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[UISystemDependency] private readonly ExamineSystem? _examine = default;
[UISystemDependency] private readonly GhostSystem? _ghost = default;
[UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
[UISystemDependency] private readonly ChatSystem? _chatSys = default;
[UISystemDependency] private readonly TransformSystem? _xformSystem = default!;
[ValidatePrototypeId<ColorPalettePrototype>]
private const string ChatNamePalette = "ChatNames";
@@ -178,8 +179,8 @@ public sealed class ChatUIController : UIController
_net.RegisterNetMessage<MsgChatMessage>(OnChatMessage);
_net.RegisterNetMessage<MsgDeleteChatMessagesBy>(OnDeleteChatMessagesBy);
SubscribeNetworkEvent<DamageForceSayEvent>(OnDamageForceSay);
_config.OnValueChanged(CCVars.ChatEnableColorName, (value) => { _chatNameColorsEnabled = value; });
_chatNameColorsEnabled = _config.GetCVar(CCVars.ChatEnableColorName);
_cfg.OnValueChanged(CCVars.ChatEnableColorName, (value) => { _chatNameColorsEnabled = value; });
_chatNameColorsEnabled = _cfg.GetCVar(CCVars.ChatEnableColorName);
_speechBubbleRoot = new LayoutContainer();
@@ -553,7 +554,7 @@ public sealed class ChatUIController : UIController
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;
}
@@ -591,7 +592,7 @@ public sealed class ChatUIController : UIController
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<TransformComponent>(player.Value).MapPosition
: MapCoordinates.Nullspace;
var occluded = player != null && _examine.IsOccluded(player.Value);
@@ -610,7 +611,7 @@ public sealed class ChatUIController : UIController
continue;
}
var otherPos = _xformSystem.GetMapCoordinates(ent);
var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
if (occluded && !ExamineSystemShared.InRangeUnOccluded(
playerPos,
@@ -769,7 +770,7 @@ public sealed class ChatUIController : UIController
ProcessChatMessage(msg);
if ((msg.Channel & ChatChannel.AdminRelated) == 0 ||
_config.GetCVar(CCVars.ReplayRecordAdminChat))
_cfg.GetCVar(CCVars.ReplayRecordAdminChat))
{
_replayRecording.RecordClientMessage(msg);
}
@@ -780,7 +781,7 @@ public sealed class ChatUIController : UIController
// color the name unless it's something like "the old man"
if ((msg.Channel == ChatChannel.Local || msg.Channel == ChatChannel.Whisper) && _chatNameColorsEnabled)
{
var grammar = EntityManager.GetComponentOrNull<GrammarComponent>(EntityManager.GetEntity(msg.SenderEntity));
var grammar = _ent.GetComponentOrNull<GrammarComponent>(_ent.GetEntity(msg.SenderEntity));
if (grammar != null && grammar.ProperNoun == true)
msg.WrappedMessage = SharedChatSystem.InjectTagInsideTag(msg, "Name", "color", GetNameColor(SharedChatSystem.GetStringInsideTag(msg, "Name")));
}
@@ -829,7 +830,7 @@ public sealed class ChatUIController : UIController
break;
case ChatChannel.LOOC:
if (_config.GetCVar(CCVars.LoocAboveHeadShow))
if (_cfg.GetCVar(CCVars.LoocAboveHeadShow))
AddSpeechBubble(msg, SpeechBubble.SpeechType.Looc);
break;
}

View File

@@ -3,7 +3,6 @@ using Content.Client.UserInterface.Systems.Gameplay;
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 sealed class ViewportUIController : UIController
_entMan.TryGetComponent(ent, out EyeComponent? eye);
if (eye?.Eye == _eyeManager.CurrentEye
&& (_xformSystem is null || _xformSystem.GetWorldPosition(ent.Value) == default))
&& _entMan.GetComponent<TransformComponent>(ent.Value).WorldPosition == default)
return; // nothing to worry about, the player is just in null space... actually that is probably a problem?
// Currently, this shouldn't happen. This likely happened because the main eye was set to null. When this

View File

@@ -25,7 +25,6 @@ namespace Content.Client.Verbs
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
/// <summary>
/// When a user right clicks somewhere, how large is the box we use to get entities for the context menu?
@@ -141,7 +140,8 @@ namespace Content.Client.Verbs
// Remove any entities that do not have LOS
if ((visibility & MenuVisibility.NoFov) == 0)
{
var playerPos = _xformSystem.GetMapCoordinates(player.Value);
var xformQuery = GetEntityQuery<TransformComponent>();
var playerPos = xformQuery.GetComponent(player.Value).MapPosition;
for (var i = entities.Count - 1; i >= 0; i--)
{
@@ -149,7 +149,7 @@ namespace Content.Client.Verbs
if (!ExamineSystemShared.InRangeUnOccluded(
playerPos,
_xformSystem.GetMapCoordinates(entity),
xformQuery.GetComponent(entity).MapPosition,
ExamineSystemShared.ExamineRange,
null))
{

View File

@@ -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 sealed class MeleeArcOverlay : Overlay
_playerManager = playerManager;
_melee = melee;
_combatMode = combatMode;
_xformSystem = _entManager.System<SharedTransformSystem>();
}
protected override void Draw(in OverlayDrawArgs args)
@@ -54,7 +52,7 @@ public sealed class MeleeArcOverlay : Overlay
if (mapPos.MapId != args.MapId)
return;
var playerPos = _xformSystem.GetMapCoordinates((player.Value, xform));
var playerPos = xform.MapPosition;
if (mapPos.MapId != playerPos.MapId)
return;

View File

@@ -80,7 +80,7 @@ public sealed partial class MeleeWeaponSystem
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;

View File

@@ -136,7 +136,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
// 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)

View File

@@ -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 sealed class GunSpreadOverlay : Overlay
_timing = timing;
_player = player;
_guns = system;
_xforms = entManager.System<SharedTransformSystem>();
}
protected override void Draw(in OverlayDrawArgs args)
@@ -43,7 +41,7 @@ public sealed class GunSpreadOverlay : Overlay
return;
}
var mapPos = _xforms.GetMapCoordinates((player.Value, xform));
var mapPos = xform.MapPosition;
if (mapPos.MapId == MapId.Nullspace)
return;

View File

@@ -99,7 +99,8 @@ public sealed partial class GunSystem : SharedGunSystem
var ent = Spawn(HitscanProto, coords);
var sprite = Comp<SpriteComponent>(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 @@ public sealed partial class GunSystem : SharedGunSystem
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;

View File

@@ -53,7 +53,6 @@ namespace Content.IntegrationTests.Tests
var eyeManager = client.ResolveDependency<IEyeManager>();
var spriteQuery = clientEntManager.GetEntityQuery<SpriteComponent>();
var xformQuery = clientEntManager.GetEntityQuery<TransformComponent>();
var clickSystem = clientEntManager.System<ClickableSystem>();
var eye = client.ResolveDependency<IEyeManager>().CurrentEye;
var testMap = await pair.CreateTestMap();
@@ -83,7 +82,7 @@ namespace Content.IntegrationTests.Tests
var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(clientEnt);
var clickable = clientEntManager.GetComponent<ClickableComponent>(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(() =>

View File

@@ -171,7 +171,8 @@ namespace Content.IntegrationTests.Tests.Disposal
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<TransformComponent>(disposalUnit).MapPosition);
// Test for components existing
unitUid = disposalUnit;

View File

@@ -24,7 +24,6 @@ public sealed class HandTests
var playerMan = server.ResolveDependency<IPlayerManager>();
var mapMan = server.ResolveDependency<IMapManager>();
var sys = entMan.System<SharedHandsSystem>();
var xfm = entMan.System<SharedTransformSystem>();
var data = await pair.CreateTestMap();
await pair.RunTicksSync(5);
@@ -36,7 +35,7 @@ public sealed class HandTests
{
player = playerMan.Sessions.First().AttachedEntity!.Value;
var xform = entMan.GetComponent<TransformComponent>(player);
item = entMan.SpawnEntity("Crowbar", xfm.GetMapCoordinates(xform));
item = entMan.SpawnEntity("Crowbar", xform.MapPosition);
hands = entMan.GetComponent<HandsComponent>(player);
sys.TryPickup(player, item, hands.ActiveHand!);
});

View File

@@ -32,7 +32,6 @@ namespace Content.IntegrationTests.Tests.Interaction
var sEntities = server.ResolveDependency<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var conSystem = sEntities.EntitySysManager.GetEntitySystem<SharedContainerSystem>();
var xfmSystem = sEntities.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
EntityUid origin = default;
EntityUid other = default;
@@ -46,7 +45,7 @@ namespace Content.IntegrationTests.Tests.Interaction
origin = sEntities.SpawnEntity(HumanId, coordinates);
other = sEntities.SpawnEntity(HumanId, coordinates);
conSystem.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
mapCoordinates = xfmSystem.GetMapCoordinates(other);
mapCoordinates = sEntities.GetComponent<TransformComponent>(other).MapPosition;
});
await server.WaitIdleAsync();

View File

@@ -626,7 +626,6 @@ namespace Content.IntegrationTests.Tests.Power
var entityManager = server.ResolveDependency<IEntityManager>();
var gameTiming = server.ResolveDependency<IGameTiming>();
var batterySys = entityManager.System<BatterySystem>();
var xformSys = entityManager.System<SharedTransformSystem>();
PowerConsumerComponent consumer = default!;
PowerSupplierComponent supplier = default!;
PowerNetworkBatteryComponent netBattery = default!;
@@ -645,7 +644,7 @@ namespace Content.IntegrationTests.Tests.Power
}
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
entityManager.GetComponent<TransformComponent>(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 @@ namespace Content.IntegrationTests.Tests.Power
var entityManager = server.ResolveDependency<IEntityManager>();
var gameTiming = server.ResolveDependency<IGameTiming>();
var batterySys = entityManager.System<BatterySystem>();
var xformSys = entityManager.System<SharedTransformSystem>();
PowerConsumerComponent consumer = default!;
PowerSupplierComponent supplier = default!;
PowerNetworkBatteryComponent netBattery = default!;
@@ -723,7 +721,7 @@ namespace Content.IntegrationTests.Tests.Power
}
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
entityManager.GetComponent<TransformComponent>(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 @@ namespace Content.IntegrationTests.Tests.Power
var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var batterySys = entityManager.System<BatterySystem>();
var xformSys = entityManager.System<SharedTransformSystem>();
PowerConsumerComponent consumer1 = default!;
PowerConsumerComponent consumer2 = default!;
PowerSupplierComponent supplier = default!;
@@ -808,7 +805,7 @@ namespace Content.IntegrationTests.Tests.Power
entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
entityManager.GetComponent<TransformComponent>(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 @@ namespace Content.IntegrationTests.Tests.Power
var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var batterySys = entityManager.System<BatterySystem>();
var xformSys = entityManager.System<SharedTransformSystem>();
PowerConsumerComponent consumer1 = default!;
PowerConsumerComponent consumer2 = default!;
PowerSupplierComponent supplier = default!;
@@ -1003,7 +999,7 @@ namespace Content.IntegrationTests.Tests.Power
entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
entityManager.GetComponent<TransformComponent>(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 @@ namespace Content.IntegrationTests.Tests.Power
var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var batterySys = entityManager.System<BatterySystem>();
var xformSys = entityManager.System<SharedTransformSystem>();
PowerConsumerComponent consumer = default!;
PowerSupplierComponent supplier = default!;
PowerNetworkBatteryComponent netBattery = default!;
@@ -1082,7 +1077,7 @@ namespace Content.IntegrationTests.Tests.Power
}
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
entityManager.GetComponent<TransformComponent>(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 @@ namespace Content.IntegrationTests.Tests.Power
var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var nodeContainer = entityManager.System<NodeContainerSystem>();
var xformSys = entityManager.System<SharedTransformSystem>();
CableNode leftNode = default!;
CableNode rightNode = default!;
Node batteryInput = default!;
@@ -1172,7 +1166,7 @@ namespace Content.IntegrationTests.Tests.Power
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<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
var battery = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
var batteryNodeContainer = entityManager.GetComponent<NodeContainerComponent>(battery);

View File

@@ -60,7 +60,8 @@ public sealed class DockTest : ContentUnitTest
mapSystem.SetTiles(grid1.Owner, grid1.Comp, tiles1);
var dock1 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid1Ent, dock1Pos));
xformSystem.SetLocalRotation(dock1, dock1Angle);
var dock1Xform = entManager.GetComponent<TransformComponent>(dock1);
dock1Xform.LocalRotation = dock1Angle;
var tiles2 = new List<(Vector2i Index, Tile Tile)>()
{
@@ -73,7 +74,8 @@ public sealed class DockTest : ContentUnitTest
mapSystem.SetTiles(grid2.Owner, grid2.Comp, tiles2);
var dock2 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid2Ent, dock2Pos));
xformSystem.SetLocalRotation(dock2, dock2Angle);
var dock2Xform = entManager.GetComponent<TransformComponent>(dock2);
dock2Xform.LocalRotation = dock2Angle;
var config = dockingSystem.GetDockingConfig(grid1Ent, grid2Ent);

View File

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

View File

@@ -105,7 +105,7 @@ public sealed class ExplosionCommand : IConsoleCommand
if (args.Length > 4)
coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
else
coords = entMan.System<SharedTransformSystem>().GetMapCoordinates(xform);
coords = xform.MapPosition;
}
ExplosionPrototype? type;

View File

@@ -118,10 +118,8 @@ namespace Content.Server.Administration.Commands
}
var xform = _entManager.GetComponent<TransformComponent>(playerEntity);
var xformSystem = _entManager.System<SharedTransformSystem>();
xformSystem.SetCoordinates((playerEntity, xform, _entManager.GetComponent<MetaDataComponent>(playerEntity)), coords);
xformSystem.AttachToGridOrMap(playerEntity, xform);
xform.Coordinates = coords;
xform.AttachToGridOrMap();
if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics))
{
_entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics);

View File

@@ -103,7 +103,7 @@ public sealed partial class AdminVerbSystem
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 @@ public sealed partial class AdminVerbSystem
Filter.PvsExcept(args.Target), true, PopupType.MediumCaution);
var board = Spawn("ChessBoard", xform.Coordinates);
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(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 @@ public sealed partial class AdminVerbSystem
{
var xform = Transform(args.Target);
var fixtures = Comp<FixturesComponent>(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 @@ public sealed partial class AdminVerbSystem
{
var xform = Transform(args.Target);
var fixtures = Comp<FixturesComponent>(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);

View File

@@ -40,7 +40,7 @@ public sealed class BluespaceAnomalySystem : EntitySystem
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);

View File

@@ -61,7 +61,7 @@ public sealed class ElectricityAnomalySystem : EntitySystem
var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
var duration = elec.MaxElectrocuteDuration * anom.Severity;
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(_transform.GetMapCoordinates((uid, xform)), range))
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(xform.MapPosition, range))
{
_electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
}

View File

@@ -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<InjectableSolutionComponent> _injectableQuery;
@@ -46,7 +45,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
//We get all the entity in the radius into which the reagent will be injected.
var xformQuery = GetEntityQuery<TransformComponent>();
var xform = xformQuery.GetComponent(entity);
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(_xformSystem.GetMapCoordinates((entity.Owner, xform)), injectRadius)
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
.Select(x => x.Owner).ToList();
//for each matching entity found

View File

@@ -66,7 +66,7 @@ public sealed class AirFilterSystem : EntitySystem
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))
{

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Atmos.EntitySystems
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;
}

View File

@@ -119,7 +119,7 @@ namespace Content.Server.Atmos.EntitySystems
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 @@ namespace Content.Server.Atmos.EntitySystems
// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
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

View File

@@ -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 sealed class BeamSystem : SharedBeamSystem
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;

View File

@@ -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 @@ public sealed class LogSystem : EntitySystem
{
var xform = Transform(plank);
_containerSystem.AttachParentToContainerOrGrid((plank, xform));
_xformSystem.SetLocalRotation(plank, 0, xform);
xform.LocalRotation = 0;
_randomHelper.RandomOffset(plank, 0.25f);
}
}

View File

@@ -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 @@ public sealed class RehydratableSystem : EntitySystem
var target = Spawn(randomMob, Transform(uid).Coordinates);
_xformSystem.AttachToGridOrMap(target);
Transform(target).AttachToGridOrMap();
var ev = new GotRehydratedEvent(target);
RaiseLocalEvent(uid, ref ev);

View File

@@ -28,7 +28,6 @@ namespace Content.Server.Chemistry.EntitySystems
[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 @@ namespace Content.Server.Chemistry.EntitySystems
_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);
}

View File

@@ -57,18 +57,16 @@ namespace Content.Server.Chemistry.ReactionEffects
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<TransformComponent>(args.SolutionEntity);
var xformSystem = args.EntityManager.System<SharedTransformSystem>();
var mapManager = IoCManager.Resolve<IMapManager>();
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<SmokeSystem>();

View File

@@ -34,7 +34,7 @@ public sealed partial class CreateEntityReactionEffect : ReagentEffect
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

View File

@@ -41,7 +41,7 @@ public sealed partial class EmpReactionEffect : ReagentEffect
var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange);
args.EntityManager.System<EmpSystem>().EmpPulse(
args.EntityManager.System<SharedTransformSystem>().GetMapCoordinates((args.SolutionEntity, transform)),
transform.MapPosition,
range,
EnergyConsumption,
DisableDuration);

View File

@@ -210,7 +210,7 @@ namespace Content.Server.Cloning
}
// end of genetic damage checks
var mob = Spawn(speciesPrototype.Prototype, _transformSystem.GetMapCoordinates(uid));
var mob = Spawn(speciesPrototype.Prototype, Transform(uid).MapPosition);
_humanoidSystem.CloneAppearance(bodyToClone, mob);
var ev = new CloningEvent(bodyToClone, mob);

View File

@@ -54,16 +54,18 @@ namespace Content.Server.Commands
public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var xfmSys = entMan.System<SharedTransformSystem>();
var transform = entMan.GetComponent<TransformComponent>(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<MetaDataComponent>(ent).EntityName);
if (shell.Player is { } player)
@@ -71,13 +73,16 @@ namespace Content.Server.Commands
if (player.AttachedEntity is {Valid: true} p)
{
var pTransform = entMan.GetComponent<TransformComponent>(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;

View File

@@ -63,7 +63,6 @@ namespace Content.Server.Construction.Commands
var changed = 0;
var tagSystem = _entManager.EntitySysManager.GetEntitySystem<TagSystem>();
var xformSystem = _entManager.System<SharedTransformSystem>();
var enumerator = xformQuery.GetComponent(gridId.Value).ChildEnumerator;
@@ -98,7 +97,7 @@ namespace Content.Server.Construction.Commands
if (childXform.LocalRotation != Angle.Zero)
{
xformSystem.SetLocalRotation(child, Angle.Zero, childXform);
childXform.LocalRotation = Angle.Zero;
changed++;
}
}

View File

@@ -12,14 +12,7 @@ namespace Content.Server.Construction.Completions
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{
var transform = entityManager.GetComponent<TransformComponent>(uid);
if (Value == transform.Anchored)
return;
var xformSystem = entityManager.System<SharedTransformSystem>();
if (Value)
xformSystem.AnchorEntity((uid, transform));
else
xformSystem.Unanchor(uid, transform);
transform.Anchored = Value;
}
}
}

View File

@@ -14,12 +14,13 @@ namespace Content.Server.Construction.Completions
{
var transform = entityManager.GetComponent<TransformComponent>(uid);
var xformSystem = entityManager.System<SharedTransformSystem>();
if (!transform.Anchored)
xformSystem.SetCoordinates((uid, transform, entityManager.GetComponent<MetaDataComponent>(uid)), transform.Coordinates.SnapToGrid(entityManager));
transform.Coordinates = transform.Coordinates.SnapToGrid(entityManager);
if (SouthRotation)
xformSystem.SetLocalRotation(uid, Angle.Zero, transform);
{
transform.LocalRotation = Angle.Zero;
}
}
}
}

View File

@@ -362,12 +362,9 @@ namespace Content.Server.Construction
// 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)

View File

@@ -32,7 +32,6 @@ namespace Content.Server.Construction
[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 @@ namespace Content.Server.Construction
}
}
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))
{
@@ -528,12 +527,10 @@ namespace Content.Server.Construction
// 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}");

View File

@@ -42,7 +42,6 @@ namespace Content.Server.Destructible
[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()
{

View File

@@ -44,14 +44,14 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
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<TransformComponent>(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<TransformComponent>(spawned).LocalRotation = system.Random.NextAngle();
}
}
}

View File

@@ -27,7 +27,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{
var position = system.TransformSystem.GetMapCoordinates(owner);
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));

View File

@@ -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 @@ namespace Content.Server.DeviceNetwork.Systems
return;
if (xform.MapID != args.SenderTransform.MapID
|| (ownPosition - _xformSystem.GetWorldPosition(xform)).Length() > sendingComponent.Range)
|| (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range)
{
args.Cancel();
}

View File

@@ -37,8 +37,6 @@ namespace Content.Server.Disposal.Tube
[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 @@ namespace Content.Server.Disposal.Tube
if (!Resolve(uid, ref entry))
return false;
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, _xformSystem.GetMapCoordinates(uid));
var xform = Transform(uid);
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, xform.MapPosition);
var holderComponent = Comp<DisposalHolderComponent>(holder);
foreach (var entity in from.Container.ContainedEntities.ToArray())

View File

@@ -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<CarpRiftsConditionComponent> _objQuery;
@@ -155,7 +154,7 @@ public sealed partial class DragonSystem : EntitySystem
}
// 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 @@ public sealed partial class DragonSystem : EntitySystem
return;
}
var carpUid = Spawn(component.RiftPrototype, _xformSystem.GetMapCoordinates((uid, xform)));
var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
component.Rifts.Add(carpUid);
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
}

View File

@@ -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 @@ public sealed class EmpSystem : SharedEmpSystem
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;
}

View File

@@ -69,15 +69,13 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
return;
_needToTransform = true;
var entMan = IoCManager.Resolve<IEntityManager>();
var xfmSys = entMan.System<SharedTransformSystem>();
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(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));
}

View File

@@ -70,8 +70,8 @@ public sealed partial class ExplosionSystem : EntitySystem
{
var targetGrid = Comp<MapGridComponent>(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 @@ public sealed partial class ExplosionSystem : EntitySystem
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
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;

View File

@@ -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?

View File

@@ -382,7 +382,7 @@ public sealed partial class ExplosionSystem : EntitySystem
if (player.AttachedEntity is not EntityUid uid)
continue;
var playerPos = _transformSystem.GetWorldPosition(player.AttachedEntity!.Value);
var playerPos = Transform(player.AttachedEntity!.Value).WorldPosition;
var delta = epicenter.Position - playerPos;
if (delta.EqualsApprox(Vector2.Zero))

View File

@@ -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 sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
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<SmokeComponent>(ent, out var smoke))
{

View File

@@ -186,7 +186,7 @@ namespace Content.Server.Explosion.EntitySystems
// 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})";

View File

@@ -37,7 +37,6 @@ namespace Content.Server.Flash
[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()
{

View File

@@ -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 sealed class DrainSystem : SharedDrainSystem
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...

View File

@@ -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<ICommonSession> _playerObservers = new();
private List<Entity<MapGridComponent>> _grids = new();
@@ -56,7 +55,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
var transform = EntityManager.GetComponent<TransformComponent>(entity);
var worldBounds = Box2.CenteredAround(_xformSystem.GetWorldPosition(transform),
var worldBounds = Box2.CenteredAround(transform.WorldPosition,
new Vector2(LocalViewRange, LocalViewRange));
_grids.Clear();

View File

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

View File

@@ -24,7 +24,6 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
[Dependency] private readonly RespawnRuleSystem _respawn = default!;
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
public override void Initialize()
{
@@ -98,7 +97,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
_point.AdjustPointValue(assist.PlayerId, 1, uid, point);
var spawns = EntitySpawnCollection.GetSpawns(dm.RewardSpawns).Cast<string?>().ToList();
EntityManager.SpawnEntities(_xformSystem.GetMapCoordinates(ev.Entity), spawns);
EntityManager.SpawnEntities(Transform(ev.Entity).MapPosition, spawns);
}
}

View File

@@ -50,8 +50,6 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
[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<EntityPrototype>]
private const string GameRuleId = "Pirates";
@@ -182,7 +180,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
var aabbs = EntityQuery<StationDataComponent>().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];

View File

@@ -19,8 +19,6 @@ public abstract class BaseEntityReplaceVariationPassSystem<TEntComp, TGameRuleCo
where TEntComp: IComponent
where TGameRuleComp: IComponent
{
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
/// <summary>
/// Used so we don't modify while enumerating
/// if the replaced entity also has <see cref="TEntComp"/>.
@@ -57,7 +55,7 @@ public abstract class BaseEntityReplaceVariationPassSystem<TEntComp, TGameRuleCo
{
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");

View File

@@ -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 sealed partial class GatherableSystem : EntitySystem
if (component.MappedLoot == null)
return;
var pos = _xformSystem.GetMapCoordinates(gatheredUid);
var pos = Transform(gatheredUid).MapPosition;
foreach (var (tag, table) in component.MappedLoot)
{

View File

@@ -34,7 +34,6 @@ namespace Content.Server.Guardian
[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 @@ namespace Content.Server.Guardian
var hostXform = Transform(args.Args.Target.Value);
var host = EnsureComp<GuardianHostComponent>(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;

View File

@@ -38,7 +38,6 @@ namespace Content.Server.Hands.Systems
[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 @@ namespace Content.Server.Hands.Systems
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;

View File

@@ -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 @@ public sealed class ImmovableRodSystem : EntitySystem
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;
}
}

View File

@@ -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 @@ public sealed class SharpSystem : EntitySystem
}
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)
{

View File

@@ -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 sealed class LightningSystem : SharedLightningSystem
//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<LightningTargetComponent>(_xformSystem.GetMapCoordinates(user), range).ToList();
var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(Transform(user).MapPosition, range).ToList();
_random.Shuffle(targets);
targets.Sort((x, y) => y.Priority.CompareTo(x.Priority));

View File

@@ -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 @@ public sealed class LightningTargetSystem : EntitySystem
if (uid.Comp.LightningExplode)
{
_explosionSystem.QueueExplosion(
_xformSystem.GetMapCoordinates(uid),
Transform(uid).MapPosition,
uid.Comp.ExplosionPrototype,
uid.Comp.TotalIntensity, uid.Comp.Dropoff,
uid.Comp.MaxTileIntensity,

View File

@@ -278,7 +278,7 @@ public sealed class MagicSystem : EntitySystem
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 @@ public sealed class MagicSystem : EntitySystem
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);

View File

@@ -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<ICommonSession> _draggers = new();
@@ -79,6 +78,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
var gridXform = Transform(grid);
_xformSystem.SetWorldPosition(gridXform, msg.WorldPosition);
gridXform.WorldPosition = msg.WorldPosition;
}
}

View File

@@ -85,7 +85,7 @@ public sealed class MechGrabberSystem : EntitySystem
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);
}

Some files were not shown because too many files have changed in this diff Show More