2019-04-26 15:51:05 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Lathe;
|
2019-04-26 15:51:05 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Lathe.Components
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2019-07-31 15:02:36 +02:00
|
|
|
[RegisterComponent]
|
|
|
|
|
[ComponentReference(typeof(SharedMaterialStorageComponent))]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class MaterialStorageComponent : SharedMaterialStorageComponent
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
2020-11-27 11:00:49 +01:00
|
|
|
protected override Dictionary<string, int> Storage { get; set; } = new();
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
public event Action? OnMaterialStorageChanged;
|
2019-04-26 15:51:05 +02:00
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
2019-04-26 15:51:05 +02:00
|
|
|
{
|
|
|
|
|
base.HandleComponentState(curState, nextState);
|
2020-11-26 14:33:31 +01:00
|
|
|
if (curState is not MaterialStorageState state) return;
|
2019-04-26 15:51:05 +02:00
|
|
|
Storage = state.Storage;
|
|
|
|
|
OnMaterialStorageChanged?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|