Replace Component.OnRemove with ComponentRemove event subscriptions (#21072)

This commit is contained in:
DrSmugleaf
2023-10-20 15:30:20 +02:00
committed by Debug
parent 903afccdd6
commit 4526541d58
7 changed files with 22 additions and 36 deletions
@@ -3,8 +3,8 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.Power.Components;
using Content.Server.Power.NodeGroups;
using Content.Server.Power.Pow3r;
using JetBrains.Annotations;
using Content.Shared.Power;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Threading;
@@ -34,6 +34,7 @@ namespace Content.Server.Power.EntitySystems
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentInit>(ApcPowerReceiverInit);
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentShutdown>(ApcPowerReceiverShutdown);
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentRemove>(ApcPowerReceiverRemove);
SubscribeLocalEvent<ApcPowerReceiverComponent, EntityPausedEvent>(ApcPowerReceiverPaused);
SubscribeLocalEvent<ApcPowerReceiverComponent, EntityUnpausedEvent>(ApcPowerReceiverUnpaused);
@@ -64,6 +65,11 @@ namespace Content.Server.Power.EntitySystems
_powerState.Loads.Free(component.NetworkLoad.Id);
}
private void ApcPowerReceiverRemove(EntityUid uid, ApcPowerReceiverComponent component, ComponentRemove args)
{
component.Provider?.RemoveReceiver(component);
}
private static void ApcPowerReceiverPaused(
EntityUid uid,
ApcPowerReceiverComponent component,