Subscribe TransformComponent events by-ref (#4478)
This commit is contained in:
committed by
GitHub
parent
bbbebbadf7
commit
ad5f7bb71b
@@ -282,7 +282,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleMoveEvent(MoveEvent ev)
|
public void HandleMoveEvent(ref MoveEvent ev)
|
||||||
{
|
{
|
||||||
if (_contextMenuView.Elements.Count == 0) return;
|
if (_contextMenuView.Elements.Count == 0) return;
|
||||||
var entity = ev.Sender;
|
var entity = ev.Sender;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleAnchorChanged(EntityUid uid, IconSmoothComponent component, AnchorStateChangedEvent args)
|
private static void HandleAnchorChanged(EntityUid uid, IconSmoothComponent component, ref AnchorStateChangedEvent args)
|
||||||
{
|
{
|
||||||
component.AnchorStateChanged();
|
component.AnchorStateChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Client.Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleAnchorChanged(EntityUid uid, WindowComponent component, AnchorStateChangedEvent args)
|
private static void HandleAnchorChanged(EntityUid uid, WindowComponent component, ref AnchorStateChangedEvent args)
|
||||||
{
|
{
|
||||||
component.AnchorStateChanged();
|
component.AnchorStateChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ namespace Content.Server.AI.Pathfinding
|
|||||||
_lastKnownPositions.Remove(entity);
|
_lastKnownPositions.Remove(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QueueMoveEvent(MoveEvent moveEvent)
|
private void QueueMoveEvent(ref MoveEvent moveEvent)
|
||||||
{
|
{
|
||||||
_moveUpdateQueue.Enqueue(moveEvent);
|
_moveUpdateQueue.Enqueue(moveEvent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
private void OnAirtightInit(EntityUid uid, AirtightComponent airtight, ComponentInit args)
|
private void OnAirtightInit(EntityUid uid, AirtightComponent airtight, ComponentInit args)
|
||||||
{
|
{
|
||||||
if (airtight.FixAirBlockedDirectionInitialize)
|
if (airtight.FixAirBlockedDirectionInitialize)
|
||||||
OnAirtightRotated(uid, airtight, new RotateEvent(airtight.Owner, Angle.Zero, airtight.Owner.Transform.WorldRotation));
|
{
|
||||||
|
var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, airtight.Owner.Transform.WorldRotation);
|
||||||
|
OnAirtightRotated(uid, airtight, ref rotateEvent);
|
||||||
|
}
|
||||||
|
|
||||||
// Adding this component will immediately anchor the entity, because the atmos system
|
// Adding this component will immediately anchor the entity, because the atmos system
|
||||||
// requires airtight entities to be anchored for performance.
|
// requires airtight entities to be anchored for performance.
|
||||||
@@ -51,7 +54,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, AnchorStateChangedEvent args)
|
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args)
|
||||||
{
|
{
|
||||||
var gridId = airtight.Owner.Transform.GridID;
|
var gridId = airtight.Owner.Transform.GridID;
|
||||||
var coords = airtight.Owner.Transform.Coordinates;
|
var coords = airtight.Owner.Transform.Coordinates;
|
||||||
@@ -64,7 +67,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
InvalidatePosition(gridId, tilePos);
|
InvalidatePosition(gridId, tilePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, RotateEvent ev)
|
private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, ref RotateEvent ev)
|
||||||
{
|
{
|
||||||
if (!airtight.RotateAirBlocked || airtight.InitialAirBlockedDirection == (int)AtmosDirection.Invalid)
|
if (!airtight.RotateAirBlocked || airtight.InitialAirBlockedDirection == (int)AtmosDirection.Invalid)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
LeaveAtmosphere(component);
|
LeaveAtmosphere(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeviceAnchorChanged(EntityUid uid, AtmosDeviceComponent component, AnchorStateChangedEvent args)
|
private void OnDeviceAnchorChanged(EntityUid uid, AtmosDeviceComponent component, ref AnchorStateChangedEvent args)
|
||||||
{
|
{
|
||||||
// Do nothing if the component doesn't require being anchored to function.
|
// Do nothing if the component doesn't require being anchored to function.
|
||||||
if (!component.RequireAnchored)
|
if (!component.RequireAnchored)
|
||||||
@@ -110,7 +110,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
LeaveAtmosphere(component);
|
LeaveAtmosphere(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeviceParentChanged(EntityUid uid, AtmosDeviceComponent component, EntParentChangedMessage args)
|
private void OnDeviceParentChanged(EntityUid uid, AtmosDeviceComponent component, ref EntParentChangedMessage args)
|
||||||
{
|
{
|
||||||
RejoinAtmosphere(component);
|
RejoinAtmosphere(component);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Content.Server.Buckle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveEvent(EntityUid uid, BuckleComponent buckle, MoveEvent ev)
|
private void MoveEvent(EntityUid uid, BuckleComponent buckle, ref MoveEvent ev)
|
||||||
{
|
{
|
||||||
var strap = buckle.BuckledTo;
|
var strap = buckle.BuckledTo;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ namespace Content.Server.Buckle
|
|||||||
buckle.TryUnbuckle(buckle.Owner, true);
|
buckle.TryUnbuckle(buckle.Owner, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RotateEvent(EntityUid uid, StrapComponent strap, RotateEvent ev)
|
private void RotateEvent(EntityUid uid, StrapComponent strap, ref RotateEvent ev)
|
||||||
{
|
{
|
||||||
// On rotation of a strap, reattach all buckled entities.
|
// On rotation of a strap, reattach all buckled entities.
|
||||||
// This fixes buckle offsets and draw depths.
|
// This fixes buckle offsets and draw depths.
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace Content.Server.Gravity.EntitySystems
|
|||||||
status.ClearAlert(AlertType.Weightless);
|
status.ClearAlert(AlertType.Weightless);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EntParentChanged(EntParentChangedMessage ev)
|
private void EntParentChanged(ref EntParentChangedMessage ev)
|
||||||
{
|
{
|
||||||
if (!ev.Entity.TryGetComponent(out ServerAlertsComponent? status))
|
if (!ev.Entity.TryGetComponent(out ServerAlertsComponent? status))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Server.NodeContainer.EntitySystems
|
|||||||
private static void OnAnchorStateChanged(
|
private static void OnAnchorStateChanged(
|
||||||
EntityUid uid,
|
EntityUid uid,
|
||||||
NodeContainerComponent component,
|
NodeContainerComponent component,
|
||||||
AnchorStateChangedEvent args)
|
ref AnchorStateChangedEvent args)
|
||||||
{
|
{
|
||||||
foreach (var node in component.Nodes.Values)
|
foreach (var node in component.Nodes.Values)
|
||||||
{
|
{
|
||||||
@@ -59,7 +59,7 @@ namespace Content.Server.NodeContainer.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnRotateEvent(EntityUid uid, NodeContainerComponent container, RotateEvent ev)
|
private static void OnRotateEvent(EntityUid uid, NodeContainerComponent container, ref RotateEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.NewRotation == ev.OldRotation)
|
if (ev.NewRotation == ev.OldRotation)
|
||||||
{
|
{
|
||||||
@@ -69,7 +69,7 @@ namespace Content.Server.NodeContainer.EntitySystems
|
|||||||
foreach (var node in container.Nodes.Values)
|
foreach (var node in container.Nodes.Values)
|
||||||
{
|
{
|
||||||
if (node is not IRotatableNode rotatableNode) continue;
|
if (node is not IRotatableNode rotatableNode) continue;
|
||||||
rotatableNode.RotateEvent(ev);
|
rotatableNode.RotateEvent(ref ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rotates this <see cref="Node"/>.
|
/// Rotates this <see cref="Node"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void RotateEvent(RotateEvent ev);
|
void RotateEvent(ref RotateEvent ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rotates the <see cref="PipeDirection"/> when the entity is rotated, and re-calculates the <see cref="IPipeNet"/>.
|
/// Rotates the <see cref="PipeDirection"/> when the entity is rotated, and re-calculates the <see cref="IPipeNet"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void IRotatableNode.RotateEvent(RotateEvent ev)
|
void IRotatableNode.RotateEvent(ref RotateEvent ev)
|
||||||
{
|
{
|
||||||
if (!RotationsEnabled) return;
|
if (!RotationsEnabled) return;
|
||||||
var diff = ev.NewRotation - ev.OldRotation;
|
var diff = ev.NewRotation - ev.OldRotation;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.ParticleAccelerator.EntitySystems
|
|||||||
component.OnAnchorChanged();
|
component.OnAnchorChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RotateEvent(RotateEvent ev)
|
private static void RotateEvent(ref RotateEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.Sender.TryGetComponent(out ParticleAcceleratorPartComponent? part))
|
if (ev.Sender.TryGetComponent(out ParticleAcceleratorPartComponent? part))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace Content.Server.Shuttles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// If pilot is moved then we'll stop them from piloting.
|
/// If pilot is moved then we'll stop them from piloting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void HandlePilotMove(EntityUid uid, PilotComponent component, MoveEvent args)
|
private void HandlePilotMove(EntityUid uid, PilotComponent component, ref MoveEvent args)
|
||||||
{
|
{
|
||||||
if (component.Console == null) return;
|
if (component.Console == null) return;
|
||||||
RemovePilot(component);
|
RemovePilot(component);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace Content.Shared.Pulling
|
|||||||
_stoppedMoving.Add(component);
|
_stoppedMoving.Add(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PullerMoved(MoveEvent ev)
|
private void PullerMoved(ref MoveEvent ev)
|
||||||
{
|
{
|
||||||
var puller = ev.Sender;
|
var puller = ev.Sender;
|
||||||
if (!TryGetPulled(ev.Sender, out var pulled))
|
if (!TryGetPulled(ev.Sender, out var pulled))
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace Content.Shared.SubFloor
|
|||||||
UpdateEntity(uid, true);
|
UpdateEntity(uid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleAnchorChanged(EntityUid uid, SubFloorHideComponent component, AnchorStateChangedEvent args)
|
private void HandleAnchorChanged(EntityUid uid, SubFloorHideComponent component, ref AnchorStateChangedEvent args)
|
||||||
{
|
{
|
||||||
var transform = ComponentManager.GetComponent<ITransformComponent>(uid);
|
var transform = ComponentManager.GetComponent<ITransformComponent>(uid);
|
||||||
|
|
||||||
|
|||||||
Submodule RobustToolbox updated: 5594bd7203...e5013d9e3f
Reference in New Issue
Block a user