Predict Injector (syringes), cleanup (#25235)
At least the mode/transfer amount logic. Actual transfer logic needs Bloodstream which I didn't wanna move into shared.
This commit is contained in:
committed by
GitHub
parent
d0c24f9aff
commit
6d8be538c9
104
Content.Shared/Chemistry/Components/InjectorComponent.cs
Normal file
104
Content.Shared/Chemistry/Components/InjectorComponent.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
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;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class InjectorDoAfterEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements draw/inject behavior for droppers and syringes.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can optionally support both
|
||||
/// injection and drawing or just injection. Can inject/draw reagents from solution
|
||||
/// containers, and can directly inject into a mobs bloodstream.
|
||||
/// </remarks>
|
||||
/// <seealso cref="SharedInjectorSystem"/>
|
||||
/// <seealso cref="InjectorToggleMode"/>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class InjectorComponent : Component
|
||||
{
|
||||
public const string SolutionName = "injector";
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the injector is able to draw from containers or if it's a single use
|
||||
/// device that can only inject.
|
||||
/// </summary>
|
||||
[DataField("injectOnly")]
|
||||
public bool InjectOnly;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the injector is able to draw from or inject from mobs
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// for example: droppers would ignore mobs
|
||||
/// </remarks>
|
||||
[DataField("ignoreMobs")]
|
||||
public bool IgnoreMobs;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum amount of solution that can be transferred at once from this solution.
|
||||
/// </summary>
|
||||
[DataField("minTransferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2 MinimumTransferAmount = FixedPoint2.New(5);
|
||||
|
||||
/// <summary>
|
||||
/// The maximum amount of solution that can be transferred at once from this solution.
|
||||
/// </summary>
|
||||
[DataField("maxTransferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2 MaximumTransferAmount = FixedPoint2.New(50);
|
||||
|
||||
/// <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>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("transferAmount")]
|
||||
[AutoNetworkedField]
|
||||
public FixedPoint2 TransferAmount = FixedPoint2.New(5);
|
||||
|
||||
/// <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>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("delay")]
|
||||
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. For InjectOnly injectors this should
|
||||
/// only ever be set to Inject
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[AutoNetworkedField]
|
||||
[DataField]
|
||||
public InjectorToggleMode ToggleState = InjectorToggleMode.Draw;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Possible modes for an <see cref="InjectorComponent"/>.
|
||||
/// </summary>
|
||||
public enum InjectorToggleMode : 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
|
||||
}
|
||||
Reference in New Issue
Block a user