Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user