Replace xform.WorldPosition with xformSystem method for Setting/Getting (#30029)
* GET WORLD POSITON, ROTATION * Missing parentheses * ui system depndency * the issue * Unused * Let the function do the transform --------- Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
@@ -16,6 +16,7 @@ namespace Content.Client.Chat.UI
|
|||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
|
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
|
||||||
|
private readonly SharedTransformSystem _transformSystem;
|
||||||
|
|
||||||
public enum SpeechType : byte
|
public enum SpeechType : byte
|
||||||
{
|
{
|
||||||
@@ -83,6 +84,7 @@ namespace Content.Client.Chat.UI
|
|||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
_senderEntity = senderEntity;
|
_senderEntity = senderEntity;
|
||||||
|
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||||
|
|
||||||
// Use text clipping so new messages don't overlap old ones being pushed up.
|
// Use text clipping so new messages don't overlap old ones being pushed up.
|
||||||
RectClipContent = true;
|
RectClipContent = true;
|
||||||
@@ -140,7 +142,7 @@ namespace Content.Client.Chat.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
|
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
|
||||||
var worldPos = xform.WorldPosition + offset;
|
var worldPos = _transformSystem.GetWorldPosition(xform) + offset;
|
||||||
|
|
||||||
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
|
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
|
||||||
var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved);
|
var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public sealed class ExplosionOverlay : Overlay
|
|||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
|
private readonly SharedTransformSystem _transformSystem;
|
||||||
private SharedAppearanceSystem _appearance;
|
private SharedAppearanceSystem _appearance;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||||
@@ -26,6 +27,7 @@ public sealed class ExplosionOverlay : Overlay
|
|||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
|
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
|
||||||
|
_transformSystem = _entMan.System<SharedTransformSystem>();
|
||||||
_appearance = appearanceSystem;
|
_appearance = appearanceSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +70,7 @@ public sealed class ExplosionOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
var xform = xforms.GetComponent(gridId);
|
var xform = xforms.GetComponent(gridId);
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform, xforms);
|
||||||
|
|
||||||
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
||||||
drawHandle.SetTransform(worldMatrix);
|
drawHandle.SetTransform(worldMatrix);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public sealed class PuddleOverlay : Overlay
|
|||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||||
private readonly PuddleDebugOverlaySystem _debugOverlaySystem;
|
private readonly PuddleDebugOverlaySystem _debugOverlaySystem;
|
||||||
|
private readonly SharedTransformSystem _transformSystem;
|
||||||
|
|
||||||
private readonly Color _heavyPuddle = new(0, 255, 255, 50);
|
private readonly Color _heavyPuddle = new(0, 255, 255, 50);
|
||||||
private readonly Color _mediumPuddle = new(0, 150, 255, 50);
|
private readonly Color _mediumPuddle = new(0, 150, 255, 50);
|
||||||
@@ -29,6 +30,7 @@ public sealed class PuddleOverlay : Overlay
|
|||||||
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
|
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
|
||||||
var cache = IoCManager.Resolve<IResourceCache>();
|
var cache = IoCManager.Resolve<IResourceCache>();
|
||||||
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
|
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
|
||||||
|
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
@@ -56,7 +58,7 @@ public sealed class PuddleOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridXform = xformQuery.GetComponent(gridId);
|
var gridXform = xformQuery.GetComponent(gridId);
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery);
|
||||||
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||||
drawHandle.SetTransform(worldMatrix);
|
drawHandle.SetTransform(worldMatrix);
|
||||||
|
|
||||||
@@ -89,7 +91,7 @@ public sealed class PuddleOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridXform = xformQuery.GetComponent(gridId);
|
var gridXform = xformQuery.GetComponent(gridId);
|
||||||
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
var (_, _, matrix, invMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery);
|
||||||
var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||||
|
|
||||||
foreach (var debugOverlayData in _debugOverlaySystem.GetData(gridId))
|
foreach (var debugOverlayData in _debugOverlaySystem.GetData(gridId))
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
|||||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
// how often to recheck possible targets (prevents calling expensive
|
// how often to recheck possible targets (prevents calling expensive
|
||||||
// check logic each update)
|
// check logic each update)
|
||||||
@@ -551,7 +552,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
|||||||
if (Exists(_dragShadow))
|
if (Exists(_dragShadow))
|
||||||
{
|
{
|
||||||
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
|
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
|
||||||
Transform(_dragShadow.Value).WorldPosition = mousePos.Position;
|
_transformSystem.SetWorldPosition(_dragShadow.Value, mousePos.Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
|
|
||||||
@@ -62,11 +63,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
if (_dragging == null) return;
|
if (_dragging == null) return;
|
||||||
|
|
||||||
if (_lastMousePosition != null && TryComp(_dragging.Value, out TransformComponent? xform) &&
|
if (_lastMousePosition != null && TryComp(_dragging.Value, out TransformComponent? xform) &&
|
||||||
TryComp<PhysicsComponent>(_dragging.Value, out var body) &&
|
TryComp<PhysicsComponent>(_dragging.Value, out _) &&
|
||||||
xform.MapID == _lastMousePosition.Value.MapId)
|
xform.MapID == _lastMousePosition.Value.MapId)
|
||||||
{
|
{
|
||||||
var tickTime = _gameTiming.TickPeriod;
|
var tickTime = _gameTiming.TickPeriod;
|
||||||
var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
|
var distance = _lastMousePosition.Value.Position - _transformSystem.GetWorldPosition(xform);
|
||||||
RaiseNetworkEvent(new GridDragVelocityRequest()
|
RaiseNetworkEvent(new GridDragVelocityRequest()
|
||||||
{
|
{
|
||||||
Grid = GetNetEntity(_dragging.Value),
|
Grid = GetNetEntity(_dragging.Value),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public sealed class HTNOverlay : Overlay
|
|||||||
{
|
{
|
||||||
private readonly IEntityManager _entManager = default!;
|
private readonly IEntityManager _entManager = default!;
|
||||||
private readonly Font _font = default!;
|
private readonly Font _font = default!;
|
||||||
|
private readonly SharedTransformSystem _transformSystem;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ public sealed class HTNOverlay : Overlay
|
|||||||
{
|
{
|
||||||
_entManager = entManager;
|
_entManager = entManager;
|
||||||
_font = new VectorFont(resourceCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
|
_font = new VectorFont(resourceCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
|
||||||
|
_transformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
@@ -30,7 +32,7 @@ public sealed class HTNOverlay : Overlay
|
|||||||
if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId)
|
if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var worldPos = xform.WorldPosition;
|
var worldPos = _transformSystem.GetWorldPosition(xform);
|
||||||
|
|
||||||
if (!args.WorldAABB.Contains(worldPos))
|
if (!args.WorldAABB.Contains(worldPos))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -81,10 +81,12 @@ public sealed class NPCSteeringOverlay : Overlay
|
|||||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||||
|
|
||||||
private readonly IEntityManager _entManager;
|
private readonly IEntityManager _entManager;
|
||||||
|
private readonly SharedTransformSystem _transformSystem;
|
||||||
|
|
||||||
public NPCSteeringOverlay(IEntityManager entManager)
|
public NPCSteeringOverlay(IEntityManager entManager)
|
||||||
{
|
{
|
||||||
_entManager = entManager;
|
_entManager = entManager;
|
||||||
|
_transformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
@@ -96,7 +98,7 @@ public sealed class NPCSteeringOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (worldPos, worldRot) = xform.GetWorldPositionRotation();
|
var (worldPos, worldRot) = _transformSystem.GetWorldPositionRotation(xform);
|
||||||
|
|
||||||
if (!args.WorldAABB.Contains(worldPos))
|
if (!args.WorldAABB.Contains(worldPos))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
|||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
private readonly DeviceListSystem _deviceListSystem;
|
private readonly DeviceListSystem _deviceListSystem;
|
||||||
|
private readonly SharedTransformSystem _transformSystem;
|
||||||
|
|
||||||
public Dictionary<EntityUid, Color> Colors = new();
|
public Dictionary<EntityUid, Color> Colors = new();
|
||||||
public EntityUid? Action;
|
public EntityUid? Action;
|
||||||
@@ -23,6 +24,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
|||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
_deviceListSystem = _entityManager.System<DeviceListSystem>();
|
_deviceListSystem = _entityManager.System<DeviceListSystem>();
|
||||||
|
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
@@ -66,7 +68,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
args.WorldHandle.DrawLine(sourceTransform.WorldPosition, linkTransform.WorldPosition, Colors[uid]);
|
args.WorldHandle.DrawLine(_transformSystem.GetWorldPosition(sourceTransform), _transformSystem.GetWorldPosition(linkTransform), Colors[uid]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace Content.Client.NodeContainer
|
|||||||
private readonly IMapManager _mapManager;
|
private readonly IMapManager _mapManager;
|
||||||
private readonly IInputManager _inputManager;
|
private readonly IInputManager _inputManager;
|
||||||
private readonly IEntityManager _entityManager;
|
private readonly IEntityManager _entityManager;
|
||||||
|
private readonly SharedTransformSystem _transformSystem;
|
||||||
|
|
||||||
private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new();
|
private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new();
|
||||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
|
private readonly Dictionary<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
|
||||||
@@ -46,6 +47,7 @@ namespace Content.Client.NodeContainer
|
|||||||
_mapManager = mapManager;
|
_mapManager = mapManager;
|
||||||
_inputManager = inputManager;
|
_inputManager = inputManager;
|
||||||
_entityManager = entityManager;
|
_entityManager = entityManager;
|
||||||
|
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||||
|
|
||||||
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
|
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
|
||||||
}
|
}
|
||||||
@@ -146,7 +148,7 @@ namespace Content.Client.NodeContainer
|
|||||||
foreach (var (gridId, gridDict) in _gridIndex)
|
foreach (var (gridId, gridDict) in _gridIndex)
|
||||||
{
|
{
|
||||||
var grid = _entityManager.GetComponent<MapGridComponent>(gridId);
|
var grid = _entityManager.GetComponent<MapGridComponent>(gridId);
|
||||||
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(gridId).GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridId);
|
||||||
|
|
||||||
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
||||||
foreach (var (pos, list) in gridDict)
|
foreach (var (pos, list) in gridDict)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public sealed class TargetOutlineSystem : EntitySystem
|
|||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
private bool _enabled = false;
|
private bool _enabled = false;
|
||||||
|
|
||||||
@@ -165,8 +166,8 @@ public sealed class TargetOutlineSystem : EntitySystem
|
|||||||
valid = _interactionSystem.InRangeUnobstructed(player, entity, Range);
|
valid = _interactionSystem.InRangeUnobstructed(player, entity, Range);
|
||||||
else if (Range >= 0)
|
else if (Range >= 0)
|
||||||
{
|
{
|
||||||
var origin = Transform(player).WorldPosition;
|
var origin = _transformSystem.GetWorldPosition(player);
|
||||||
var target = Transform(entity).WorldPosition;
|
var target = _transformSystem.GetWorldPosition(entity);
|
||||||
valid = (origin - target).LengthSquared() <= Range;
|
valid = (origin - target).LengthSquared() <= Range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace Content.Client.Stealth;
|
|||||||
public sealed class StealthSystem : SharedStealthSystem
|
public sealed class StealthSystem : SharedStealthSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
private ShaderInstance _shader = default!;
|
private ShaderInstance _shader = default!;
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ public sealed class StealthSystem : SharedStealthSystem
|
|||||||
if (!parent.IsValid())
|
if (!parent.IsValid())
|
||||||
return; // should never happen, but lets not kill the client.
|
return; // should never happen, but lets not kill the client.
|
||||||
var parentXform = Transform(parent);
|
var parentXform = Transform(parent);
|
||||||
var reference = args.Viewport.WorldToLocal(parentXform.WorldPosition);
|
var reference = args.Viewport.WorldToLocal(_transformSystem.GetWorldPosition(parentXform));
|
||||||
reference.X = -reference.X;
|
reference.X = -reference.X;
|
||||||
var visibility = GetVisibility(uid, component);
|
var visibility = GetVisibility(uid, component);
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace Content.Client.Tabletop
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
// Time in seconds to wait until sending the location of a dragged entity to the server again
|
// Time in seconds to wait until sending the location of a dragged entity to the server again
|
||||||
private const float Delay = 1f / 10; // 10 Hz
|
private const float Delay = 1f / 10; // 10 Hz
|
||||||
@@ -100,7 +101,7 @@ namespace Content.Client.Tabletop
|
|||||||
if (clampedCoords.Equals(MapCoordinates.Nullspace)) return;
|
if (clampedCoords.Equals(MapCoordinates.Nullspace)) return;
|
||||||
|
|
||||||
// Move the entity locally every update
|
// Move the entity locally every update
|
||||||
EntityManager.GetComponent<TransformComponent>(_draggedEntity.Value).WorldPosition = clampedCoords.Position;
|
_transformSystem.SetWorldPosition(_draggedEntity.Value, clampedCoords.Position);
|
||||||
|
|
||||||
// Increment total time passed
|
// Increment total time passed
|
||||||
_timePassed += frameTime;
|
_timePassed += frameTime;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ public sealed class ViewportUIController : UIController
|
|||||||
[Dependency] private readonly IPlayerManager _playerMan = default!;
|
[Dependency] private readonly IPlayerManager _playerMan = default!;
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||||
|
|
||||||
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);
|
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);
|
||||||
public const int ViewportHeight = 15;
|
public const int ViewportHeight = 15;
|
||||||
private MainViewport? Viewport => UIManager.ActiveScreen?.GetWidget<MainViewport>();
|
private MainViewport? Viewport => UIManager.ActiveScreen?.GetWidget<MainViewport>();
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
private void UpdateEffects()
|
private void UpdateEffects()
|
||||||
{
|
{
|
||||||
var query = EntityQueryEnumerator<TrackUserComponent, TransformComponent>();
|
var query = EntityQueryEnumerator<TrackUserComponent, TransformComponent>();
|
||||||
while (query.MoveNext(out var arcComponent, out var xform))
|
while (query.MoveNext(out var uid, out var arcComponent, out var xform))
|
||||||
{
|
{
|
||||||
if (arcComponent.User == null)
|
if (arcComponent.User == null)
|
||||||
continue;
|
continue;
|
||||||
@@ -226,7 +226,7 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
targetPos += entRotation.RotateVec(arcComponent.Offset);
|
targetPos += entRotation.RotateVec(arcComponent.Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformSystem.SetWorldPosition(xform, targetPos);
|
TransformSystem.SetWorldPosition(uid, targetPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
|
// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
|
||||||
if (throwTarget != EntityCoordinates.Invalid)
|
if (throwTarget != EntityCoordinates.Invalid)
|
||||||
{
|
{
|
||||||
var pos = ((throwTarget.ToMap(EntityManager, _transformSystem).Position - xform.WorldPosition).Normalized() + dirVec).Normalized();
|
var pos = ((_transformSystem.ToMapCoordinates(throwTarget).Position - _transformSystem.GetWorldPosition(xform)).Normalized() + dirVec).Normalized();
|
||||||
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
|
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||||
[Dependency] private readonly ReactiveSystem _reactive = default!;
|
[Dependency] private readonly ReactiveSystem _reactive = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
private const float ReactTime = 0.125f;
|
private const float ReactTime = 0.125f;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
|
|
||||||
_throwing.TryThrow(vapor, dir, speed, user: user);
|
_throwing.TryThrow(vapor, dir, speed, user: user);
|
||||||
|
|
||||||
var distance = (target.Position - vaporXform.WorldPosition).Length();
|
var distance = (target.Position - _transformSystem.GetWorldPosition(vaporXform)).Length();
|
||||||
var time = (distance / physics.LinearVelocity.Length());
|
var time = (distance / physics.LinearVelocity.Length());
|
||||||
despawn.Lifetime = MathF.Min(aliveTime, time);
|
despawn.Lifetime = MathF.Min(aliveTime, time);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
@@ -55,13 +55,15 @@ namespace Content.Server.Commands
|
|||||||
{
|
{
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
var transform = entMan.GetComponent<TransformComponent>(ent);
|
var transform = entMan.GetComponent<TransformComponent>(ent);
|
||||||
|
var transformSystem = entMan.System<SharedTransformSystem>();
|
||||||
|
var worldPosition = transformSystem.GetWorldPosition(transform);
|
||||||
|
|
||||||
// gross, is there a better way to do this?
|
// gross, is there a better way to do this?
|
||||||
ruleString = ruleString.Replace("$ID", ent.ToString());
|
ruleString = ruleString.Replace("$ID", ent.ToString());
|
||||||
ruleString = ruleString.Replace("$WX",
|
ruleString = ruleString.Replace("$WX",
|
||||||
transform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
|
worldPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$WY",
|
ruleString = ruleString.Replace("$WY",
|
||||||
transform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
worldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$LX",
|
ruleString = ruleString.Replace("$LX",
|
||||||
transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$LY",
|
ruleString = ruleString.Replace("$LY",
|
||||||
@@ -73,12 +75,13 @@ namespace Content.Server.Commands
|
|||||||
if (player.AttachedEntity is {Valid: true} p)
|
if (player.AttachedEntity is {Valid: true} p)
|
||||||
{
|
{
|
||||||
var pTransform = entMan.GetComponent<TransformComponent>(p);
|
var pTransform = entMan.GetComponent<TransformComponent>(p);
|
||||||
|
var pWorldPosition = transformSystem.GetWorldPosition(pTransform);
|
||||||
|
|
||||||
ruleString = ruleString.Replace("$PID", ent.ToString());
|
ruleString = ruleString.Replace("$PID", ent.ToString());
|
||||||
ruleString = ruleString.Replace("$PWX",
|
ruleString = ruleString.Replace("$PWX",
|
||||||
pTransform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
|
pWorldPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$PWY",
|
ruleString = ruleString.Replace("$PWY",
|
||||||
pTransform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
pWorldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$PLX",
|
ruleString = ruleString.Replace("$PLX",
|
||||||
pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$PLY",
|
ruleString = ruleString.Replace("$PLY",
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace Content.Server.DeviceNetwork.Systems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class WirelessNetworkSystem : EntitySystem
|
public sealed class WirelessNetworkSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -25,7 +27,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (xform.MapID != args.SenderTransform.MapID
|
if (xform.MapID != args.SenderTransform.MapID
|
||||||
|| (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range)
|
|| (ownPosition - _transformSystem.GetWorldPosition(xform)).Length() > sendingComponent.Range)
|
||||||
{
|
{
|
||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public sealed partial class DragonSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cant put a rift on solars
|
// cant put a rift on solars
|
||||||
foreach (var tile in grid.GetTilesIntersecting(new Circle(xform.WorldPosition, RiftTileRadius), false))
|
foreach (var tile in grid.GetTilesIntersecting(new Circle(_transform.GetWorldPosition(xform), RiftTileRadius), false))
|
||||||
{
|
{
|
||||||
if (!tile.IsSpace(_tileDef))
|
if (!tile.IsSpace(_tileDef))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
|||||||
|
|
||||||
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
|
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
|
||||||
var xform = xforms.GetComponent(gridToTransform);
|
var xform = xforms.GetComponent(gridToTransform);
|
||||||
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform, xforms);
|
||||||
|
|
||||||
var localEpicentre = (Vector2i) Vector2.Transform(epicentre.Position, invGridWorldMatrid);
|
var localEpicentre = (Vector2i) Vector2.Transform(epicentre.Position, invGridWorldMatrid);
|
||||||
var matrix = offsetMatrix * gridWorldMatrix * targetMatrix;
|
var matrix = offsetMatrix * gridWorldMatrix * targetMatrix;
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
|||||||
if (player.AttachedEntity is not EntityUid uid)
|
if (player.AttachedEntity is not EntityUid uid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var playerPos = Transform(player.AttachedEntity!.Value).WorldPosition;
|
var playerPos = _transformSystem.GetWorldPosition(player.AttachedEntity!.Value);
|
||||||
var delta = epicenter.Position - playerPos;
|
var delta = epicenter.Position - playerPos;
|
||||||
|
|
||||||
if (delta.EqualsApprox(Vector2.Zero))
|
if (delta.EqualsApprox(Vector2.Zero))
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ namespace Content.Server.Hands.Systems
|
|||||||
throwEnt = splitStack.Value;
|
throwEnt = splitStack.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var direction = coordinates.ToMapPos(EntityManager, _transformSystem) - Transform(player).WorldPosition;
|
var direction = _transformSystem.ToMapCoordinates(coordinates).Position - _transformSystem.GetWorldPosition(player);
|
||||||
if (direction == Vector2.Zero)
|
if (direction == Vector2.Zero)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IConGroupController _admin = default!;
|
[Dependency] private readonly IConGroupController _admin = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
private readonly HashSet<ICommonSession> _draggers = new();
|
private readonly HashSet<ICommonSession> _draggers = new();
|
||||||
|
|
||||||
@@ -76,8 +77,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gridXform = Transform(grid);
|
_transformSystem.SetWorldPosition(grid, msg.WorldPosition);
|
||||||
|
|
||||||
gridXform.WorldPosition = msg.WorldPosition;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Interaction;
|
using Content.Server.Interaction;
|
||||||
using Content.Server.Mech.Equipment.Components;
|
using Content.Server.Mech.Equipment.Components;
|
||||||
using Content.Server.Mech.Systems;
|
using Content.Server.Mech.Systems;
|
||||||
@@ -85,7 +85,7 @@ public sealed class MechGrabberSystem : EntitySystem
|
|||||||
var (mechPos, mechRot) = _transform.GetWorldPositionRotation(mechxform);
|
var (mechPos, mechRot) = _transform.GetWorldPositionRotation(mechxform);
|
||||||
|
|
||||||
var offset = mechPos + mechRot.RotateVec(component.DepositOffset);
|
var offset = mechPos + mechRot.RotateVec(component.DepositOffset);
|
||||||
_transform.SetWorldPositionRotation(xform, offset, Angle.Zero);
|
_transform.SetWorldPositionRotation(toRemove, offset, Angle.Zero);
|
||||||
_mech.UpdateUserInterface(mech);
|
_mech.UpdateUserInterface(mech);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public sealed class StressTestMovementSystem : EntitySystem
|
|||||||
var x = MathF.Sin(stressTest.Progress * MathHelper.TwoPi);
|
var x = MathF.Sin(stressTest.Progress * MathHelper.TwoPi);
|
||||||
var y = MathF.Cos(stressTest.Progress * MathHelper.TwoPi);
|
var y = MathF.Cos(stressTest.Progress * MathHelper.TwoPi);
|
||||||
|
|
||||||
_transform.SetWorldPosition(transform, stressTest.Origin + new Vector2(x, y) * 5);
|
_transform.SetWorldPosition((uid, transform), stressTest.Origin + new Vector2(x, y) * 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly ExplosionSystem _explosion = default!;
|
[Dependency] private readonly ExplosionSystem _explosion = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null)
|
private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null)
|
||||||
{
|
{
|
||||||
@@ -66,27 +67,28 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
component.TurningDelay -= frameTime;
|
component.TurningDelay -= frameTime;
|
||||||
|
var (transformPos, transformRot) = _transformSystem.GetWorldPositionRotation(transform);
|
||||||
|
|
||||||
if (component.TurningDelay > 0)
|
if (component.TurningDelay > 0)
|
||||||
{
|
{
|
||||||
var difference = Comp<TransformComponent>(chasing).WorldPosition - transform.WorldPosition;
|
var difference = _transformSystem.GetWorldPosition(chasing) - transformPos;
|
||||||
var angle = difference.ToAngle();
|
var angle = difference.ToAngle();
|
||||||
var adjusted = angle.Degrees + 90;
|
var adjusted = angle.Degrees + 90;
|
||||||
var newAngle = Angle.FromDegrees(adjusted);
|
var newAngle = Angle.FromDegrees(adjusted);
|
||||||
|
|
||||||
transform.WorldRotation = newAngle;
|
_transformSystem.SetWorldRotation(transform, newAngle);
|
||||||
|
|
||||||
UpdateAppearance(uid, component, transform);
|
UpdateAppearance(uid, component, transform);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
transform.WorldRotation += Angle.FromDegrees(20);
|
_transformSystem.SetWorldRotation(transform, transformRot + Angle.FromDegrees(20));
|
||||||
|
|
||||||
UpdateAppearance(uid, component, transform);
|
UpdateAppearance(uid, component, transform);
|
||||||
|
|
||||||
var toChased = Comp<TransformComponent>(chasing).WorldPosition - transform.WorldPosition;
|
var toChased = _transformSystem.GetWorldPosition(chasing) - transformPos;
|
||||||
|
|
||||||
transform.WorldPosition += toChased * frameTime * component.ChasingSpeed;
|
_transformSystem.SetWorldPosition((uid, transform), transformPos + (toChased * frameTime * component.ChasingSpeed));
|
||||||
|
|
||||||
component.ChasingTime -= frameTime;
|
component.ChasingTime -= frameTime;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
@@ -157,7 +157,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
|||||||
var tile = tileRef.GridIndices;
|
var tile = tileRef.GridIndices;
|
||||||
|
|
||||||
var found = false;
|
var found = false;
|
||||||
var (gridPos, _, gridMatrix) = xform.GetWorldPositionRotationMatrix();
|
var (gridPos, _, gridMatrix) = _transform.GetWorldPositionRotationMatrix(xform);
|
||||||
var gridBounds = gridMatrix.TransformBox(grid.LocalAABB);
|
var gridBounds = gridMatrix.TransformBox(grid.LocalAABB);
|
||||||
|
|
||||||
//Obviously don't put anything ridiculous in here
|
//Obviously don't put anything ridiculous in here
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public sealed partial class RevenantSystem
|
|||||||
[Dependency] private readonly GhostSystem _ghost = default!;
|
[Dependency] private readonly GhostSystem _ghost = default!;
|
||||||
[Dependency] private readonly TileSystem _tile = default!;
|
[Dependency] private readonly TileSystem _tile = default!;
|
||||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
private void InitializeAbilities()
|
private void InitializeAbilities()
|
||||||
{
|
{
|
||||||
@@ -227,7 +228,7 @@ public sealed partial class RevenantSystem
|
|||||||
var xform = Transform(uid);
|
var xform = Transform(uid);
|
||||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var map))
|
if (!TryComp<MapGridComponent>(xform.GridUid, out var map))
|
||||||
return;
|
return;
|
||||||
var tiles = map.GetTilesIntersecting(Box2.CenteredAround(xform.WorldPosition,
|
var tiles = map.GetTilesIntersecting(Box2.CenteredAround(_transformSystem.GetWorldPosition(xform),
|
||||||
new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray();
|
new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray();
|
||||||
|
|
||||||
_random.Shuffle(tiles);
|
_random.Shuffle(tiles);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
|||||||
[Dependency] private readonly PhysicsSystem _physics = default!;
|
[Dependency] private readonly PhysicsSystem _physics = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly SharedPointLightSystem _light = default!;
|
[Dependency] private readonly SharedPointLightSystem _light = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
[Dependency] private readonly TagSystem _tags = default!;
|
[Dependency] private readonly TagSystem _tags = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -234,7 +235,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
|||||||
if (!gen1XForm.Anchored)
|
if (!gen1XForm.Anchored)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var genWorldPosRot = gen1XForm.GetWorldPositionRotation();
|
var genWorldPosRot = _transformSystem.GetWorldPositionRotation(gen1XForm);
|
||||||
var dirRad = dir.ToAngle() + genWorldPosRot.WorldRotation; //needs to be like this for the raycast to work properly
|
var dirRad = dir.ToAngle() + genWorldPosRot.WorldRotation; //needs to be like this for the raycast to work properly
|
||||||
|
|
||||||
var ray = new CollisionRay(genWorldPosRot.WorldPosition, dirRad.ToVec(), component.CollisionMask);
|
var ray = new CollisionRay(genWorldPosRot.WorldPosition, dirRad.ToVec(), component.CollisionMask);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Server.Singularity.Events;
|
using Content.Server.Singularity.Events;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
@@ -13,6 +13,7 @@ public sealed class ContainmentFieldSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -34,8 +35,8 @@ public sealed class ContainmentFieldSystem : EntitySystem
|
|||||||
|
|
||||||
if (TryComp<PhysicsComponent>(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard)
|
if (TryComp<PhysicsComponent>(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard)
|
||||||
{
|
{
|
||||||
var fieldDir = Transform(uid).WorldPosition;
|
var fieldDir = _transformSystem.GetWorldPosition(uid);
|
||||||
var playerDir = Transform(otherBody).WorldPosition;
|
var playerDir = _transformSystem.GetWorldPosition(otherBody);
|
||||||
|
|
||||||
_throwing.TryThrow(otherBody, playerDir-fieldDir, baseThrowSpeed: component.ThrowForce);
|
_throwing.TryThrow(otherBody, playerDir-fieldDir, baseThrowSpeed: component.ThrowForce);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace Content.Server.Solar.EntitySystems
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum panel angular velocity range - used to stop people rotating panels fast enough that the lag prevention becomes noticable
|
/// Maximum panel angular velocity range - used to stop people rotating panels fast enough that the lag prevention becomes noticable
|
||||||
@@ -112,7 +113,7 @@ namespace Content.Server.Solar.EntitySystems
|
|||||||
while (query.MoveNext(out var uid, out var panel, out var xform))
|
while (query.MoveNext(out var uid, out var panel, out var xform))
|
||||||
{
|
{
|
||||||
TotalPanelPower += panel.MaxSupply * panel.Coverage;
|
TotalPanelPower += panel.MaxSupply * panel.Coverage;
|
||||||
xform.WorldRotation = TargetPanelRotation;
|
_transformSystem.SetWorldRotation(xform, TargetPanelRotation);
|
||||||
_updateQueue.Enqueue((uid, panel));
|
_updateQueue.Enqueue((uid, panel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +136,7 @@ namespace Content.Server.Solar.EntitySystems
|
|||||||
// directly downwards (abs(theta) = pi) = coverage -1
|
// directly downwards (abs(theta) = pi) = coverage -1
|
||||||
// as TowardsSun + = CCW,
|
// as TowardsSun + = CCW,
|
||||||
// panelRelativeToSun should - = CW
|
// panelRelativeToSun should - = CW
|
||||||
var panelRelativeToSun = xform.WorldRotation - TowardsSun;
|
var panelRelativeToSun = _transformSystem.GetWorldRotation(xform) - TowardsSun;
|
||||||
// essentially, given cos = X & sin = Y & Y is 'downwards',
|
// essentially, given cos = X & sin = Y & Y is 'downwards',
|
||||||
// then for the first 90 degrees of rotation in either direction,
|
// then for the first 90 degrees of rotation in either direction,
|
||||||
// this plots the lower-right quadrant of a circle.
|
// this plots the lower-right quadrant of a circle.
|
||||||
@@ -153,7 +154,7 @@ namespace Content.Server.Solar.EntitySystems
|
|||||||
if (coverage > 0)
|
if (coverage > 0)
|
||||||
{
|
{
|
||||||
// Determine if the solar panel is occluded, and zero out coverage if so.
|
// Determine if the solar panel is occluded, and zero out coverage if so.
|
||||||
var ray = new CollisionRay(xform.WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque);
|
var ray = new CollisionRay(_transformSystem.GetWorldPosition(xform), TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque);
|
||||||
var rayCastResults = _physicsSystem.IntersectRayWithPredicate(
|
var rayCastResults = _physicsSystem.IntersectRayWithPredicate(
|
||||||
xform.MapID,
|
xform.MapID,
|
||||||
ray,
|
ray,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Server.Worldgen.Components;
|
using Content.Server.Worldgen.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ namespace Content.Server.Worldgen.Systems;
|
|||||||
public abstract class BaseWorldSystem : EntitySystem
|
public abstract class BaseWorldSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly WorldControllerSystem _worldController = default!;
|
[Dependency] private readonly WorldControllerSystem _worldController = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a chunk's coordinates in chunk space as an integer value.
|
/// Gets a chunk's coordinates in chunk space as an integer value.
|
||||||
@@ -25,7 +26,7 @@ public abstract class BaseWorldSystem : EntitySystem
|
|||||||
if (!Resolve(ent, ref xform))
|
if (!Resolve(ent, ref xform))
|
||||||
throw new Exception("Failed to resolve transform, somehow.");
|
throw new Exception("Failed to resolve transform, somehow.");
|
||||||
|
|
||||||
return WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored();
|
return WorldGen.WorldToChunkCoords(_transformSystem.GetWorldPosition(xform)).Floored();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -40,7 +41,7 @@ public abstract class BaseWorldSystem : EntitySystem
|
|||||||
if (!Resolve(ent, ref xform))
|
if (!Resolve(ent, ref xform))
|
||||||
throw new Exception("Failed to resolve transform, somehow.");
|
throw new Exception("Failed to resolve transform, somehow.");
|
||||||
|
|
||||||
return WorldGen.WorldToChunkCoords(xform.WorldPosition);
|
return WorldGen.WorldToChunkCoords(_transformSystem.GetWorldPosition(xform));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
|
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
|
||||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
@@ -31,7 +31,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
|
|||||||
if (TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
if (TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||||
{
|
{
|
||||||
var tiles = grid.GetTilesIntersecting(
|
var tiles = grid.GetTilesIntersecting(
|
||||||
Box2.CenteredAround(xform.WorldPosition, new Vector2(component.Range * 2, component.Range)));
|
Box2.CenteredAround(_transform.GetWorldPosition(xform), new Vector2(component.Range * 2, component.Range)));
|
||||||
|
|
||||||
foreach (var tile in tiles)
|
foreach (var tile in tiles)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
|
|
||||||
// get blueprint and user position
|
// get blueprint and user position
|
||||||
var transformSystem = entManager.System<SharedTransformSystem>();
|
var transformSystem = entManager.System<SharedTransformSystem>();
|
||||||
var userWorldPosition = entManager.GetComponent<TransformComponent>(user).WorldPosition;
|
var userWorldPosition = transformSystem.GetWorldPosition(user);
|
||||||
var objWorldPosition = location.ToMap(entManager, transformSystem).Position;
|
var objWorldPosition = location.ToMap(entManager, transformSystem).Position;
|
||||||
|
|
||||||
// find direction from user to blueprint
|
// find direction from user to blueprint
|
||||||
var userToObject = (objWorldPosition - userWorldPosition);
|
var userToObject = (objWorldPosition - userWorldPosition);
|
||||||
// get direction of the grid being placed on as an offset.
|
// get direction of the grid being placed on as an offset.
|
||||||
var gridRotation = entManager.GetComponent<TransformComponent>(location.EntityId).WorldRotation;
|
var gridRotation = transformSystem.GetWorldRotation(location.EntityId);
|
||||||
var directionWithOffset = gridRotation.RotateVec(direction.ToVec());
|
var directionWithOffset = gridRotation.RotateVec(direction.ToVec());
|
||||||
|
|
||||||
// dot product will be positive if user direction and blueprint are co-directed
|
// dot product will be positive if user direction and blueprint are co-directed
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public sealed class FloorTileSystem : EntitySystem
|
|||||||
|
|
||||||
var grid = _mapManager.CreateGridEntity(locationMap.MapId);
|
var grid = _mapManager.CreateGridEntity(locationMap.MapId);
|
||||||
var gridXform = Transform(grid);
|
var gridXform = Transform(grid);
|
||||||
_transform.SetWorldPosition(gridXform, locationMap.Position);
|
_transform.SetWorldPosition((grid, gridXform), locationMap.Position);
|
||||||
location = new EntityCoordinates(grid, Vector2.Zero);
|
location = new EntityCoordinates(grid, Vector2.Zero);
|
||||||
PlaceAt(args.User, grid, grid.Comp, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, grid.Comp.TileSize / 2f);
|
PlaceAt(args.User, grid, grid.Comp, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, grid.Comp.TileSize / 2f);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user