using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Shared.Stacks { [NetworkedComponent, Access(typeof(SharedStackSystem))] public abstract class SharedStackComponent : Component { [ViewVariables(VVAccess.ReadWrite)] [DataField("stackType", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))] public string? StackTypeId { get; private set; } /// /// Current stack count. /// Do NOT set this directly, use the method instead. /// [DataField("count")] public int Count { get; set; } = 30; /// /// Max amount of things that can be in the stack. /// Overrides the max defined on the stack prototype. /// [ViewVariables(VVAccess.ReadOnly)] [DataField("maxCountOverride")] public int? MaxCountOverride { get; set; } /// /// Set to true to not reduce the count when used. /// [DataField("unlimited")] [ViewVariables(VVAccess.ReadOnly)] public bool Unlimited { get; set; } } [Serializable, NetSerializable] public sealed class StackComponentState : ComponentState { public int Count { get; } public int MaxCount { get; } public StackComponentState(int count, int maxCount) { Count = count; MaxCount = maxCount; } } }