Fix ApcPowerReceiverComponent deletion (#5031)

Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
This commit is contained in:
Julian Giebel
2021-10-25 21:55:00 +02:00
committed by GitHub
parent 3bbe8f7652
commit d1a830cd74
3 changed files with 30 additions and 1 deletions

View File

@@ -35,6 +35,8 @@ namespace Content.Server.Power.Components
[DataField("powerLoad")]
public float Load { get => NetworkLoad.DesiredPower; set => NetworkLoad.DesiredPower = value; }
public ApcPowerProviderComponent? Provider = null;
/// <summary>
/// When false, causes this to appear powered even if not receiving power from an Apc.
/// </summary>
@@ -68,6 +70,13 @@ namespace Content.Server.Power.Components
DesiredPower = 5
};
protected override void OnRemove()
{
Provider?.RemoveReceiver(this);
base.OnRemove();
}
public void ApcPowerChanged()
{
OnNewPowerState();