ImplanterComponent.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using Content.Shared.Containers.ItemSlots;
  2. using Content.Shared.Damage;
  3. using Content.Shared.Whitelist;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. using Robust.Shared.Serialization;
  7. namespace Content.Shared.Implants.Components;
  8. /// <summary>
  9. /// Implanters are used to implant or extract implants from an entity.
  10. /// Some can be single use (implant only) or some can draw out an implant
  11. /// </summary>
  12. //TODO: Rework drawing to work with implant cases when surgery is in
  13. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
  14. public sealed partial class ImplanterComponent : Component
  15. {
  16. public const string ImplanterSlotId = "implanter_slot";
  17. public const string ImplantSlotId = "implant";
  18. /// <summary>
  19. /// Whitelist to check entities against before implanting.
  20. /// Implants get their own whitelist which is checked afterwards.
  21. /// </summary>
  22. [DataField, AutoNetworkedField]
  23. public EntityWhitelist? Whitelist;
  24. /// <summary>
  25. /// Blacklist to check entities against before implanting.
  26. /// </summary>
  27. [DataField, AutoNetworkedField]
  28. public EntityWhitelist? Blacklist;
  29. /// <summary>
  30. /// Used for implanters that start with specific implants
  31. /// </summary>
  32. [DataField]
  33. public EntProtoId? Implant;
  34. /// <summary>
  35. /// The time it takes to implant someone else
  36. /// </summary>
  37. [ViewVariables(VVAccess.ReadWrite)]
  38. [DataField]
  39. public float ImplantTime = 5f;
  40. //TODO: Remove when surgery is a thing
  41. /// <summary>
  42. /// The time it takes to extract an implant from someone
  43. /// It's excessively long to deter from implant checking any antag
  44. /// </summary>
  45. [ViewVariables(VVAccess.ReadWrite)]
  46. [DataField]
  47. public float DrawTime = 25f;
  48. /// <summary>
  49. /// Good for single-use injectors
  50. /// </summary>
  51. [DataField, AutoNetworkedField]
  52. public bool ImplantOnly;
  53. /// <summary>
  54. /// The current mode of the implanter
  55. /// Mode is changed automatically depending if it implants or draws
  56. /// </summary>
  57. [DataField, AutoNetworkedField]
  58. public ImplanterToggleMode CurrentMode;
  59. /// <summary>
  60. /// The name and description of the implant to show on the implanter
  61. /// </summary>
  62. [DataField]
  63. public (string, string) ImplantData;
  64. /// <summary>
  65. /// Determines if the same type of implant can be implanted into an entity multiple times.
  66. /// </summary>
  67. [DataField]
  68. public bool AllowMultipleImplants = false;
  69. /// <summary>
  70. /// The <see cref="ItemSlot"/> for this implanter
  71. /// </summary>
  72. [DataField(required: true)]
  73. public ItemSlot ImplanterSlot = new();
  74. /// <summary>
  75. /// If true, the implanter may be used to remove all kinds of (deimplantable) implants without selecting any.
  76. /// </summary>
  77. [DataField]
  78. public bool AllowDeimplantAll = false;
  79. /// <summary>
  80. /// The subdermal implants that may be removed via this implanter
  81. /// </summary>
  82. [DataField]
  83. public List<EntProtoId> DeimplantWhitelist = new();
  84. /// <summary>
  85. /// The subdermal implants that may be removed via this implanter
  86. /// </summary>
  87. [DataField]
  88. public DamageSpecifier DeimplantFailureDamage = new();
  89. /// <summary>
  90. /// Chosen implant to remove, if necessary.
  91. /// </summary>
  92. [AutoNetworkedField]
  93. public EntProtoId? DeimplantChosen = null;
  94. public bool UiUpdateNeeded;
  95. }
  96. [Serializable, NetSerializable]
  97. public enum ImplanterToggleMode : byte
  98. {
  99. Inject,
  100. Draw
  101. }
  102. [Serializable, NetSerializable]
  103. public enum ImplanterVisuals : byte
  104. {
  105. Full
  106. }
  107. [Serializable, NetSerializable]
  108. public enum ImplanterImplantOnlyVisuals : byte
  109. {
  110. ImplantOnly
  111. }