Files
tbd-station-14/Content.Shared/Implants/Components/ImplanterComponent.cs
Simon 771390bb67 Make all implants unable to be implanted more than once (#26250)
* Make mind shield implants unable to be implanted more than once

* Default AllowMultipleImplants to false and update implanters.yml

* Use TryComp instead of TryGetComponent

* Deny multiple implants for fun implants too.

* Make comment more precise
2024-03-26 01:16:19 +01:00

106 lines
2.9 KiB
C#

using Content.Shared.Containers.ItemSlots;
using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Implants.Components;
/// <summary>
/// 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
/// </summary>
//TODO: Rework drawing to work with implant cases when surgery is in
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
public sealed partial class ImplanterComponent : Component
{
public const string ImplanterSlotId = "implanter_slot";
public const string ImplantSlotId = "implant";
/// <summary>
/// Whitelist to check entities against before implanting.
/// Implants get their own whitelist which is checked afterwards.
/// </summary>
[DataField, AutoNetworkedField]
public EntityWhitelist? Whitelist;
/// <summary>
/// Blacklist to check entities against before implanting.
/// </summary>
[DataField, AutoNetworkedField]
public EntityWhitelist? Blacklist;
/// <summary>
/// Used for implanters that start with specific implants
/// </summary>
[DataField]
public EntProtoId? Implant;
/// <summary>
/// The time it takes to implant someone else
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float ImplantTime = 5f;
//TODO: Remove when surgery is a thing
/// <summary>
/// The time it takes to extract an implant from someone
/// It's excessively long to deter from implant checking any antag
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float DrawTime = 60f;
/// <summary>
/// Good for single-use injectors
/// </summary>
[DataField, AutoNetworkedField]
public bool ImplantOnly;
/// <summary>
/// The current mode of the implanter
/// Mode is changed automatically depending if it implants or draws
/// </summary>
[DataField, AutoNetworkedField]
public ImplanterToggleMode CurrentMode;
/// <summary>
/// The name and description of the implant to show on the implanter
/// </summary>
[DataField]
public (string, string) ImplantData;
/// <summary>
/// Determines if the same type of implant can be implanted into an entity multiple times.
/// </summary>
[DataField]
public bool AllowMultipleImplants = false;
/// <summary>
/// The <see cref="ItemSlot"/> for this implanter
/// </summary>
[DataField(required: true)]
public ItemSlot ImplanterSlot = new();
public bool UiUpdateNeeded;
}
[Serializable, NetSerializable]
public enum ImplanterToggleMode : byte
{
Inject,
Draw
}
[Serializable, NetSerializable]
public enum ImplanterVisuals : byte
{
Full
}
[Serializable, NetSerializable]
public enum ImplanterImplantOnlyVisuals : byte
{
ImplantOnly
}