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

@@ -2,7 +2,6 @@ using Content.Shared.Access.Components;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.DoAfter;
using JetBrains.Annotations;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Access.Systems
@@ -23,19 +22,6 @@ namespace Content.Shared.Access.Systems
SubscribeLocalEvent<AccessOverriderComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<AccessOverriderComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<AccessOverriderComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<AccessOverriderComponent, ComponentHandleState>(OnHandleState);
}
private void OnHandleState(EntityUid uid, AccessOverriderComponent component, ref ComponentHandleState args)
{
if (args.Current is not AccessOverriderComponentState state) return;
component.AccessLevels = state.AccessLevels;
}
private void OnGetState(EntityUid uid, AccessOverriderComponent component, ref ComponentGetState args)
{
args.State = new AccessOverriderComponentState(component.AccessLevels);
}
private void OnComponentInit(EntityUid uid, AccessOverriderComponent component, ComponentInit args)
@@ -48,17 +34,6 @@ namespace Content.Shared.Access.Systems
_itemSlotsSystem.RemoveItemSlot(uid, component.PrivilegedIdSlot);
}
[Serializable, NetSerializable]
private sealed class AccessOverriderComponentState : ComponentState
{
public List<string> AccessLevels;
public AccessOverriderComponentState(List<string> accessLevels)
{
AccessLevels = accessLevels;
}
}
[Serializable, NetSerializable]
public sealed partial class AccessOverriderDoAfterEvent : DoAfterEvent
{