Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
using System.Threading;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Implants.Components;
|
||||
/// <summary>
|
||||
@@ -12,7 +9,7 @@ namespace Content.Shared.Implants.Components;
|
||||
/// Some can be single use (implant only) or some can draw out an implant
|
||||
/// </summary>
|
||||
//TODO: Rework drawing to work with implant cases when surgery is in
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||
public sealed partial class ImplanterComponent : Component
|
||||
{
|
||||
public const string ImplanterSlotId = "implanter_slot";
|
||||
@@ -21,15 +18,14 @@ public sealed partial class ImplanterComponent : Component
|
||||
/// <summary>
|
||||
/// Used for implanters that start with specific implants
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("implant", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string? Implant;
|
||||
[DataField]
|
||||
public EntProtoId? Implant;
|
||||
|
||||
/// <summary>
|
||||
/// The time it takes to implant someone else
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("implantTime")]
|
||||
[DataField]
|
||||
public float ImplantTime = 5f;
|
||||
|
||||
//TODO: Remove when surgery is a thing
|
||||
@@ -38,54 +34,37 @@ public sealed partial class ImplanterComponent : Component
|
||||
/// It's excessively long to deter from implant checking any antag
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("drawTime")]
|
||||
[DataField]
|
||||
public float DrawTime = 60f;
|
||||
|
||||
/// <summary>
|
||||
/// Good for single-use injectors
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("implantOnly")]
|
||||
public bool ImplantOnly = false;
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool ImplantOnly;
|
||||
|
||||
/// <summary>
|
||||
/// The current mode of the implanter
|
||||
/// Mode is changed automatically depending if it implants or draws
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("currentMode")]
|
||||
[DataField, AutoNetworkedField]
|
||||
public ImplanterToggleMode CurrentMode;
|
||||
|
||||
/// <summary>
|
||||
/// The name and description of the implant to show on the implanter
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("implantData")]
|
||||
[DataField]
|
||||
public (string, string) ImplantData;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="ItemSlot"/> for this implanter
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("implanterSlot", required:true)]
|
||||
[DataField(required: true)]
|
||||
public ItemSlot ImplanterSlot = new();
|
||||
|
||||
public bool UiUpdateNeeded;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class ImplanterComponentState : ComponentState
|
||||
{
|
||||
public ImplanterToggleMode CurrentMode;
|
||||
public bool ImplantOnly;
|
||||
|
||||
public ImplanterComponentState(ImplanterToggleMode currentMode, bool implantOnly)
|
||||
{
|
||||
CurrentMode = currentMode;
|
||||
ImplantOnly = implantOnly;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum ImplanterToggleMode : byte
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user