Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Shared.CartridgeLoader;
|
||||
@@ -24,10 +22,6 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<CartridgeLoaderComponent, EntInsertedIntoContainerMessage>(OnItemInserted);
|
||||
SubscribeLocalEvent<CartridgeLoaderComponent, EntRemovedFromContainerMessage>(OnItemRemoved);
|
||||
|
||||
SubscribeLocalEvent<CartridgeComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<CartridgeComponent, ComponentHandleState>(OnHandleState);
|
||||
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, CartridgeLoaderComponent loader, ComponentInit args)
|
||||
@@ -55,22 +49,6 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem
|
||||
UpdateAppearanceData(uid, loader);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, CartridgeComponent component, ref ComponentGetState args)
|
||||
{
|
||||
var state = new CartridgeComponentState();
|
||||
state.InstallationStatus = component.InstallationStatus;
|
||||
|
||||
args.State = state;
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, CartridgeComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not CartridgeComponentState state)
|
||||
return;
|
||||
|
||||
component.InstallationStatus = state.InstallationStatus;
|
||||
}
|
||||
|
||||
private void UpdateAppearanceData(EntityUid uid, CartridgeLoaderComponent loader)
|
||||
{
|
||||
_appearanceSystem.SetData(uid, CartridgeLoaderVisuals.CartridgeInserted, loader.CartridgeSlot.HasItem);
|
||||
|
||||
Reference in New Issue
Block a user