24 lines
706 B
C#
24 lines
706 B
C#
|
|
using Content.Client.Power.Components;
|
|||
|
|
using Content.Shared.Power.Components;
|
|||
|
|
using Content.Shared.Power.EntitySystems;
|
|||
|
|
using Robust.Shared.GameStates;
|
|||
|
|
|
|||
|
|
namespace Content.Client.Power.EntitySystems;
|
|||
|
|
|
|||
|
|
public sealed class PowerReceiverSystem : SharedPowerReceiverSystem
|
|||
|
|
{
|
|||
|
|
public override void Initialize()
|
|||
|
|
{
|
|||
|
|
base.Initialize();
|
|||
|
|
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentHandleState>(OnHandleState);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnHandleState(EntityUid uid, ApcPowerReceiverComponent component, ref ComponentHandleState args)
|
|||
|
|
{
|
|||
|
|
if (args.Current is not ApcPowerReceiverComponentState state)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
component.Powered = state.Powered;
|
|||
|
|
}
|
|||
|
|
}
|