Update trivial components to use auto comp states (#20539)

This commit is contained in:
DrSmugleaf
2023-09-28 16:20:29 -07:00
committed by GitHub
parent 14cfe44ece
commit a44fa86b68
158 changed files with 806 additions and 2866 deletions

View File

@@ -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;
}
}
}
}