Update PowerChangedEvent (#7503)

* Update PowerChangedEvent

* Comments
This commit is contained in:
Leon Friedrich
2022-04-14 01:50:42 +12:00
committed by GitHub
parent f440006ed9
commit 2777d2ef64
3 changed files with 24 additions and 31 deletions

View File

@@ -1,5 +1,7 @@
using Content.Server.Power.Components;
using Content.Server.Power.Components;
using Content.Shared.Examine;
using Content.Shared.Power;
namespace Content.Server.Power.EntitySystems
{
public sealed class PowerReceiverSystem : EntitySystem
@@ -72,10 +74,14 @@ namespace Content.Server.Power.EntitySystems
}
}
private static void ProviderChanged(ApcPowerReceiverComponent receiver)
private void ProviderChanged(ApcPowerReceiverComponent receiver)
{
receiver.NetworkLoad.LinkedNetwork = default;
receiver.ApcPowerChanged();
RaiseLocalEvent(receiver.Owner, new PowerChangedEvent(receiver.Powered, receiver.NetworkLoad.ReceivingPower));
if (TryComp(receiver.Owner, out AppearanceComponent? appearance))
appearance.SetData(PowerDeviceVisuals.Powered, receiver.Powered);
}
}
}