Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Access.Systems
|
||||
{
|
||||
@@ -22,19 +20,6 @@ namespace Content.Shared.Access.Systems
|
||||
|
||||
SubscribeLocalEvent<IdCardConsoleComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<IdCardConsoleComponent, ComponentRemove>(OnComponentRemove);
|
||||
SubscribeLocalEvent<IdCardConsoleComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<IdCardConsoleComponent, ComponentHandleState>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, IdCardConsoleComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not IdCardConsoleComponentState state) return;
|
||||
component.AccessLevels = state.AccessLevels;
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, IdCardConsoleComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new IdCardConsoleComponentState(component.AccessLevels);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, IdCardConsoleComponent component, ComponentInit args)
|
||||
@@ -48,16 +33,5 @@ namespace Content.Shared.Access.Systems
|
||||
_itemSlotsSystem.RemoveItemSlot(uid, component.PrivilegedIdSlot);
|
||||
_itemSlotsSystem.RemoveItemSlot(uid, component.TargetIdSlot);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
private sealed class IdCardConsoleComponentState : ComponentState
|
||||
{
|
||||
public List<string> AccessLevels;
|
||||
|
||||
public IdCardConsoleComponentState(List<string> accessLevels)
|
||||
{
|
||||
AccessLevels = accessLevels;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user