From 57907bde6f240becf659412de8827ab3d60199bd Mon Sep 17 00:00:00 2001 From: Justin Trotter Date: Wed, 9 Nov 2022 16:59:54 -0800 Subject: [PATCH] droppers behave more like syringes (#12518) --- .../Chemistry/Components/InjectorComponent.cs | 11 ++++++++++ .../EntitySystems/ChemistrySystem.Injector.cs | 6 +++++- .../Entities/Objects/Specific/chemistry.yml | 20 +++++++++---------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Content.Server/Chemistry/Components/InjectorComponent.cs b/Content.Server/Chemistry/Components/InjectorComponent.cs index 4783cc4c21..032a469a1c 100644 --- a/Content.Server/Chemistry/Components/InjectorComponent.cs +++ b/Content.Server/Chemistry/Components/InjectorComponent.cs @@ -25,6 +25,16 @@ namespace Content.Server.Chemistry.Components [DataField("injectOnly")] public bool InjectOnly; + /// + /// Whether or not the injector is able to draw from or inject from mobs + /// + /// + /// for example: droppers would ignore mobs + /// + [ViewVariables] + [DataField("ignoreMobs")] + public bool IgnoreMobs = false; + /// /// The minimum amount of solution that can be transferred at once from this solution. /// @@ -72,6 +82,7 @@ namespace Content.Server.Chemistry.Components /// only ever be set to Inject /// [ViewVariables(VVAccess.ReadWrite)] + [DataField("toggleState")] public InjectorToggleMode ToggleState { get => _toggleState; diff --git a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs index 7b4a78d520..9899356e2f 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs @@ -27,7 +27,7 @@ public sealed partial class ChemistrySystem /// /// Default transfer amounts for the set-transfer verb. /// - public static readonly List TransferAmounts = new() { 5, 10, 15}; + public static readonly List TransferAmounts = new() {1, 5, 10, 15}; private void InitializeInjector() { SubscribeLocalEvent>(AddSetTransferVerbs); @@ -173,6 +173,10 @@ public sealed partial class ChemistrySystem if (HasComp(target) || HasComp(target)) { + // Are use using an injector capible of targeting a mob? + if (component.IgnoreMobs) + return; + InjectDoAfter(component, args.User, target); args.Handled = true; return; diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml index 1f18c647d8..a3af012bed 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml @@ -186,25 +186,23 @@ visible: false - type: SolutionContainerManager solutions: - dropper: + injector: maxVol: 5 - - type: RefillableSolution - solution: dropper - - type: DrainableSolution - solution: dropper + - type: Injector + injectOnly: false + ignoreMobs: true + minTransferAmount: 1 + maxTransferAmount: 5 + transferAmount: 1 + toggleState: 1 # draw - type: ExaminableSolution solution: dropper - - type: SolutionTransfer - minTransferAmount: 1 - transferAmount: 1 - maxTransferAmount: 5 - canChangeTransferAmount: true - type: UserInterface interfaces: - key: enum.TransferAmountUiKey.Key type: TransferAmountBoundUserInterface - type: Spillable - solution: dropper + solution: injector - type: Item sprite: Objects/Specific/Chemistry/dropper.rsi - type: Appearance