Stack components are now entirely logicless.

- GetState is handled in SharedStackSystem
- Adds friend attributes to the stack components
This commit is contained in:
Vera Aguilera Puerto
2021-08-30 11:49:09 +02:00
parent f15ed2ba50
commit d1fe278afc
5 changed files with 19 additions and 20 deletions

View File

@@ -13,6 +13,7 @@ namespace Content.Shared.Stacks
{
base.Initialize();
SubscribeLocalEvent<SharedStackComponent, ComponentGetState>(OnStackGetState);
SubscribeLocalEvent<SharedStackComponent, ComponentHandleState>(OnStackHandleState);
SubscribeLocalEvent<SharedStackComponent, ComponentStartup>(OnStackStarted);
SubscribeLocalEvent<SharedStackComponent, ExaminedEvent>(OnStackExamined);
@@ -62,6 +63,11 @@ namespace Content.Shared.Stacks
RaiseLocalEvent(uid, new StackCountChangedEvent(old, component.Count));
}
private void OnStackGetState(EntityUid uid, SharedStackComponent component, ref ComponentGetState args)
{
args.State = new StackComponentState(component.Count, component.MaxCount);
}
private void OnStackHandleState(EntityUid uid, SharedStackComponent component, ref ComponentHandleState args)
{
if (args.Current is not StackComponentState cast)