diff --git a/Content.Shared/Dice/DiceComponent.cs b/Content.Shared/Dice/DiceComponent.cs
index e2e23890a4..c01ad3c451 100644
--- a/Content.Shared/Dice/DiceComponent.cs
+++ b/Content.Shared/Dice/DiceComponent.cs
@@ -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");
///
/// Multiplier for the value of a die. Applied after the .
///
- [DataField("multiplier")]
+ [DataField]
public int Multiplier { get; private set; } = 1;
///
/// Quantity that is subtracted from the value of a die. Can be used to make dice that start at "0". Applied
/// before the
///
- [DataField("offset")]
+ [DataField]
public int Offset { get; private set; } = 0;
- [DataField("sides")]
+ [DataField]
public int Sides { get; private set; } = 20;
///
/// The currently displayed value.
///
- [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;
- }
- }
}
diff --git a/Content.Shared/Dice/SharedDiceSystem.cs b/Content.Shared/Dice/SharedDiceSystem.cs
index be3c912fb5..defb3d5f0e 100644
--- a/Content.Shared/Dice/SharedDiceSystem.cs
+++ b/Content.Shared/Dice/SharedDiceSystem.cs
@@ -14,23 +14,14 @@ public abstract class SharedDiceSystem : EntitySystem
SubscribeLocalEvent(OnUseInHand);
SubscribeLocalEvent(OnLand);
SubscribeLocalEvent(OnExamined);
- SubscribeLocalEvent(OnGetState);
- SubscribeLocalEvent(OnHandleState);
+ SubscribeLocalEvent(OnDiceAfterHandleState);
}
- private void OnHandleState(EntityUid uid, DiceComponent component, ref ComponentHandleState args)
+ private void OnDiceAfterHandleState(EntityUid uid, DiceComponent component, ref AfterAutoHandleStateEvent args)
{
- if (args.Current is DiceComponent.DiceState state)
- component.CurrentValue = state.CurrentValue;
-
UpdateVisuals(uid, component);
}
- private void OnGetState(EntityUid uid, DiceComponent component, ref ComponentGetState args)
- {
- args.State = new DiceComponent.DiceState(component.CurrentValue);
- }
-
private void OnUseInHand(EntityUid uid, DiceComponent component, UseInHandEvent args)
{
if (args.Handled)