Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,53 +1,41 @@
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Tools.Components
|
||||
namespace Content.Shared.Tools.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||
public sealed partial class MultipleToolComponent : Component
|
||||
{
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class MultipleToolComponent : Component
|
||||
[DataDefinition]
|
||||
public sealed partial class ToolEntry
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed partial class ToolEntry
|
||||
{
|
||||
[DataField("behavior", required: true)]
|
||||
public PrototypeFlags<ToolQualityPrototype> Behavior = new();
|
||||
[DataField(required: true)]
|
||||
public PrototypeFlags<ToolQualityPrototype> Behavior = new();
|
||||
|
||||
[DataField("useSound")]
|
||||
public SoundSpecifier? Sound;
|
||||
[DataField]
|
||||
public SoundSpecifier? UseSound;
|
||||
|
||||
[DataField("changeSound")]
|
||||
public SoundSpecifier? ChangeSound;
|
||||
[DataField]
|
||||
public SoundSpecifier? ChangeSound;
|
||||
|
||||
[DataField("sprite")]
|
||||
public SpriteSpecifier? Sprite;
|
||||
}
|
||||
|
||||
[DataField("entries", required: true)]
|
||||
public ToolEntry[] Entries { get; private set; } = Array.Empty<ToolEntry>();
|
||||
|
||||
[ViewVariables]
|
||||
public uint CurrentEntry = 0;
|
||||
|
||||
[ViewVariables]
|
||||
public string CurrentQualityName = string.Empty;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool UiUpdateNeeded;
|
||||
|
||||
[DataField("statusShowBehavior")]
|
||||
public bool StatusShowBehavior = true;
|
||||
[DataField]
|
||||
public SpriteSpecifier? Sprite;
|
||||
}
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
public sealed class MultipleToolComponentState : ComponentState
|
||||
{
|
||||
public readonly uint Selected;
|
||||
[DataField(required: true)]
|
||||
public ToolEntry[] Entries { get; private set; } = Array.Empty<ToolEntry>();
|
||||
|
||||
public MultipleToolComponentState(uint selected)
|
||||
{
|
||||
Selected = selected;
|
||||
}
|
||||
}
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField]
|
||||
public uint CurrentEntry = 0;
|
||||
|
||||
[ViewVariables]
|
||||
public string CurrentQualityName = string.Empty;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool UiUpdateNeeded;
|
||||
|
||||
[DataField]
|
||||
public bool StatusShowBehavior = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user