Files
wwdpublic/Content.Shared/Implants/Components/ImplanterComponent.cs
SimpleStation14 4b8036c494 Mirror 26250: Make all implants unable to be implanted more than once (#445)
## Mirror of PR #26250: [Make all implants unable to be implanted more
than once](https://github.com/space-wizards/space-station-14/pull/26250)
from <img src="https://avatars.githubusercontent.com/u/10567778?v=4"
alt="space-wizards" width="22"/>
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)

###### `771390bb6741074935e5f24c0aa9c87bc7b5ad09`

PR opened by <img
src="https://avatars.githubusercontent.com/u/63975668?v=4"
width="16"/><a href="https://github.com/Simyon264"> Simyon264</a> at
2024-03-19 00:44:21 UTC - merged at 2024-03-26 00:16:19 UTC

---

PR changed 3 files with 28 additions and 0 deletions.

The PR had the following labels:
- Status: Needs Review


---

<details open="true"><summary><h1>Original Body</h1></summary>

> <!-- Please read these guidelines before opening your PR:
https://docs.spacestation14.io/en/getting-started/pr-guideline -->
> <!-- The text between the arrows are comments - they will not be
visible on your PR. -->
> 
> ## About the PR
> This PR makes mind shields unable to be implanted more than once.
> ## Why / Balance
> <!-- Why was it changed? Link any discussions or issues here. Please
discuss how this would affect game balance. -->
> PJB complained and people waste implants by injecting already injected
people.
> 
> ## Technical details
> <!-- If this is a code change, summarize at high level how your new
code works. This makes it easier to review. -->
> Adds a new datafield to the Implanter component which is checked in
implanter system.
> 
> ## Media
> <!-- 
> PRs which make ingame changes (adding clothing, items, new features,
etc) are required to have media attached that showcase the changes.
> Small fixes/refactors are exempt.
> Any media may be used in SS14 progress reports, with clear credit
given.
> 
> If you're unsure whether your PR will require media, ask a maintainer.
> 
> Check the box below to confirm that you have in fact seen this (put an
X in the brackets, like [X]):
> -->
>
![image](https://github.com/space-wizards/space-station-14/assets/63975668/4907ddb2-de2f-490c-a35d-07c4f3b6c79b)
> 
> - [x] I have added screenshots/videos to this PR showcasing its
changes ingame, **or** this PR does not require an ingame showcase
> 
> ## Breaking changes
> <!--
> List any breaking changes, including namespace, public
class/method/field changes, prototype renames; and provide instructions
for fixing them. This will be pasted in #codebase-changes.
> -->
> N/A
> 
> **Changelog**
> <!--
> Make players aware of new features and changes that could affect how
they play the game by adding a Changelog entry. Please read the
Changelog guidelines located at:
https://docs.spacestation14.io/en/getting-started/pr-guideline#changelog
> -->
> 
> 🆑 Simyon
> - tweak: All implants are now unable to be implanted more than once.
> 


</details>

Co-authored-by: SimpleStation14 <Unknown>
2024-06-20 23:25:18 +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
}