Files
tbd-station-14/Content.Shared/DeviceNetwork/Systems/SharedNetworkConfiguratorSystem.cs
2022-09-14 16:09:43 +10:00

38 lines
1.1 KiB
C#

using Content.Shared.Actions;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.DeviceNetwork;
public abstract class SharedNetworkConfiguratorSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<NetworkConfiguratorComponent, ComponentGetState>(GetNetworkConfiguratorState);
SubscribeLocalEvent<NetworkConfiguratorComponent, ComponentHandleState>(HandleNetworkConfiguratorState);
}
private void GetNetworkConfiguratorState(EntityUid uid, NetworkConfiguratorComponent comp,
ref ComponentGetState args)
{
args.State = new NetworkConfiguratorComponentState(comp.ActiveDeviceList);
}
private void HandleNetworkConfiguratorState(EntityUid uid, NetworkConfiguratorComponent comp,
ref ComponentHandleState args)
{
if (args.Current is not NetworkConfiguratorComponentState state)
{
return;
}
comp.ActiveDeviceList = state.ActiveDeviceList;
}
}
public sealed class ClearAllOverlaysEvent : InstantActionEvent
{
}