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

This commit is contained in:
DrSmugleaf
2023-10-17 19:35:36 -07:00
committed by GitHub
parent cb1b067a21
commit a136616531
7 changed files with 22 additions and 36 deletions

View File

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