Replaces AnchoredChanged C# event with ComponentMessage (#2905)
* Replaces AnchoredChanged C# event with ComponentMessage * Removes unneeded fields Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.NodeContainer;
|
||||
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
@@ -9,6 +8,7 @@ using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.ComponentDependencies;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -99,16 +99,11 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
|
||||
if (_physicsComponent != null)
|
||||
{
|
||||
AnchorUpdate();
|
||||
_physicsComponent.AnchoredChanged += AnchorUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
{
|
||||
if (_physicsComponent != null)
|
||||
{
|
||||
_physicsComponent.AnchoredChanged -= AnchorUpdate;
|
||||
}
|
||||
_provider.RemoveReceiver(this);
|
||||
base.OnRemove();
|
||||
}
|
||||
@@ -121,6 +116,17 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
switch (message)
|
||||
{
|
||||
case AnchoredChangedMessage:
|
||||
AnchorUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ApcPowerChanged()
|
||||
{
|
||||
var oldPowered = Powered;
|
||||
|
||||
Reference in New Issue
Block a user