Files
wwdpublic/Content.Shared/Chemistry/Components/FillableOneTimeInjectorComponent.cs
Timfa efd20ba61d Disposable Syringes (#1775)
<!--
This is a semi-strict format, you can add/remove sections as needed but
the order/format should be kept the same
Remove these comments before submitting
-->

# Description

<!--
Explain this PR in as much detail as applicable

Some example prompts to consider:
How might this affect the game? The codebase?
What might be some alternatives to this?
How/Who does this benefit/hurt [the game/codebase]?
-->

A cheap disposable syringe. It can draw once, inject once, and is then
rendered unusable.
The point of the syringe is to let Chemists pack specific dosages of
specific chemicals into a simple syringe. A doctor can then not
accidentally alter a dosage during treatments.

These cheap syringes live alongside normal syringes. They use fewer
materials to make, and are printed much faster.

---

<!--
This is default collapsed, readers click to expand it and see all your
media
The PR media section can get very large at times, so this is a good way
to keep it clean
The title is written using HTML tags
The title must be within the <summary> tags or you won't see it
-->

<details><summary><h1>Media</h1></summary>
<p>

https://github.com/user-attachments/assets/eb439050-b86d-49ba-b95e-22ab271f2358

https://github.com/user-attachments/assets/9e8954ec-11c9-4569-820e-08b91e09f52b

</p>
</details>

---

# Changelog

<!--
You can add an author after the `🆑` to change the name that appears
in the changelog (ex: `🆑 Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

🆑
- add: Added disposable syringes! These cheaper, quicker-to-produce
syringes let Chemists pick dosages while preparing medicine so that
doctors can inject without worrying about volume, but the syringes
cannot be used more than once.

(cherry picked from commit 5516dda48db268f5685e2c926d3dcbdb74ac7e1d)
2025-02-28 16:21:24 +03:00

86 lines
2.6 KiB
C#

using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.DoAfter;
using Content.Shared.FixedPoint;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Chemistry.Components;
/// <summary>
/// Implements draw/inject behavior for syringes that can be filled once and then injected once.
/// </summary>
/// <seealso cref="SharedInjectorSystem"/>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class FillableOneTimeInjectorComponent : Component
{
[DataField]
public string SolutionName = "injector";
/// <summary>
/// The minimum amount of solution that can be transferred at once from this solution.
/// </summary>
[DataField("minTransferAmount")]
public FixedPoint2 MinimumTransferAmount = FixedPoint2.New(1);
/// <summary>
/// The maximum amount of solution that can be transferred at once from this solution.
/// </summary>
[DataField("maxTransferAmount")]
public FixedPoint2 MaximumTransferAmount = FixedPoint2.New(15);
/// <summary>
/// Amount to inject or draw on each usage. If the injector is inject only, it will
/// attempt to inject it's entire contents upon use.
/// </summary>
[DataField]
[AutoNetworkedField]
public FixedPoint2 TransferAmount = FixedPoint2.New(1);
/// <summary>
/// Injection delay (seconds) when the target is a mob.
/// </summary>
/// <remarks>
/// The base delay has a minimum of 1 second, but this will still be modified if the target is incapacitated or
/// in combat mode.
/// </remarks>
[DataField]
public TimeSpan Delay = TimeSpan.FromSeconds(5);
/// <summary>
/// The state of the injector. Determines it's attack behavior. Containers must have the
/// right SolutionCaps to support injection/drawing.
/// </summary>
[AutoNetworkedField]
[DataField]
public FillableOneTimeInjectorToggleMode ToggleState = FillableOneTimeInjectorToggleMode.Draw;
[AutoNetworkedField]
[DataField]
public bool HasDrawn = false;
[AutoNetworkedField]
[DataField]
public bool HasInjected = false;
}
/// <summary>
/// Possible modes for an <see cref="FillableOneTimeInjectorComponent"/>.
/// </summary>
public enum FillableOneTimeInjectorToggleMode : byte
{
/// <summary>
/// The injector will try to inject reagent into things.
/// </summary>
Inject,
/// <summary>
/// The injector will try to draw reagent from things.
/// </summary>
Draw,
/// <summary>
/// The injector can no longer be used.
/// </summary>
Spent,
}