more component ref removal + combining server/client comps (#13178)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
55
Content.Shared/Stacks/StackComponent.cs
Normal file
55
Content.Shared/Stacks/StackComponent.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Stacks
|
||||
{
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class StackComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("stackType", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<StackPrototype>))]
|
||||
public string? StackTypeId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current stack count.
|
||||
/// Do NOT set this directly, use the <see cref="SharedStackSystem.SetCount"/> method instead.
|
||||
/// </summary>
|
||||
[DataField("count")]
|
||||
public int Count { get; set; } = 30;
|
||||
|
||||
/// <summary>
|
||||
/// Max amount of things that can be in the stack.
|
||||
/// Overrides the max defined on the stack prototype.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("maxCountOverride")]
|
||||
public int? MaxCountOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set to true to not reduce the count when used.
|
||||
/// </summary>
|
||||
[DataField("unlimited")]
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public bool Unlimited { get; set; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool ThrowIndividually { get; set; } = false;
|
||||
|
||||
[ViewVariables]
|
||||
public bool UiUpdateNeeded { 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user