Merge remote-tracking branch 'upstream/master' into ed-05-08-2024-upstream
# Conflicts: # Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs
This commit is contained in:
@@ -93,6 +93,6 @@ public sealed class ClientAlertsSystem : AlertsSystem
|
||||
|
||||
public void AlertClicked(ProtoId<AlertPrototype> alertType)
|
||||
{
|
||||
RaiseNetworkEvent(new ClickAlertEvent(alertType));
|
||||
RaisePredictiveEvent(new ClickAlertEvent(alertType));
|
||||
}
|
||||
}
|
||||
|
||||
10
Content.Client/Atmos/EntitySystems/GasMinerSystem.cs
Normal file
10
Content.Client/Atmos/EntitySystems/GasMinerSystem.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Content.Shared.Atmos.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Client.Atmos.EntitySystems;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class GasMinerSystem : SharedGasMinerSystem
|
||||
{
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ 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 _transformSystem;
|
||||
|
||||
public enum SpeechType : byte
|
||||
{
|
||||
@@ -83,6 +84,7 @@ namespace Content.Client.Chat.UI
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_senderEntity = senderEntity;
|
||||
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
|
||||
// Use text clipping so new messages don't overlap old ones being pushed up.
|
||||
RectClipContent = true;
|
||||
@@ -140,7 +142,7 @@ namespace Content.Client.Chat.UI
|
||||
}
|
||||
|
||||
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
|
||||
var worldPos = xform.WorldPosition + offset;
|
||||
var worldPos = _transformSystem.GetWorldPosition(xform) + offset;
|
||||
|
||||
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
|
||||
var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Client.Actions;
|
||||
using Content.Client.Mapping;
|
||||
using Content.Client.Markers;
|
||||
using JetBrains.Annotations;
|
||||
@@ -25,7 +26,7 @@ internal sealed class MappingClientSideSetupCommand : LocalizedCommands
|
||||
_entitySystemManager.GetEntitySystem<MarkerSystem>().MarkersVisible = true;
|
||||
_lightManager.Enabled = false;
|
||||
shell.ExecuteCommand("showsubfloorforever");
|
||||
_stateManager.RequestStateChange<MappingState>();
|
||||
_entitySystemManager.GetEntitySystem<ActionsSystem>().LoadActionAssignments("/mapping_actions.yml", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public sealed class ExplosionOverlay : Overlay
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
private SharedAppearanceSystem _appearance;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||
@@ -26,6 +27,7 @@ public sealed class ExplosionOverlay : Overlay
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_shader = _proto.Index<ShaderPrototype>("unshaded").Instance();
|
||||
_transformSystem = _entMan.System<SharedTransformSystem>();
|
||||
_appearance = appearanceSystem;
|
||||
}
|
||||
|
||||
@@ -68,7 +70,7 @@ public sealed class ExplosionOverlay : Overlay
|
||||
continue;
|
||||
|
||||
var xform = xforms.GetComponent(gridId);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform, xforms);
|
||||
|
||||
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
||||
drawHandle.SetTransform(worldMatrix);
|
||||
|
||||
@@ -14,6 +14,7 @@ public sealed class PuddleOverlay : Overlay
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
private readonly PuddleDebugOverlaySystem _debugOverlaySystem;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
|
||||
private readonly Color _heavyPuddle = new(0, 255, 255, 50);
|
||||
private readonly Color _mediumPuddle = new(0, 150, 255, 50);
|
||||
@@ -29,6 +30,7 @@ public sealed class PuddleOverlay : Overlay
|
||||
_debugOverlaySystem = _entitySystemManager.GetEntitySystem<PuddleDebugOverlaySystem>();
|
||||
var cache = IoCManager.Resolve<IResourceCache>();
|
||||
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
|
||||
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -56,7 +58,7 @@ public sealed class PuddleOverlay : Overlay
|
||||
continue;
|
||||
|
||||
var gridXform = xformQuery.GetComponent(gridId);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery);
|
||||
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||
drawHandle.SetTransform(worldMatrix);
|
||||
|
||||
@@ -89,7 +91,7 @@ public sealed class PuddleOverlay : Overlay
|
||||
continue;
|
||||
|
||||
var gridXform = xformQuery.GetComponent(gridId);
|
||||
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||
var (_, _, matrix, invMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery);
|
||||
var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||
|
||||
foreach (var debugOverlayData in _debugOverlaySystem.GetData(gridId))
|
||||
|
||||
@@ -42,6 +42,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
// how often to recheck possible targets (prevents calling expensive
|
||||
// check logic each update)
|
||||
@@ -89,7 +90,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
/// </summary>
|
||||
private bool _isReplaying;
|
||||
|
||||
private float _deadzone;
|
||||
public float Deadzone;
|
||||
|
||||
private DragState _state = DragState.NotDragging;
|
||||
|
||||
@@ -121,7 +122,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
|
||||
private void SetDeadZone(float deadZone)
|
||||
{
|
||||
_deadzone = deadZone;
|
||||
Deadzone = deadZone;
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
@@ -211,7 +212,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
|
||||
_draggedEntity = entity;
|
||||
_state = DragState.MouseDown;
|
||||
_mouseDownScreenPos = _inputManager.MouseScreenPosition;
|
||||
_mouseDownScreenPos = args.ScreenCoordinates;
|
||||
_mouseDownTime = 0;
|
||||
|
||||
// don't want anything else to process the click,
|
||||
@@ -239,8 +240,13 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
|
||||
if (TryComp<SpriteComponent>(_draggedEntity, out var draggedSprite))
|
||||
{
|
||||
var screenPos = _inputManager.MouseScreenPosition;
|
||||
// No _draggedEntity in null window (Happens in tests)
|
||||
if (!screenPos.IsValid)
|
||||
return;
|
||||
|
||||
// pop up drag shadow under mouse
|
||||
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
|
||||
var mousePos = _eyeManager.PixelToMap(screenPos);
|
||||
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
||||
var dragSprite = Comp<SpriteComponent>(_dragShadow.Value);
|
||||
dragSprite.CopyFrom(draggedSprite);
|
||||
@@ -517,6 +523,9 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
if (dropEv2.Handled)
|
||||
return dropEv2.CanDrop;
|
||||
|
||||
if (dropEv.Handled && dropEv.CanDrop)
|
||||
return true;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -530,7 +539,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
case DragState.MouseDown:
|
||||
{
|
||||
var screenPos = _inputManager.MouseScreenPosition;
|
||||
if ((_mouseDownScreenPos!.Value.Position - screenPos.Position).Length() > _deadzone)
|
||||
if ((_mouseDownScreenPos!.Value.Position - screenPos.Position).Length() > Deadzone)
|
||||
{
|
||||
StartDrag();
|
||||
}
|
||||
@@ -551,7 +560,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
if (Exists(_dragShadow))
|
||||
{
|
||||
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);
|
||||
Transform(_dragShadow.Value).WorldPosition = mousePos.Position;
|
||||
_transformSystem.SetWorldPosition(_dragShadow.Value, mousePos.Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
@@ -62,11 +63,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
if (_dragging == null) return;
|
||||
|
||||
if (_lastMousePosition != null && TryComp(_dragging.Value, out TransformComponent? xform) &&
|
||||
TryComp<PhysicsComponent>(_dragging.Value, out var body) &&
|
||||
TryComp<PhysicsComponent>(_dragging.Value, out _) &&
|
||||
xform.MapID == _lastMousePosition.Value.MapId)
|
||||
{
|
||||
var tickTime = _gameTiming.TickPeriod;
|
||||
var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
|
||||
var distance = _lastMousePosition.Value.Position - _transformSystem.GetWorldPosition(xform);
|
||||
RaiseNetworkEvent(new GridDragVelocityRequest()
|
||||
{
|
||||
Grid = GetNetEntity(_dragging.Value),
|
||||
|
||||
@@ -9,6 +9,7 @@ public sealed class HTNOverlay : Overlay
|
||||
{
|
||||
private readonly IEntityManager _entManager = default!;
|
||||
private readonly Font _font = default!;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
||||
|
||||
@@ -16,6 +17,7 @@ public sealed class HTNOverlay : Overlay
|
||||
{
|
||||
_entManager = entManager;
|
||||
_font = new VectorFont(resourceCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
|
||||
_transformSystem = _entManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -30,7 +32,7 @@ public sealed class HTNOverlay : Overlay
|
||||
if (string.IsNullOrEmpty(comp.DebugText) || xform.MapID != args.MapId)
|
||||
continue;
|
||||
|
||||
var worldPos = xform.WorldPosition;
|
||||
var worldPos = _transformSystem.GetWorldPosition(xform);
|
||||
|
||||
if (!args.WorldAABB.Contains(worldPos))
|
||||
continue;
|
||||
|
||||
@@ -81,10 +81,12 @@ public sealed class NPCSteeringOverlay : Overlay
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
|
||||
public NPCSteeringOverlay(IEntityManager entManager)
|
||||
{
|
||||
_entManager = entManager;
|
||||
_transformSystem = _entManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -96,7 +98,7 @@ public sealed class NPCSteeringOverlay : Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
var (worldPos, worldRot) = xform.GetWorldPositionRotation();
|
||||
var (worldPos, worldRot) = _transformSystem.GetWorldPositionRotation(xform);
|
||||
|
||||
if (!args.WorldAABB.Contains(worldPos))
|
||||
continue;
|
||||
|
||||
@@ -12,6 +12,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
private readonly DeviceListSystem _deviceListSystem;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
|
||||
public Dictionary<EntityUid, Color> Colors = new();
|
||||
public EntityUid? Action;
|
||||
@@ -23,6 +24,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_deviceListSystem = _entityManager.System<DeviceListSystem>();
|
||||
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -66,7 +68,7 @@ public sealed class NetworkConfiguratorLinkOverlay : Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
args.WorldHandle.DrawLine(sourceTransform.WorldPosition, linkTransform.WorldPosition, Colors[uid]);
|
||||
args.WorldHandle.DrawLine(_transformSystem.GetWorldPosition(sourceTransform), _transformSystem.GetWorldPosition(linkTransform), Colors[uid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Content.Client.NodeContainer
|
||||
private readonly IMapManager _mapManager;
|
||||
private readonly IInputManager _inputManager;
|
||||
private readonly IEntityManager _entityManager;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
|
||||
private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new();
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
|
||||
@@ -46,6 +47,7 @@ namespace Content.Client.NodeContainer
|
||||
_mapManager = mapManager;
|
||||
_inputManager = inputManager;
|
||||
_entityManager = entityManager;
|
||||
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
|
||||
_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
|
||||
}
|
||||
@@ -146,7 +148,7 @@ namespace Content.Client.NodeContainer
|
||||
foreach (var (gridId, gridDict) in _gridIndex)
|
||||
{
|
||||
var grid = _entityManager.GetComponent<MapGridComponent>(gridId);
|
||||
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(gridId).GetWorldPositionRotationMatrixWithInv();
|
||||
var (_, _, worldMatrix, invMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridId);
|
||||
|
||||
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
||||
foreach (var (pos, list) in gridDict)
|
||||
|
||||
@@ -23,6 +23,7 @@ public sealed class TargetOutlineSystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
private bool _enabled = false;
|
||||
|
||||
@@ -165,8 +166,8 @@ public sealed class TargetOutlineSystem : EntitySystem
|
||||
valid = _interactionSystem.InRangeUnobstructed(player, entity, Range);
|
||||
else if (Range >= 0)
|
||||
{
|
||||
var origin = Transform(player).WorldPosition;
|
||||
var target = Transform(entity).WorldPosition;
|
||||
var origin = _transformSystem.GetWorldPosition(player);
|
||||
var target = _transformSystem.GetWorldPosition(entity);
|
||||
valid = (origin - target).LengthSquared() <= Range;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Content.Client.Stealth;
|
||||
public sealed class StealthSystem : SharedStealthSystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
private ShaderInstance _shader = default!;
|
||||
|
||||
@@ -81,7 +82,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(parentXform.WorldPosition);
|
||||
var reference = args.Viewport.WorldToLocal(_transformSystem.GetWorldPosition(parentXform));
|
||||
reference.X = -reference.X;
|
||||
var visibility = GetVisibility(uid, component);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ 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 _transformSystem = 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
|
||||
@@ -100,7 +101,7 @@ namespace Content.Client.Tabletop
|
||||
if (clampedCoords.Equals(MapCoordinates.Nullspace)) return;
|
||||
|
||||
// Move the entity locally every update
|
||||
EntityManager.GetComponent<TransformComponent>(_draggedEntity.Value).WorldPosition = clampedCoords.Position;
|
||||
_transformSystem.SetWorldPosition(_draggedEntity.Value, clampedCoords.Position);
|
||||
|
||||
// Increment total time passed
|
||||
_timePassed += frameTime;
|
||||
|
||||
@@ -15,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!;
|
||||
|
||||
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);
|
||||
public const int ViewportHeight = 15;
|
||||
private MainViewport? Viewport => UIManager.ActiveScreen?.GetWidget<MainViewport>();
|
||||
|
||||
@@ -236,7 +236,7 @@ public sealed partial class MeleeWeaponSystem
|
||||
private void UpdateEffects()
|
||||
{
|
||||
var query = EntityQueryEnumerator<TrackUserComponent, TransformComponent>();
|
||||
while (query.MoveNext(out var arcComponent, out var xform))
|
||||
while (query.MoveNext(out var uid, out var arcComponent, out var xform))
|
||||
{
|
||||
if (arcComponent.User == null)
|
||||
continue;
|
||||
@@ -249,7 +249,7 @@ public sealed partial class MeleeWeaponSystem
|
||||
targetPos += entRotation.RotateVec(arcComponent.Offset);
|
||||
}
|
||||
|
||||
TransformSystem.SetWorldPosition(xform, targetPos);
|
||||
TransformSystem.SetWorldPosition(uid, targetPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user