* Revert "Fix chat bubbles (#25643)" This reverts commit23d2c4d924. * Revert "Fixes obsolete Transform warnings in Content. (#25256)" This reverts commitf284b43ff6.
This commit is contained in:
@@ -22,7 +22,6 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
private SharedTransformSystem? _xformSystem = null;
|
||||
|
||||
|
||||
private readonly SpawnExplosionEui _eui;
|
||||
@@ -103,13 +102,9 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
|
||||
if (!_entMan.TryGetComponent(_playerManager.LocalEntity, out TransformComponent? transform))
|
||||
return;
|
||||
|
||||
_xformSystem ??= _entMan.SystemOrNull<SharedTransformSystem>();
|
||||
if (_xformSystem is null)
|
||||
return;
|
||||
|
||||
_pausePreview = true;
|
||||
MapOptions.Select(_mapData.IndexOf(transform.MapID));
|
||||
(MapX.Value, MapY.Value) = _xformSystem.GetWorldPosition(transform);
|
||||
(MapX.Value, MapY.Value) = transform.MapPosition.Position;
|
||||
_pausePreview = false;
|
||||
|
||||
UpdatePreview();
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace Content.Client.Atmos.Overlays
|
||||
{
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly IMapManager _mapManager;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
|
||||
private readonly ShaderInstance _shader;
|
||||
@@ -52,7 +51,6 @@ namespace Content.Client.Atmos.Overlays
|
||||
{
|
||||
_entManager = entManager;
|
||||
_mapManager = IoCManager.Resolve<IMapManager>();
|
||||
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
_shader = protoMan.Index<ShaderPrototype>("unshaded").Instance();
|
||||
ZIndex = GasOverlayZIndex;
|
||||
|
||||
@@ -158,8 +156,7 @@ namespace Content.Client.Atmos.Overlays
|
||||
_fireFrameCounter,
|
||||
_shader,
|
||||
overlayQuery,
|
||||
xformQuery,
|
||||
_xformSystem);
|
||||
xformQuery);
|
||||
|
||||
var mapUid = _mapManager.GetMapEntityId(args.MapId);
|
||||
|
||||
@@ -197,8 +194,7 @@ namespace Content.Client.Atmos.Overlays
|
||||
int[] fireFrameCounter,
|
||||
ShaderInstance shader,
|
||||
EntityQuery<GasTileOverlayComponent> overlayQuery,
|
||||
EntityQuery<TransformComponent> xformQuery,
|
||||
SharedTransformSystem xformSystem) state) =>
|
||||
EntityQuery<TransformComponent> xformQuery) state) =>
|
||||
{
|
||||
if (!state.overlayQuery.TryGetComponent(uid, out var comp) ||
|
||||
!state.xformQuery.TryGetComponent(uid, out var gridXform))
|
||||
@@ -206,7 +202,7 @@ namespace Content.Client.Atmos.Overlays
|
||||
return true;
|
||||
}
|
||||
|
||||
var (_, _, worldMatrix, invMatrix) = state.xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
state.drawHandle.SetTransform(worldMatrix);
|
||||
var floatBounds = invMatrix.TransformBox(in state.WorldBounds).Enlarged(grid.TileSize);
|
||||
var localBounds = new Box2i(
|
||||
|
||||
@@ -30,7 +30,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
if (!xformQuery.TryGetComponent(source, out var xform))
|
||||
return;
|
||||
|
||||
var sourcePos = _transform.GetMapCoordinates((source, xform));
|
||||
var sourcePos = _transform.GetMapCoordinates(source, xform);
|
||||
|
||||
//Any mob that can move should be surprised?
|
||||
//God mind rework needs to come faster so it can just check for mind
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Numerics;
|
||||
using Content.Client.Chat.Managers;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Chat;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
@@ -17,7 +16,6 @@ namespace Content.Client.Chat.UI
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
public enum SpeechType : byte
|
||||
{
|
||||
@@ -84,7 +82,6 @@ namespace Content.Client.Chat.UI
|
||||
public SpeechBubble(ChatMessage message, EntityUid senderEntity, string speechStyleClass, Color? fontColor = null)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_xformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
_senderEntity = senderEntity;
|
||||
|
||||
// Use text clipping so new messages don't overlap old ones being pushed up.
|
||||
@@ -143,7 +140,7 @@ namespace Content.Client.Chat.UI
|
||||
}
|
||||
|
||||
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
|
||||
var worldPos = _xformSystem.GetWorldPosition(xform) + offset;
|
||||
var worldPos = xform.WorldPosition + offset;
|
||||
|
||||
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
|
||||
var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved);
|
||||
|
||||
@@ -1,27 +1,145 @@
|
||||
namespace Content.Client.Clickable;
|
||||
using System.Numerics;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.Graphics;
|
||||
using static Robust.Client.GameObjects.SpriteComponent;
|
||||
using Direction = Robust.Shared.Maths.Direction;
|
||||
|
||||
/// <summary>
|
||||
/// Makes it possible to click the associated entity.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class ClickableComponent : Component
|
||||
namespace Content.Client.Clickable
|
||||
{
|
||||
/// <summary>
|
||||
/// A set of AABBs used as an approximate check for whether a click could hit this entity.
|
||||
/// </summary>
|
||||
[DataField("bounds")]
|
||||
public DirBoundData? Bounds;
|
||||
|
||||
/// <summary>
|
||||
/// A set of AABBs associated with the cardinal directions used for approximate click intersection calculations.
|
||||
/// </summary>
|
||||
[DataDefinition]
|
||||
public sealed partial class DirBoundData
|
||||
[RegisterComponent]
|
||||
public sealed partial class ClickableComponent : Component
|
||||
{
|
||||
[DataField("all")] public Box2 All;
|
||||
[DataField("north")] public Box2 North;
|
||||
[DataField("south")] public Box2 South;
|
||||
[DataField("east")] public Box2 East;
|
||||
[DataField("west")] public Box2 West;
|
||||
[Dependency] private readonly IClickMapManager _clickMapManager = default!;
|
||||
|
||||
[DataField("bounds")] public DirBoundData? Bounds;
|
||||
|
||||
/// <summary>
|
||||
/// Used to check whether a click worked. Will first check if the click falls inside of some explicit bounding
|
||||
/// boxes (see <see cref="Bounds"/>). If that fails, attempts to use automatically generated click maps.
|
||||
/// </summary>
|
||||
/// <param name="worldPos">The world position that was clicked.</param>
|
||||
/// <param name="drawDepth">
|
||||
/// The draw depth for the sprite that captured the click.
|
||||
/// </param>
|
||||
/// <returns>True if the click worked, false otherwise.</returns>
|
||||
public bool CheckClick(SpriteComponent sprite, TransformComponent transform, EntityQuery<TransformComponent> xformQuery, Vector2 worldPos, IEye eye, out int drawDepth, out uint renderOrder, out float bottom)
|
||||
{
|
||||
if (!sprite.Visible)
|
||||
{
|
||||
drawDepth = default;
|
||||
renderOrder = default;
|
||||
bottom = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
drawDepth = sprite.DrawDepth;
|
||||
renderOrder = sprite.RenderOrder;
|
||||
var (spritePos, spriteRot) = transform.GetWorldPositionRotation(xformQuery);
|
||||
var spriteBB = sprite.CalculateRotatedBoundingBox(spritePos, spriteRot, eye.Rotation);
|
||||
bottom = Matrix3.CreateRotation(eye.Rotation).TransformBox(spriteBB).Bottom;
|
||||
|
||||
var invSpriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix());
|
||||
|
||||
// This should have been the rotation of the sprite relative to the screen, but this is not the case with no-rot or directional sprites.
|
||||
var relativeRotation = (spriteRot + eye.Rotation).Reduced().FlipPositive();
|
||||
|
||||
Angle cardinalSnapping = sprite.SnapCardinals ? relativeRotation.GetCardinalDir().ToAngle() : Angle.Zero;
|
||||
|
||||
// First we get `localPos`, the clicked location in the sprite-coordinate frame.
|
||||
var entityXform = Matrix3.CreateInverseTransform(transform.WorldPosition, sprite.NoRotation ? -eye.Rotation : spriteRot - cardinalSnapping);
|
||||
var localPos = invSpriteMatrix.Transform(entityXform.Transform(worldPos));
|
||||
|
||||
// Check explicitly defined click-able bounds
|
||||
if (CheckDirBound(sprite, relativeRotation, localPos))
|
||||
return true;
|
||||
|
||||
// Next check each individual sprite layer using automatically computed click maps.
|
||||
foreach (var spriteLayer in sprite.AllLayers)
|
||||
{
|
||||
if (!spriteLayer.Visible || spriteLayer is not Layer layer)
|
||||
continue;
|
||||
|
||||
// Check the layer's texture, if it has one
|
||||
if (layer.Texture != null)
|
||||
{
|
||||
// Convert to image coordinates
|
||||
var imagePos = (Vector2i) (localPos * EyeManager.PixelsPerMeter * new Vector2(1, -1) + layer.Texture.Size / 2f);
|
||||
|
||||
if (_clickMapManager.IsOccluding(layer.Texture, imagePos))
|
||||
return true;
|
||||
}
|
||||
|
||||
// Either we weren't clicking on the texture, or there wasn't one. In which case: check the RSI next
|
||||
if (layer.ActualRsi is not { } rsi || !rsi.TryGetState(layer.State, out var rsiState))
|
||||
continue;
|
||||
|
||||
var dir = Layer.GetDirection(rsiState.RsiDirections, relativeRotation);
|
||||
|
||||
// convert to layer-local coordinates
|
||||
layer.GetLayerDrawMatrix(dir, out var matrix);
|
||||
var inverseMatrix = Matrix3.Invert(matrix);
|
||||
var layerLocal = inverseMatrix.Transform(localPos);
|
||||
|
||||
// Convert to image coordinates
|
||||
var layerImagePos = (Vector2i) (layerLocal * EyeManager.PixelsPerMeter * new Vector2(1, -1) + rsiState.Size / 2f);
|
||||
|
||||
// Next, to get the right click map we need the "direction" of this layer that is actually being used to draw the sprite on the screen.
|
||||
// This **can** differ from the dir defined before, but can also just be the same.
|
||||
if (sprite.EnableDirectionOverride)
|
||||
dir = sprite.DirectionOverride.Convert(rsiState.RsiDirections);
|
||||
dir = dir.OffsetRsiDir(layer.DirOffset);
|
||||
|
||||
if (_clickMapManager.IsOccluding(layer.ActualRsi!, layer.State, dir, layer.AnimationFrame, layerImagePos))
|
||||
return true;
|
||||
}
|
||||
|
||||
drawDepth = default;
|
||||
renderOrder = default;
|
||||
bottom = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckDirBound(SpriteComponent sprite, Angle relativeRotation, Vector2 localPos)
|
||||
{
|
||||
if (Bounds == null)
|
||||
return false;
|
||||
|
||||
// These explicit bounds only work for either 1 or 4 directional sprites.
|
||||
|
||||
// This would be the orientation of a 4-directional sprite.
|
||||
var direction = relativeRotation.GetCardinalDir();
|
||||
|
||||
var modLocalPos = sprite.NoRotation
|
||||
? localPos
|
||||
: direction.ToAngle().RotateVec(localPos);
|
||||
|
||||
// First, check the bounding box that is valid for all orientations
|
||||
if (Bounds.All.Contains(modLocalPos))
|
||||
return true;
|
||||
|
||||
// Next, get and check the appropriate bounding box for the current sprite orientation
|
||||
var boundsForDir = (sprite.EnableDirectionOverride ? sprite.DirectionOverride : direction) switch
|
||||
{
|
||||
Direction.East => Bounds.East,
|
||||
Direction.North => Bounds.North,
|
||||
Direction.South => Bounds.South,
|
||||
Direction.West => Bounds.West,
|
||||
_ => throw new InvalidOperationException()
|
||||
};
|
||||
|
||||
return boundsForDir.Contains(modLocalPos);
|
||||
}
|
||||
|
||||
[DataDefinition]
|
||||
public sealed partial class DirBoundData
|
||||
{
|
||||
[DataField("all")] public Box2 All;
|
||||
[DataField("north")] public Box2 North;
|
||||
[DataField("south")] public Box2 South;
|
||||
[DataField("east")] public Box2 East;
|
||||
[DataField("west")] public Box2 West;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using static Robust.Client.GameObjects.SpriteComponent;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.Graphics;
|
||||
using Direction = Robust.Shared.Maths.Direction;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Content.Client.Clickable;
|
||||
|
||||
public sealed partial class ClickableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IClickMapManager _clickMapManager = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Used to check whether a click worked. Will first check if the click falls inside of some explicit bounding
|
||||
/// boxes (see <see cref="Bounds"/>). If that fails, attempts to use automatically generated click maps.
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity that we are trying to click.</param>
|
||||
/// <param name="worldPos">The world position that was clicked.</param>
|
||||
/// <param name="eye">The PoV the click is originating from.</param>
|
||||
/// <param name="drawDepth">The draw depth for the sprite that captured the click.</param>
|
||||
/// <param name="renderOrder">The render order for the sprite that captured the click.</param>
|
||||
/// <param name="bottom">The bottom of the sprite AABB from the perspective of the eye doing the click.</param>
|
||||
/// <returns>True if the click worked, false otherwise.</returns>
|
||||
public bool CheckClick(Entity<ClickableComponent, SpriteComponent, TransformComponent> entity, Vector2 worldPos, IEye eye, out int drawDepth, out uint renderOrder, out float bottom)
|
||||
{
|
||||
var (uid, clickable, sprite, xform) = entity;
|
||||
|
||||
if (!sprite.Visible)
|
||||
{
|
||||
drawDepth = default;
|
||||
renderOrder = default;
|
||||
bottom = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
drawDepth = sprite.DrawDepth;
|
||||
renderOrder = sprite.RenderOrder;
|
||||
var (spritePos, spriteRot) = _transformSystem.GetWorldPositionRotation(xform);
|
||||
var spriteBB = sprite.CalculateRotatedBoundingBox(spritePos, spriteRot, eye.Rotation);
|
||||
bottom = Matrix3.CreateRotation(eye.Rotation).TransformBox(spriteBB).Bottom;
|
||||
|
||||
var invSpriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix());
|
||||
|
||||
// This should have been the rotation of the sprite relative to the screen, but this is not the case with no-rot or directional sprites.
|
||||
var relativeRotation = (spriteRot + eye.Rotation).Reduced().FlipPositive();
|
||||
|
||||
Angle cardinalSnapping = sprite.SnapCardinals ? relativeRotation.GetCardinalDir().ToAngle() : Angle.Zero;
|
||||
|
||||
// First we get `localPos`, the clicked location in the sprite-coordinate frame.
|
||||
var entityXform = Matrix3.CreateInverseTransform(_transformSystem.GetWorldPosition(xform), sprite.NoRotation ? -eye.Rotation : spriteRot - cardinalSnapping);
|
||||
var localPos = invSpriteMatrix.Transform(entityXform.Transform(worldPos));
|
||||
|
||||
// Check explicitly defined click-able bounds
|
||||
if (CheckDirBound((uid, clickable, sprite), relativeRotation, localPos))
|
||||
return true;
|
||||
|
||||
// Next check each individual sprite layer using automatically computed click maps.
|
||||
foreach (var spriteLayer in sprite.AllLayers)
|
||||
{
|
||||
if (!spriteLayer.Visible || spriteLayer is not Layer layer)
|
||||
continue;
|
||||
|
||||
// Check the layer's texture, if it has one
|
||||
if (layer.Texture != null)
|
||||
{
|
||||
// Convert to image coordinates
|
||||
var imagePos = (Vector2i) (localPos * EyeManager.PixelsPerMeter * new Vector2(1, -1) + layer.Texture.Size / 2f);
|
||||
|
||||
if (_clickMapManager.IsOccluding(layer.Texture, imagePos))
|
||||
return true;
|
||||
}
|
||||
|
||||
// Either we weren't clicking on the texture, or there wasn't one. In which case: check the RSI next
|
||||
if (layer.ActualRsi is not { } rsi || !rsi.TryGetState(layer.State, out var rsiState))
|
||||
continue;
|
||||
|
||||
var dir = Layer.GetDirection(rsiState.RsiDirections, relativeRotation);
|
||||
|
||||
// convert to layer-local coordinates
|
||||
layer.GetLayerDrawMatrix(dir, out var matrix);
|
||||
var inverseMatrix = Matrix3.Invert(matrix);
|
||||
var layerLocal = inverseMatrix.Transform(localPos);
|
||||
|
||||
// Convert to image coordinates
|
||||
var layerImagePos = (Vector2i) (layerLocal * EyeManager.PixelsPerMeter * new Vector2(1, -1) + rsiState.Size / 2f);
|
||||
|
||||
// Next, to get the right click map we need the "direction" of this layer that is actually being used to draw the sprite on the screen.
|
||||
// This **can** differ from the dir defined before, but can also just be the same.
|
||||
if (sprite.EnableDirectionOverride)
|
||||
dir = sprite.DirectionOverride.Convert(rsiState.RsiDirections);
|
||||
dir = dir.OffsetRsiDir(layer.DirOffset);
|
||||
|
||||
if (_clickMapManager.IsOccluding(layer.ActualRsi!, layer.State, dir, layer.AnimationFrame, layerImagePos))
|
||||
return true;
|
||||
}
|
||||
|
||||
drawDepth = default;
|
||||
renderOrder = default;
|
||||
bottom = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to check whether a click worked lands inside of the AABB for the current sprite for a clickable entity.
|
||||
/// </summary>
|
||||
/// <param name="localPos">The world position that was clicked.</param>
|
||||
/// <param name="relativeRotation">The angle of the entity to check relative to the PoV that the click is coming from.</param>
|
||||
/// <returns>True if the click lands inside the relevant AABB.</returns>
|
||||
public bool CheckDirBound(Entity<ClickableComponent, SpriteComponent> entity, Angle relativeRotation, Vector2 localPos)
|
||||
{
|
||||
var (uid, clickable, sprite) = entity;
|
||||
|
||||
if (clickable.Bounds == null)
|
||||
return false;
|
||||
|
||||
// These explicit bounds only work for either 1 or 4 directional sprites.
|
||||
|
||||
// This would be the orientation of a 4-directional sprite.
|
||||
var direction = relativeRotation.GetCardinalDir();
|
||||
|
||||
var modLocalPos = sprite.NoRotation
|
||||
? localPos
|
||||
: direction.ToAngle().RotateVec(localPos);
|
||||
|
||||
// First, check the bounding box that is valid for all orientations
|
||||
if (clickable.Bounds.All.Contains(modLocalPos))
|
||||
return true;
|
||||
|
||||
// Next, get and check the appropriate bounding box for the current sprite orientation
|
||||
var boundsForDir = (sprite.EnableDirectionOverride ? sprite.DirectionOverride : direction) switch
|
||||
{
|
||||
Direction.East => clickable.Bounds.East,
|
||||
Direction.North => clickable.Bounds.North,
|
||||
Direction.South => clickable.Bounds.South,
|
||||
Direction.West => clickable.Bounds.West,
|
||||
_ => throw new InvalidOperationException()
|
||||
};
|
||||
|
||||
return boundsForDir.Contains(modLocalPos);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ namespace Content.Client.Construction
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
private readonly Dictionary<int, EntityUid> _ghosts = new();
|
||||
@@ -206,7 +205,7 @@ namespace Content.Client.Construction
|
||||
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
||||
comp.Prototype = prototype;
|
||||
_xformSystem.SetLocalRotation(ghost.Value, dir.ToAngle());
|
||||
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
|
||||
_ghosts.Add(ghost.GetHashCode(), ghost.Value);
|
||||
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
|
||||
sprite.Color = new Color(48, 255, 48, 128);
|
||||
|
||||
@@ -16,7 +16,6 @@ public sealed class ExplosionOverlay : Overlay
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
private SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||
|
||||
@@ -25,7 +24,6 @@ public sealed class ExplosionOverlay : Overlay
|
||||
public ExplosionOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_xformSystem = _entMan.System<SharedTransformSystem>();
|
||||
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
|
||||
}
|
||||
|
||||
@@ -69,7 +67,7 @@ public sealed class ExplosionOverlay : Overlay
|
||||
continue;
|
||||
|
||||
var xform = xforms.GetComponent(gridId);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(xform);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
||||
|
||||
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
||||
drawHandle.SetTransform(worldMatrix);
|
||||
|
||||
@@ -13,7 +13,6 @@ public sealed class PuddleOverlay : Overlay
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
private readonly PuddleDebugOverlaySystem _debugOverlaySystem;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
private readonly Color _heavyPuddle = new(0, 255, 255, 50);
|
||||
private readonly Color _mediumPuddle = new(0, 150, 255, 50);
|
||||
@@ -27,7 +26,6 @@ public sealed class PuddleOverlay : Overlay
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
|
||||
_xformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
|
||||
var cache = IoCManager.Resolve<IResourceCache>();
|
||||
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
|
||||
}
|
||||
@@ -57,7 +55,7 @@ public sealed class PuddleOverlay : Overlay
|
||||
continue;
|
||||
|
||||
var gridXform = xformQuery.GetComponent(gridId);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||
drawHandle.SetTransform(worldMatrix);
|
||||
|
||||
@@ -90,7 +88,7 @@ public sealed class PuddleOverlay : Overlay
|
||||
continue;
|
||||
|
||||
var gridXform = xformQuery.GetComponent(gridId);
|
||||
var (_, _, matrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||
var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||
|
||||
foreach (var debugOverlayData in _debugOverlaySystem.GetData(gridId))
|
||||
|
||||
@@ -13,13 +13,11 @@ public sealed class HandheldGpsStatusControl : Control
|
||||
private readonly RichTextLabel _label;
|
||||
private float _updateDif;
|
||||
private readonly IEntityManager _entMan;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
public HandheldGpsStatusControl(Entity<HandheldGPSComponent> parent)
|
||||
{
|
||||
_parent = parent;
|
||||
_entMan = IoCManager.Resolve<IEntityManager>();
|
||||
_xformSystem = _entMan.System<SharedTransformSystem>();
|
||||
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
|
||||
AddChild(_label);
|
||||
UpdateGpsDetails();
|
||||
@@ -43,7 +41,7 @@ public sealed class HandheldGpsStatusControl : Control
|
||||
var posText = "Error";
|
||||
if (_entMan.TryGetComponent(_parent, out TransformComponent? transComp))
|
||||
{
|
||||
var pos = _xformSystem.GetMapCoordinates((_parent, transComp));
|
||||
var pos = transComp.MapPosition;
|
||||
var x = (int) pos.X;
|
||||
var y = (int) pos.Y;
|
||||
posText = $"({x}, {y})";
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Content.Client.Gameplay
|
||||
// Check the entities against whether or not we can click them
|
||||
var foundEntities = new List<(EntityUid, int, uint, float)>(entities.Count);
|
||||
var clickQuery = _entityManager.GetEntityQuery<ClickableComponent>();
|
||||
var clickSystem = _entityManager.System<ClickableSystem>();
|
||||
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
// TODO: Smelly
|
||||
var eye = _eyeManager.CurrentEye;
|
||||
@@ -124,7 +124,7 @@ namespace Content.Client.Gameplay
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (clickQuery.TryGetComponent(entity.Uid, out var component) &&
|
||||
clickSystem.CheckClick((entity.Uid, component, entity.Component, entity.Transform), coordinates.Position, eye, out var drawDepthClicked, out var renderOrder, out var bottom))
|
||||
component.CheckClick(entity.Component, entity.Transform, xformQuery, coordinates.Position, eye, out var drawDepthClicked, out var renderOrder, out var bottom))
|
||||
{
|
||||
foundEntities.Add((entity.Uid, drawDepthClicked, renderOrder, bottom));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ public sealed class GuidebookSystem : EntitySystem
|
||||
[Dependency] private readonly RgbLightControllerSystem _rgbLightControllerSystem = default!;
|
||||
[Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tags = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public event Action<List<string>, List<string>?, string?, bool, string?>? OnGuidebookOpen;
|
||||
public const string GuideEmbedTag = "GuideEmbeded";
|
||||
@@ -99,9 +98,8 @@ public sealed class GuidebookSystem : EntitySystem
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
if (xform.LocalRotation != Angle.Zero)
|
||||
_xformSystem.SetLocalRotation(uid, xform.LocalRotation - Angle.FromDegrees(90), xform);
|
||||
if (Transform(uid).LocalRotation != Angle.Zero)
|
||||
Transform(uid).LocalRotation -= Angle.FromDegrees(90);
|
||||
},
|
||||
Text = Loc.GetString("guidebook-monkey-unspin"),
|
||||
Priority = -9999,
|
||||
@@ -132,8 +130,7 @@ public sealed class GuidebookSystem : EntitySystem
|
||||
|
||||
private void OnGuidebookControlsTestActivateInWorld(EntityUid uid, GuidebookControlsTestComponent component, ActivateInWorldEvent args)
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
_xformSystem.SetLocalRotation(uid, xform.LocalRotation + Angle.FromDegrees(90), xform);
|
||||
Transform(uid).LocalRotation += Angle.FromDegrees(90);
|
||||
}
|
||||
|
||||
private void OnGuidebookControlsTestInteractHand(EntityUid uid, GuidebookControlsTestComponent component, InteractHandEvent args)
|
||||
|
||||
@@ -22,7 +22,6 @@ public sealed class HotPotatoSystem : SharedHotPotatoSystem
|
||||
{
|
||||
if (_timing.CurTime < comp.TargetTime)
|
||||
continue;
|
||||
|
||||
comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown);
|
||||
Spawn("HotPotatoEffect", _transform.GetMapCoordinates(uid).Offset(_random.NextVector2(0.25f)));
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
// how often to recheck possible targets (prevents calling expensive
|
||||
// check logic each update)
|
||||
@@ -251,7 +250,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||
if (!dragSprite.NoRotation)
|
||||
{
|
||||
_xformSystem.SetWorldRotation(_dragShadow.Value, _xformSystem.GetWorldRotation(_draggedEntity.Value));
|
||||
Transform(_dragShadow.Value).WorldRotation = Transform(_draggedEntity.Value).WorldRotation;
|
||||
}
|
||||
|
||||
// drag initiated
|
||||
@@ -552,7 +551,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
if (Exists(_dragShadow))
|
||||
{
|
||||
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
|
||||
_xformSystem.SetWorldPosition(_dragShadow.Value, mousePos.Position);
|
||||
Transform(_dragShadow.Value).WorldPosition = mousePos.Position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
@@ -67,7 +66,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
xform.MapID == _lastMousePosition.Value.MapId)
|
||||
{
|
||||
var tickTime = _gameTiming.TickPeriod;
|
||||
var distance = _lastMousePosition.Value.Position - _xformSystem.GetWorldPosition(xform);
|
||||
var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
|
||||
RaiseNetworkEvent(new GridDragVelocityRequest()
|
||||
{
|
||||
Grid = GetNetEntity(_dragging.Value),
|
||||
@@ -102,7 +101,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
|
||||
return;
|
||||
|
||||
StartDragging(gridUid, _xformSystem.GetInvWorldMatrix(gridUid).Transform(mousePos.Position));
|
||||
StartDragging(gridUid, Transform(gridUid).InvWorldMatrix.Transform(mousePos.Position));
|
||||
}
|
||||
|
||||
if (!TryComp<TransformComponent>(_dragging, out var xform))
|
||||
@@ -117,11 +116,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
return;
|
||||
}
|
||||
|
||||
var localToWorld = _xformSystem.GetWorldMatrix(xform).Transform(_localPosition);
|
||||
var localToWorld = xform.WorldMatrix.Transform(_localPosition);
|
||||
|
||||
if (localToWorld.EqualsApprox(mousePos.Position, 0.01f)) return;
|
||||
|
||||
var requestedGridOrigin = mousePos.Position - _xformSystem.GetWorldRotation(xform).RotateVec(_localPosition);
|
||||
var requestedGridOrigin = mousePos.Position - xform.WorldRotation.RotateVec(_localPosition);
|
||||
_lastMousePosition = new MapCoordinates(requestedGridOrigin, mousePos.MapId);
|
||||
|
||||
RaiseNetworkEvent(new GridDragRequestPosition()
|
||||
|
||||
@@ -37,7 +37,7 @@ public sealed class MouseRotatorSystem : SharedMouseRotatorSystem
|
||||
if (mapPos.MapId == MapId.Nullspace)
|
||||
return;
|
||||
|
||||
var angle = (mapPos.Position - _transform.GetMapCoordinates((player.Value, xform)).Position).ToWorldAngle();
|
||||
var angle = (mapPos.Position - xform.MapPosition.Position).ToWorldAngle();
|
||||
|
||||
var curRot = _transform.GetWorldRotation(xform);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ public sealed class HTNOverlay : Overlay
|
||||
{
|
||||
private readonly IEntityManager _entManager = default!;
|
||||
private readonly Font _font = default!;
|
||||
private SharedTransformSystem? _xformSystem = null;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
||||
|
||||
@@ -24,10 +23,6 @@ public sealed class HTNOverlay : Overlay
|
||||
if (args.ViewportControl == null)
|
||||
return;
|
||||
|
||||
_xformSystem ??= _entManager.SystemOrNull<SharedTransformSystem>();
|
||||
if (_xformSystem is null)
|
||||
return;
|
||||
|
||||
var handle = args.ScreenHandle;
|
||||
|
||||
foreach (var (comp, xform) in _entManager.EntityQuery<HTNComponent, TransformComponent>(true))
|
||||
@@ -35,7 +30,7 @@ public sealed class HTNOverlay : Overlay
|
||||
if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId)
|
||||
continue;
|
||||
|
||||
var worldPos = _xformSystem.GetWorldPosition(xform);
|
||||
var worldPos = xform.WorldPosition;
|
||||
|
||||
if (!args.WorldAABB.Contains(worldPos))
|
||||
continue;
|
||||
|
||||
@@ -89,10 +89,6 @@ public sealed class NPCSteeringOverlay : Overlay
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
{
|
||||
var xformSystem = _entManager.SystemOrNull<SharedTransformSystem>();
|
||||
if (xformSystem is null)
|
||||
return;
|
||||
|
||||
foreach (var (comp, mover, xform) in _entManager.EntityQuery<NPCSteeringComponent, InputMoverComponent, TransformComponent>(true))
|
||||
{
|
||||
if (xform.MapID != args.MapId)
|
||||
@@ -100,7 +96,7 @@ public sealed class NPCSteeringOverlay : Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
var (worldPos, worldRot) = xformSystem.GetWorldPositionRotation(xform);
|
||||
var (worldPos, worldRot) = xform.GetWorldPositionRotation();
|
||||
|
||||
if (!args.WorldAABB.Contains(worldPos))
|
||||
continue;
|
||||
|
||||
@@ -140,7 +140,6 @@ namespace Content.Client.NPC
|
||||
private readonly IMapManager _mapManager;
|
||||
private readonly PathfindingSystem _system;
|
||||
private readonly MapSystem _mapSystem;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace | OverlaySpace.WorldSpace;
|
||||
|
||||
@@ -162,7 +161,6 @@ namespace Content.Client.NPC
|
||||
_mapManager = mapManager;
|
||||
_system = system;
|
||||
_mapSystem = mapSystem;
|
||||
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
|
||||
}
|
||||
|
||||
@@ -201,7 +199,7 @@ namespace Content.Client.NPC
|
||||
if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize));
|
||||
|
||||
foreach (var chunk in crumbs)
|
||||
@@ -285,7 +283,7 @@ namespace Content.Client.NPC
|
||||
return;
|
||||
}
|
||||
|
||||
var invGridMatrix = _xformSystem.GetInvWorldMatrix(gridXform);
|
||||
var invGridMatrix = gridXform.InvWorldMatrix;
|
||||
DebugPathPoly? nearest = null;
|
||||
var nearestDistance = float.MaxValue;
|
||||
|
||||
@@ -358,7 +356,7 @@ namespace Content.Client.NPC
|
||||
continue;
|
||||
}
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
worldHandle.SetTransform(worldMatrix);
|
||||
var localAABB = invWorldMatrix.TransformBox(aabb);
|
||||
|
||||
@@ -418,7 +416,7 @@ namespace Content.Client.NPC
|
||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
worldHandle.SetTransform(worldMatrix);
|
||||
var localAABB = invWorldMatrix.TransformBox(aabb);
|
||||
|
||||
@@ -457,7 +455,7 @@ namespace Content.Client.NPC
|
||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
worldHandle.SetTransform(worldMatrix);
|
||||
var localAABB = invMatrix.TransformBox(aabb);
|
||||
|
||||
@@ -516,7 +514,7 @@ namespace Content.Client.NPC
|
||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
worldHandle.SetTransform(worldMatrix);
|
||||
var localAABB = invWorldMatrix.TransformBox(args.WorldBounds);
|
||||
|
||||
@@ -543,7 +541,7 @@ namespace Content.Client.NPC
|
||||
if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
|
||||
continue;
|
||||
|
||||
worldHandle.SetTransform(_xformSystem.GetWorldMatrix(graphXform));
|
||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
||||
worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f));
|
||||
}
|
||||
}
|
||||
@@ -567,7 +565,7 @@ namespace Content.Client.NPC
|
||||
continue;
|
||||
|
||||
matrix = graph;
|
||||
worldHandle.SetTransform(_xformSystem.GetWorldMatrix(graphXform));
|
||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
||||
}
|
||||
|
||||
worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f));
|
||||
|
||||
@@ -12,7 +12,6 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
private readonly DeviceListSystem _deviceListSystem;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
public Dictionary<EntityUid, Color> Colors = new();
|
||||
public EntityUid? Action;
|
||||
@@ -24,7 +23,6 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_deviceListSystem = _entityManager.System<DeviceListSystem>();
|
||||
_xformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -68,7 +66,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
args.WorldHandle.DrawLine(_xformSystem.GetWorldPosition(sourceTransform), _xformSystem.GetWorldPosition(linkTransform), Colors[uid]);
|
||||
args.WorldHandle.DrawLine(sourceTransform.WorldPosition, linkTransform.WorldPosition, Colors[uid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace Content.Client.NodeContainer
|
||||
private readonly IMapManager _mapManager;
|
||||
private readonly IInputManager _inputManager;
|
||||
private readonly IEntityManager _entityManager;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new();
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
|
||||
@@ -47,7 +46,6 @@ namespace Content.Client.NodeContainer
|
||||
_mapManager = mapManager;
|
||||
_inputManager = inputManager;
|
||||
_entityManager = entityManager;
|
||||
_xformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
|
||||
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
|
||||
}
|
||||
@@ -148,7 +146,7 @@ namespace Content.Client.NodeContainer
|
||||
foreach (var (gridId, gridDict) in _gridIndex)
|
||||
{
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
var (_, _, worldMatrix, invMatrix) = _xformSystem.GetWorldPositionRotationMatrixWithInv(gridId);
|
||||
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(gridId).GetWorldPositionRotationMatrixWithInv();
|
||||
|
||||
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
||||
foreach (var (pos, list) in gridDict)
|
||||
|
||||
@@ -22,7 +22,6 @@ public sealed class TargetOutlineSystem : EntitySystem
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private bool _enabled = false;
|
||||
|
||||
@@ -165,8 +164,8 @@ public sealed class TargetOutlineSystem : EntitySystem
|
||||
valid = _interactionSystem.InRangeUnobstructed(player, entity, Range);
|
||||
else if (Range >= 0)
|
||||
{
|
||||
var origin = _xformSystem.GetWorldPosition(player);
|
||||
var target = _xformSystem.GetWorldPosition(entity);
|
||||
var origin = Transform(player).WorldPosition;
|
||||
var target = Transform(entity).WorldPosition;
|
||||
valid = (origin - target).LengthSquared() <= Range;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ public sealed class NavMapOverlay : Overlay
|
||||
{
|
||||
var query = _entManager.GetEntityQuery<NavMapComponent>();
|
||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
var scale = Matrix3.CreateScale(new Vector2(1f, 1f));
|
||||
|
||||
_grids.Clear();
|
||||
@@ -70,7 +69,7 @@ public sealed class NavMapOverlay : Overlay
|
||||
continue;
|
||||
|
||||
// TODO: Faster helper method
|
||||
var (_, _, matrix, invMatrix) = xformSystem.GetWorldPositionRotationMatrixWithInv(xform);
|
||||
var (_, _, matrix, invMatrix) = xform.GetWorldPositionRotationMatrixWithInv();
|
||||
|
||||
var localAABB = invMatrix.TransformBox(args.WorldBounds);
|
||||
Matrix3.Multiply(in scale, in matrix, out var matty);
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Content.Client.Radiation.Overlays
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
private SharedTransformSystem? _xformSystem = null;
|
||||
|
||||
private const float MaxDist = 15.0f;
|
||||
|
||||
@@ -73,9 +72,7 @@ namespace Content.Client.Radiation.Overlays
|
||||
//Queries all pulses on the map and either adds or removes them from the list of rendered pulses based on whether they should be drawn (in range? on the same z-level/map? pulse entity still exists?)
|
||||
private void RadiationQuery(IEye? currentEye)
|
||||
{
|
||||
_xformSystem ??= _entityManager.SystemOrNull<SharedTransformSystem>();
|
||||
|
||||
if (_xformSystem is null || currentEye is null)
|
||||
if (currentEye == null)
|
||||
{
|
||||
_pulses.Clear();
|
||||
return;
|
||||
@@ -94,7 +91,7 @@ namespace Content.Client.Radiation.Overlays
|
||||
(
|
||||
_baseShader.Duplicate(),
|
||||
new RadiationShaderInstance(
|
||||
_xformSystem.GetMapCoordinates(pulseEntity),
|
||||
_entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition,
|
||||
pulse.VisualRange,
|
||||
pulse.StartTime,
|
||||
pulse.VisualDuration
|
||||
@@ -112,7 +109,7 @@ namespace Content.Client.Radiation.Overlays
|
||||
_entityManager.TryGetComponent(pulseEntity, out RadiationPulseComponent? pulse))
|
||||
{
|
||||
var shaderInstance = _pulses[pulseEntity];
|
||||
shaderInstance.instance.CurrentMapCoords = _xformSystem.GetMapCoordinates(pulseEntity);
|
||||
shaderInstance.instance.CurrentMapCoords = _entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition;
|
||||
shaderInstance.instance.Range = pulse.VisualRange;
|
||||
} else {
|
||||
_pulses[pulseEntity].shd.Dispose();
|
||||
|
||||
@@ -126,18 +126,18 @@ public sealed partial class ReplaySpectatorSystem
|
||||
|
||||
if (data.Local != null && data.Local.Value.Coords.IsValid(EntityManager))
|
||||
{
|
||||
var (newUid, newXform) = SpawnSpectatorGhost(data.Local.Value.Coords, false);
|
||||
_transform.SetLocalRotation(newUid, data.Local.Value.Rot, newXform);
|
||||
var newXform = SpawnSpectatorGhost(data.Local.Value.Coords, false);
|
||||
newXform.LocalRotation = data.Local.Value.Rot;
|
||||
}
|
||||
else if (data.World != null && data.World.Value.Coords.IsValid(EntityManager))
|
||||
{
|
||||
var (newUid, newXform) = SpawnSpectatorGhost(data.World.Value.Coords, true);
|
||||
_transform.SetLocalRotation(newUid, data.World.Value.Rot, newXform);
|
||||
var newXform = SpawnSpectatorGhost(data.World.Value.Coords, true);
|
||||
newXform.LocalRotation = data.World.Value.Rot;
|
||||
}
|
||||
else if (TryFindFallbackSpawn(out var coords))
|
||||
{
|
||||
var (newUid, newXform) = SpawnSpectatorGhost(coords, true);
|
||||
_transform.SetLocalRotation(newUid, 0, newXform);
|
||||
var newXform = SpawnSpectatorGhost(coords, true);
|
||||
newXform.LocalRotation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
RemComp<ReplaySpectatorComponent>(old.Value);
|
||||
}
|
||||
|
||||
public Entity<TransformComponent> SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach)
|
||||
public TransformComponent SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach)
|
||||
{
|
||||
var old = _player.LocalEntity;
|
||||
var session = _player.GetSessionById(DefaultUser);
|
||||
@@ -83,7 +83,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
_stateMan.RequestStateChange<ReplayGhostState>();
|
||||
|
||||
_spectatorData = GetSpectatorData();
|
||||
return (ent, xform);
|
||||
return xform;
|
||||
}
|
||||
|
||||
private void SpectateCommand(IConsoleShell shell, string argStr, string[] args)
|
||||
|
||||
@@ -58,7 +58,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
public sealed class EmergencyShuttleOverlay : Overlay
|
||||
{
|
||||
private IEntityManager _entManager;
|
||||
private SharedTransformSystem _xformSystem;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
|
||||
@@ -68,14 +67,13 @@ public sealed class EmergencyShuttleOverlay : Overlay
|
||||
public EmergencyShuttleOverlay(IEntityManager entManager)
|
||||
{
|
||||
_entManager = entManager;
|
||||
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
{
|
||||
if (Position == null || !_entManager.TryGetComponent<TransformComponent>(StationUid, out var xform)) return;
|
||||
|
||||
args.WorldHandle.SetTransform(_xformSystem.GetWorldMatrix(xform));
|
||||
args.WorldHandle.SetTransform(xform.WorldMatrix);
|
||||
args.WorldHandle.DrawRect(Position.Value, Color.Red.WithAlpha(100));
|
||||
args.WorldHandle.SetTransform(Matrix3.Identity);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public class DockingControl : Control
|
||||
{
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly IMapManager _mapManager;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
private float _range = 8f;
|
||||
private float _rangeSquared = 0f;
|
||||
@@ -51,7 +50,6 @@ public class DockingControl : Control
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_mapManager = IoCManager.Resolve<IMapManager>();
|
||||
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
_rangeSquared = _range * _range;
|
||||
MinSize = new Vector2(SizeFull, SizeFull);
|
||||
}
|
||||
@@ -145,8 +143,8 @@ public class DockingControl : Control
|
||||
ScalePosition(rotation.Transform(new Vector2(0.5f, -0.5f)))), Color.Green);
|
||||
|
||||
// Draw nearby grids
|
||||
var worldPos = _xformSystem.GetWorldMatrix(gridXform).Transform(Coordinates.Value.Position);
|
||||
var gridInvMatrix = _xformSystem.GetInvWorldMatrix(gridXform);
|
||||
var worldPos = gridXform.WorldMatrix.Transform(Coordinates.Value.Position);
|
||||
var gridInvMatrix = gridXform.InvWorldMatrix;
|
||||
Matrix3.Multiply(in gridInvMatrix, in matrix, out var invMatrix);
|
||||
|
||||
// TODO: Getting some overdraw so need to fix that.
|
||||
@@ -164,7 +162,7 @@ public class DockingControl : Control
|
||||
if (!_entManager.TryGetComponent<FixturesComponent>(grid, out var gridFixtures))
|
||||
continue;
|
||||
|
||||
var gridMatrix = _xformSystem.GetWorldMatrix(grid);
|
||||
var gridMatrix = xformQuery.GetComponent(grid).WorldMatrix;
|
||||
|
||||
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
{
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly IGameTiming _timing;
|
||||
private SharedTransformSystem? _xformSystem = null;
|
||||
|
||||
private EntityUid? _shuttleEntity;
|
||||
|
||||
@@ -310,9 +309,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
{
|
||||
base.Draw(handle);
|
||||
|
||||
_xformSystem ??= _entManager.SystemOrNull<SharedTransformSystem>();
|
||||
if (_xformSystem is null ||
|
||||
!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
|
||||
if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
|
||||
!_entManager.TryGetComponent<TransformComponent>(_shuttleEntity, out var gridXform))
|
||||
{
|
||||
return;
|
||||
@@ -325,7 +322,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
|
||||
FTLTimer.Text = GetFTLText();
|
||||
|
||||
var (_, worldRot, worldMatrix) = _xformSystem.GetWorldPositionRotationMatrix(gridXform);
|
||||
var (_, worldRot, worldMatrix) = gridXform.GetWorldPositionRotationMatrix();
|
||||
var worldPos = worldMatrix.Transform(gridBody.LocalCenter);
|
||||
|
||||
// Get the positive reduced angle.
|
||||
|
||||
@@ -15,7 +15,6 @@ public sealed class SpriteFadeSystem : EntitySystem
|
||||
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private readonly HashSet<FadingSpriteComponent> _comps = new();
|
||||
|
||||
@@ -49,7 +48,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
||||
spriteQuery.TryGetComponent(player, out var playerSprite))
|
||||
{
|
||||
var fadeQuery = GetEntityQuery<SpriteFadeComponent>();
|
||||
var mapPos = _xformSystem.GetMapCoordinates((player.Value, playerXform));
|
||||
var mapPos = playerXform.MapPosition;
|
||||
|
||||
// Also want to handle large entities even if they may not be clickable.
|
||||
foreach (var ent in state.GetClickableEntities(mapPos))
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Content.Client.Stealth;
|
||||
public sealed class StealthSystem : SharedStealthSystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private ShaderInstance _shader = default!;
|
||||
|
||||
@@ -80,7 +79,7 @@ public sealed class StealthSystem : SharedStealthSystem
|
||||
if (!parent.IsValid())
|
||||
return; // should never happen, but lets not kill the client.
|
||||
var parentXform = Transform(parent);
|
||||
var reference = args.Viewport.WorldToLocal(_xformSystem.GetWorldPosition(parentXform));
|
||||
var reference = args.Viewport.WorldToLocal(parentXform.WorldPosition);
|
||||
reference.X = -reference.X;
|
||||
var visibility = GetVisibility(uid, component);
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Content.Client.Tabletop
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
// Time in seconds to wait until sending the location of a dragged entity to the server again
|
||||
private const float Delay = 1f / 10; // 10 Hz
|
||||
@@ -101,7 +100,7 @@ namespace Content.Client.Tabletop
|
||||
if (clampedCoords.Equals(MapCoordinates.Nullspace)) return;
|
||||
|
||||
// Move the entity locally every update
|
||||
_xformSystem.SetWorldPosition(_draggedEntity.Value, clampedCoords.Position);
|
||||
EntityManager.GetComponent<TransformComponent>(_draggedEntity.Value).WorldPosition = clampedCoords.Position;
|
||||
|
||||
// Increment total time passed
|
||||
_timePassed += frameTime;
|
||||
@@ -259,7 +258,7 @@ namespace Content.Client.Tabletop
|
||||
// Set the dragging player on the component to noone
|
||||
if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
|
||||
{
|
||||
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transforms.GetMapCoordinates(_draggedEntity.Value), GetNetEntity(_table!.Value)));
|
||||
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value)));
|
||||
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public sealed class ChatUIController : UIController
|
||||
[Dependency] private readonly IChatManager _manager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _config = default!;
|
||||
[Dependency] private readonly IEyeManager _eye = default!;
|
||||
[Dependency] private readonly IEntityManager _ent = default!;
|
||||
[Dependency] private readonly IInputManager _input = default!;
|
||||
[Dependency] private readonly IClientNetManager _net = default!;
|
||||
[Dependency] private readonly IPlayerManager _player = default!;
|
||||
@@ -53,12 +54,12 @@ public sealed class ChatUIController : UIController
|
||||
[Dependency] private readonly IStateManager _state = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IReplayRecordingManager _replayRecording = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
[UISystemDependency] private readonly ExamineSystem? _examine = default;
|
||||
[UISystemDependency] private readonly GhostSystem? _ghost = default;
|
||||
[UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
|
||||
[UISystemDependency] private readonly ChatSystem? _chatSys = default;
|
||||
[UISystemDependency] private readonly TransformSystem? _xformSystem = default!;
|
||||
|
||||
[ValidatePrototypeId<ColorPalettePrototype>]
|
||||
private const string ChatNamePalette = "ChatNames";
|
||||
@@ -178,8 +179,8 @@ public sealed class ChatUIController : UIController
|
||||
_net.RegisterNetMessage<MsgChatMessage>(OnChatMessage);
|
||||
_net.RegisterNetMessage<MsgDeleteChatMessagesBy>(OnDeleteChatMessagesBy);
|
||||
SubscribeNetworkEvent<DamageForceSayEvent>(OnDamageForceSay);
|
||||
_config.OnValueChanged(CCVars.ChatEnableColorName, (value) => { _chatNameColorsEnabled = value; });
|
||||
_chatNameColorsEnabled = _config.GetCVar(CCVars.ChatEnableColorName);
|
||||
_cfg.OnValueChanged(CCVars.ChatEnableColorName, (value) => { _chatNameColorsEnabled = value; });
|
||||
_chatNameColorsEnabled = _cfg.GetCVar(CCVars.ChatEnableColorName);
|
||||
|
||||
_speechBubbleRoot = new LayoutContainer();
|
||||
|
||||
@@ -553,7 +554,7 @@ public sealed class ChatUIController : UIController
|
||||
private void UpdateQueuedSpeechBubbles(FrameEventArgs delta)
|
||||
{
|
||||
// Update queued speech bubbles.
|
||||
if (_queuedSpeechBubbles.Count == 0 || _examine is null || _xformSystem is null)
|
||||
if (_queuedSpeechBubbles.Count == 0 || _examine == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -591,7 +592,7 @@ public sealed class ChatUIController : UIController
|
||||
var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
|
||||
=> uid == data.compOwner || uid == data.attachedEntity;
|
||||
var playerPos = player != null
|
||||
? _xformSystem.GetMapCoordinates(player.Value)
|
||||
? EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition
|
||||
: MapCoordinates.Nullspace;
|
||||
|
||||
var occluded = player != null && _examine.IsOccluded(player.Value);
|
||||
@@ -610,7 +611,7 @@ public sealed class ChatUIController : UIController
|
||||
continue;
|
||||
}
|
||||
|
||||
var otherPos = _xformSystem.GetMapCoordinates(ent);
|
||||
var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
|
||||
|
||||
if (occluded && !ExamineSystemShared.InRangeUnOccluded(
|
||||
playerPos,
|
||||
@@ -769,7 +770,7 @@ public sealed class ChatUIController : UIController
|
||||
ProcessChatMessage(msg);
|
||||
|
||||
if ((msg.Channel & ChatChannel.AdminRelated) == 0 ||
|
||||
_config.GetCVar(CCVars.ReplayRecordAdminChat))
|
||||
_cfg.GetCVar(CCVars.ReplayRecordAdminChat))
|
||||
{
|
||||
_replayRecording.RecordClientMessage(msg);
|
||||
}
|
||||
@@ -780,7 +781,7 @@ public sealed class ChatUIController : UIController
|
||||
// color the name unless it's something like "the old man"
|
||||
if ((msg.Channel == ChatChannel.Local || msg.Channel == ChatChannel.Whisper) && _chatNameColorsEnabled)
|
||||
{
|
||||
var grammar = EntityManager.GetComponentOrNull<GrammarComponent>(EntityManager.GetEntity(msg.SenderEntity));
|
||||
var grammar = _ent.GetComponentOrNull<GrammarComponent>(_ent.GetEntity(msg.SenderEntity));
|
||||
if (grammar != null && grammar.ProperNoun == true)
|
||||
msg.WrappedMessage = SharedChatSystem.InjectTagInsideTag(msg, "Name", "color", GetNameColor(SharedChatSystem.GetStringInsideTag(msg, "Name")));
|
||||
}
|
||||
@@ -829,7 +830,7 @@ public sealed class ChatUIController : UIController
|
||||
break;
|
||||
|
||||
case ChatChannel.LOOC:
|
||||
if (_config.GetCVar(CCVars.LoocAboveHeadShow))
|
||||
if (_cfg.GetCVar(CCVars.LoocAboveHeadShow))
|
||||
AddSpeechBubble(msg, SpeechBubble.SpeechType.Looc);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Client.UserInterface.Systems.Gameplay;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controllers;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -16,7 +15,6 @@ public sealed class ViewportUIController : UIController
|
||||
[Dependency] private readonly IPlayerManager _playerMan = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||
[UISystemDependency] private readonly SharedTransformSystem? _xformSystem = default!;
|
||||
|
||||
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);
|
||||
public const int ViewportHeight = 15;
|
||||
@@ -89,7 +87,7 @@ public sealed class ViewportUIController : UIController
|
||||
_entMan.TryGetComponent(ent, out EyeComponent? eye);
|
||||
|
||||
if (eye?.Eye == _eyeManager.CurrentEye
|
||||
&& (_xformSystem is null || _xformSystem.GetWorldPosition(ent.Value) == default))
|
||||
&& _entMan.GetComponent<TransformComponent>(ent.Value).WorldPosition == default)
|
||||
return; // nothing to worry about, the player is just in null space... actually that is probably a problem?
|
||||
|
||||
// Currently, this shouldn't happen. This likely happened because the main eye was set to null. When this
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Content.Client.Verbs
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// When a user right clicks somewhere, how large is the box we use to get entities for the context menu?
|
||||
@@ -141,7 +140,8 @@ namespace Content.Client.Verbs
|
||||
// Remove any entities that do not have LOS
|
||||
if ((visibility & MenuVisibility.NoFov) == 0)
|
||||
{
|
||||
var playerPos = _xformSystem.GetMapCoordinates(player.Value);
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var playerPos = xformQuery.GetComponent(player.Value).MapPosition;
|
||||
|
||||
for (var i = entities.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -149,7 +149,7 @@ namespace Content.Client.Verbs
|
||||
|
||||
if (!ExamineSystemShared.InRangeUnOccluded(
|
||||
playerPos,
|
||||
_xformSystem.GetMapCoordinates(entity),
|
||||
xformQuery.GetComponent(entity).MapPosition,
|
||||
ExamineSystemShared.ExamineRange,
|
||||
null))
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@ public sealed class MeleeArcOverlay : Overlay
|
||||
private readonly IPlayerManager _playerManager;
|
||||
private readonly MeleeWeaponSystem _melee;
|
||||
private readonly SharedCombatModeSystem _combatMode;
|
||||
private readonly SharedTransformSystem _xformSystem;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||
|
||||
@@ -32,7 +31,6 @@ public sealed class MeleeArcOverlay : Overlay
|
||||
_playerManager = playerManager;
|
||||
_melee = melee;
|
||||
_combatMode = combatMode;
|
||||
_xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -54,7 +52,7 @@ public sealed class MeleeArcOverlay : Overlay
|
||||
if (mapPos.MapId != args.MapId)
|
||||
return;
|
||||
|
||||
var playerPos = _xformSystem.GetMapCoordinates((player.Value, xform));
|
||||
var playerPos = xform.MapPosition;
|
||||
|
||||
if (mapPos.MapId != playerPos.MapId)
|
||||
return;
|
||||
|
||||
@@ -80,7 +80,7 @@ public sealed partial class MeleeWeaponSystem
|
||||
TransformSystem.AttachToGridOrMap(animationUid, xform);
|
||||
var worldPos = mapPos + (mapRot - userXform.LocalRotation).RotateVec(localPos);
|
||||
var newLocalPos = TransformSystem.GetInvWorldMatrix(xform.ParentUid).Transform(worldPos);
|
||||
TransformSystem.SetLocalPositionNoLerp(animationUid, newLocalPos, xform);
|
||||
TransformSystem.SetLocalPositionNoLerp(xform, newLocalPos);
|
||||
if (arcComponent.Fadeout)
|
||||
_animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey);
|
||||
break;
|
||||
|
||||
@@ -136,7 +136,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
// Light attack
|
||||
if (useDown == BoundKeyState.Down)
|
||||
{
|
||||
var attackerPos = TransformSystem.GetMapCoordinates(entity);
|
||||
var attackerPos = Transform(entity).MapPosition;
|
||||
|
||||
if (mousePos.MapId != attackerPos.MapId ||
|
||||
(attackerPos.Position - mousePos.Position).Length() > weapon.Range)
|
||||
|
||||
@@ -18,7 +18,6 @@ public sealed class GunSpreadOverlay : Overlay
|
||||
private readonly IInputManager _input;
|
||||
private readonly IPlayerManager _player;
|
||||
private readonly GunSystem _guns;
|
||||
private readonly SharedTransformSystem _xforms;
|
||||
|
||||
public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system)
|
||||
{
|
||||
@@ -28,7 +27,6 @@ public sealed class GunSpreadOverlay : Overlay
|
||||
_timing = timing;
|
||||
_player = player;
|
||||
_guns = system;
|
||||
_xforms = entManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -43,7 +41,7 @@ public sealed class GunSpreadOverlay : Overlay
|
||||
return;
|
||||
}
|
||||
|
||||
var mapPos = _xforms.GetMapCoordinates((player.Value, xform));
|
||||
var mapPos = xform.MapPosition;
|
||||
|
||||
if (mapPos.MapId == MapId.Nullspace)
|
||||
return;
|
||||
|
||||
@@ -99,7 +99,8 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
|
||||
var ent = Spawn(HitscanProto, coords);
|
||||
var sprite = Comp<SpriteComponent>(ent);
|
||||
TransformSystem.SetLocalRotation(ent, a.angle);
|
||||
var xform = Transform(ent);
|
||||
xform.LocalRotation = a.angle;
|
||||
sprite[EffectLayers.Unshaded].AutoAnimated = false;
|
||||
sprite.LayerSetSprite(EffectLayers.Unshaded, rsi);
|
||||
sprite.LayerSetState(EffectLayers.Unshaded, rsi.RsiState);
|
||||
@@ -277,11 +278,9 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
var ent = Spawn(message.Prototype, coordinates);
|
||||
|
||||
var effectXform = Transform(ent);
|
||||
TransformSystem.SetLocalPositionRotation(ent,
|
||||
TransformSystem.SetLocalPositionRotation(effectXform,
|
||||
effectXform.LocalPosition + new Vector2(0f, -0.5f),
|
||||
effectXform.LocalRotation - MathF.PI / 2,
|
||||
effectXform
|
||||
);
|
||||
effectXform.LocalRotation - MathF.PI / 2);
|
||||
|
||||
var lifetime = 0.4f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user