diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index 9133343b82..99054cd2d0 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -19,7 +19,7 @@ namespace Content.Server.Atmos.EntitySystems SubscribeLocalEvent(OnAirtightShutdown); SubscribeLocalEvent(OnAirtightPositionChanged); SubscribeLocalEvent(OnAirtightReAnchor); - SubscribeLocalEvent(OnAirtightRotated); + SubscribeLocalEvent(OnAirtightRotated); } private void OnAirtightInit(EntityUid uid, AirtightComponent airtight, ComponentInit args) @@ -28,8 +28,8 @@ namespace Content.Server.Atmos.EntitySystems if (airtight.FixAirBlockedDirectionInitialize) { - var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, xform.LocalRotation, xform); - OnAirtightRotated(uid, airtight, ref rotateEvent); + var moveEvent = new MoveEvent(airtight.Owner, default, default, Angle.Zero, xform.LocalRotation, xform, false); + OnAirtightRotated(uid, airtight, ref moveEvent); } // Adding this component will immediately anchor the entity, because the atmos system @@ -79,13 +79,13 @@ namespace Content.Server.Atmos.EntitySystems } } - private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, ref RotateEvent ev) + private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, ref MoveEvent ev) { if (!airtight.RotateAirBlocked || airtight.InitialAirBlockedDirection == (int)AtmosDirection.Invalid) return; airtight.CurrentAirBlockedDirection = (int) Rotate((AtmosDirection)airtight.InitialAirBlockedDirection, ev.NewRotation); - UpdatePosition(airtight); + UpdatePosition(airtight, ev.Component); RaiseLocalEvent(uid, new AirtightChanged(airtight), true); } diff --git a/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs b/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs index cdc1478f4c..c3d3231c92 100644 --- a/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs +++ b/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs @@ -23,7 +23,7 @@ namespace Content.Server.NodeContainer.EntitySystems SubscribeLocalEvent(OnShutdownEvent); SubscribeLocalEvent(OnAnchorStateChanged); SubscribeLocalEvent(OnReAnchor); - SubscribeLocalEvent(OnRotateEvent); + SubscribeLocalEvent(OnMoveEvent); SubscribeLocalEvent(OnExamine); } @@ -81,14 +81,14 @@ namespace Content.Server.NodeContainer.EntitySystems } } - private void OnRotateEvent(EntityUid uid, NodeContainerComponent container, ref RotateEvent ev) + private void OnMoveEvent(EntityUid uid, NodeContainerComponent container, ref MoveEvent ev) { if (ev.NewRotation == ev.OldRotation) { return; } - var xform = Transform(uid); + var xform = ev.Component; foreach (var node in container.Nodes.Values) { @@ -99,7 +99,7 @@ namespace Content.Server.NodeContainer.EntitySystems if (!node.Connectable(EntityManager, xform)) continue; - if (rotatableNode.RotateEvent(ref ev)) + if (rotatableNode.RotateNode(in ev)) _nodeGroupSystem.QueueReflood(node); } } diff --git a/Content.Server/NodeContainer/Nodes/IRotatableNode.cs b/Content.Server/NodeContainer/Nodes/IRotatableNode.cs index a4468af09e..38b6dbdf19 100644 --- a/Content.Server/NodeContainer/Nodes/IRotatableNode.cs +++ b/Content.Server/NodeContainer/Nodes/IRotatableNode.cs @@ -1,7 +1,7 @@ -namespace Content.Server.NodeContainer.Nodes +namespace Content.Server.NodeContainer.Nodes { /// - /// A that implements this will have its called when its + /// A that implements this will have its called when its /// is rotated. /// public interface IRotatableNode @@ -9,6 +9,6 @@ /// /// Rotates this . Returns true if the node's connections need to be updated. /// - bool RotateEvent(ref RotateEvent ev); + bool RotateNode(in MoveEvent ev); } } diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs index 8fa33dd44f..ddd046c928 100644 --- a/Content.Server/NodeContainer/Nodes/PipeNode.cs +++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs @@ -114,7 +114,7 @@ namespace Content.Server.NodeContainer.Nodes CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(xform.LocalRotation); } - bool IRotatableNode.RotateEvent(ref RotateEvent ev) + bool IRotatableNode.RotateNode(in MoveEvent ev) { if (_originalPipeDirection == PipeDirection.Fourway) return false; diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs index d3ea1553ed..2867e3317a 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs @@ -662,7 +662,7 @@ namespace Content.Server.ParticleAccelerator.Components appearanceComponent.SetData(ParticleAcceleratorVisuals.VisualState, state); } - public override void Rotated() + public override void Moved() { // We rotate OURSELVES when scanning for parts, so don't actually run rescan on rotate. // That would be silly. diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs index 0ce47a538e..fe73f1c961 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs @@ -29,7 +29,7 @@ namespace Content.Server.ParticleAccelerator.Components Master?.RescanParts(); } - public virtual void Rotated() + public virtual void Moved() { RescanIfPossible(); } diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs index 771d2a2d9a..62fe92c3fc 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs @@ -1,4 +1,4 @@ -using Content.Server.ParticleAccelerator.Components; +using Content.Server.ParticleAccelerator.Components; using JetBrains.Annotations; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; @@ -10,7 +10,7 @@ namespace Content.Server.ParticleAccelerator.EntitySystems { private void InitializePartSystem() { - SubscribeLocalEvent(OnRotateEvent); + SubscribeLocalEvent(OnMoveEvent); SubscribeLocalEvent(BodyTypeChanged); } @@ -22,9 +22,9 @@ namespace Content.Server.ParticleAccelerator.EntitySystems component.OnAnchorChanged(); } - private static void OnRotateEvent(EntityUid uid, ParticleAcceleratorPartComponent component, ref RotateEvent args) + private static void OnMoveEvent(EntityUid uid, ParticleAcceleratorPartComponent component, ref MoveEvent args) { - component.Rotated(); + component.Moved(); } } } diff --git a/Content.Server/Shuttles/Systems/ThrusterSystem.cs b/Content.Server/Shuttles/Systems/ThrusterSystem.cs index 8fe2760dc7..fb3beac00d 100644 --- a/Content.Server/Shuttles/Systems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/Systems/ThrusterSystem.cs @@ -51,7 +51,7 @@ namespace Content.Server.Shuttles.Systems SubscribeLocalEvent(OnPowerChange); SubscribeLocalEvent(OnAnchorChange); SubscribeLocalEvent(OnThrusterReAnchor); - SubscribeLocalEvent(OnRotate); + SubscribeLocalEvent(OnRotate); SubscribeLocalEvent(OnIsHotEvent); SubscribeLocalEvent(OnStartCollide); SubscribeLocalEvent(OnEndCollide); @@ -143,7 +143,7 @@ namespace Content.Server.Shuttles.Systems /// /// If the thruster rotates change the direction where the linear thrust is applied /// - private void OnRotate(EntityUid uid, ThrusterComponent component, ref RotateEvent args) + private void OnRotate(EntityUid uid, ThrusterComponent component, ref MoveEvent args) { // TODO: Disable visualizer for old direction diff --git a/Content.Shared/Buckle/SharedBuckleSystem.cs b/Content.Shared/Buckle/SharedBuckleSystem.cs index 5d36039341..55969b1140 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.cs @@ -17,7 +17,7 @@ namespace Content.Shared.Buckle public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnStrapRotate); + SubscribeLocalEvent(OnStrapRotate); SubscribeLocalEvent(PreventCollision); SubscribeLocalEvent(HandleDown); @@ -27,12 +27,13 @@ namespace Content.Shared.Buckle SubscribeLocalEvent(OnBuckleChangeDirectionAttempt); } - private void OnStrapRotate(EntityUid uid, SharedStrapComponent component, ref RotateEvent args) + private void OnStrapRotate(EntityUid uid, SharedStrapComponent component, ref MoveEvent args) { // TODO: This looks dirty af. // On rotation of a strap, reattach all buckled entities. // This fixes buckle offsets and draw depths. // This is mega cursed. Please somebody save me from Mr Buckle's wild ride. + // Oh god I'm back here again. Send help. // Consider a chair that has a player strapped to it. Then the client receives a new server state, showing // that the player entity has moved elsewhere, and the chair has rotated. If the client applies the player @@ -43,7 +44,7 @@ namespace Content.Shared.Buckle // One option is to just never trigger re-buckles during state application. // another is to.. just not do this? Like wtf is this code. But I CBF with buckle atm. - if (GameTiming.ApplyingState) + if (GameTiming.ApplyingState || args.NewRotation == args.OldRotation) return; foreach (var buckledEntity in component.BuckledEntities) diff --git a/Content.Shared/Vehicle/SharedVehicleSystem.cs b/Content.Shared/Vehicle/SharedVehicleSystem.cs index 763c5b1012..c1b58e8634 100644 --- a/Content.Shared/Vehicle/SharedVehicleSystem.cs +++ b/Content.Shared/Vehicle/SharedVehicleSystem.cs @@ -28,7 +28,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem SubscribeLocalEvent(OnRiderPull); SubscribeLocalEvent(OnVehicleModifier); SubscribeLocalEvent(OnVehicleStartup); - SubscribeLocalEvent(OnVehicleRotate); + SubscribeLocalEvent(OnVehicleRotate); } @@ -47,8 +47,11 @@ public abstract partial class SharedVehicleSystem : EntitySystem } // TODO: Shitcode, needs to use sprites instead of actual offsets. - private void OnVehicleRotate(EntityUid uid, VehicleComponent component, ref RotateEvent args) + private void OnVehicleRotate(EntityUid uid, VehicleComponent component, ref MoveEvent args) { + if (args.NewRotation == args.OldRotation) + return; + // This first check is just for safety if (!HasComp(uid)) {