};
public float PowerReceived => NetworkLoad.ReceivingPower;
-
- protected override void OnRemove()
- {
- Provider?.RemoveReceiver(this);
-
- base.OnRemove();
- }
}
/// <summary>
[DataField("node")] public string? NodeId { get; set; }
- protected override void OnRemove()
- {
- ClearNet();
- base.OnRemove();
- }
-
public void TryFindAndSetNet()
{
if (TryFindNet(out var net))
SubscribeLocalEvent<ApcPowerProviderComponent, ComponentInit>(OnApcPowerProviderInit);
SubscribeLocalEvent<BatteryChargerComponent, ComponentInit>(OnBatteryChargerInit);
SubscribeLocalEvent<BatteryDischargerComponent, ComponentInit>(OnBatteryDischargerInit);
+
+ // TODO please end my life
+ SubscribeLocalEvent<ApcComponent, ComponentRemove>(OnRemove<ApcComponent, IApcNet>);
+ SubscribeLocalEvent<ApcPowerProviderComponent, ComponentRemove>(OnRemove<ApcPowerProviderComponent, IApcNet>);
+ SubscribeLocalEvent<BatteryChargerComponent, ComponentRemove>(OnRemove<BatteryChargerComponent, IPowerNet>);
+ SubscribeLocalEvent<BatteryDischargerComponent, ComponentRemove>(OnRemove<BatteryDischargerComponent, IPowerNet>);
+ SubscribeLocalEvent<PowerConsumerComponent, ComponentRemove>(OnRemove<PowerConsumerComponent, IBasePowerNet>);
+ SubscribeLocalEvent<PowerSupplierComponent, ComponentRemove>(OnRemove<PowerSupplierComponent, IBasePowerNet>);
+ }
+
+ private void OnRemove<TComp, TNet>(EntityUid uid, TComp component, ComponentRemove args)
+ where TComp : BaseNetConnectorComponent<TNet>
+ where TNet : class
+ {
+ component.ClearNet();
}
private void OnPowerSupplierInit(EntityUid uid, PowerSupplierComponent component, ComponentInit args)
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;
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentInit>(ApcPowerReceiverInit);
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentShutdown>(ApcPowerReceiverShutdown);
+ SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentRemove>(ApcPowerReceiverRemove);
SubscribeLocalEvent<ApcPowerReceiverComponent, EntityPausedEvent>(ApcPowerReceiverPaused);
SubscribeLocalEvent<ApcPowerReceiverComponent, EntityUnpausedEvent>(ApcPowerReceiverUnpaused);
_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,
using Robust.Shared.GameStates;
using Robust.Shared.Map;
-using Robust.Shared.Physics.Dynamics.Joints;
using Robust.Shared.Serialization;
namespace Content.Shared.Pulling.Components
[Access(typeof(SharedPullingSystem), Other = AccessPermissions.ReadExecute)]
[ViewVariables]
public bool PrevFixedRotation;
-
- protected override void OnRemove()
- {
- if (Puller != null)
- {
- // This is absolute paranoia but it's also absolutely necessary. Too many puller state bugs. - 20kdc
- Logger.ErrorS("c.go.c.pulling", "PULLING STATE CORRUPTION IMMINENT IN PULLABLE {0} - OnRemove called when Puller is set!", Owner);
- }
- base.OnRemove();
- }
}
[Serializable, NetSerializable]
/// </summary>
[DataField("needsHands")]
public bool NeedsHands = true;
-
- protected override void OnRemove()
- {
- if (Pulling != default)
- {
- // This is absolute paranoia but it's also absolutely necessary. Too many puller state bugs. - 20kdc
- Logger.ErrorS("c.go.c.pulling", "PULLING STATE CORRUPTION IMMINENT IN PULLER {0} - OnRemove called when Pulling is set!", Owner);
- }
- base.OnRemove();
- }
}
}
-using System.Linq;
using Content.Shared.Physics.Pull;
using Content.Shared.Pulling.Components;
using JetBrains.Annotations;