Update dice state handling (#23643)
* Auto generate dice component state handling, and update data field annotations * Missed one.
This commit is contained in:
@@ -5,40 +5,33 @@ using Robust.Shared.Serialization;
|
||||
namespace Content.Shared.Dice;
|
||||
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedDiceSystem))]
|
||||
[AutoGenerateComponentState(true)]
|
||||
public sealed partial class DiceComponent : Component
|
||||
{
|
||||
[DataField("sound")]
|
||||
[DataField]
|
||||
public SoundSpecifier Sound { get; private set; } = new SoundCollectionSpecifier("Dice");
|
||||
|
||||
/// <summary>
|
||||
/// Multiplier for the value of a die. Applied after the <see cref="Offset"/>.
|
||||
/// </summary>
|
||||
[DataField("multiplier")]
|
||||
[DataField]
|
||||
public int Multiplier { get; private set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Quantity that is subtracted from the value of a die. Can be used to make dice that start at "0". Applied
|
||||
/// before the <see cref="Multiplier"/>
|
||||
/// </summary>
|
||||
[DataField("offset")]
|
||||
[DataField]
|
||||
public int Offset { get; private set; } = 0;
|
||||
|
||||
[DataField("sides")]
|
||||
[DataField]
|
||||
public int Sides { get; private set; } = 20;
|
||||
|
||||
/// <summary>
|
||||
/// The currently displayed value.
|
||||
/// </summary>
|
||||
[DataField("currentValue")]
|
||||
[DataField]
|
||||
[AutoNetworkedField]
|
||||
public int CurrentValue { get; set; } = 20;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class DiceState : ComponentState
|
||||
{
|
||||
public readonly int CurrentValue;
|
||||
public DiceState(int value)
|
||||
{
|
||||
CurrentValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user