Fixes obsolete Transform warnings in Content. (#25256)
* Fix TransformComponent.MapPosition warnings in Content.Client * Fix TransformComponent.MapPosition warnings in Content.IntegrationTests * Fix TransformComponent.MapPosition warnings in Content.Shared * Fix TransformComponent.MapPosition warnings in Content.Server * Fix TransformComponent.WorldPosition warnings in Content.Shared * Fix TransformComponent.WorldPosition warnings in Content.Client Excepts ClickableComponent b/c that needs to be ECS'd entirely later * Fix TransformComponent.WorldPosition warnings in Content.Server * Fix TransformComponent.WorldRotation warnings in Content.* * Fix TransformComponent.MapPosition warnings I missed * Fix TransformComponent.WorldMatrix warnings in Content.* * Fix TransformComponent.InvWorldMatrix warnings in Content.* * Fix TransformComponent.GetWorldPositionRotationMatrixWithInv warnings in Content.* * Fix TransformComponent.GetWorldPositionRotationMatrix warnings in Content.* * Fix TransformComponent.GetWorldPositionRotation warnings in Content.* * Fix TransformComponent.Anchored.set warnings in Content.* * Fix TransformComponent.Coordinates.set warnings in Content.* * Fix TransformComponent.LocalPosition.set warnings in Content.* * Fix TransformComponent.AttachToGridOrMap warnings in Content.* * Fix TransformComponent.AttachParent warnings in Content.* * Preempt TransformComponent.LocalRotation.set warnings in Content.Shared * Preempt TransformComponent.LocalRotation.set warnings in Content.Client * Preempt TransformComponent.LocalRotation.set warnings in Content.IntegrationTests * Preempt TransformComponent.LocalRotation.set warnings in Content.Server * Fix/Preempt the remaining obsolete TransformComponent properties/methods in Content.* * ECS ClickableComponent * Fix obsolete SharedTransformSystem methods in Content.* * Fix ExplosionOverlay `SharedTransformSystem` dependency * Maybe fix null eye position breaking tests * MGS requested changes
This commit is contained in:
@@ -22,6 +22,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
private SharedTransformSystem? _xformSystem = null;
|
||||||
|
|
||||||
|
|
||||||
private readonly SpawnExplosionEui _eui;
|
private readonly SpawnExplosionEui _eui;
|
||||||
@@ -102,9 +103,13 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
|
|||||||
if (!_entMan.TryGetComponent(_playerManager.LocalEntity, out TransformComponent? transform))
|
if (!_entMan.TryGetComponent(_playerManager.LocalEntity, out TransformComponent? transform))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_xformSystem ??= _entMan.SystemOrNull<SharedTransformSystem>();
|
||||||
|
if (_xformSystem is null)
|
||||||
|
return;
|
||||||
|
|
||||||
_pausePreview = true;
|
_pausePreview = true;
|
||||||
MapOptions.Select(_mapData.IndexOf(transform.MapID));
|
MapOptions.Select(_mapData.IndexOf(transform.MapID));
|
||||||
(MapX.Value, MapY.Value) = transform.MapPosition.Position;
|
(MapX.Value, MapY.Value) = _xformSystem.GetWorldPosition(transform);
|
||||||
_pausePreview = false;
|
_pausePreview = false;
|
||||||
|
|
||||||
UpdatePreview();
|
UpdatePreview();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Content.Client.Atmos.Overlays
|
|||||||
{
|
{
|
||||||
private readonly IEntityManager _entManager;
|
private readonly IEntityManager _entManager;
|
||||||
private readonly IMapManager _mapManager;
|
private readonly IMapManager _mapManager;
|
||||||
|
private readonly SharedTransformSystem _xformSystem;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
|
public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
|
||||||
private readonly ShaderInstance _shader;
|
private readonly ShaderInstance _shader;
|
||||||
@@ -51,6 +52,7 @@ namespace Content.Client.Atmos.Overlays
|
|||||||
{
|
{
|
||||||
_entManager = entManager;
|
_entManager = entManager;
|
||||||
_mapManager = IoCManager.Resolve<IMapManager>();
|
_mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
_shader = protoMan.Index<ShaderPrototype>("unshaded").Instance();
|
_shader = protoMan.Index<ShaderPrototype>("unshaded").Instance();
|
||||||
ZIndex = GasOverlayZIndex;
|
ZIndex = GasOverlayZIndex;
|
||||||
|
|
||||||
@@ -156,7 +158,8 @@ namespace Content.Client.Atmos.Overlays
|
|||||||
_fireFrameCounter,
|
_fireFrameCounter,
|
||||||
_shader,
|
_shader,
|
||||||
overlayQuery,
|
overlayQuery,
|
||||||
xformQuery);
|
xformQuery,
|
||||||
|
_xformSystem);
|
||||||
|
|
||||||
var mapUid = _mapManager.GetMapEntityId(args.MapId);
|
var mapUid = _mapManager.GetMapEntityId(args.MapId);
|
||||||
|
|
||||||
@@ -194,7 +197,8 @@ namespace Content.Client.Atmos.Overlays
|
|||||||
int[] fireFrameCounter,
|
int[] fireFrameCounter,
|
||||||
ShaderInstance shader,
|
ShaderInstance shader,
|
||||||
EntityQuery<GasTileOverlayComponent> overlayQuery,
|
EntityQuery<GasTileOverlayComponent> overlayQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery) state) =>
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
|
SharedTransformSystem xformSystem) state) =>
|
||||||
{
|
{
|
||||||
if (!state.overlayQuery.TryGetComponent(uid, out var comp) ||
|
if (!state.overlayQuery.TryGetComponent(uid, out var comp) ||
|
||||||
!state.xformQuery.TryGetComponent(uid, out var gridXform))
|
!state.xformQuery.TryGetComponent(uid, out var gridXform))
|
||||||
@@ -202,7 +206,7 @@ namespace Content.Client.Atmos.Overlays
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = state.xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
state.drawHandle.SetTransform(worldMatrix);
|
state.drawHandle.SetTransform(worldMatrix);
|
||||||
var floatBounds = invMatrix.TransformBox(in state.WorldBounds).Enlarged(grid.TileSize);
|
var floatBounds = invMatrix.TransformBox(in state.WorldBounds).Enlarged(grid.TileSize);
|
||||||
var localBounds = new Box2i(
|
var localBounds = new Box2i(
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
|||||||
if (!xformQuery.TryGetComponent(source, out var xform))
|
if (!xformQuery.TryGetComponent(source, out var xform))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var sourcePos = _transform.GetMapCoordinates(source, xform);
|
var sourcePos = _transform.GetMapCoordinates((source, xform));
|
||||||
|
|
||||||
//Any mob that can move should be surprised?
|
//Any mob that can move should be surprised?
|
||||||
//God mind rework needs to come faster so it can just check for mind
|
//God mind rework needs to come faster so it can just check for mind
|
||||||
|
|||||||
@@ -15,6 +15,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] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
|
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
|
||||||
|
|
||||||
public enum SpeechType : byte
|
public enum SpeechType : byte
|
||||||
@@ -82,6 +83,7 @@ namespace Content.Client.Chat.UI
|
|||||||
public SpeechBubble(ChatMessage message, EntityUid senderEntity, string speechStyleClass, Color? fontColor = null)
|
public SpeechBubble(ChatMessage message, EntityUid senderEntity, string speechStyleClass, Color? fontColor = null)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
_xformSystem = _entityManager.System<SharedTransformSystem>();
|
||||||
_senderEntity = senderEntity;
|
_senderEntity = senderEntity;
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -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 = _xformSystem.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);
|
||||||
|
|||||||
@@ -1,145 +1,27 @@
|
|||||||
using System.Numerics;
|
namespace Content.Client.Clickable;
|
||||||
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;
|
|
||||||
|
|
||||||
namespace Content.Client.Clickable
|
/// <summary>
|
||||||
|
/// Makes it possible to click the associated entity.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class ClickableComponent : Component
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
/// <summary>
|
||||||
public sealed partial class ClickableComponent : Component
|
/// 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
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IClickMapManager _clickMapManager = default!;
|
[DataField("all")] public Box2 All;
|
||||||
|
[DataField("north")] public Box2 North;
|
||||||
[DataField("bounds")] public DirBoundData? Bounds;
|
[DataField("south")] public Box2 South;
|
||||||
|
[DataField("east")] public Box2 East;
|
||||||
/// <summary>
|
[DataField("west")] public Box2 West;
|
||||||
/// 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
144
Content.Client/Clickable/ClickableSystem.cs
Normal file
144
Content.Client/Clickable/ClickableSystem.cs
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ namespace Content.Client.Construction
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
|
||||||
private readonly Dictionary<int, EntityUid> _ghosts = new();
|
private readonly Dictionary<int, EntityUid> _ghosts = new();
|
||||||
@@ -205,7 +206,7 @@ namespace Content.Client.Construction
|
|||||||
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||||
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
||||||
comp.Prototype = prototype;
|
comp.Prototype = prototype;
|
||||||
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
|
_xformSystem.SetLocalRotation(ghost.Value, dir.ToAngle());
|
||||||
_ghosts.Add(ghost.GetHashCode(), ghost.Value);
|
_ghosts.Add(ghost.GetHashCode(), ghost.Value);
|
||||||
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
|
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
|
||||||
sprite.Color = new Color(48, 255, 48, 128);
|
sprite.Color = new Color(48, 255, 48, 128);
|
||||||
|
|||||||
@@ -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 SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ public sealed class ExplosionOverlay : Overlay
|
|||||||
public ExplosionOverlay()
|
public ExplosionOverlay()
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
_xformSystem = _entMan.System<SharedTransformSystem>();
|
||||||
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
|
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +69,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) = _xformSystem.GetWorldPositionRotationMatrixWithInv(xform);
|
||||||
|
|
||||||
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
||||||
drawHandle.SetTransform(worldMatrix);
|
drawHandle.SetTransform(worldMatrix);
|
||||||
|
|||||||
@@ -13,6 +13,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 _xformSystem;
|
||||||
|
|
||||||
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);
|
||||||
@@ -26,6 +27,7 @@ public sealed class PuddleOverlay : Overlay
|
|||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
|
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
|
||||||
|
_xformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
|
||||||
var cache = IoCManager.Resolve<IResourceCache>();
|
var cache = IoCManager.Resolve<IResourceCache>();
|
||||||
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
|
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
|
||||||
}
|
}
|
||||||
@@ -55,7 +57,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) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||||
drawHandle.SetTransform(worldMatrix);
|
drawHandle.SetTransform(worldMatrix);
|
||||||
|
|
||||||
@@ -88,7 +90,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) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
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))
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ public sealed class HandheldGpsStatusControl : Control
|
|||||||
private readonly RichTextLabel _label;
|
private readonly RichTextLabel _label;
|
||||||
private float _updateDif;
|
private float _updateDif;
|
||||||
private readonly IEntityManager _entMan;
|
private readonly IEntityManager _entMan;
|
||||||
|
private readonly SharedTransformSystem _xformSystem;
|
||||||
|
|
||||||
public HandheldGpsStatusControl(Entity<HandheldGPSComponent> parent)
|
public HandheldGpsStatusControl(Entity<HandheldGPSComponent> parent)
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
_entMan = IoCManager.Resolve<IEntityManager>();
|
_entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
_xformSystem = _entMan.System<SharedTransformSystem>();
|
||||||
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
|
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
|
||||||
AddChild(_label);
|
AddChild(_label);
|
||||||
UpdateGpsDetails();
|
UpdateGpsDetails();
|
||||||
@@ -41,7 +43,7 @@ public sealed class HandheldGpsStatusControl : Control
|
|||||||
var posText = "Error";
|
var posText = "Error";
|
||||||
if (_entMan.TryGetComponent(_parent, out TransformComponent? transComp))
|
if (_entMan.TryGetComponent(_parent, out TransformComponent? transComp))
|
||||||
{
|
{
|
||||||
var pos = transComp.MapPosition;
|
var pos = _xformSystem.GetMapCoordinates((_parent, transComp));
|
||||||
var x = (int) pos.X;
|
var x = (int) pos.X;
|
||||||
var y = (int) pos.Y;
|
var y = (int) pos.Y;
|
||||||
posText = $"({x}, {y})";
|
posText = $"({x}, {y})";
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace Content.Client.Gameplay
|
|||||||
// Check the entities against whether or not we can click them
|
// Check the entities against whether or not we can click them
|
||||||
var foundEntities = new List<(EntityUid, int, uint, float)>(entities.Count);
|
var foundEntities = new List<(EntityUid, int, uint, float)>(entities.Count);
|
||||||
var clickQuery = _entityManager.GetEntityQuery<ClickableComponent>();
|
var clickQuery = _entityManager.GetEntityQuery<ClickableComponent>();
|
||||||
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
|
var clickSystem = _entityManager.System<ClickableSystem>();
|
||||||
|
|
||||||
// TODO: Smelly
|
// TODO: Smelly
|
||||||
var eye = _eyeManager.CurrentEye;
|
var eye = _eyeManager.CurrentEye;
|
||||||
@@ -124,7 +124,7 @@ namespace Content.Client.Gameplay
|
|||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
{
|
{
|
||||||
if (clickQuery.TryGetComponent(entity.Uid, out var component) &&
|
if (clickQuery.TryGetComponent(entity.Uid, out var component) &&
|
||||||
component.CheckClick(entity.Component, entity.Transform, xformQuery, coordinates.Position, eye, out var drawDepthClicked, out var renderOrder, out var bottom))
|
clickSystem.CheckClick((entity.Uid, component, entity.Component, entity.Transform), coordinates.Position, eye, out var drawDepthClicked, out var renderOrder, out var bottom))
|
||||||
{
|
{
|
||||||
foundEntities.Add((entity.Uid, drawDepthClicked, renderOrder, bottom));
|
foundEntities.Add((entity.Uid, drawDepthClicked, renderOrder, bottom));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public sealed class GuidebookSystem : EntitySystem
|
|||||||
[Dependency] private readonly RgbLightControllerSystem _rgbLightControllerSystem = default!;
|
[Dependency] private readonly RgbLightControllerSystem _rgbLightControllerSystem = default!;
|
||||||
[Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;
|
[Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;
|
||||||
[Dependency] private readonly TagSystem _tags = 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 event Action<List<string>, List<string>?, string?, bool, string?>? OnGuidebookOpen;
|
||||||
public const string GuideEmbedTag = "GuideEmbeded";
|
public const string GuideEmbedTag = "GuideEmbeded";
|
||||||
@@ -98,8 +99,9 @@ public sealed class GuidebookSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
if (Transform(uid).LocalRotation != Angle.Zero)
|
var xform = Transform(uid);
|
||||||
Transform(uid).LocalRotation -= Angle.FromDegrees(90);
|
if (xform.LocalRotation != Angle.Zero)
|
||||||
|
_xformSystem.SetLocalRotation(uid, xform.LocalRotation - Angle.FromDegrees(90), xform);
|
||||||
},
|
},
|
||||||
Text = Loc.GetString("guidebook-monkey-unspin"),
|
Text = Loc.GetString("guidebook-monkey-unspin"),
|
||||||
Priority = -9999,
|
Priority = -9999,
|
||||||
@@ -130,7 +132,8 @@ public sealed class GuidebookSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnGuidebookControlsTestActivateInWorld(EntityUid uid, GuidebookControlsTestComponent component, ActivateInWorldEvent args)
|
private void OnGuidebookControlsTestActivateInWorld(EntityUid uid, GuidebookControlsTestComponent component, ActivateInWorldEvent args)
|
||||||
{
|
{
|
||||||
Transform(uid).LocalRotation += Angle.FromDegrees(90);
|
var xform = Transform(uid);
|
||||||
|
_xformSystem.SetLocalRotation(uid, xform.LocalRotation + Angle.FromDegrees(90), xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGuidebookControlsTestInteractHand(EntityUid uid, GuidebookControlsTestComponent component, InteractHandEvent args)
|
private void OnGuidebookControlsTestInteractHand(EntityUid uid, GuidebookControlsTestComponent component, InteractHandEvent args)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public sealed class HotPotatoSystem : SharedHotPotatoSystem
|
|||||||
{
|
{
|
||||||
if (_timing.CurTime < comp.TargetTime)
|
if (_timing.CurTime < comp.TargetTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown);
|
comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown);
|
||||||
Spawn("HotPotatoEffect", _transform.GetMapCoordinates(uid).Offset(_random.NextVector2(0.25f)));
|
Spawn("HotPotatoEffect", _transform.GetMapCoordinates(uid).Offset(_random.NextVector2(0.25f)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 _xformSystem = 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)
|
||||||
@@ -250,7 +251,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
|||||||
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||||
if (!dragSprite.NoRotation)
|
if (!dragSprite.NoRotation)
|
||||||
{
|
{
|
||||||
Transform(_dragShadow.Value).WorldRotation = Transform(_draggedEntity.Value).WorldRotation;
|
_xformSystem.SetWorldRotation(_dragShadow.Value, _xformSystem.GetWorldRotation(_draggedEntity.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// drag initiated
|
// drag initiated
|
||||||
@@ -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;
|
_xformSystem.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 _xformSystem = default!;
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
xform.MapID == _lastMousePosition.Value.MapId)
|
xform.MapID == _lastMousePosition.Value.MapId)
|
||||||
{
|
{
|
||||||
var tickTime = _gameTiming.TickPeriod;
|
var tickTime = _gameTiming.TickPeriod;
|
||||||
var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
|
var distance = _lastMousePosition.Value.Position - _xformSystem.GetWorldPosition(xform);
|
||||||
RaiseNetworkEvent(new GridDragVelocityRequest()
|
RaiseNetworkEvent(new GridDragVelocityRequest()
|
||||||
{
|
{
|
||||||
Grid = GetNetEntity(_dragging.Value),
|
Grid = GetNetEntity(_dragging.Value),
|
||||||
@@ -101,7 +102,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
|
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StartDragging(gridUid, Transform(gridUid).InvWorldMatrix.Transform(mousePos.Position));
|
StartDragging(gridUid, _xformSystem.GetInvWorldMatrix(gridUid).Transform(mousePos.Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TryComp<TransformComponent>(_dragging, out var xform))
|
if (!TryComp<TransformComponent>(_dragging, out var xform))
|
||||||
@@ -116,11 +117,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var localToWorld = xform.WorldMatrix.Transform(_localPosition);
|
var localToWorld = _xformSystem.GetWorldMatrix(xform).Transform(_localPosition);
|
||||||
|
|
||||||
if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) return;
|
if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) return;
|
||||||
|
|
||||||
var requestedGridOrigin = mousePos.Position - xform.WorldRotation.RotateVec(_localPosition);
|
var requestedGridOrigin = mousePos.Position - _xformSystem.GetWorldRotation(xform).RotateVec(_localPosition);
|
||||||
_lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId);
|
_lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId);
|
||||||
|
|
||||||
RaiseNetworkEvent(new GridDragRequestPosition()
|
RaiseNetworkEvent(new GridDragRequestPosition()
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public sealed class MouseRotatorSystem : SharedMouseRotatorSystem
|
|||||||
if (mapPos.MapId == MapId.Nullspace)
|
if (mapPos.MapId == MapId.Nullspace)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var angle = (mapPos.Position - xform.MapPosition.Position).ToWorldAngle();
|
var angle = (mapPos.Position - _transform.GetMapCoordinates((player.Value, xform)).Position).ToWorldAngle();
|
||||||
|
|
||||||
var curRot = _transform.GetWorldRotation(xform);
|
var curRot = _transform.GetWorldRotation(xform);
|
||||||
|
|
||||||
|
|||||||
@@ -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 SharedTransformSystem? _xformSystem = null;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
||||||
|
|
||||||
@@ -23,6 +24,10 @@ public sealed class HTNOverlay : Overlay
|
|||||||
if (args.ViewportControl == null)
|
if (args.ViewportControl == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_xformSystem ??= _entManager.SystemOrNull<SharedTransformSystem>();
|
||||||
|
if (_xformSystem is null)
|
||||||
|
return;
|
||||||
|
|
||||||
var handle = args.ScreenHandle;
|
var handle = args.ScreenHandle;
|
||||||
|
|
||||||
foreach (var (comp, xform) in _entManager.EntityQuery<HTNComponent, TransformComponent>(true))
|
foreach (var (comp, xform) in _entManager.EntityQuery<HTNComponent, TransformComponent>(true))
|
||||||
@@ -30,7 +35,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 = _xformSystem.GetWorldPosition(xform);
|
||||||
|
|
||||||
if (!args.WorldAABB.Contains(worldPos))
|
if (!args.WorldAABB.Contains(worldPos))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ public sealed class NPCSteeringOverlay : Overlay
|
|||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
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))
|
foreach (var (comp, mover, xform) in _entManager.EntityQuery<NPCSteeringComponent, InputMoverComponent, TransformComponent>(true))
|
||||||
{
|
{
|
||||||
if (xform.MapID != args.MapId)
|
if (xform.MapID != args.MapId)
|
||||||
@@ -96,7 +100,7 @@ public sealed class NPCSteeringOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (worldPos, worldRot) = xform.GetWorldPositionRotation();
|
var (worldPos, worldRot) = xformSystem.GetWorldPositionRotation(xform);
|
||||||
|
|
||||||
if (!args.WorldAABB.Contains(worldPos))
|
if (!args.WorldAABB.Contains(worldPos))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ namespace Content.Client.NPC
|
|||||||
private readonly IMapManager _mapManager;
|
private readonly IMapManager _mapManager;
|
||||||
private readonly PathfindingSystem _system;
|
private readonly PathfindingSystem _system;
|
||||||
private readonly MapSystem _mapSystem;
|
private readonly MapSystem _mapSystem;
|
||||||
|
private readonly SharedTransformSystem _xformSystem;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace | OverlaySpace.WorldSpace;
|
public override OverlaySpace Space => OverlaySpace.ScreenSpace | OverlaySpace.WorldSpace;
|
||||||
|
|
||||||
@@ -161,6 +162,7 @@ namespace Content.Client.NPC
|
|||||||
_mapManager = mapManager;
|
_mapManager = mapManager;
|
||||||
_system = system;
|
_system = system;
|
||||||
_mapSystem = mapSystem;
|
_mapSystem = mapSystem;
|
||||||
|
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
|
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +201,7 @@ namespace Content.Client.NPC
|
|||||||
if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid, out var gridXform))
|
if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize));
|
var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize));
|
||||||
|
|
||||||
foreach (var chunk in crumbs)
|
foreach (var chunk in crumbs)
|
||||||
@@ -283,7 +285,7 @@ namespace Content.Client.NPC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var invGridMatrix = gridXform.InvWorldMatrix;
|
var invGridMatrix = _xformSystem.GetInvWorldMatrix(gridXform);
|
||||||
DebugPathPoly? nearest = null;
|
DebugPathPoly? nearest = null;
|
||||||
var nearestDistance = float.MaxValue;
|
var nearestDistance = float.MaxValue;
|
||||||
|
|
||||||
@@ -356,7 +358,7 @@ namespace Content.Client.NPC
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invWorldMatrix.TransformBox(aabb);
|
var localAABB = invWorldMatrix.TransformBox(aabb);
|
||||||
|
|
||||||
@@ -416,7 +418,7 @@ namespace Content.Client.NPC
|
|||||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invWorldMatrix.TransformBox(aabb);
|
var localAABB = invWorldMatrix.TransformBox(aabb);
|
||||||
|
|
||||||
@@ -455,7 +457,7 @@ namespace Content.Client.NPC
|
|||||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invMatrix.TransformBox(aabb);
|
var localAABB = invMatrix.TransformBox(aabb);
|
||||||
|
|
||||||
@@ -514,7 +516,7 @@ namespace Content.Client.NPC
|
|||||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invWorldMatrix.TransformBox(args.WorldBounds);
|
var localAABB = invWorldMatrix.TransformBox(args.WorldBounds);
|
||||||
|
|
||||||
@@ -541,7 +543,7 @@ namespace Content.Client.NPC
|
|||||||
if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
|
if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
worldHandle.SetTransform(_xformSystem.GetWorldMatrix(graphXform));
|
||||||
worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f));
|
worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -565,7 +567,7 @@ namespace Content.Client.NPC
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
matrix = graph;
|
matrix = graph;
|
||||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
worldHandle.SetTransform(_xformSystem.GetWorldMatrix(graphXform));
|
||||||
}
|
}
|
||||||
|
|
||||||
worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f));
|
worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f));
|
||||||
|
|||||||
@@ -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 _xformSystem;
|
||||||
|
|
||||||
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>();
|
||||||
|
_xformSystem = _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(_xformSystem.GetWorldPosition(sourceTransform), _xformSystem.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 _xformSystem;
|
||||||
|
|
||||||
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;
|
||||||
|
_xformSystem = _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 = _mapManager.GetGrid(gridId);
|
var grid = _mapManager.GetGrid(gridId);
|
||||||
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(gridId).GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridId);
|
||||||
|
|
||||||
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
||||||
foreach (var (pos, list) in gridDict)
|
foreach (var (pos, list) in gridDict)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public sealed class TargetOutlineSystem : EntitySystem
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
private bool _enabled = false;
|
private bool _enabled = false;
|
||||||
|
|
||||||
@@ -164,8 +165,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 = _xformSystem.GetWorldPosition(player);
|
||||||
var target = Transform(entity).WorldPosition;
|
var target = _xformSystem.GetWorldPosition(entity);
|
||||||
valid = (origin - target).LengthSquared() <= Range;
|
valid = (origin - target).LengthSquared() <= Range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public sealed class NavMapOverlay : Overlay
|
|||||||
{
|
{
|
||||||
var query = _entManager.GetEntityQuery<NavMapComponent>();
|
var query = _entManager.GetEntityQuery<NavMapComponent>();
|
||||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||||
|
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
var scale = Matrix3.CreateScale(new Vector2(1f, 1f));
|
var scale = Matrix3.CreateScale(new Vector2(1f, 1f));
|
||||||
|
|
||||||
_grids.Clear();
|
_grids.Clear();
|
||||||
@@ -69,7 +70,7 @@ public sealed class NavMapOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// TODO: Faster helper method
|
// TODO: Faster helper method
|
||||||
var (_, _, matrix, invMatrix) = xform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, matrix, invMatrix) = xformSystem.GetWorldPositionRotationMatrixWithInv(xform);
|
||||||
|
|
||||||
var localAABB = invMatrix.TransformBox(args.WorldBounds);
|
var localAABB = invMatrix.TransformBox(args.WorldBounds);
|
||||||
Matrix3.Multiply(in scale, in matrix, out var matty);
|
Matrix3.Multiply(in scale, in matrix, out var matty);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Content.Client.Radiation.Overlays
|
|||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
private SharedTransformSystem? _xformSystem = null;
|
||||||
|
|
||||||
private const float MaxDist = 15.0f;
|
private const float MaxDist = 15.0f;
|
||||||
|
|
||||||
@@ -72,7 +73,9 @@ 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?)
|
//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)
|
private void RadiationQuery(IEye? currentEye)
|
||||||
{
|
{
|
||||||
if (currentEye == null)
|
_xformSystem ??= _entityManager.SystemOrNull<SharedTransformSystem>();
|
||||||
|
|
||||||
|
if (_xformSystem is null || currentEye is null)
|
||||||
{
|
{
|
||||||
_pulses.Clear();
|
_pulses.Clear();
|
||||||
return;
|
return;
|
||||||
@@ -91,7 +94,7 @@ namespace Content.Client.Radiation.Overlays
|
|||||||
(
|
(
|
||||||
_baseShader.Duplicate(),
|
_baseShader.Duplicate(),
|
||||||
new RadiationShaderInstance(
|
new RadiationShaderInstance(
|
||||||
_entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition,
|
_xformSystem.GetMapCoordinates(pulseEntity),
|
||||||
pulse.VisualRange,
|
pulse.VisualRange,
|
||||||
pulse.StartTime,
|
pulse.StartTime,
|
||||||
pulse.VisualDuration
|
pulse.VisualDuration
|
||||||
@@ -109,7 +112,7 @@ namespace Content.Client.Radiation.Overlays
|
|||||||
_entityManager.TryGetComponent(pulseEntity, out RadiationPulseComponent? pulse))
|
_entityManager.TryGetComponent(pulseEntity, out RadiationPulseComponent? pulse))
|
||||||
{
|
{
|
||||||
var shaderInstance = _pulses[pulseEntity];
|
var shaderInstance = _pulses[pulseEntity];
|
||||||
shaderInstance.instance.CurrentMapCoords = _entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition;
|
shaderInstance.instance.CurrentMapCoords = _xformSystem.GetMapCoordinates(pulseEntity);
|
||||||
shaderInstance.instance.Range = pulse.VisualRange;
|
shaderInstance.instance.Range = pulse.VisualRange;
|
||||||
} else {
|
} else {
|
||||||
_pulses[pulseEntity].shd.Dispose();
|
_pulses[pulseEntity].shd.Dispose();
|
||||||
|
|||||||
@@ -126,18 +126,18 @@ public sealed partial class ReplaySpectatorSystem
|
|||||||
|
|
||||||
if (data.Local != null && data.Local.Value.Coords.IsValid(EntityManager))
|
if (data.Local != null && data.Local.Value.Coords.IsValid(EntityManager))
|
||||||
{
|
{
|
||||||
var newXform = SpawnSpectatorGhost(data.Local.Value.Coords, false);
|
var (newUid, newXform) = SpawnSpectatorGhost(data.Local.Value.Coords, false);
|
||||||
newXform.LocalRotation = data.Local.Value.Rot;
|
_transform.SetLocalRotation(newUid, data.Local.Value.Rot, newXform);
|
||||||
}
|
}
|
||||||
else if (data.World != null && data.World.Value.Coords.IsValid(EntityManager))
|
else if (data.World != null && data.World.Value.Coords.IsValid(EntityManager))
|
||||||
{
|
{
|
||||||
var newXform = SpawnSpectatorGhost(data.World.Value.Coords, true);
|
var (newUid, newXform) = SpawnSpectatorGhost(data.World.Value.Coords, true);
|
||||||
newXform.LocalRotation = data.World.Value.Rot;
|
_transform.SetLocalRotation(newUid, data.World.Value.Rot, newXform);
|
||||||
}
|
}
|
||||||
else if (TryFindFallbackSpawn(out var coords))
|
else if (TryFindFallbackSpawn(out var coords))
|
||||||
{
|
{
|
||||||
var newXform = SpawnSpectatorGhost(coords, true);
|
var (newUid, newXform) = SpawnSpectatorGhost(coords, true);
|
||||||
newXform.LocalRotation = 0;
|
_transform.SetLocalRotation(newUid, 0, newXform);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public sealed partial class ReplaySpectatorSystem
|
|||||||
RemComp<ReplaySpectatorComponent>(old.Value);
|
RemComp<ReplaySpectatorComponent>(old.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransformComponent SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach)
|
public Entity<TransformComponent> SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach)
|
||||||
{
|
{
|
||||||
var old = _player.LocalEntity;
|
var old = _player.LocalEntity;
|
||||||
var session = _player.GetSessionById(DefaultUser);
|
var session = _player.GetSessionById(DefaultUser);
|
||||||
@@ -83,7 +83,7 @@ public sealed partial class ReplaySpectatorSystem
|
|||||||
_stateMan.RequestStateChange<ReplayGhostState>();
|
_stateMan.RequestStateChange<ReplayGhostState>();
|
||||||
|
|
||||||
_spectatorData = GetSpectatorData();
|
_spectatorData = GetSpectatorData();
|
||||||
return xform;
|
return (ent, xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpectateCommand(IConsoleShell shell, string argStr, string[] args)
|
private void SpectateCommand(IConsoleShell shell, string argStr, string[] args)
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
|||||||
public sealed class EmergencyShuttleOverlay : Overlay
|
public sealed class EmergencyShuttleOverlay : Overlay
|
||||||
{
|
{
|
||||||
private IEntityManager _entManager;
|
private IEntityManager _entManager;
|
||||||
|
private SharedTransformSystem _xformSystem;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||||
|
|
||||||
@@ -67,13 +68,14 @@ public sealed class EmergencyShuttleOverlay : Overlay
|
|||||||
public EmergencyShuttleOverlay(IEntityManager entManager)
|
public EmergencyShuttleOverlay(IEntityManager entManager)
|
||||||
{
|
{
|
||||||
_entManager = entManager;
|
_entManager = entManager;
|
||||||
|
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
{
|
{
|
||||||
if (Position == null || !_entManager.TryGetComponent<TransformComponent>(StationUid, out var xform)) return;
|
if (Position == null || !_entManager.TryGetComponent<TransformComponent>(StationUid, out var xform)) return;
|
||||||
|
|
||||||
args.WorldHandle.SetTransform(xform.WorldMatrix);
|
args.WorldHandle.SetTransform(_xformSystem.GetWorldMatrix(xform));
|
||||||
args.WorldHandle.DrawRect(Position.Value, Color.Red.WithAlpha(100));
|
args.WorldHandle.DrawRect(Position.Value, Color.Red.WithAlpha(100));
|
||||||
args.WorldHandle.SetTransform(Matrix3.Identity);
|
args.WorldHandle.SetTransform(Matrix3.Identity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class DockingControl : Control
|
|||||||
{
|
{
|
||||||
private readonly IEntityManager _entManager;
|
private readonly IEntityManager _entManager;
|
||||||
private readonly IMapManager _mapManager;
|
private readonly IMapManager _mapManager;
|
||||||
|
private readonly SharedTransformSystem _xformSystem;
|
||||||
|
|
||||||
private float _range = 8f;
|
private float _range = 8f;
|
||||||
private float _rangeSquared = 0f;
|
private float _rangeSquared = 0f;
|
||||||
@@ -50,6 +51,7 @@ public class DockingControl : Control
|
|||||||
{
|
{
|
||||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||||
_mapManager = IoCManager.Resolve<IMapManager>();
|
_mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
_rangeSquared = _range * _range;
|
_rangeSquared = _range * _range;
|
||||||
MinSize = new Vector2(SizeFull, SizeFull);
|
MinSize = new Vector2(SizeFull, SizeFull);
|
||||||
}
|
}
|
||||||
@@ -143,8 +145,8 @@ public class DockingControl : Control
|
|||||||
ScalePosition(rotation.Transform(new Vector2(0.5f, -0.5f)))), Color.Green);
|
ScalePosition(rotation.Transform(new Vector2(0.5f, -0.5f)))), Color.Green);
|
||||||
|
|
||||||
// Draw nearby grids
|
// Draw nearby grids
|
||||||
var worldPos = gridXform.WorldMatrix.Transform(Coordinates.Value.Position);
|
var worldPos = _xformSystem.GetWorldMatrix(gridXform).Transform(Coordinates.Value.Position);
|
||||||
var gridInvMatrix = gridXform.InvWorldMatrix;
|
var gridInvMatrix = _xformSystem.GetInvWorldMatrix(gridXform);
|
||||||
Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix);
|
Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix);
|
||||||
|
|
||||||
// TODO: Getting some overdraw so need to fix that.
|
// TODO: Getting some overdraw so need to fix that.
|
||||||
@@ -162,7 +164,7 @@ public class DockingControl : Control
|
|||||||
if (!_entManager.TryGetComponent<FixturesComponent>(grid, out var gridFixtures))
|
if (!_entManager.TryGetComponent<FixturesComponent>(grid, out var gridFixtures))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridMatrix = xformQuery.GetComponent(grid).WorldMatrix;
|
var gridMatrix = _xformSystem.GetWorldMatrix(grid);
|
||||||
|
|
||||||
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
|||||||
{
|
{
|
||||||
private readonly IEntityManager _entManager;
|
private readonly IEntityManager _entManager;
|
||||||
private readonly IGameTiming _timing;
|
private readonly IGameTiming _timing;
|
||||||
|
private SharedTransformSystem? _xformSystem = null;
|
||||||
|
|
||||||
private EntityUid? _shuttleEntity;
|
private EntityUid? _shuttleEntity;
|
||||||
|
|
||||||
@@ -309,7 +310,9 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
|||||||
{
|
{
|
||||||
base.Draw(handle);
|
base.Draw(handle);
|
||||||
|
|
||||||
if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
|
_xformSystem ??= _entManager.SystemOrNull<SharedTransformSystem>();
|
||||||
|
if (_xformSystem is null ||
|
||||||
|
!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
|
||||||
!_entManager.TryGetComponent<TransformComponent>(_shuttleEntity, out var gridXform))
|
!_entManager.TryGetComponent<TransformComponent>(_shuttleEntity, out var gridXform))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -322,7 +325,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
|||||||
|
|
||||||
FTLTimer.Text = GetFTLText();
|
FTLTimer.Text = GetFTLText();
|
||||||
|
|
||||||
var (_, worldRot, worldMatrix) = gridXform.GetWorldPositionRotationMatrix();
|
var (_, worldRot, worldMatrix) = _xformSystem.GetWorldPositionRotationMatrix(gridXform);
|
||||||
var worldPos = worldMatrix.Transform(gridBody.LocalCenter);
|
var worldPos = worldMatrix.Transform(gridBody.LocalCenter);
|
||||||
|
|
||||||
// Get the positive reduced angle.
|
// Get the positive reduced angle.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
|||||||
|
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
private readonly HashSet<FadingSpriteComponent> _comps = new();
|
private readonly HashSet<FadingSpriteComponent> _comps = new();
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
|||||||
spriteQuery.TryGetComponent(player, out var playerSprite))
|
spriteQuery.TryGetComponent(player, out var playerSprite))
|
||||||
{
|
{
|
||||||
var fadeQuery = GetEntityQuery<SpriteFadeComponent>();
|
var fadeQuery = GetEntityQuery<SpriteFadeComponent>();
|
||||||
var mapPos = playerXform.MapPosition;
|
var mapPos = _xformSystem.GetMapCoordinates((player.Value, playerXform));
|
||||||
|
|
||||||
// Also want to handle large entities even if they may not be clickable.
|
// Also want to handle large entities even if they may not be clickable.
|
||||||
foreach (var ent in state.GetClickableEntities(mapPos))
|
foreach (var ent in state.GetClickableEntities(mapPos))
|
||||||
|
|||||||
@@ -10,6 +10,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 _xformSystem = default!;
|
||||||
|
|
||||||
private ShaderInstance _shader = default!;
|
private ShaderInstance _shader = default!;
|
||||||
|
|
||||||
@@ -79,7 +80,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(_xformSystem.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 _xformSystem = 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;
|
_xformSystem.SetWorldPosition(_draggedEntity.Value, clampedCoords.Position);
|
||||||
|
|
||||||
// Increment total time passed
|
// Increment total time passed
|
||||||
_timePassed += frameTime;
|
_timePassed += frameTime;
|
||||||
@@ -258,7 +259,7 @@ namespace Content.Client.Tabletop
|
|||||||
// Set the dragging player on the component to noone
|
// Set the dragging player on the component to noone
|
||||||
if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
|
if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
|
||||||
{
|
{
|
||||||
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value)));
|
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transforms.GetMapCoordinates(_draggedEntity.Value), GetNetEntity(_table!.Value)));
|
||||||
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
|
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public sealed class ChatUIController : UIController
|
|||||||
[UISystemDependency] private readonly GhostSystem? _ghost = default;
|
[UISystemDependency] private readonly GhostSystem? _ghost = default;
|
||||||
[UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
|
[UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
|
||||||
[UISystemDependency] private readonly ChatSystem? _chatSys = default;
|
[UISystemDependency] private readonly ChatSystem? _chatSys = default;
|
||||||
|
[UISystemDependency] private readonly SharedTransformSystem? _xformSystem = default!;
|
||||||
|
|
||||||
[ValidatePrototypeId<ColorPalettePrototype>]
|
[ValidatePrototypeId<ColorPalettePrototype>]
|
||||||
private const string ChatNamePalette = "ChatNames";
|
private const string ChatNamePalette = "ChatNames";
|
||||||
@@ -553,7 +554,7 @@ public sealed class ChatUIController : UIController
|
|||||||
private void UpdateQueuedSpeechBubbles(FrameEventArgs delta)
|
private void UpdateQueuedSpeechBubbles(FrameEventArgs delta)
|
||||||
{
|
{
|
||||||
// Update queued speech bubbles.
|
// Update queued speech bubbles.
|
||||||
if (_queuedSpeechBubbles.Count == 0 || _examine == null)
|
if (_queuedSpeechBubbles.Count == 0 || _examine is null || _xformSystem is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -591,7 +592,7 @@ public sealed class ChatUIController : UIController
|
|||||||
var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
|
var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
|
||||||
=> uid == data.compOwner || uid == data.attachedEntity;
|
=> uid == data.compOwner || uid == data.attachedEntity;
|
||||||
var playerPos = player != null
|
var playerPos = player != null
|
||||||
? EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition
|
? _xformSystem.GetMapCoordinates(player.Value)
|
||||||
: MapCoordinates.Nullspace;
|
: MapCoordinates.Nullspace;
|
||||||
|
|
||||||
var occluded = player != null && _examine.IsOccluded(player.Value);
|
var occluded = player != null && _examine.IsOccluded(player.Value);
|
||||||
@@ -610,7 +611,7 @@ public sealed class ChatUIController : UIController
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
|
var otherPos = _xformSystem.GetMapCoordinates(ent);
|
||||||
|
|
||||||
if (occluded && !ExamineSystemShared.InRangeUnOccluded(
|
if (occluded && !ExamineSystemShared.InRangeUnOccluded(
|
||||||
playerPos,
|
playerPos,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Client.UserInterface.Systems.Gameplay;
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controllers;
|
using Robust.Client.UserInterface.Controllers;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -15,6 +16,7 @@ public sealed class ViewportUIController : UIController
|
|||||||
[Dependency] private readonly IPlayerManager _playerMan = default!;
|
[Dependency] private readonly IPlayerManager _playerMan = default!;
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||||
|
[UISystemDependency] private readonly SharedTransformSystem? _xformSystem = 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;
|
||||||
@@ -87,7 +89,7 @@ public sealed class ViewportUIController : UIController
|
|||||||
_entMan.TryGetComponent(ent, out EyeComponent? eye);
|
_entMan.TryGetComponent(ent, out EyeComponent? eye);
|
||||||
|
|
||||||
if (eye?.Eye == _eyeManager.CurrentEye
|
if (eye?.Eye == _eyeManager.CurrentEye
|
||||||
&& _entMan.GetComponent<TransformComponent>(ent.Value).WorldPosition == default)
|
&& (_xformSystem is null || _xformSystem.GetWorldPosition(ent.Value) == default))
|
||||||
return; // nothing to worry about, the player is just in null space... actually that is probably a problem?
|
return; // nothing to worry about, the player is just in null space... actually that is probably a problem?
|
||||||
|
|
||||||
// Currently, this shouldn't happen. This likely happened because the main eye was set to null. When this
|
// Currently, this shouldn't happen. This likely happened because the main eye was set to null. When this
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace Content.Client.Verbs
|
|||||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When a user right clicks somewhere, how large is the box we use to get entities for the context menu?
|
/// When a user right clicks somewhere, how large is the box we use to get entities for the context menu?
|
||||||
@@ -140,8 +141,7 @@ namespace Content.Client.Verbs
|
|||||||
// Remove any entities that do not have LOS
|
// Remove any entities that do not have LOS
|
||||||
if ((visibility & MenuVisibility.NoFov) == 0)
|
if ((visibility & MenuVisibility.NoFov) == 0)
|
||||||
{
|
{
|
||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var playerPos = _xformSystem.GetMapCoordinates(player.Value);
|
||||||
var playerPos = xformQuery.GetComponent(player.Value).MapPosition;
|
|
||||||
|
|
||||||
for (var i = entities.Count - 1; i >= 0; i--)
|
for (var i = entities.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
@@ -149,7 +149,7 @@ namespace Content.Client.Verbs
|
|||||||
|
|
||||||
if (!ExamineSystemShared.InRangeUnOccluded(
|
if (!ExamineSystemShared.InRangeUnOccluded(
|
||||||
playerPos,
|
playerPos,
|
||||||
xformQuery.GetComponent(entity).MapPosition,
|
_xformSystem.GetMapCoordinates(entity),
|
||||||
ExamineSystemShared.ExamineRange,
|
ExamineSystemShared.ExamineRange,
|
||||||
null))
|
null))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public sealed class MeleeArcOverlay : Overlay
|
|||||||
private readonly IPlayerManager _playerManager;
|
private readonly IPlayerManager _playerManager;
|
||||||
private readonly MeleeWeaponSystem _melee;
|
private readonly MeleeWeaponSystem _melee;
|
||||||
private readonly SharedCombatModeSystem _combatMode;
|
private readonly SharedCombatModeSystem _combatMode;
|
||||||
|
private readonly SharedTransformSystem _xformSystem;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ public sealed class MeleeArcOverlay : Overlay
|
|||||||
_playerManager = playerManager;
|
_playerManager = playerManager;
|
||||||
_melee = melee;
|
_melee = melee;
|
||||||
_combatMode = combatMode;
|
_combatMode = combatMode;
|
||||||
|
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
@@ -52,7 +54,7 @@ public sealed class MeleeArcOverlay : Overlay
|
|||||||
if (mapPos.MapId != args.MapId)
|
if (mapPos.MapId != args.MapId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var playerPos = xform.MapPosition;
|
var playerPos = _xformSystem.GetMapCoordinates((player.Value, xform));
|
||||||
|
|
||||||
if (mapPos.MapId != playerPos.MapId)
|
if (mapPos.MapId != playerPos.MapId)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
TransformSystem.AttachToGridOrMap(animationUid, xform);
|
TransformSystem.AttachToGridOrMap(animationUid, xform);
|
||||||
var worldPos = mapPos + (mapRot - userXform.LocalRotation).RotateVec(localPos);
|
var worldPos = mapPos + (mapRot - userXform.LocalRotation).RotateVec(localPos);
|
||||||
var newLocalPos = TransformSystem.GetInvWorldMatrix(xform.ParentUid).Transform(worldPos);
|
var newLocalPos = TransformSystem.GetInvWorldMatrix(xform.ParentUid).Transform(worldPos);
|
||||||
TransformSystem.SetLocalPositionNoLerp(xform, newLocalPos);
|
TransformSystem.SetLocalPositionNoLerp(animationUid, newLocalPos, xform);
|
||||||
if (arcComponent.Fadeout)
|
if (arcComponent.Fadeout)
|
||||||
_animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey);
|
_animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
// Light attack
|
// Light attack
|
||||||
if (useDown == BoundKeyState.Down)
|
if (useDown == BoundKeyState.Down)
|
||||||
{
|
{
|
||||||
var attackerPos = Transform(entity).MapPosition;
|
var attackerPos = TransformSystem.GetMapCoordinates(entity);
|
||||||
|
|
||||||
if (mousePos.MapId != attackerPos.MapId ||
|
if (mousePos.MapId != attackerPos.MapId ||
|
||||||
(attackerPos.Position - mousePos.Position).Length() > weapon.Range)
|
(attackerPos.Position - mousePos.Position).Length() > weapon.Range)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public sealed class GunSpreadOverlay : Overlay
|
|||||||
private readonly IInputManager _input;
|
private readonly IInputManager _input;
|
||||||
private readonly IPlayerManager _player;
|
private readonly IPlayerManager _player;
|
||||||
private readonly GunSystem _guns;
|
private readonly GunSystem _guns;
|
||||||
|
private readonly SharedTransformSystem _xforms;
|
||||||
|
|
||||||
public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system)
|
public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system)
|
||||||
{
|
{
|
||||||
@@ -27,6 +28,7 @@ public sealed class GunSpreadOverlay : Overlay
|
|||||||
_timing = timing;
|
_timing = timing;
|
||||||
_player = player;
|
_player = player;
|
||||||
_guns = system;
|
_guns = system;
|
||||||
|
_xforms = entManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
@@ -41,7 +43,7 @@ public sealed class GunSpreadOverlay : Overlay
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapPos = xform.MapPosition;
|
var mapPos = _xforms.GetMapCoordinates((player.Value, xform));
|
||||||
|
|
||||||
if (mapPos.MapId == MapId.Nullspace)
|
if (mapPos.MapId == MapId.Nullspace)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -99,8 +99,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
|
|
||||||
var ent = Spawn(HitscanProto, coords);
|
var ent = Spawn(HitscanProto, coords);
|
||||||
var sprite = Comp<SpriteComponent>(ent);
|
var sprite = Comp<SpriteComponent>(ent);
|
||||||
var xform = Transform(ent);
|
TransformSystem.SetLocalRotation(ent, a.angle);
|
||||||
xform.LocalRotation = a.angle;
|
|
||||||
sprite[EffectLayers.Unshaded].AutoAnimated = false;
|
sprite[EffectLayers.Unshaded].AutoAnimated = false;
|
||||||
sprite.LayerSetSprite(EffectLayers.Unshaded, rsi);
|
sprite.LayerSetSprite(EffectLayers.Unshaded, rsi);
|
||||||
sprite.LayerSetState(EffectLayers.Unshaded, rsi.RsiState);
|
sprite.LayerSetState(EffectLayers.Unshaded, rsi.RsiState);
|
||||||
@@ -278,9 +277,11 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
var ent = Spawn(message.Prototype, coordinates);
|
var ent = Spawn(message.Prototype, coordinates);
|
||||||
|
|
||||||
var effectXform = Transform(ent);
|
var effectXform = Transform(ent);
|
||||||
TransformSystem.SetLocalPositionRotation(effectXform,
|
TransformSystem.SetLocalPositionRotation(ent,
|
||||||
effectXform.LocalPosition + new Vector2(0f, -0.5f),
|
effectXform.LocalPosition + new Vector2(0f, -0.5f),
|
||||||
effectXform.LocalRotation - MathF.PI / 2);
|
effectXform.LocalRotation - MathF.PI / 2,
|
||||||
|
effectXform
|
||||||
|
);
|
||||||
|
|
||||||
var lifetime = 0.4f;
|
var lifetime = 0.4f;
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var eyeManager = client.ResolveDependency<IEyeManager>();
|
var eyeManager = client.ResolveDependency<IEyeManager>();
|
||||||
var spriteQuery = clientEntManager.GetEntityQuery<SpriteComponent>();
|
var spriteQuery = clientEntManager.GetEntityQuery<SpriteComponent>();
|
||||||
var xformQuery = clientEntManager.GetEntityQuery<TransformComponent>();
|
var xformQuery = clientEntManager.GetEntityQuery<TransformComponent>();
|
||||||
|
var clickSystem = clientEntManager.System<ClickableSystem>();
|
||||||
var eye = client.ResolveDependency<IEyeManager>().CurrentEye;
|
var eye = client.ResolveDependency<IEyeManager>().CurrentEye;
|
||||||
|
|
||||||
var testMap = await pair.CreateTestMap();
|
var testMap = await pair.CreateTestMap();
|
||||||
@@ -82,7 +83,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(clientEnt);
|
var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(clientEnt);
|
||||||
var clickable = clientEntManager.GetComponent<ClickableComponent>(clientEnt);
|
var clickable = clientEntManager.GetComponent<ClickableComponent>(clientEnt);
|
||||||
|
|
||||||
hit = clickable.CheckClick(sprite, xformQuery.GetComponent(clientEnt), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _);
|
hit = clickSystem.CheckClick((clientEnt, clickable, sprite, xformQuery.GetComponent(clientEnt)), new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _);
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
|
|||||||
@@ -171,8 +171,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
human = entityManager.SpawnEntity("HumanDisposalDummy", coordinates);
|
human = entityManager.SpawnEntity("HumanDisposalDummy", coordinates);
|
||||||
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
||||||
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
||||||
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy",
|
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", xformSystem.GetMapCoordinates(disposalUnit));
|
||||||
entityManager.GetComponent<TransformComponent>(disposalUnit).MapPosition);
|
|
||||||
|
|
||||||
// Test for components existing
|
// Test for components existing
|
||||||
unitUid = disposalUnit;
|
unitUid = disposalUnit;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public sealed class HandTests
|
|||||||
var playerMan = server.ResolveDependency<IPlayerManager>();
|
var playerMan = server.ResolveDependency<IPlayerManager>();
|
||||||
var mapMan = server.ResolveDependency<IMapManager>();
|
var mapMan = server.ResolveDependency<IMapManager>();
|
||||||
var sys = entMan.System<SharedHandsSystem>();
|
var sys = entMan.System<SharedHandsSystem>();
|
||||||
|
var xfm = entMan.System<SharedTransformSystem>();
|
||||||
|
|
||||||
var data = await pair.CreateTestMap();
|
var data = await pair.CreateTestMap();
|
||||||
await pair.RunTicksSync(5);
|
await pair.RunTicksSync(5);
|
||||||
@@ -35,7 +36,7 @@ public sealed class HandTests
|
|||||||
{
|
{
|
||||||
player = playerMan.Sessions.First().AttachedEntity!.Value;
|
player = playerMan.Sessions.First().AttachedEntity!.Value;
|
||||||
var xform = entMan.GetComponent<TransformComponent>(player);
|
var xform = entMan.GetComponent<TransformComponent>(player);
|
||||||
item = entMan.SpawnEntity("Crowbar", xform.MapPosition);
|
item = entMan.SpawnEntity("Crowbar", xfm.GetMapCoordinates(xform));
|
||||||
hands = entMan.GetComponent<HandsComponent>(player);
|
hands = entMan.GetComponent<HandsComponent>(player);
|
||||||
sys.TryPickup(player, item, hands.ActiveHand!);
|
sys.TryPickup(player, item, hands.ActiveHand!);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
var sEntities = server.ResolveDependency<IEntityManager>();
|
var sEntities = server.ResolveDependency<IEntityManager>();
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var conSystem = sEntities.EntitySysManager.GetEntitySystem<SharedContainerSystem>();
|
var conSystem = sEntities.EntitySysManager.GetEntitySystem<SharedContainerSystem>();
|
||||||
|
var xfmSystem = sEntities.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
|
||||||
|
|
||||||
EntityUid origin = default;
|
EntityUid origin = default;
|
||||||
EntityUid other = default;
|
EntityUid other = default;
|
||||||
@@ -45,7 +46,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
origin = sEntities.SpawnEntity(HumanId, coordinates);
|
origin = sEntities.SpawnEntity(HumanId, coordinates);
|
||||||
other = sEntities.SpawnEntity(HumanId, coordinates);
|
other = sEntities.SpawnEntity(HumanId, coordinates);
|
||||||
conSystem.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
conSystem.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
||||||
mapCoordinates = sEntities.GetComponent<TransformComponent>(other).MapPosition;
|
mapCoordinates = xfmSystem.GetMapCoordinates(other);
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|||||||
@@ -626,6 +626,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var gameTiming = server.ResolveDependency<IGameTiming>();
|
var gameTiming = server.ResolveDependency<IGameTiming>();
|
||||||
var batterySys = entityManager.System<BatterySystem>();
|
var batterySys = entityManager.System<BatterySystem>();
|
||||||
|
var xformSys = entityManager.System<SharedTransformSystem>();
|
||||||
PowerConsumerComponent consumer = default!;
|
PowerConsumerComponent consumer = default!;
|
||||||
PowerSupplierComponent supplier = default!;
|
PowerSupplierComponent supplier = default!;
|
||||||
PowerNetworkBatteryComponent netBattery = default!;
|
PowerNetworkBatteryComponent netBattery = default!;
|
||||||
@@ -644,7 +645,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
}
|
}
|
||||||
|
|
||||||
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
entityManager.GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
|
||||||
|
|
||||||
var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
@@ -703,6 +704,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var gameTiming = server.ResolveDependency<IGameTiming>();
|
var gameTiming = server.ResolveDependency<IGameTiming>();
|
||||||
var batterySys = entityManager.System<BatterySystem>();
|
var batterySys = entityManager.System<BatterySystem>();
|
||||||
|
var xformSys = entityManager.System<SharedTransformSystem>();
|
||||||
PowerConsumerComponent consumer = default!;
|
PowerConsumerComponent consumer = default!;
|
||||||
PowerSupplierComponent supplier = default!;
|
PowerSupplierComponent supplier = default!;
|
||||||
PowerNetworkBatteryComponent netBattery = default!;
|
PowerNetworkBatteryComponent netBattery = default!;
|
||||||
@@ -721,7 +723,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
}
|
}
|
||||||
|
|
||||||
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
entityManager.GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
|
||||||
|
|
||||||
var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
@@ -779,6 +781,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var batterySys = entityManager.System<BatterySystem>();
|
var batterySys = entityManager.System<BatterySystem>();
|
||||||
|
var xformSys = entityManager.System<SharedTransformSystem>();
|
||||||
PowerConsumerComponent consumer1 = default!;
|
PowerConsumerComponent consumer1 = default!;
|
||||||
PowerConsumerComponent consumer2 = default!;
|
PowerConsumerComponent consumer2 = default!;
|
||||||
PowerSupplierComponent supplier = default!;
|
PowerSupplierComponent supplier = default!;
|
||||||
@@ -805,7 +808,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
|
|
||||||
entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
entityManager.GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
|
||||||
|
|
||||||
var batteryEnt1 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
var batteryEnt1 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||||
var batteryEnt2 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
var batteryEnt2 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||||
@@ -973,6 +976,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var batterySys = entityManager.System<BatterySystem>();
|
var batterySys = entityManager.System<BatterySystem>();
|
||||||
|
var xformSys = entityManager.System<SharedTransformSystem>();
|
||||||
PowerConsumerComponent consumer1 = default!;
|
PowerConsumerComponent consumer1 = default!;
|
||||||
PowerConsumerComponent consumer2 = default!;
|
PowerConsumerComponent consumer2 = default!;
|
||||||
PowerSupplierComponent supplier = default!;
|
PowerSupplierComponent supplier = default!;
|
||||||
@@ -999,7 +1003,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
|
|
||||||
entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
entityManager.GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
|
||||||
|
|
||||||
var batteryEnt1 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
var batteryEnt1 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||||
var batteryEnt2 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
var batteryEnt2 = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||||
@@ -1060,6 +1064,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var batterySys = entityManager.System<BatterySystem>();
|
var batterySys = entityManager.System<BatterySystem>();
|
||||||
|
var xformSys = entityManager.System<SharedTransformSystem>();
|
||||||
PowerConsumerComponent consumer = default!;
|
PowerConsumerComponent consumer = default!;
|
||||||
PowerSupplierComponent supplier = default!;
|
PowerSupplierComponent supplier = default!;
|
||||||
PowerNetworkBatteryComponent netBattery = default!;
|
PowerNetworkBatteryComponent netBattery = default!;
|
||||||
@@ -1077,7 +1082,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
}
|
}
|
||||||
|
|
||||||
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
entityManager.GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
|
||||||
|
|
||||||
var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var batteryEnt = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
@@ -1144,6 +1149,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
var nodeContainer = entityManager.System<NodeContainerSystem>();
|
var nodeContainer = entityManager.System<NodeContainerSystem>();
|
||||||
|
var xformSys = entityManager.System<SharedTransformSystem>();
|
||||||
CableNode leftNode = default!;
|
CableNode leftNode = default!;
|
||||||
CableNode rightNode = default!;
|
CableNode rightNode = default!;
|
||||||
Node batteryInput = default!;
|
Node batteryInput = default!;
|
||||||
@@ -1166,7 +1172,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var rightEnt = entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3));
|
var rightEnt = entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3));
|
||||||
|
|
||||||
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
entityManager.GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
xformSys.SetLocalRotation(terminal, Angle.FromDegrees(180));
|
||||||
|
|
||||||
var battery = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var battery = entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var batteryNodeContainer = entityManager.GetComponent<NodeContainerComponent>(battery);
|
var batteryNodeContainer = entityManager.GetComponent<NodeContainerComponent>(battery);
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ public sealed class DockTest : ContentUnitTest
|
|||||||
|
|
||||||
mapSystem.SetTiles(grid1.Owner, grid1.Comp, tiles1);
|
mapSystem.SetTiles(grid1.Owner, grid1.Comp, tiles1);
|
||||||
var dock1 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid1Ent, dock1Pos));
|
var dock1 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid1Ent, dock1Pos));
|
||||||
var dock1Xform = entManager.GetComponent<TransformComponent>(dock1);
|
xformSystem.SetLocalRotation(dock1, dock1Angle);
|
||||||
dock1Xform.LocalRotation = dock1Angle;
|
|
||||||
|
|
||||||
var tiles2 = new List<(Vector2i Index, Tile Tile)>()
|
var tiles2 = new List<(Vector2i Index, Tile Tile)>()
|
||||||
{
|
{
|
||||||
@@ -74,8 +73,7 @@ public sealed class DockTest : ContentUnitTest
|
|||||||
|
|
||||||
mapSystem.SetTiles(grid2.Owner, grid2.Comp, tiles2);
|
mapSystem.SetTiles(grid2.Owner, grid2.Comp, tiles2);
|
||||||
var dock2 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid2Ent, dock2Pos));
|
var dock2 = entManager.SpawnEntity("AirlockShuttle", new EntityCoordinates(grid2Ent, dock2Pos));
|
||||||
var dock2Xform = entManager.GetComponent<TransformComponent>(dock2);
|
xformSystem.SetLocalRotation(dock2, dock2Angle);
|
||||||
dock2Xform.LocalRotation = dock2Angle;
|
|
||||||
|
|
||||||
var config = dockingSystem.GetDockingConfig(grid1Ent, grid2Ent);
|
var config = dockingSystem.GetDockingConfig(grid1Ent, grid2Ent);
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
|
? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
|
||||||
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
||||||
var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates);
|
var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates);
|
||||||
_entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
|
_entities.System<SharedTransformSystem>().AttachToGridOrMap(ghost);
|
||||||
|
|
||||||
if (canReturn)
|
if (canReturn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public sealed class ExplosionCommand : IConsoleCommand
|
|||||||
if (args.Length > 4)
|
if (args.Length > 4)
|
||||||
coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
|
coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
|
||||||
else
|
else
|
||||||
coords = xform.MapPosition;
|
coords = entMan.System<SharedTransformSystem>().GetMapCoordinates(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExplosionPrototype? type;
|
ExplosionPrototype? type;
|
||||||
|
|||||||
@@ -118,8 +118,10 @@ namespace Content.Server.Administration.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
var xform = _entManager.GetComponent<TransformComponent>(playerEntity);
|
var xform = _entManager.GetComponent<TransformComponent>(playerEntity);
|
||||||
xform.Coordinates = coords;
|
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
xform.AttachToGridOrMap();
|
|
||||||
|
xformSystem.SetCoordinates((playerEntity, xform, _entManager.GetComponent<MetaDataComponent>(playerEntity)), coords);
|
||||||
|
xformSystem.AttachToGridOrMap(playerEntity, xform);
|
||||||
if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics))
|
if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
_entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics);
|
_entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")),
|
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")),
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
var coords = Transform(args.Target).MapPosition;
|
var coords = _transformSystem.GetMapCoordinates(args.Target);
|
||||||
Timer.Spawn(_gameTiming.TickPeriod,
|
Timer.Spawn(_gameTiming.TickPeriod,
|
||||||
() => _explosionSystem.QueueExplosion(coords, ExplosionSystem.DefaultExplosionPrototypeId,
|
() => _explosionSystem.QueueExplosion(coords, ExplosionSystem.DefaultExplosionPrototypeId,
|
||||||
4, 1, 2, maxTileBreak: 0), // it gibs, damage doesn't need to be high.
|
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);
|
Filter.PvsExcept(args.Target), true, PopupType.MediumCaution);
|
||||||
var board = Spawn("ChessBoard", xform.Coordinates);
|
var board = Spawn("ChessBoard", xform.Coordinates);
|
||||||
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
|
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
|
||||||
xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
|
_transformSystem.SetCoordinates((args.Target, xform, MetaData(args.Target)), EntityCoordinates.FromMap(_mapManager, session.Position));
|
||||||
xform.WorldRotation = Angle.Zero;
|
_transformSystem.SetWorldRotation(xform, Angle.Zero);
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Extreme,
|
Impact = LogImpact.Extreme,
|
||||||
Message = Loc.GetString("admin-smite-chess-dimension-description")
|
Message = Loc.GetString("admin-smite-chess-dimension-description")
|
||||||
@@ -407,7 +407,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
var xform = Transform(args.Target);
|
var xform = Transform(args.Target);
|
||||||
var fixtures = Comp<FixturesComponent>(args.Target);
|
var fixtures = Comp<FixturesComponent>(args.Target);
|
||||||
xform.Anchored = false; // Just in case.
|
_xformSystem.Unanchor(args.Target, xform); // Just in case.
|
||||||
_physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics);
|
_physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics);
|
||||||
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||||
_physics.WakeBody(args.Target, manager: fixtures, body: physics);
|
_physics.WakeBody(args.Target, manager: fixtures, body: physics);
|
||||||
@@ -441,7 +441,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
{
|
{
|
||||||
var xform = Transform(args.Target);
|
var xform = Transform(args.Target);
|
||||||
var fixtures = Comp<FixturesComponent>(args.Target);
|
var fixtures = Comp<FixturesComponent>(args.Target);
|
||||||
xform.Anchored = false; // Just in case.
|
_xformSystem.Unanchor(args.Target, xform); // Just in case.
|
||||||
|
|
||||||
_physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics);
|
_physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics);
|
||||||
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public sealed class BluespaceAnomalySystem : EntitySystem
|
|||||||
foreach (var ent in allEnts)
|
foreach (var ent in allEnts)
|
||||||
{
|
{
|
||||||
if (xformQuery.TryGetComponent(ent, out var xf))
|
if (xformQuery.TryGetComponent(ent, out var xf))
|
||||||
coords.Add(xf.MapPosition.Position);
|
coords.Add(_xform.GetWorldPosition(xf));
|
||||||
}
|
}
|
||||||
|
|
||||||
_random.Shuffle(coords);
|
_random.Shuffle(coords);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public sealed class ElectricityAnomalySystem : EntitySystem
|
|||||||
var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
|
var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
|
||||||
var duration = elec.MaxElectrocuteDuration * anom.Severity;
|
var duration = elec.MaxElectrocuteDuration * anom.Severity;
|
||||||
|
|
||||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(xform.MapPosition, range))
|
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(_transform.GetMapCoordinates((uid, xform)), range))
|
||||||
{
|
{
|
||||||
_electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
|
_electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
private EntityQuery<InjectableSolutionComponent> _injectableQuery;
|
private EntityQuery<InjectableSolutionComponent> _injectableQuery;
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
|||||||
//We get all the entity in the radius into which the reagent will be injected.
|
//We get all the entity in the radius into which the reagent will be injected.
|
||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
var xform = xformQuery.GetComponent(entity);
|
var xform = xformQuery.GetComponent(entity);
|
||||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
|
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(_xformSystem.GetMapCoordinates((entity.Owner, xform)), injectRadius)
|
||||||
.Select(x => x.Owner).ToList();
|
.Select(x => x.Owner).ToList();
|
||||||
|
|
||||||
//for each matching entity found
|
//for each matching entity found
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public sealed class AirFilterSystem : EntitySystem
|
|||||||
var oxygen = air.GetMoles(filter.Oxygen) / air.TotalMoles;
|
var oxygen = air.GetMoles(filter.Oxygen) / air.TotalMoles;
|
||||||
var gases = oxygen >= filter.TargetOxygen ? filter.Gases : filter.OverflowGases;
|
var gases = oxygen >= filter.TargetOxygen ? filter.Gases : filter.OverflowGases;
|
||||||
|
|
||||||
var coordinates = Transform(uid).MapPosition;
|
var coordinates = _transform.GetMapCoordinates(uid);
|
||||||
GasMixture? destination = null;
|
GasMixture? destination = null;
|
||||||
if (_map.TryFindGridAt(coordinates, out _, out var grid))
|
if (_map.TryFindGridAt(coordinates, out _, out var grid))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
if (airtight.Comp.FixAirBlockedDirectionInitialize)
|
if (airtight.Comp.FixAirBlockedDirectionInitialize)
|
||||||
{
|
{
|
||||||
var moveEvent = new MoveEvent(airtight, default, default, Angle.Zero, xform.LocalRotation, xform, false);
|
var moveEvent = new MoveEvent((airtight, xform, MetaData(airtight)), default, default, Angle.Zero, xform.LocalRotation);
|
||||||
if (AirtightMove(airtight, ref moveEvent))
|
if (AirtightMove(airtight, ref moveEvent))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Used by ExperiencePressureDifference to correct push/throw directions from tile-relative to physics world.
|
// Used by ExperiencePressureDifference to correct push/throw directions from tile-relative to physics world.
|
||||||
var gridWorldRotation = xforms.GetComponent(gridAtmosphere).WorldRotation;
|
var gridWorldRotation = _transformSystem.GetWorldRotation(gridAtmosphere);
|
||||||
|
|
||||||
// If we're using monstermos, smooth out the yeet direction to follow the flow
|
// If we're using monstermos, smooth out the yeet direction to follow the flow
|
||||||
if (MonstermosEqualization)
|
if (MonstermosEqualization)
|
||||||
@@ -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.
|
// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
|
||||||
if (throwTarget != EntityCoordinates.Invalid)
|
if (throwTarget != EntityCoordinates.Invalid)
|
||||||
{
|
{
|
||||||
var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized();
|
var pos = ((throwTarget.ToMap(EntityManager).Position - _transformSystem.GetWorldPosition(xform)).Normalized() + dirVec).Normalized();
|
||||||
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
|
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public sealed class BeamSystem : SharedBeamSystem
|
|||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -144,8 +145,8 @@ public sealed class BeamSystem : SharedBeamSystem
|
|||||||
if (Deleted(user) || Deleted(target))
|
if (Deleted(user) || Deleted(target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var userMapPos = Transform(user).MapPosition;
|
var userMapPos = _xformSystem.GetMapCoordinates(user);
|
||||||
var targetMapPos = Transform(target).MapPosition;
|
var targetMapPos = _xformSystem.GetMapCoordinates(target);
|
||||||
|
|
||||||
//The distance between the target and the user.
|
//The distance between the target and the user.
|
||||||
var calculatedDistance = targetMapPos.Position - userMapPos.Position;
|
var calculatedDistance = targetMapPos.Position - userMapPos.Position;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public sealed class LogSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||||
[Dependency] private readonly RandomHelperSystem _randomHelper = default!;
|
[Dependency] private readonly RandomHelperSystem _randomHelper = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -39,7 +40,7 @@ public sealed class LogSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
var xform = Transform(plank);
|
var xform = Transform(plank);
|
||||||
_containerSystem.AttachParentToContainerOrGrid((plank, xform));
|
_containerSystem.AttachParentToContainerOrGrid((plank, xform));
|
||||||
xform.LocalRotation = 0;
|
_xformSystem.SetLocalRotation(plank, 0, xform);
|
||||||
_randomHelper.RandomOffset(plank, 0.25f);
|
_randomHelper.RandomOffset(plank, 0.25f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public sealed class RehydratableSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly SharedPopupSystem _popups = default!;
|
[Dependency] private readonly SharedPopupSystem _popups = default!;
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -40,7 +41,7 @@ public sealed class RehydratableSystem : EntitySystem
|
|||||||
|
|
||||||
var target = Spawn(randomMob, Transform(uid).Coordinates);
|
var target = Spawn(randomMob, Transform(uid).Coordinates);
|
||||||
|
|
||||||
Transform(target).AttachToGridOrMap();
|
_xformSystem.AttachToGridOrMap(target);
|
||||||
var ev = new GotRehydratedEvent(target);
|
var ev = new GotRehydratedEvent(target);
|
||||||
RaiseLocalEvent(uid, ref ev);
|
RaiseLocalEvent(uid, ref ev);
|
||||||
|
|
||||||
|
|||||||
@@ -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 _xformSystem = default!;
|
||||||
|
|
||||||
private const float ReactTime = 0.125f;
|
private const float ReactTime = 0.125f;
|
||||||
|
|
||||||
@@ -71,7 +72,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 - _xformSystem.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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,16 +57,18 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
var spreadAmount = (int) Math.Max(0, Math.Ceiling((args.Quantity / OverflowThreshold).Float()));
|
var spreadAmount = (int) Math.Max(0, Math.Ceiling((args.Quantity / OverflowThreshold).Float()));
|
||||||
var splitSolution = args.Source.SplitSolution(args.Source.Volume);
|
var splitSolution = args.Source.SplitSolution(args.Source.Volume);
|
||||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||||
|
var xformSystem = args.EntityManager.System<SharedTransformSystem>();
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
if (!mapManager.TryFindGridAt(transform.MapPosition, out _, out var grid) ||
|
var mapCoordinates = xformSystem.GetMapCoordinates((args.SolutionEntity, transform));
|
||||||
|
if (!mapManager.TryFindGridAt(mapCoordinates, out _, out var grid) ||
|
||||||
!grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
|
!grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
|
||||||
tileRef.Tile.IsSpace())
|
tileRef.Tile.IsSpace())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var coords = grid.MapToGrid(transform.MapPosition);
|
var coords = grid.MapToGrid(mapCoordinates);
|
||||||
var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
|
var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
|
||||||
|
|
||||||
var smoke = args.EntityManager.System<SmokeSystem>();
|
var smoke = args.EntityManager.System<SmokeSystem>();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public sealed partial class CreateEntityReactionEffect : ReagentEffect
|
|||||||
|
|
||||||
for (var i = 0; i < quantity; i++)
|
for (var i = 0; i < quantity; i++)
|
||||||
{
|
{
|
||||||
var uid = args.EntityManager.SpawnEntity(Entity, transform.MapPosition);
|
var uid = args.EntityManager.SpawnEntity(Entity, transformSystem.GetMapCoordinates((args.SolutionEntity, transform)));
|
||||||
transformSystem.AttachToGridOrMap(uid);
|
transformSystem.AttachToGridOrMap(uid);
|
||||||
|
|
||||||
// TODO figure out how to properly spawn inside of containers
|
// TODO figure out how to properly spawn inside of containers
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public sealed partial class EmpReactionEffect : ReagentEffect
|
|||||||
var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange);
|
var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange);
|
||||||
|
|
||||||
args.EntityManager.System<EmpSystem>().EmpPulse(
|
args.EntityManager.System<EmpSystem>().EmpPulse(
|
||||||
transform.MapPosition,
|
args.EntityManager.System<SharedTransformSystem>().GetMapCoordinates((args.SolutionEntity, transform)),
|
||||||
range,
|
range,
|
||||||
EnergyConsumption,
|
EnergyConsumption,
|
||||||
DisableDuration);
|
DisableDuration);
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ namespace Content.Server.Cloning
|
|||||||
}
|
}
|
||||||
// end of genetic damage checks
|
// end of genetic damage checks
|
||||||
|
|
||||||
var mob = Spawn(speciesPrototype.Prototype, Transform(uid).MapPosition);
|
var mob = Spawn(speciesPrototype.Prototype, _transformSystem.GetMapCoordinates(uid));
|
||||||
_humanoidSystem.CloneAppearance(bodyToClone, mob);
|
_humanoidSystem.CloneAppearance(bodyToClone, mob);
|
||||||
|
|
||||||
var ev = new CloningEvent(bodyToClone, mob);
|
var ev = new CloningEvent(bodyToClone, mob);
|
||||||
|
|||||||
@@ -54,18 +54,16 @@ namespace Content.Server.Commands
|
|||||||
public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString)
|
public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString)
|
||||||
{
|
{
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
var xfmSys = entMan.System<SharedTransformSystem>();
|
||||||
var transform = entMan.GetComponent<TransformComponent>(ent);
|
var transform = entMan.GetComponent<TransformComponent>(ent);
|
||||||
|
var worldPosition = xfmSys.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", worldPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
transform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
|
ruleString = ruleString.Replace("$WY", worldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$WY",
|
ruleString = ruleString.Replace("$LX", transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
transform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
ruleString = ruleString.Replace("$LY", transform.LocalPosition.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);
|
ruleString = ruleString.Replace("$NAME", entMan.GetComponent<MetaDataComponent>(ent).EntityName);
|
||||||
|
|
||||||
if (shell.Player is { } player)
|
if (shell.Player is { } player)
|
||||||
@@ -73,16 +71,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 pPosition = xfmSys.GetWorldPosition(pTransform);
|
||||||
|
|
||||||
ruleString = ruleString.Replace("$PID", ent.ToString());
|
ruleString = ruleString.Replace("$PID", ent.ToString());
|
||||||
ruleString = ruleString.Replace("$PWX",
|
ruleString = ruleString.Replace("$PWX", pPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
pTransform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
|
ruleString = ruleString.Replace("$PWY", pPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||||
ruleString = ruleString.Replace("$PWY",
|
ruleString = ruleString.Replace("$PLX", pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||||
pTransform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
ruleString = ruleString.Replace("$PLY", pTransform.LocalPosition.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;
|
return ruleString;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
|
|
||||||
var changed = 0;
|
var changed = 0;
|
||||||
var tagSystem = _entManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
var tagSystem = _entManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
||||||
|
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||||
|
|
||||||
|
|
||||||
var enumerator = xformQuery.GetComponent(gridId.Value).ChildEnumerator;
|
var enumerator = xformQuery.GetComponent(gridId.Value).ChildEnumerator;
|
||||||
@@ -97,7 +98,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
|
|
||||||
if (childXform.LocalRotation != Angle.Zero)
|
if (childXform.LocalRotation != Angle.Zero)
|
||||||
{
|
{
|
||||||
childXform.LocalRotation = Angle.Zero;
|
xformSystem.SetLocalRotation(child, Angle.Zero, childXform);
|
||||||
changed++;
|
changed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,14 @@ namespace Content.Server.Construction.Completions
|
|||||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||||
{
|
{
|
||||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||||
transform.Anchored = Value;
|
if (Value == transform.Anchored)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var xformSystem = entityManager.System<SharedTransformSystem>();
|
||||||
|
if (Value)
|
||||||
|
xformSystem.AnchorEntity((uid, transform));
|
||||||
|
else
|
||||||
|
xformSystem.Unanchor(uid, transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,12 @@ namespace Content.Server.Construction.Completions
|
|||||||
{
|
{
|
||||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||||
|
|
||||||
|
var xformSystem = entityManager.System<SharedTransformSystem>();
|
||||||
if (!transform.Anchored)
|
if (!transform.Anchored)
|
||||||
transform.Coordinates = transform.Coordinates.SnapToGrid(entityManager);
|
xformSystem.SetCoordinates((uid, transform, entityManager.GetComponent<MetaDataComponent>(uid)), transform.Coordinates.SnapToGrid(entityManager));
|
||||||
|
|
||||||
if (SouthRotation)
|
if (SouthRotation)
|
||||||
{
|
xformSystem.SetLocalRotation(uid, Angle.Zero, transform);
|
||||||
transform.LocalRotation = Angle.Zero;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,9 +362,12 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
// Transform transferring.
|
// Transform transferring.
|
||||||
var newTransform = Transform(newUid);
|
var newTransform = Transform(newUid);
|
||||||
newTransform.AttachToGridOrMap(); // in case in hands or a container
|
_xformSystem.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container
|
||||||
newTransform.LocalRotation = transform.LocalRotation;
|
_xformSystem.SetLocalRotation(newUid, transform.LocalRotation, newTransform);
|
||||||
newTransform.Anchored = transform.Anchored;
|
if (transform.Anchored)
|
||||||
|
_xformSystem.AnchorEntity((newUid, newTransform));
|
||||||
|
else
|
||||||
|
_xformSystem.Unanchor(newUid, newTransform);
|
||||||
|
|
||||||
// Container transferring.
|
// Container transferring.
|
||||||
if (containerManager != null)
|
if (containerManager != null)
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace Content.Server.Construction
|
|||||||
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
|
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
|
||||||
[Dependency] private readonly StorageSystem _storageSystem = default!;
|
[Dependency] private readonly StorageSystem _storageSystem = default!;
|
||||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
// --- WARNING! LEGACY CODE AHEAD! ---
|
// --- WARNING! LEGACY CODE AHEAD! ---
|
||||||
// This entire file contains the legacy code for initial construction.
|
// This entire file contains the legacy code for initial construction.
|
||||||
@@ -82,7 +83,7 @@ namespace Content.Server.Construction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = Transform(user).MapPosition;
|
var pos = _xformSystem.GetMapCoordinates(user);
|
||||||
|
|
||||||
foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate))
|
foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate))
|
||||||
{
|
{
|
||||||
@@ -527,10 +528,12 @@ namespace Content.Server.Construction
|
|||||||
// ikr
|
// ikr
|
||||||
var xform = Transform(structure);
|
var xform = Transform(structure);
|
||||||
var wasAnchored = xform.Anchored;
|
var wasAnchored = xform.Anchored;
|
||||||
xform.Anchored = false;
|
if (wasAnchored)
|
||||||
xform.Coordinates = GetCoordinates(ev.Location);
|
_xformSystem.Unanchor(structure, xform);
|
||||||
xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero;
|
_xformSystem.SetCoordinates((structure, xform, MetaData(structure)), GetCoordinates(ev.Location));
|
||||||
xform.Anchored = wasAnchored;
|
_xformSystem.SetLocalRotation(structure, constructionPrototype.CanRotate ? ev.Angle : Angle.Zero, xform);
|
||||||
|
if (wasAnchored)
|
||||||
|
_xformSystem.AnchorEntity((structure, xform));
|
||||||
|
|
||||||
RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack, GetNetEntity(structure)));
|
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}");
|
_adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has turned a {ev.PrototypeName} construction ghost into {ToPrettyString(structure)} at {Transform(structure).Coordinates}");
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace Content.Server.Destructible
|
|||||||
[Dependency] public readonly IPrototypeManager PrototypeManager = default!;
|
[Dependency] public readonly IPrototypeManager PrototypeManager = default!;
|
||||||
[Dependency] public readonly IComponentFactory ComponentFactory = default!;
|
[Dependency] public readonly IComponentFactory ComponentFactory = default!;
|
||||||
[Dependency] public readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] public readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
[Dependency] public readonly SharedTransformSystem TransformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||||||
{
|
{
|
||||||
var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset)));
|
var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset)));
|
||||||
system.StackSystem.SetCount(spawned, toSpawn);
|
system.StackSystem.SetCount(spawned, toSpawn);
|
||||||
system.EntityManager.GetComponent<TransformComponent>(spawned).LocalRotation = system.Random.NextAngle();
|
system.TransformSystem.SetLocalRotation(spawned, system.Random.NextAngle());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (var i = 0; i < toSpawn; i++)
|
for (var i = 0; i < toSpawn; i++)
|
||||||
{
|
{
|
||||||
var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset)));
|
var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset)));
|
||||||
system.EntityManager.GetComponent<TransformComponent>(spawned).LocalRotation = system.Random.NextAngle();
|
system.TransformSystem.SetLocalRotation(spawned, system.Random.NextAngle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||||||
|
|
||||||
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
||||||
{
|
{
|
||||||
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
|
var position = system.TransformSystem.GetMapCoordinates(owner);
|
||||||
|
|
||||||
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
|
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
|
||||||
|
|
||||||
|
|||||||
@@ -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 _xformSystem = 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 - _xformSystem.GetWorldPosition(xform)).Length() > sendingComponent.Range)
|
||||||
{
|
{
|
||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ namespace Content.Server.Disposal.Tube
|
|||||||
[Dependency] private readonly DisposableSystem _disposableSystem = default!;
|
[Dependency] private readonly DisposableSystem _disposableSystem = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -430,8 +432,7 @@ namespace Content.Server.Disposal.Tube
|
|||||||
if (!Resolve(uid, ref entry))
|
if (!Resolve(uid, ref entry))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var xform = Transform(uid);
|
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, _xformSystem.GetMapCoordinates(uid));
|
||||||
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, xform.MapPosition);
|
|
||||||
var holderComponent = Comp<DisposalHolderComponent>(holder);
|
var holderComponent = Comp<DisposalHolderComponent>(holder);
|
||||||
|
|
||||||
foreach (var entity in from.Container.ContainedEntities.ToArray())
|
foreach (var entity in from.Container.ContainedEntities.ToArray())
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public sealed partial class DragonSystem : EntitySystem
|
|||||||
[Dependency] private readonly RoleSystem _role = default!;
|
[Dependency] private readonly RoleSystem _role = default!;
|
||||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
private EntityQuery<CarpRiftsConditionComponent> _objQuery;
|
private EntityQuery<CarpRiftsConditionComponent> _objQuery;
|
||||||
|
|
||||||
@@ -154,7 +155,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(_xformSystem.GetWorldPosition(xform), RiftTileRadius), false))
|
||||||
{
|
{
|
||||||
if (!tile.IsSpace(_tileDef))
|
if (!tile.IsSpace(_tileDef))
|
||||||
continue;
|
continue;
|
||||||
@@ -163,7 +164,7 @@ public sealed partial class DragonSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
|
var carpUid = Spawn(component.RiftPrototype, _xformSystem.GetMapCoordinates((uid, xform)));
|
||||||
component.Rifts.Add(carpUid);
|
component.Rifts.Add(carpUid);
|
||||||
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace Content.Server.Emp;
|
|||||||
public sealed class EmpSystem : SharedEmpSystem
|
public sealed class EmpSystem : SharedEmpSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public const string EmpPulseEffectPrototype = "EffectEmpPulse";
|
public const string EmpPulseEffectPrototype = "EffectEmpPulse";
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ public sealed class EmpSystem : SharedEmpSystem
|
|||||||
|
|
||||||
private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
|
private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
|
||||||
{
|
{
|
||||||
EmpPulse(Transform(uid).MapPosition, comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
EmpPulse(_xformSystem.GetMapCoordinates(uid), comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,13 +69,15 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_needToTransform = true;
|
_needToTransform = true;
|
||||||
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
var xfmSys = entMan.System<SharedTransformSystem>();
|
||||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.Owner);
|
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.Owner);
|
||||||
var size = (float) Grid.TileSize;
|
var size = (float) Grid.TileSize;
|
||||||
|
|
||||||
_matrix.R0C2 = size / 2;
|
_matrix.R0C2 = size / 2;
|
||||||
_matrix.R1C2 = size / 2;
|
_matrix.R1C2 = size / 2;
|
||||||
_matrix *= transform.WorldMatrix * Matrix3.Invert(spaceMatrix);
|
_matrix *= xfmSys.GetWorldMatrix(transform) * Matrix3.Invert(spaceMatrix);
|
||||||
var relativeAngle = transform.WorldRotation - spaceAngle;
|
var relativeAngle = xfmSys.GetWorldRotation(transform) - spaceAngle;
|
||||||
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4));
|
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
var targetGrid = Comp<MapGridComponent>(referenceGrid.Value);
|
var targetGrid = Comp<MapGridComponent>(referenceGrid.Value);
|
||||||
var xform = Transform(referenceGrid.Value);
|
var xform = Transform(referenceGrid.Value);
|
||||||
targetAngle = xform.WorldRotation;
|
targetAngle = _transformSystem.GetWorldRotation(xform);
|
||||||
targetMatrix = xform.InvWorldMatrix;
|
targetMatrix = _transformSystem.GetInvWorldMatrix(xform);
|
||||||
tileSize = targetGrid.TileSize;
|
tileSize = targetGrid.TileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
var localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
|
var localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
|
||||||
var matrix = offsetMatrix * gridWorldMatrix * targetMatrix;
|
var matrix = offsetMatrix * gridWorldMatrix * targetMatrix;
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
if (referenceGrid != null)
|
if (referenceGrid != null)
|
||||||
{
|
{
|
||||||
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
|
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
|
||||||
spaceMatrix = xform.WorldMatrix;
|
spaceMatrix = _transformSystem.GetWorldMatrix(xform);
|
||||||
spaceAngle = xform.WorldRotation;
|
spaceAngle = _transformSystem.GetWorldRotation(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the explosion starting on a grid?
|
// is the explosion starting on a grid?
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
if (player.AttachedEntity is not EntityUid uid)
|
if (player.AttachedEntity is not EntityUid uid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var playerPos = 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))
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapMan = default!;
|
[Dependency] private readonly IMapManager _mapMan = default!;
|
||||||
[Dependency] private readonly SmokeSystem _smoke = default!;
|
[Dependency] private readonly SmokeSystem _smoke = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -26,14 +27,15 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
|||||||
private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args)
|
private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args)
|
||||||
{
|
{
|
||||||
var xform = Transform(uid);
|
var xform = Transform(uid);
|
||||||
if (!_mapMan.TryFindGridAt(xform.MapPosition, out _, out var grid) ||
|
var mapCoords = _xformSystem.GetMapCoordinates((uid, xform));
|
||||||
|
if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) ||
|
||||||
!grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
|
!grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
|
||||||
tileRef.Tile.IsSpace())
|
tileRef.Tile.IsSpace())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var coords = grid.MapToGrid(xform.MapPosition);
|
var coords = grid.MapToGrid(mapCoords);
|
||||||
var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
|
var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
|
||||||
if (!TryComp<SmokeComponent>(ent, out var smoke))
|
if (!TryComp<SmokeComponent>(ent, out var smoke))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ namespace Content.Server.Explosion.EntitySystems
|
|||||||
|
|
||||||
// Gets location of the implant
|
// Gets location of the implant
|
||||||
var ownerXform = Transform(uid);
|
var ownerXform = Transform(uid);
|
||||||
var pos = ownerXform.MapPosition;
|
var pos = _transformSystem.GetMapCoordinates((uid, ownerXform));
|
||||||
var x = (int) pos.X;
|
var x = (int) pos.X;
|
||||||
var y = (int) pos.Y;
|
var y = (int) pos.Y;
|
||||||
var posText = $"({x}, {y})";
|
var posText = $"({x}, {y})";
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace Content.Server.Flash
|
|||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly StunSystem _stun = default!;
|
[Dependency] private readonly StunSystem _stun = default!;
|
||||||
[Dependency] private readonly TagSystem _tag = default!;
|
[Dependency] private readonly TagSystem _tag = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
|||||||
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
|
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -155,7 +156,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
|||||||
|
|
||||||
puddles.Clear();
|
puddles.Clear();
|
||||||
|
|
||||||
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, drain.Range))
|
foreach (var entity in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates((uid, xform)), drain.Range))
|
||||||
{
|
{
|
||||||
// No InRangeUnobstructed because there's no collision group that fits right now
|
// 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...
|
// and these are placed by mappers and not buildable/movable so shouldnt really be a problem...
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
|
|||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly PuddleSystem _puddle = default!;
|
[Dependency] private readonly PuddleSystem _puddle = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
private readonly HashSet<ICommonSession> _playerObservers = new();
|
private readonly HashSet<ICommonSession> _playerObservers = new();
|
||||||
private List<Entity<MapGridComponent>> _grids = new();
|
private List<Entity<MapGridComponent>> _grids = new();
|
||||||
@@ -55,7 +56,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
|
|||||||
|
|
||||||
var transform = EntityManager.GetComponent<TransformComponent>(entity);
|
var transform = EntityManager.GetComponent<TransformComponent>(entity);
|
||||||
|
|
||||||
var worldBounds = Box2.CenteredAround(transform.WorldPosition,
|
var worldBounds = Box2.CenteredAround(_xformSystem.GetWorldPosition(transform),
|
||||||
new Vector2(LocalViewRange, LocalViewRange));
|
new Vector2(LocalViewRange, LocalViewRange));
|
||||||
|
|
||||||
_grids.Clear();
|
_grids.Clear();
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ namespace Content.Server.GameTicking
|
|||||||
var gridXform = Transform(gridUid);
|
var gridXform = Transform(gridUid);
|
||||||
|
|
||||||
return new EntityCoordinates(gridUid,
|
return new EntityCoordinates(gridUid,
|
||||||
gridXform.InvWorldMatrix.Transform(toMap.Position));
|
_transform.GetInvWorldMatrix(gridXform).Transform(toMap.Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
return spawn;
|
return spawn;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
|||||||
[Dependency] private readonly RespawnRuleSystem _respawn = default!;
|
[Dependency] private readonly RespawnRuleSystem _respawn = default!;
|
||||||
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
||||||
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -97,7 +98,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
|||||||
_point.AdjustPointValue(assist.PlayerId, 1, uid, point);
|
_point.AdjustPointValue(assist.PlayerId, 1, uid, point);
|
||||||
|
|
||||||
var spawns = EntitySpawnCollection.GetSpawns(dm.RewardSpawns).Cast<string?>().ToList();
|
var spawns = EntitySpawnCollection.GetSpawns(dm.RewardSpawns).Cast<string?>().ToList();
|
||||||
EntityManager.SpawnEntities(Transform(ev.Entity).MapPosition, spawns);
|
EntityManager.SpawnEntities(_xformSystem.GetMapCoordinates(ev.Entity), spawns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
|||||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
|
|
||||||
[ValidatePrototypeId<EntityPrototype>]
|
[ValidatePrototypeId<EntityPrototype>]
|
||||||
private const string GameRuleId = "Pirates";
|
private const string GameRuleId = "Pirates";
|
||||||
@@ -180,7 +182,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
|||||||
|
|
||||||
var aabbs = EntityQuery<StationDataComponent>().SelectMany(x =>
|
var aabbs = EntityQuery<StationDataComponent>().SelectMany(x =>
|
||||||
x.Grids.Select(x =>
|
x.Grids.Select(x =>
|
||||||
xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).LocalAABB)))
|
_xformSystem.GetWorldMatrix(x).TransformBox(_mapManager.GetGridComp(x).LocalAABB)))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var aabb = aabbs[0];
|
var aabb = aabbs[0];
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public abstract class BaseEntityReplaceVariationPassSystem<TEntComp, TGameRuleCo
|
|||||||
where TEntComp: IComponent
|
where TEntComp: IComponent
|
||||||
where TGameRuleComp: IComponent
|
where TGameRuleComp: IComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used so we don't modify while enumerating
|
/// Used so we don't modify while enumerating
|
||||||
/// if the replaced entity also has <see cref="TEntComp"/>.
|
/// if the replaced entity also has <see cref="TEntComp"/>.
|
||||||
@@ -55,7 +57,7 @@ public abstract class BaseEntityReplaceVariationPassSystem<TEntComp, TGameRuleCo
|
|||||||
{
|
{
|
||||||
var (spawn, coords, rot) = tup;
|
var (spawn, coords, rot) = tup;
|
||||||
var newEnt = Spawn(spawn, coords);
|
var newEnt = Spawn(spawn, coords);
|
||||||
Transform(newEnt).LocalRotation = rot;
|
_xformSystem.SetLocalRotation(newEnt, rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Debug($"Entity replacement took {stopwatch.Elapsed} with {Stations.GetTileCount(args.Station)} tiles");
|
Log.Debug($"Entity replacement took {stopwatch.Elapsed} with {Stations.GetTileCount(args.Station)} tiles");
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
|||||||
[Dependency] private readonly DestructibleSystem _destructible = default!;
|
[Dependency] private readonly DestructibleSystem _destructible = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -61,7 +62,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
|||||||
if (component.MappedLoot == null)
|
if (component.MappedLoot == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var pos = Transform(gatheredUid).MapPosition;
|
var pos = _xformSystem.GetMapCoordinates(gatheredUid);
|
||||||
|
|
||||||
foreach (var (tag, table) in component.MappedLoot)
|
foreach (var (tag, table) in component.MappedLoot)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace Content.Server.Guardian
|
|||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly BodySystem _bodySystem = default!;
|
[Dependency] private readonly BodySystem _bodySystem = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -211,7 +212,7 @@ namespace Content.Server.Guardian
|
|||||||
var hostXform = Transform(args.Args.Target.Value);
|
var hostXform = Transform(args.Args.Target.Value);
|
||||||
var host = EnsureComp<GuardianHostComponent>(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.
|
// 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, hostXform.MapPosition);
|
var guardian = Spawn(component.GuardianProto, _xformSystem.GetMapCoordinates(hostXform));
|
||||||
|
|
||||||
_container.Insert(guardian, host.GuardianContainer);
|
_container.Insert(guardian, host.GuardianContainer);
|
||||||
host.HostedGuardian = guardian;
|
host.HostedGuardian = guardian;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace Content.Server.Hands.Systems
|
|||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
[Dependency] private readonly PullingSystem _pullingSystem = default!;
|
[Dependency] private readonly PullingSystem _pullingSystem = default!;
|
||||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -198,7 +199,7 @@ namespace Content.Server.Hands.Systems
|
|||||||
throwEnt = splitStack.Value;
|
throwEnt = splitStack.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var direction = coordinates.ToMapPos(EntityManager) - Transform(player).WorldPosition;
|
var direction = coordinates.ToMapPos(EntityManager) - _xformSystem.GetWorldPosition(player);
|
||||||
if (direction == Vector2.Zero)
|
if (direction == Vector2.Zero)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public sealed class ImmovableRodSystem : EntitySystem
|
|||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
@@ -64,11 +65,11 @@ public sealed class ImmovableRodSystem : EntitySystem
|
|||||||
var vel = component.DirectionOverride.Degrees switch
|
var vel = component.DirectionOverride.Degrees switch
|
||||||
{
|
{
|
||||||
0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed),
|
0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed),
|
||||||
_ => xform.WorldRotation.RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
|
_ => _xformSystem.GetWorldRotation(xform).RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
|
||||||
};
|
};
|
||||||
|
|
||||||
_physics.ApplyLinearImpulse(uid, vel, body: phys);
|
_physics.ApplyLinearImpulse(uid, vel, body: phys);
|
||||||
xform.LocalRotation = (vel - xform.WorldPosition).ToWorldAngle() + MathHelper.PiOver2;
|
_xformSystem.SetLocalRotation(uid, (vel - _xformSystem.GetWorldPosition(xform)).ToWorldAngle() + MathHelper.PiOver2, xform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -97,7 +98,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
|
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
|
||||||
var coords = Transform(args.Args.Target.Value).MapPosition;
|
var coords = _xformSystem.GetMapCoordinates(args.Args.Target.Value);
|
||||||
EntityUid popupEnt = default!;
|
EntityUid popupEnt = default!;
|
||||||
foreach (var proto in spawnEntities)
|
foreach (var proto in spawnEntities)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public sealed class LightningSystem : SharedLightningSystem
|
|||||||
[Dependency] private readonly BeamSystem _beam = default!;
|
[Dependency] private readonly BeamSystem _beam = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -74,7 +75,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
|
//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
|
// several hashsets every time
|
||||||
|
|
||||||
var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(Transform(user).MapPosition, range).ToList();
|
var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(_xformSystem.GetMapCoordinates(user), range).ToList();
|
||||||
_random.Shuffle(targets);
|
_random.Shuffle(targets);
|
||||||
targets.Sort((x, y) => y.Priority.CompareTo(x.Priority));
|
targets.Sort((x, y) => y.Priority.CompareTo(x.Priority));
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public sealed class LightningTargetSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||||
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
|
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -29,7 +30,7 @@ public sealed class LightningTargetSystem : EntitySystem
|
|||||||
if (uid.Comp.LightningExplode)
|
if (uid.Comp.LightningExplode)
|
||||||
{
|
{
|
||||||
_explosionSystem.QueueExplosion(
|
_explosionSystem.QueueExplosion(
|
||||||
Transform(uid).MapPosition,
|
_xformSystem.GetMapCoordinates(uid),
|
||||||
uid.Comp.ExplosionPrototype,
|
uid.Comp.ExplosionPrototype,
|
||||||
uid.Comp.TotalIntensity, uid.Comp.Dropoff,
|
uid.Comp.TotalIntensity, uid.Comp.Dropoff,
|
||||||
uid.Comp.MaxTileIntensity,
|
uid.Comp.MaxTileIntensity,
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public sealed class MagicSystem : EntitySystem
|
|||||||
if (transform.MapID != args.Target.GetMapId(EntityManager)) return;
|
if (transform.MapID != args.Target.GetMapId(EntityManager)) return;
|
||||||
|
|
||||||
_transformSystem.SetCoordinates(args.Performer, args.Target);
|
_transformSystem.SetCoordinates(args.Performer, args.Target);
|
||||||
transform.AttachToGridOrMap();
|
_transformSystem.AttachToGridOrMap(args.Performer, transform);
|
||||||
_audio.PlayPvs(args.BlinkSound, args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume));
|
_audio.PlayPvs(args.BlinkSound, args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume));
|
||||||
Speak(args);
|
Speak(args);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
@@ -321,7 +321,7 @@ public sealed class MagicSystem : EntitySystem
|
|||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
Speak(ev);
|
Speak(ev);
|
||||||
|
|
||||||
var direction = Transform(ev.Target).MapPosition.Position - Transform(ev.Performer).MapPosition.Position;
|
var direction = _transformSystem.GetWorldPosition(ev.Target) - _transformSystem.GetWorldPosition(ev.Performer);
|
||||||
var impulseVector = direction * 10000;
|
var impulseVector = direction * 10000;
|
||||||
|
|
||||||
_physics.ApplyLinearImpulse(ev.Target, impulseVector);
|
_physics.ApplyLinearImpulse(ev.Target, impulseVector);
|
||||||
|
|||||||
@@ -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 _xformSystem = default!;
|
||||||
|
|
||||||
private readonly HashSet<ICommonSession> _draggers = new();
|
private readonly HashSet<ICommonSession> _draggers = new();
|
||||||
|
|
||||||
@@ -78,6 +79,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
|
|
||||||
var gridXform = Transform(grid);
|
var gridXform = Transform(grid);
|
||||||
|
|
||||||
gridXform.WorldPosition = msg.WorldPosition;
|
_xformSystem.SetWorldPosition(gridXform, msg.WorldPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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, xform);
|
||||||
_mech.UpdateUserInterface(mech);
|
_mech.UpdateUserInterface(mech);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user