Content changes for engine RotateEvent removal PR (#11448)

This commit is contained in:
Leon Friedrich
2022-09-23 15:57:30 +12:00
committed by GitHub
parent caa5efcd6f
commit e5f968a7fb
10 changed files with 30 additions and 26 deletions

View File

@@ -19,7 +19,7 @@ namespace Content.Server.Atmos.EntitySystems
SubscribeLocalEvent<AirtightComponent, ComponentShutdown>(OnAirtightShutdown);
SubscribeLocalEvent<AirtightComponent, AnchorStateChangedEvent>(OnAirtightPositionChanged);
SubscribeLocalEvent<AirtightComponent, ReAnchorEvent>(OnAirtightReAnchor);
SubscribeLocalEvent<AirtightComponent, RotateEvent>(OnAirtightRotated);
SubscribeLocalEvent<AirtightComponent, MoveEvent>(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);
}

View File

@@ -23,7 +23,7 @@ namespace Content.Server.NodeContainer.EntitySystems
SubscribeLocalEvent<NodeContainerComponent, ComponentShutdown>(OnShutdownEvent);
SubscribeLocalEvent<NodeContainerComponent, AnchorStateChangedEvent>(OnAnchorStateChanged);
SubscribeLocalEvent<NodeContainerComponent, ReAnchorEvent>(OnReAnchor);
SubscribeLocalEvent<NodeContainerComponent, RotateEvent>(OnRotateEvent);
SubscribeLocalEvent<NodeContainerComponent, MoveEvent>(OnMoveEvent);
SubscribeLocalEvent<NodeContainerComponent, ExaminedEvent>(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);
}
}

View File

@@ -1,7 +1,7 @@
namespace Content.Server.NodeContainer.Nodes
namespace Content.Server.NodeContainer.Nodes
{
/// <summary>
/// A <see cref="Node"/> that implements this will have its <see cref="RotateEvent(RotateEvent)"/> called when its
/// A <see cref="Node"/> that implements this will have its <see cref="RotateNode(MoveEvent)"/> called when its
/// <see cref="NodeContainerComponent"/> is rotated.
/// </summary>
public interface IRotatableNode
@@ -9,6 +9,6 @@
/// <summary>
/// Rotates this <see cref="Node"/>. Returns true if the node's connections need to be updated.
/// </summary>
bool RotateEvent(ref RotateEvent ev);
bool RotateNode(in MoveEvent ev);
}
}

View File

@@ -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;

View File

@@ -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.

View File

@@ -29,7 +29,7 @@ namespace Content.Server.ParticleAccelerator.Components
Master?.RescanParts();
}
public virtual void Rotated()
public virtual void Moved()
{
RescanIfPossible();
}

View File

@@ -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<ParticleAcceleratorPartComponent, RotateEvent>(OnRotateEvent);
SubscribeLocalEvent<ParticleAcceleratorPartComponent, MoveEvent>(OnMoveEvent);
SubscribeLocalEvent<ParticleAcceleratorPartComponent, PhysicsBodyTypeChangedEvent>(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();
}
}
}

View File

@@ -51,7 +51,7 @@ namespace Content.Server.Shuttles.Systems
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
SubscribeLocalEvent<ThrusterComponent, ReAnchorEvent>(OnThrusterReAnchor);
SubscribeLocalEvent<ThrusterComponent, RotateEvent>(OnRotate);
SubscribeLocalEvent<ThrusterComponent, MoveEvent>(OnRotate);
SubscribeLocalEvent<ThrusterComponent, IsHotEvent>(OnIsHotEvent);
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
SubscribeLocalEvent<ThrusterComponent, EndCollideEvent>(OnEndCollide);
@@ -143,7 +143,7 @@ namespace Content.Server.Shuttles.Systems
/// <summary>
/// If the thruster rotates change the direction where the linear thrust is applied
/// </summary>
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