Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -5,7 +5,6 @@ using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -27,8 +26,6 @@ public sealed class BinSystem : EntitySystem
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<BinComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<BinComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<BinComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<BinComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<BinComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
|
||||
@@ -36,21 +33,6 @@ public sealed class BinSystem : EntitySystem
|
||||
SubscribeLocalEvent<BinComponent, AfterInteractUsingEvent>(OnAfterInteractUsing);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, BinComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new BinComponentState(GetNetEntityList(component.Items), component.Whitelist, component.MaxItems);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, BinComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not BinComponentState state)
|
||||
return;
|
||||
|
||||
component.Items = EnsureEntityList<BinComponent>(state.Items, uid);
|
||||
component.Whitelist = state.Whitelist;
|
||||
component.MaxItems = state.MaxItems;
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, BinComponent component, ComponentStartup args)
|
||||
{
|
||||
component.ItemContainer = _container.EnsureContainer<Container>(uid, BinContainerId);
|
||||
|
||||
Reference in New Issue
Block a user