using System.Threading;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.DoAfter;
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;
///
/// Implanters are used to implant or extract implants from an entity.
/// Some can be single use (implant only) or some can draw out an implant
///
//TODO: Rework drawing to work with implant cases when surgery is in
[RegisterComponent, NetworkedComponent]
public sealed partial class ImplanterComponent : Component
{
public const string ImplanterSlotId = "implanter_slot";
public const string ImplantSlotId = "implant";
///
/// Used for implanters that start with specific implants
///
[ViewVariables]
[DataField("implant", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string? Implant;
///
/// The time it takes to implant someone else
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("implantTime")]
public float ImplantTime = 5f;
//TODO: Remove when surgery is a thing
///
/// The time it takes to extract an implant from someone
/// It's excessively long to deter from implant checking any antag
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("drawTime")]
public float DrawTime = 60f;
///
/// Good for single-use injectors
///
[ViewVariables]
[DataField("implantOnly")]
public bool ImplantOnly = false;
///
/// The current mode of the implanter
/// Mode is changed automatically depending if it implants or draws
///
[ViewVariables]
[DataField("currentMode")]
public ImplanterToggleMode CurrentMode;
///
/// The name and description of the implant to show on the implanter
///
[ViewVariables]
[DataField("implantData")]
public (string, string) ImplantData;
///
/// The for this implanter
///
[ViewVariables]
[DataField("implanterSlot", 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
{
Inject,
Draw
}
[Serializable, NetSerializable]
public enum ImplanterVisuals : byte
{
Full
}
[Serializable, NetSerializable]
public enum ImplanterImplantOnlyVisuals : byte
{
ImplantOnly
}