diff --git a/Content.Client/Buckle/BuckleSystem.cs b/Content.Client/Buckle/BuckleSystem.cs index c26976ffbe..32e3709b9a 100644 --- a/Content.Client/Buckle/BuckleSystem.cs +++ b/Content.Client/Buckle/BuckleSystem.cs @@ -1,4 +1,5 @@ using Content.Client.Rotation; +using Content.Shared._White; using Content.Shared.Buckle; using Content.Shared.Buckle.Components; using Content.Shared.Rotation; @@ -16,7 +17,7 @@ internal sealed class BuckleSystem : SharedBuckleSystem base.Initialize(); SubscribeLocalEvent(OnAppearanceChange); - SubscribeLocalEvent(OnStrapMoveEvent); + SubscribeLocalEvent(OnStrapMoveEvent); SubscribeLocalEvent(OnBuckledEvent); SubscribeLocalEvent(OnUnbuckledEvent); } @@ -52,7 +53,7 @@ internal sealed class BuckleSystem : SharedBuckleSystem } } - private void OnStrapMoveEvent(EntityUid uid, StrapComponent component, ref MoveEvent args) + private void OnStrapMoveEvent(EntityUid uid, StrapComponent component, ref MoveEventProxy args) { // I'm moving this to the client-side system, but for the sake of posterity let's keep this comment: // > This is mega cursed. Please somebody save me from Mr Buckle's wild ride diff --git a/Content.Client/Standing/LayingDownSystem.cs b/Content.Client/Standing/LayingDownSystem.cs index d45d481134..e94c4ce181 100644 --- a/Content.Client/Standing/LayingDownSystem.cs +++ b/Content.Client/Standing/LayingDownSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared._White; using Content.Shared.Buckle; using Content.Shared.Rotation; using Content.Shared.Standing; @@ -20,7 +21,7 @@ public sealed class LayingDownSystem : SharedLayingDownSystem { base.Initialize(); - SubscribeLocalEvent(OnMovementInput); + SubscribeLocalEvent(OnMovementInput); SubscribeNetworkEvent(OnCheckAutoGetUp); } @@ -42,7 +43,7 @@ public sealed class LayingDownSystem : SharedLayingDownSystem query.Dispose(); } - private void OnMovementInput(EntityUid uid, LayingDownComponent component, MoveEvent args) + private void OnMovementInput(EntityUid uid, LayingDownComponent component, MoveEventProxy args) { if (!_timing.IsFirstTimePredicted || !_standing.IsDown(uid) diff --git a/Content.Client/_Goobstation/Vehicles/VehicleSystem.cs b/Content.Client/_Goobstation/Vehicles/VehicleSystem.cs index 7ab1afd9a4..846ebeff97 100644 --- a/Content.Client/_Goobstation/Vehicles/VehicleSystem.cs +++ b/Content.Client/_Goobstation/Vehicles/VehicleSystem.cs @@ -1,4 +1,5 @@ using System.Numerics; +using Content.Shared._White; using Content.Shared.Vehicles; using Robust.Client.GameObjects; using Robust.Client.Graphics; @@ -15,7 +16,7 @@ public sealed class VehicleSystem : SharedVehicleSystem { base.Initialize(); SubscribeLocalEvent(OnAppearanceChange); - SubscribeLocalEvent(OnMove); + SubscribeLocalEvent(OnMove); } private void OnAppearanceChange(EntityUid uid, VehicleComponent comp, ref AppearanceChangeEvent args) @@ -27,7 +28,7 @@ public sealed class VehicleSystem : SharedVehicleSystem spriteComp.LayerSetAutoAnimated(0, animated); } - private void OnMove(EntityUid uid, VehicleComponent component, ref MoveEvent args) + private void OnMove(EntityUid uid, VehicleComponent component, ref MoveEventProxy args) { SpritePos(uid, component); } diff --git a/Content.Client/_White/AntiParkinsons/AntiParkinsonsRevertSystem.cs b/Content.Client/_White/AntiParkinsons/AntiParkinsonsRevertSystem.cs deleted file mode 100644 index ccd1c4a72b..0000000000 --- a/Content.Client/_White/AntiParkinsons/AntiParkinsonsRevertSystem.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Content.Shared._White; -using Content.Shared.CCVar; -using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using Robust.Client.Player; -using Robust.Shared.Configuration; -using Robust.Shared.Map; -using Robust.Shared.Player; -using Robust.Shared.Reflection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; - -namespace Content.Client._White.AntiParkinsons; - -// The following code is slightly esoteric and higly schizophrenic. You have been warned. - -#pragma warning disable RA0002 - -public sealed class AntiParkinsonsRevertSystem : EntitySystem -{ - [Dependency] private readonly IReflectionManager _refl = default!; - [Dependency] private readonly IEyeManager _eye = default!; - [Dependency] private readonly IPlayerManager _player = default!; - - - public override void Initialize() - { - UpdatesOutsidePrediction = true; - - // dnas tae - foreach (Type sys in _refl.GetAllChildren()) - { - if (sys.IsAbstract || sys == typeof(AntiParkinsonsRevertSystem)) - continue; - - UpdatesBefore.Add(sys); - } - } - - // dnas tae - public override void FrameUpdate(float frameTime) - { - var query = AllEntityQuery(); - - while (query.MoveNext(out var uid, out var ppComp)) - { - if (!TryComp(uid, out var eyeComp) || eyeComp.Eye == null) - continue; - - eyeComp.Eye.Position = PPCamHelper.CheckForChange(eyeComp.Eye.Position, ppComp.EyePositionModified, ppComp.EyePosition); - eyeComp.Eye.Offset = PPCamHelper.CheckForChange(eyeComp.Eye.Offset, ppComp.EyeOffsetModified, ppComp.EyeOffset); - eyeComp.Offset = eyeComp.Eye.Offset; - - if(TryComp(uid, out var sprite)) - sprite.Offset = PPCamHelper.CheckForChange(sprite.Offset, ppComp.SpriteOffsetModified, ppComp.SpriteOffset); - } - } -} - -#pragma warning restore RA0002 diff --git a/Content.Client/_White/AntiParkinsons/AntiParkinsonsSystem.cs b/Content.Client/_White/AntiParkinsons/AntiParkinsonsSystem.cs index f52e479d67..9a0b6ea151 100644 --- a/Content.Client/_White/AntiParkinsons/AntiParkinsonsSystem.cs +++ b/Content.Client/_White/AntiParkinsons/AntiParkinsonsSystem.cs @@ -1,25 +1,19 @@ +using Content.Client.Interaction; +using Content.Client.Outline; using Content.Shared._White; -using Content.Shared.CCVar; +using Robust.Client.Audio; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Player; using Robust.Shared.Configuration; -using Robust.Shared.Map; -using Robust.Shared.Player; +using Robust.Shared.Map.Components; using Robust.Shared.Reflection; -using System; -using System.Collections.Generic; -using System.Linq; using System.Numerics; -using System.Text; -using System.Threading.Tasks; +using System.Runtime.CompilerServices; +using DependencyAttribute = Robust.Shared.IoC.DependencyAttribute; namespace Content.Client._White.AntiParkinsons; -// The following code is slightly esoteric and higly schizophrenic. You have been warned. - -#pragma warning disable RA0002 - public sealed class AntiParkinsonsSystem : EntitySystem { [Dependency] private readonly IReflectionManager _refl = default!; @@ -29,135 +23,150 @@ public sealed class AntiParkinsonsSystem : EntitySystem [Dependency] private readonly SharedTransformSystem _transform = default!; - private bool _enabled = false; + bool _enabled = false; + bool _doingShit = false; + Vector2 _savedLocalPos; + EntityUid _modifiedEntity = EntityUid.Invalid; + Vector2 _modifiedLocalPos; + + public delegate void MoveEventHandlerProxy(ref MoveEventProxy ev); + public event MoveEventHandlerProxy? OnGlobalMoveEvent; + public override void Initialize() { UpdatesOutsidePrediction = true; _cfg.OnValueChanged(WhiteCVars.PixelSnapCamera, OnEnabledDisabled, true); - // eat sand - foreach(Type sys in _refl.GetAllChildren()) + UpdatesBefore.Add(typeof(EyeSystem)); // so that EyeSystem moves the eye to the spessman insead of moving it ourselves + UpdatesBefore.Add(typeof(AudioSystem)); // the rest is stuff that also updates after EyeSystem. + UpdatesBefore.Add(typeof(MidiSystem)); // Without this, the system update order fails to resolve. + UpdatesBefore.Add(typeof(InteractionOutlineSystem)); + UpdatesBefore.Add(typeof(DragDropSystem)); + + foreach (Type sys in _refl.GetAllChildren()) { - if (sys.IsAbstract || sys == typeof(AntiParkinsonsSystem)) + if (sys.IsAbstract || sys == typeof(AntiParkinsonsSystem) || UpdatesBefore.Contains(sys)) continue; UpdatesAfter.Add(sys); } - SubscribeLocalEvent(OnAttached); - SubscribeLocalEvent(OnDetached); + + _player.LocalPlayerAttached += OnPlayerAttached; + _player.LocalPlayerDetached += OnPlayerDetached; + _transform.OnGlobalMoveEvent += OnMoveEventGlobal; + } + + private void OnMoveEventGlobal(ref MoveEvent ev) + { + if (!_enabled || !_doingShit) + { + var evproxy = new MoveEventProxy(ev.Entity, ev.OldPosition, ev.NewPosition, ev.OldRotation, ev.NewRotation); + RaiseLocalEvent(ev.Sender, ref evproxy); + OnGlobalMoveEvent?.Invoke(ref evproxy); + } + } + + private void OnPlayerAttached(EntityUid ent) + { + + } + + private void OnPlayerDetached(EntityUid ent) + { + } private void OnEnabledDisabled(bool val) { _enabled = val; - if (_enabled) - { - if (_player.LocalEntity is not EntityUid player) - return; - - var ppComp = EnsureComp(player); - if (TryComp(player, out var eyeComp) && eyeComp.Eye != null) - { - ppComp.EyePosition = eyeComp.Eye.Position; - ppComp.EyePositionModified = eyeComp.Eye.Position; - ppComp.EyeOffset = eyeComp.Eye.Offset; - ppComp.EyeOffsetModified = eyeComp.Eye.Offset; - } - if (TryComp(player, out var sprite)) - ppComp.SpriteOffset = sprite.Offset; - - } - else - { - if (_player.LocalEntity is not EntityUid player || !TryComp(player, out var ppComp)) - return; - - if (TryComp(player, out var eyeComp) && eyeComp.Eye != null) - { - eyeComp.Eye.Position = ppComp.EyePosition; - eyeComp.Eye.Offset = ppComp.EyeOffset; - eyeComp.Offset = ppComp.EyeOffset; - } - - if (TryComp(player, out var sprite) && ppComp.SpriteOffset is System.Numerics.Vector2 orig) - sprite.Offset = orig; - - RemComp(player); - } - } - - private void OnAttached(LocalPlayerAttachedEvent args) - { - if (!_enabled) - return; - - EnsureComp(args.Entity); - } - - private void OnDetached(EntityUid uid, PixelSnapEyeComponent comp, LocalPlayerDetachedEvent args) - { - if (!_enabled) - return; - - if (TryComp(uid, out var eyeComp) && eyeComp.Eye != null) - { - eyeComp.Eye.Position = comp.EyePosition; - eyeComp.Eye.Offset = comp.EyeOffset; - eyeComp.Offset = comp.EyeOffset; - } - - if (TryComp(uid, out var sprite) && comp.SpriteOffset is System.Numerics.Vector2 orig) - sprite.Offset = orig; - - RemComp(uid); } public override void FrameUpdate(float frameTime) { - var query = AllEntityQuery(); - while (query.MoveNext(out var uid, out var ppComp)) + if (_player.LocalEntity is not EntityUid localEnt || !TryComp(localEnt, out var xform)) + return; + + if (!_enabled) + return; + + _modifiedEntity = localEnt; + var iterXform = xform; + while (!TerminatingOrDeleted(xform.ParentUid) && + !HasComp(xform.ParentUid) && + !HasComp(xform.ParentUid)) + xform = Transform(xform.ParentUid); + + _modifiedEntity = xform.Owner; + _savedLocalPos = xform.LocalPosition; + _modifiedLocalPos = _savedLocalPos; + + _doingShit = true; + // i really want to make sure that _doingShit doesn't get stuck on true for even a single frame, + // as that would result in ALL moveEvents being dropped on client. + try { - if (!TryComp(uid, out var eyeComp) || eyeComp.Eye == null) - continue; - - if (!TryComp(eyeComp.Target, out var xform)) - xform = Transform(uid); - - if (xform.GridUid.HasValue && xform.GridUid.Value.IsValid()) - ppComp.LastParent = xform.GridUid.Value; - else - if (!ppComp.LastParent.IsValid()) - ppComp.LastParent = xform.ParentUid; // fallback to whatever parent we have (in this case this will probably end up being the map) - - var vec = xform.LocalPosition; - var offset = Vector2.Zero; - - ppComp.EyePosition = eyeComp.Eye.Position; - ppComp.EyeOffset = eyeComp.Eye.Offset; - - var eyePos = PPCamHelper.WorldPosPixelRoundToParent(eyeComp.Eye.Position.Position, ppComp.LastParent, _transform); - var eyeOffset = PPCamHelper.WorldPosPixelRoundToParent(eyeComp.Eye.Offset, ppComp.LastParent, _transform); - //var eyePosDiff = eyePos - eyeComp.Eye.Position.Position; - - eyeComp.Eye.Position = new(eyePos, xform.MapID); - eyeComp.Eye.Offset = eyeOffset; - eyeComp.Offset = eyeOffset; - - ppComp.EyePositionModified = eyeComp.Eye.Position; - ppComp.EyeOffsetModified = eyeComp.Eye.Offset; - - if (!TryComp(uid, out var sprite)) - continue; - - ppComp.SpriteOffset = sprite.Offset; - - var (_, diff) = PPCamHelper.WorldPosPixelRoundToParentWithDiff(xform.WorldPosition, ppComp.LastParent, _transform); - sprite.Offset += diff; - ppComp.SpriteOffsetModified = sprite.Offset; + const int roundFactor = EyeManager.PixelsPerMeter; + _modifiedLocalPos = RoundVec(_savedLocalPos); + xform.LocalPosition = _modifiedLocalPos; + _eye.CurrentEye.Offset = RoundVec(_eye.CurrentEye.Offset); + } + catch (Exception e) { throw; } + finally + { + _doingShit = false; } } + + public void FrameUpdateRevert() + { + if (!_enabled || _player.LocalEntity is not EntityUid localEnt || !TryComp(_modifiedEntity, out var modifiedXform)) + return; + + // if this is true, then our localpos was updated outside the system Update() loop, + // probably after a server state was applied. In that case, keep the new value + // instead of reverting to the old one. + if (modifiedXform.LocalPosition != _modifiedLocalPos) + return; + + _doingShit = true; + try + { + modifiedXform.LocalPosition = _savedLocalPos; + } + catch (Exception e) { throw; } + finally + { + _doingShit = false; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private Vector2 RoundVec(Vector2 vec) => Vector2.Round((vec) * EyeManager.PixelsPerMeter) / EyeManager.PixelsPerMeter; } -#pragma warning restore RA0002 +public sealed class AntiParkinsonsRevertSystem : EntitySystem +{ + [Dependency] private readonly IReflectionManager _refl = default!; + [Dependency] private readonly AntiParkinsonsSystem _parkinsons = default!; + + + public override void Initialize() + { + UpdatesOutsidePrediction = true; + + foreach (Type sys in _refl.GetAllChildren()) + { + if (sys.IsAbstract || sys == typeof(AntiParkinsonsRevertSystem)) + continue; + + UpdatesBefore.Add(sys); + } + } + + public override void FrameUpdate(float frameTime) + { + _parkinsons.FrameUpdateRevert(); + } +} diff --git a/Content.Client/_White/AntiParkinsons/PPCamHelper.cs b/Content.Client/_White/AntiParkinsons/PPCamHelper.cs deleted file mode 100644 index a3d20ede46..0000000000 --- a/Content.Client/_White/AntiParkinsons/PPCamHelper.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Content.Shared._White; -using Content.Shared.CCVar; -using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using Robust.Client.Player; -using Robust.Shared.Configuration; -using Robust.Shared.Map; -using Robust.Shared.Player; -using Robust.Shared.Reflection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; - -namespace Content.Client._White.AntiParkinsons; - -public static class PPCamHelper -{ - private static int roundFactor => EyeManager.PixelsPerMeter; - - public static Vector2 RoundXY(Vector2 vec) => new Vector2(MathF.Round(vec.X * roundFactor) / roundFactor, MathF.Round(vec.Y * roundFactor) / roundFactor); - - /// - /// Translates world vector into local (to parent) vector, rounds it to a 1 over and translates back to world space. - /// - /// - /// - /// - public static Vector2 WorldPosPixelRoundToParent(Vector2 worldPos, EntityUid parent, SharedTransformSystem xformSystem) - { - var (_, _, mat, invmat) = xformSystem.GetWorldPositionRotationMatrixWithInv(parent); - Vector2 localSpacePos = Vector2.Transform(worldPos, invmat); - localSpacePos = RoundXY(localSpacePos); - Vector2 worldRoundedPos = Vector2.Transform(localSpacePos, mat); - return worldRoundedPos; - } - - public static (Vector2 roundedWorldPos, Vector2 LocalSpaceDiff) WorldPosPixelRoundToParentWithDiff(Vector2 worldPos, EntityUid parent, SharedTransformSystem xformSystem) - { - var (_, _, mat, invmat) = xformSystem.GetWorldPositionRotationMatrixWithInv(parent); - Vector2 localSpacePos = Vector2.Transform(worldPos, invmat); - var roundedLocalSpacePos = RoundXY(localSpacePos); - Vector2 worldRoundedPos = Vector2.Transform(localSpacePos, mat); - return (worldRoundedPos, roundedLocalSpacePos - localSpacePos); - } - - public static T CheckForChange(T currentValue, T modifiedValue, T originalValue) where T : IEquatable - { - // if this is false, this means that the value tracked was changed outside - // of the engine's FrameUpdate loop, and this change should be preserved. - if (currentValue.Equals(modifiedValue)) - return originalValue; - return currentValue; - } -} diff --git a/Content.Client/_White/AntiParkinsons/PixelSnapEyeComponent.cs b/Content.Client/_White/AntiParkinsons/PixelSnapEyeComponent.cs deleted file mode 100644 index c41c765c18..0000000000 --- a/Content.Client/_White/AntiParkinsons/PixelSnapEyeComponent.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Content.Shared._White; -using Content.Shared.CCVar; -using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using Robust.Client.Player; -using Robust.Shared.Configuration; -using Robust.Shared.Map; -using Robust.Shared.Player; -using Robust.Shared.Reflection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; - -namespace Content.Client._White.AntiParkinsons; - -[RegisterComponent] -[UnsavedComponent] -public sealed partial class PixelSnapEyeComponent : Component -{ - [ViewVariables(VVAccess.ReadWrite)] - public EntityUid LastParent; - [ViewVariables(VVAccess.ReadWrite)] - public System.Numerics.Vector2 SpriteOffset, SpriteOffsetModified; - [ViewVariables(VVAccess.ReadWrite)] - public MapCoordinates EyePosition, EyePositionModified; - [ViewVariables(VVAccess.ReadWrite)] - public System.Numerics.Vector2 EyeOffset, EyeOffsetModified; - -} diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index 3f3373ed2d..05a04786a8 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -240,7 +240,7 @@ namespace Content.Server.Administration.Systems var mobUid = _spawning.SpawnPlayerMob(coords.Value, null, profile, stationUid); var targetMind = _mindSystem.GetMind(args.Target); - if (targetMind != null) + if (targetMind != null) // AGHOSTS DON'T HAVE A FUCKING MINDDDDD { _mindSystem.TransferTo(targetMind.Value, mobUid); } diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index cd07da7112..9393260fd0 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Atmos.Components; using Content.Server.Explosion.EntitySystems; +using Content.Shared._White; using Content.Shared.Atmos; using JetBrains.Annotations; using Robust.Shared.Map.Components; @@ -20,7 +21,7 @@ namespace Content.Server.Atmos.EntitySystems SubscribeLocalEvent(OnAirtightShutdown); SubscribeLocalEvent(OnAirtightPositionChanged); SubscribeLocalEvent(OnAirtightReAnchor); - SubscribeLocalEvent(OnAirtightMoved); + SubscribeLocalEvent(OnAirtightMoved); } private void OnAirtightInit(Entity airtight, ref ComponentInit args) @@ -81,7 +82,7 @@ namespace Content.Server.Atmos.EntitySystems } } - private void OnAirtightMoved(Entity ent, ref MoveEvent ev) + private void OnAirtightMoved(Entity ent, ref MoveEventProxy ev) { var (owner, airtight) = ent; airtight.CurrentAirBlockedDirection = (int) Rotate((AtmosDirection)airtight.InitialAirBlockedDirection, ev.NewRotation); diff --git a/Content.Server/Entry/IgnoredComponents.cs b/Content.Server/Entry/IgnoredComponents.cs index 571ea589a4..13d7f6a600 100644 --- a/Content.Server/Entry/IgnoredComponents.cs +++ b/Content.Server/Entry/IgnoredComponents.cs @@ -21,7 +21,6 @@ namespace Content.Server.Entry "HolidayRsiSwap", "OptionsVisualizer", "ToggleableLightWieldable", // Goobstation - "PixelSnapEye", // WWDP EDIT "DollyMixture", // WWDP EDIT "ItemSlotRenderer", // WWDP EDIT }; diff --git a/Content.Server/FootPrint/FootPrintsSystem.cs b/Content.Server/FootPrint/FootPrintsSystem.cs index 72ca307884..ed16659892 100644 --- a/Content.Server/FootPrint/FootPrintsSystem.cs +++ b/Content.Server/FootPrint/FootPrintsSystem.cs @@ -11,6 +11,7 @@ using Robust.Shared.Map; using Robust.Shared.Physics.Components; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using Content.Shared._White; namespace Content.Server.FootPrint; @@ -37,7 +38,7 @@ public sealed class FootPrintsSystem : EntitySystem _standingStateQuery = GetEntityQuery(); SubscribeLocalEvent(OnStartupComponent); - SubscribeLocalEvent(OnMove); + SubscribeLocalEvent(OnMove); SubscribeLocalEvent(OnGetState); } @@ -51,7 +52,7 @@ public sealed class FootPrintsSystem : EntitySystem component.StepSize = Math.Max(0f, component.StepSize + _random.NextFloat(-0.05f, 0.05f)); } - private void OnMove(EntityUid uid, FootPrintsComponent component, ref MoveEvent args) + private void OnMove(EntityUid uid, FootPrintsComponent component, ref MoveEventProxy args) { if (TerminatingOrDeleted(uid) || component.ContainedSolution.Volume <= 0 diff --git a/Content.Server/Guardian/GuardianSystem.cs b/Content.Server/Guardian/GuardianSystem.cs index 6154d586a3..626e74d2eb 100644 --- a/Content.Server/Guardian/GuardianSystem.cs +++ b/Content.Server/Guardian/GuardianSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Body.Systems; using Content.Server.Popups; +using Content.Shared._White; using Content.Shared.Actions; using Content.Shared.Audio; using Content.Shared.Damage; @@ -45,13 +46,13 @@ namespace Content.Server.Guardian SubscribeLocalEvent(OnDoAfter); SubscribeLocalEvent(OnGuardianShutdown); - SubscribeLocalEvent(OnGuardianMove); + SubscribeLocalEvent(OnGuardianMove); SubscribeLocalEvent(OnGuardianDamaged); SubscribeLocalEvent(OnGuardianPlayerAttached); SubscribeLocalEvent(OnGuardianPlayerDetached); SubscribeLocalEvent(OnHostInit); - SubscribeLocalEvent(OnHostMove); + SubscribeLocalEvent(OnHostMove); SubscribeLocalEvent(OnHostStateChange); SubscribeLocalEvent(OnHostShutdown); @@ -285,7 +286,7 @@ namespace Content.Server.Guardian /// /// Called every time the host moves, to make sure the distance between the host and the guardian isn't too far /// - private void OnHostMove(EntityUid uid, GuardianHostComponent component, ref MoveEvent args) + private void OnHostMove(EntityUid uid, GuardianHostComponent component, ref MoveEventProxy args) { if (!TryComp(component.HostedGuardian, out GuardianComponent? guardianComponent) || !guardianComponent.GuardianLoose) @@ -299,7 +300,7 @@ namespace Content.Server.Guardian /// /// Called every time the guardian moves: makes sure it's not out of it's allowed distance /// - private void OnGuardianMove(EntityUid uid, GuardianComponent component, ref MoveEvent args) + private void OnGuardianMove(EntityUid uid, GuardianComponent component, ref MoveEventProxy args) { if (!component.GuardianLoose || component.Host == null) return; diff --git a/Content.Server/Movement/Systems/LagCompensationSystem.cs b/Content.Server/Movement/Systems/LagCompensationSystem.cs index 8496a8a9b9..880b7bb0cb 100644 --- a/Content.Server/Movement/Systems/LagCompensationSystem.cs +++ b/Content.Server/Movement/Systems/LagCompensationSystem.cs @@ -1,4 +1,5 @@ using Content.Server.Movement.Components; +using Content.Shared._White; using Robust.Server.Player; using Robust.Shared.Map; using Robust.Shared.Player; @@ -22,7 +23,7 @@ public sealed class LagCompensationSystem : EntitySystem { base.Initialize(); Log.Level = LogLevel.Info; - SubscribeLocalEvent(OnLagMove); + SubscribeLocalEvent(OnLagMove); } public override void Update(float frameTime) @@ -51,7 +52,7 @@ public sealed class LagCompensationSystem : EntitySystem } } - private void OnLagMove(EntityUid uid, LagCompensationComponent component, ref MoveEvent args) + private void OnLagMove(EntityUid uid, LagCompensationComponent component, ref MoveEventProxy args) { if (!args.NewPosition.EntityId.IsValid()) return; // probably being sent to nullspace for deletion. diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs index 35122e3e62..926d7e232e 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs @@ -2,7 +2,9 @@ using System.Diagnostics.CodeAnalysis; using System.Numerics; using System.Threading; using System.Threading.Tasks; +using Content.Server._White; using Content.Server.Destructible; +using Content.Shared._White; using Content.Shared.Access.Components; using Content.Shared.Climbing.Components; using Content.Shared.Doors.Components; @@ -49,7 +51,7 @@ public sealed partial class PathfindingSystem SubscribeLocalEvent(OnCollisionLayerChange); SubscribeLocalEvent(OnBodyTypeChange); SubscribeLocalEvent(OnTileChange); - _transform.OnGlobalMoveEvent += OnMoveEvent; + _stab.OnGlobalMoveEvent += OnMoveEvent; } private void OnTileChange(ref TileChangedEvent ev) @@ -269,7 +271,7 @@ public sealed partial class PathfindingSystem } } - private void OnMoveEvent(ref MoveEvent ev) + private void OnMoveEvent(ref MoveEventProxy ev) { if (!_fixturesQuery.TryGetComponent(ev.Sender, out var fixtures) || !IsBodyRelevant(fixtures) || diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs index af9c44a1ef..f0b4aa2c60 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Numerics; using System.Threading; using System.Threading.Tasks; +using Content.Server._White; using Content.Server.Administration.Managers; using Content.Server.Destructible; using Content.Server.NPC.Systems; @@ -52,6 +53,7 @@ namespace Content.Server.NPC.Pathfinding [Dependency] private readonly SharedMapSystem _maps = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; + [Dependency] private readonly MoveEventProxyPassthroughSystem _stab = default!; private readonly Dictionary _subscribedSessions = new(); @@ -98,7 +100,7 @@ namespace Content.Server.NPC.Pathfinding base.Shutdown(); _subscribedSessions.Clear(); _playerManager.PlayerStatusChanged -= OnPlayerChange; - _transform.OnGlobalMoveEvent -= OnMoveEvent; + _stab.OnGlobalMoveEvent -= OnMoveEvent; } public override void Update(float frameTime) diff --git a/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs b/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs index c0603949be..fd2be4fa45 100644 --- a/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs +++ b/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Content.Server.NodeContainer.NodeGroups; using Content.Server.NodeContainer.Nodes; +using Content.Shared._White; using Content.Shared.Examine; using JetBrains.Annotations; @@ -25,7 +26,7 @@ namespace Content.Server.NodeContainer.EntitySystems SubscribeLocalEvent(OnShutdownEvent); SubscribeLocalEvent(OnAnchorStateChanged); SubscribeLocalEvent(OnReAnchor); - SubscribeLocalEvent(OnMoveEvent); + SubscribeLocalEvent(OnMoveEvent); SubscribeLocalEvent(OnExamine); _query = GetEntityQuery(); @@ -174,7 +175,7 @@ namespace Content.Server.NodeContainer.EntitySystems } } - private void OnMoveEvent(EntityUid uid, NodeContainerComponent container, ref MoveEvent ev) + private void OnMoveEvent(EntityUid uid, NodeContainerComponent container, ref MoveEventProxy ev) { if (ev.NewRotation == ev.OldRotation) { diff --git a/Content.Server/NodeContainer/Nodes/IRotatableNode.cs b/Content.Server/NodeContainer/Nodes/IRotatableNode.cs index 38b6dbdf19..d56691bff6 100644 --- a/Content.Server/NodeContainer/Nodes/IRotatableNode.cs +++ b/Content.Server/NodeContainer/Nodes/IRotatableNode.cs @@ -1,3 +1,5 @@ +using Content.Shared._White; + namespace Content.Server.NodeContainer.Nodes { /// @@ -9,6 +11,6 @@ namespace Content.Server.NodeContainer.Nodes /// /// Rotates this . Returns true if the node's connections need to be updated. /// - bool RotateNode(in MoveEvent ev); + bool RotateNode(in MoveEventProxy ev); } } diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs index 6914d98583..c66cf235e3 100644 --- a/Content.Server/NodeContainer/Nodes/PipeNode.cs +++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs @@ -1,6 +1,7 @@ using Content.Server.Atmos; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.NodeGroups; +using Content.Shared._White; using Content.Shared.Atmos; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -113,7 +114,7 @@ namespace Content.Server.NodeContainer.Nodes CurrentPipeDirection = OriginalPipeDirection.RotatePipeDirection(xform.LocalRotation); } - bool IRotatableNode.RotateNode(in MoveEvent ev) + bool IRotatableNode.RotateNode(in MoveEventProxy ev) { if (OriginalPipeDirection == PipeDirection.Fourway) return false; diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs index 99bb0d5cbd..0ba722649c 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Numerics; using Content.Server.ParticleAccelerator.Components; +using Content.Shared._White; using JetBrains.Annotations; using Robust.Shared.Map.Components; using Robust.Shared.Physics.Events; @@ -14,7 +15,7 @@ public sealed partial class ParticleAcceleratorSystem private void InitializePartSystem() { SubscribeLocalEvent(OnComponentShutdown); - SubscribeLocalEvent(OnMoveEvent); + SubscribeLocalEvent(OnMoveEvent); SubscribeLocalEvent(BodyTypeChanged); } @@ -167,7 +168,7 @@ public sealed partial class ParticleAcceleratorSystem RescanParts(comp.Master!.Value); } - private void OnMoveEvent(EntityUid uid, ParticleAcceleratorPartComponent comp, ref MoveEvent args) + private void OnMoveEvent(EntityUid uid, ParticleAcceleratorPartComponent comp, ref MoveEventProxy args) { if (EntityManager.EntityExists(comp.Master)) RescanParts(comp.Master!.Value); diff --git a/Content.Server/Shuttles/Systems/ThrusterSystem.cs b/Content.Server/Shuttles/Systems/ThrusterSystem.cs index 30c6cf6e37..78268c22cd 100644 --- a/Content.Server/Shuttles/Systems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/Systems/ThrusterSystem.cs @@ -21,6 +21,7 @@ using Robust.Shared.Timing; using Robust.Shared.Utility; using Content.Shared.Localizations; using Content.Shared.Power; +using Content.Shared._White; namespace Content.Server.Shuttles.Systems; @@ -47,7 +48,7 @@ public sealed class ThrusterSystem : EntitySystem SubscribeLocalEvent(OnThrusterShutdown); SubscribeLocalEvent(OnPowerChange); SubscribeLocalEvent(OnAnchorChange); - SubscribeLocalEvent(OnRotate); + SubscribeLocalEvent(OnRotate); SubscribeLocalEvent(OnIsHotEvent); SubscribeLocalEvent(OnStartCollide); SubscribeLocalEvent(OnEndCollide); @@ -154,7 +155,7 @@ public sealed class ThrusterSystem : EntitySystem /// /// If the thruster rotates change the direction where the linear thrust is applied /// - private void OnRotate(EntityUid uid, ThrusterComponent component, ref MoveEvent args) + private void OnRotate(EntityUid uid, ThrusterComponent component, ref MoveEventProxy args) { // TODO: Disable visualizer for old direction // TODO: Don't make them rotatable and make it require anchoring. diff --git a/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs b/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs index 47ee6f6214..1c65753004 100644 --- a/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs +++ b/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs @@ -1,8 +1,9 @@ -using System.Linq; +using System.Linq; using System.Numerics; using Content.Server.Worldgen.Components; using Content.Server.Worldgen.Components.Debris; using Content.Server.Worldgen.Tools; +using Content.Shared._White; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Map; @@ -33,7 +34,7 @@ public sealed class DebrisFeaturePlacerSystem : BaseWorldSystem SubscribeLocalEvent(OnChunkLoaded); SubscribeLocalEvent(OnChunkUnloaded); SubscribeLocalEvent(OnDebrisShutdown); - SubscribeLocalEvent(OnDebrisMove); + SubscribeLocalEvent(OnDebrisMove); SubscribeLocalEvent( OnTryGetPlacableDebrisEvent); } @@ -41,7 +42,7 @@ public sealed class DebrisFeaturePlacerSystem : BaseWorldSystem /// /// Handles debris moving, and making sure it stays parented to a chunk for loading purposes. /// - private void OnDebrisMove(EntityUid uid, OwnedDebrisComponent component, ref MoveEvent args) + private void OnDebrisMove(EntityUid uid, OwnedDebrisComponent component, ref MoveEventProxy args) { if (!HasComp(component.OwningController)) return; // Redundant logic, prolly needs it's own handler for your custom system. diff --git a/Content.Server/_White/MoveEventProxyPassthroughSystem.cs b/Content.Server/_White/MoveEventProxyPassthroughSystem.cs new file mode 100644 index 0000000000..8375c2956e --- /dev/null +++ b/Content.Server/_White/MoveEventProxyPassthroughSystem.cs @@ -0,0 +1,28 @@ +using Content.Shared._White; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Content.Server._White; + +public sealed class MoveEventProxyPassthroughSystem : EntitySystem +{ + [Dependency] private readonly SharedTransformSystem _transform = default!; + + public delegate void MoveEventHandlerProxy(ref MoveEventProxy ev); + public event MoveEventHandlerProxy? OnGlobalMoveEvent; + + public override void Initialize() + { + _transform.OnGlobalMoveEvent += OnMoveEventGlobal; + } + + private void OnMoveEventGlobal(ref MoveEvent ev) + { + var evproxy = new MoveEventProxy(ev.Entity, ev.OldPosition, ev.NewPosition, ev.OldRotation, ev.NewRotation); + RaiseLocalEvent(ev.Sender, ref evproxy); + OnGlobalMoveEvent?.Invoke(ref evproxy); + } +} diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index c992f442e2..952a648020 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Numerics; +using Content.Shared._White; using Content.Shared.Alert; using Content.Shared.Buckle.Components; using Content.Shared.Cuffs.Components; @@ -36,7 +37,7 @@ public abstract partial class SharedBuckleSystem private void InitializeBuckle() { SubscribeLocalEvent(OnBuckleComponentShutdown); - SubscribeLocalEvent(OnBuckleMove); + SubscribeLocalEvent(OnBuckleMove); SubscribeLocalEvent(OnParentChanged); SubscribeLocalEvent(OnInserted); @@ -93,7 +94,7 @@ public abstract partial class SharedBuckleSystem BuckleTransformCheck(ent, Transform(ent)); } - private void OnBuckleMove(Entity ent, ref MoveEvent ev) + private void OnBuckleMove(Entity ent, ref MoveEventProxy ev) { BuckleTransformCheck(ent, ev.Component); } diff --git a/Content.Shared/Chasm/ChasmSystem.cs b/Content.Shared/Chasm/ChasmSystem.cs index 8322afc292..26ead793fe 100644 --- a/Content.Shared/Chasm/ChasmSystem.cs +++ b/Content.Shared/Chasm/ChasmSystem.cs @@ -1,4 +1,4 @@ -using Content.Shared.ActionBlocker; +using Content.Shared.ActionBlocker; using Content.Shared.Buckle.Components; using Content.Shared.Movement.Events; using Content.Shared.StepTrigger.Systems; diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Relay.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Relay.cs index ac49a3e96f..579aeb4f90 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Relay.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Relay.cs @@ -1,3 +1,4 @@ +using Content.Shared._White; using Content.Shared.Hands.Components; using Content.Shared.MouseRotator; using Content.Shared.Movement.Systems; @@ -9,7 +10,7 @@ public abstract partial class SharedHandsSystem private void InitializeRelay() { SubscribeLocalEvent(RelayEvent); - SubscribeLocalEvent(RelayMoveEvent); // WWDP EDIT + SubscribeLocalEvent(RelayMoveEvent); // WWDP EDIT } private void RelayEvent(Entity entity, ref T args) where T : EntityEventArgs @@ -22,7 +23,7 @@ public abstract partial class SharedHandsSystem } //WWDP EDIT START - private void RelayMoveEvent(EntityUid uid, HandsComponent comp, ref MoveEvent args) + private void RelayMoveEvent(EntityUid uid, HandsComponent comp, ref MoveEventProxy args) { var ev = new HolderMoveEvent(args); foreach (var itemUid in EnumerateHeld(uid, comp)) @@ -36,7 +37,7 @@ public abstract partial class SharedHandsSystem // WWDP STUFF I GUESS [ByRefEvent] -public readonly struct HolderMoveEvent(MoveEvent ev) +public readonly struct HolderMoveEvent(MoveEventProxy ev) { - public readonly MoveEvent Ev = ev; + public readonly MoveEventProxy Ev = ev; } diff --git a/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs b/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs index 7f9a0a8b56..5c6785ec5d 100644 --- a/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs +++ b/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs @@ -1,4 +1,4 @@ -using Content.Shared.ActionBlocker; +using Content.Shared.ActionBlocker; using Content.Shared.Bed.Sleep; using Content.Shared.Buckle.Components; using Content.Shared.CCVar; diff --git a/Content.Shared/Movement/Systems/MovementIgnoreGravitySystem.cs b/Content.Shared/Movement/Systems/MovementIgnoreGravitySystem.cs index 52cdf219e5..8727b80879 100644 --- a/Content.Shared/Movement/Systems/MovementIgnoreGravitySystem.cs +++ b/Content.Shared/Movement/Systems/MovementIgnoreGravitySystem.cs @@ -1,4 +1,4 @@ -using Content.Shared.Movement.Components; +using Content.Shared.Movement.Components; using Content.Shared.Movement.Events; using Robust.Shared.GameStates; diff --git a/Content.Shared/OfferItem/SharedOfferItemSystem.cs b/Content.Shared/OfferItem/SharedOfferItemSystem.cs index 27592a38a9..d4a1193676 100644 --- a/Content.Shared/OfferItem/SharedOfferItemSystem.cs +++ b/Content.Shared/OfferItem/SharedOfferItemSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Interaction; using Content.Shared.IdentityManagement; using Content.Shared.Hands.Components; +using Content.Shared._White; namespace Content.Shared.OfferItem; @@ -11,7 +12,7 @@ public abstract partial class SharedOfferItemSystem : EntitySystem public override void Initialize() { SubscribeLocalEvent(SetInReceiveMode); - SubscribeLocalEvent(OnMove); + SubscribeLocalEvent(OnMove); InitializeInteractions(); } @@ -48,7 +49,7 @@ public abstract partial class SharedOfferItemSystem : EntitySystem args.Handled = true; } - private void OnMove(EntityUid uid, OfferItemComponent component, MoveEvent args) + private void OnMove(EntityUid uid, OfferItemComponent component, MoveEventProxy args) { if (component.Target == null || args.NewPosition.InRange(EntityManager, _transform, diff --git a/Content.Shared/Stealth/SharedStealthSystem.cs b/Content.Shared/Stealth/SharedStealthSystem.cs index e66a36f741..2b5b1b55a2 100644 --- a/Content.Shared/Stealth/SharedStealthSystem.cs +++ b/Content.Shared/Stealth/SharedStealthSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared._White; using Content.Shared.Examine; using Content.Shared.Interaction.Events; using Content.Shared.Mobs; @@ -20,7 +21,7 @@ public abstract class SharedStealthSystem : EntitySystem SubscribeLocalEvent(OnStealthGetState); SubscribeLocalEvent(OnStealthHandleState); - SubscribeLocalEvent(OnMove); + SubscribeLocalEvent(OnMove); SubscribeLocalEvent(OnGetVisibilityModifiers); SubscribeLocalEvent(OnPaused); SubscribeLocalEvent(OnUnpaused); @@ -118,7 +119,7 @@ public abstract class SharedStealthSystem : EntitySystem component.MaxVisibility = cast.MaxVisibility; // Shitmed Change } - private void OnMove(EntityUid uid, StealthOnMoveComponent component, ref MoveEvent args) + private void OnMove(EntityUid uid, StealthOnMoveComponent component, ref MoveEventProxy args) { if (_timing.ApplyingState) return; diff --git a/Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs b/Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs index 4556d8ee99..0c4bd83a92 100644 --- a/Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs +++ b/Content.Shared/Traits/Assorted/Systems/LegsParalyzedSystem.cs @@ -1,4 +1,4 @@ -using Content.Shared.Body.Systems; +using Content.Shared.Body.Systems; using Content.Shared.Buckle.Components; using Content.Shared.Movement.Events; using Content.Shared.Movement.Systems; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 0d4d458b80..fb035397df 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -112,7 +112,7 @@ public abstract partial class SharedGunSystem : EntitySystem { if (Timing.ApplyingState) return; - MoveEvent args = _args.Ev; + var args = _args.Ev; double posDiff = 0; if (!args.ParentChanged) posDiff = (args.OldPosition.Position - args.NewPosition.Position).Length(); diff --git a/Content.Shared/_White/Animations/SharedWaddleAnimationSystem.cs b/Content.Shared/_White/Animations/SharedWaddleAnimationSystem.cs index 852b2241fd..325e6b6124 100644 --- a/Content.Shared/_White/Animations/SharedWaddleAnimationSystem.cs +++ b/Content.Shared/_White/Animations/SharedWaddleAnimationSystem.cs @@ -18,10 +18,10 @@ public abstract class SharedWaddleAnimationSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnMovementInput); + SubscribeLocalEvent(OnMovementInput); } - private void OnMovementInput(EntityUid uid, WaddleAnimationComponent component, MoveEvent args) + private void OnMovementInput(EntityUid uid, WaddleAnimationComponent component, MoveEventProxy args) { if (_standingState.IsDown(uid) || _gravity.IsWeightless(uid) diff --git a/Content.Shared/_White/MoveEventProxy.cs b/Content.Shared/_White/MoveEventProxy.cs new file mode 100644 index 0000000000..a584ca968f --- /dev/null +++ b/Content.Shared/_White/MoveEventProxy.cs @@ -0,0 +1,28 @@ +using Robust.Shared.Map; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Content.Shared._White; + +[ByRefEvent] +public readonly struct MoveEventProxy( + Entity entity, + EntityCoordinates oldPos, + EntityCoordinates newPos, + Angle oldRotation, + Angle newRotation) +{ + public readonly Entity Entity = entity; + public readonly EntityCoordinates OldPosition = oldPos; + public readonly EntityCoordinates NewPosition = newPos; + public readonly Angle OldRotation = oldRotation; + public readonly Angle NewRotation = newRotation; + + public EntityUid Sender => Entity.Owner; + public TransformComponent Component => Entity.Comp1; + + public bool ParentChanged => NewPosition.EntityId != OldPosition.EntityId; +}