diff --git a/Content.Server/Chemistry/Components/InjectorComponent.cs b/Content.Server/Chemistry/Components/InjectorComponent.cs index b4ef96f17f..71eb2af01a 100644 --- a/Content.Server/Chemistry/Components/InjectorComponent.cs +++ b/Content.Server/Chemistry/Components/InjectorComponent.cs @@ -127,7 +127,11 @@ namespace Content.Server.Chemistry.Components { if (solutionsSys.TryGetInjectableSolution(targetEntity.Uid, out var injectableSolution)) { - TryInject(targetEntity, injectableSolution, eventArgs.User); + TryInject(targetEntity, injectableSolution, eventArgs.User, false); + } + else if (solutionsSys.TryGetRefillableSolution(targetEntity.Uid, out var refillableSolution)) + { + TryInject(targetEntity, refillableSolution, eventArgs.User, true); } else if (targetEntity.TryGetComponent(out BloodstreamComponent? bloodstream)) { @@ -137,7 +141,7 @@ namespace Content.Server.Chemistry.Components { eventArgs.User.PopupMessage(eventArgs.User, Loc.GetString("injector-component-cannot-transfer-message", - ("owner", eventArgs.User))); + ("target", targetEntity))); } } else if (ToggleState == InjectorToggleMode.Draw) @@ -150,7 +154,7 @@ namespace Content.Server.Chemistry.Components { eventArgs.User.PopupMessage(eventArgs.User, Loc.GetString("injector-component-cannot-draw-message", - ("owner", eventArgs.User))); + ("target", targetEntity))); } } @@ -181,7 +185,7 @@ namespace Content.Server.Chemistry.Components if (realTransferAmount <= 0) { Owner.PopupMessage(user, - Loc.GetString("injector-component-cannot-inject-message", ("owner", targetBloodstream.Owner))); + Loc.GetString("injector-component-cannot-inject-message", ("target", targetBloodstream.Owner))); return; } @@ -210,7 +214,7 @@ namespace Content.Server.Chemistry.Components AfterInject(); } - private void TryInject(IEntity targetEntity, Solution targetSolution, IEntity user) + private void TryInject(IEntity targetEntity, Solution targetSolution, IEntity user, bool asRefill) { if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution) || solution.CurrentVolume == 0) @@ -233,8 +237,16 @@ namespace Content.Server.Chemistry.Components removedSolution.DoEntityReaction(targetEntity, ReactionMethod.Injection); - EntitySystem.Get() - .Inject(targetEntity.Uid, targetSolution, removedSolution); + if (!asRefill) + { + EntitySystem.Get() + .Inject(targetEntity.Uid, targetSolution, removedSolution); + } + else + { + EntitySystem.Get() + .Refill(targetEntity.Uid, targetSolution, removedSolution); + } Owner.PopupMessage(user, Loc.GetString("injector-component-transfer-success-message", diff --git a/Resources/Locale/en-US/chemistry/components/injector-component.ftl b/Resources/Locale/en-US/chemistry/components/injector-component.ftl index 9e3ba0c63d..84e58824a6 100644 --- a/Resources/Locale/en-US/chemistry/components/injector-component.ftl +++ b/Resources/Locale/en-US/chemistry/components/injector-component.ftl @@ -9,11 +9,11 @@ injector-volume-label = Volume: [color=white]{$currentVolume}/{$totalVolume}[/co injector-component-drawing-text = Now drawing injector-component-injecting-text = Now injecting -injector-component-cannot-transfer-message = You aren't able to transfer to {$owner}! -injector-component-cannot-draw-message = You aren't able to draw from {$owner}! -injector-component-cannot-inject-message = You aren't able to inject to {$owner}! +injector-component-cannot-transfer-message = You aren't able to transfer to {$target}! +injector-component-cannot-draw-message = You aren't able to draw from {$target}! +injector-component-cannot-inject-message = You aren't able to inject to {$target}! injector-component-inject-success-message = You inject {$amount}u into {$target}! injector-component-transfer-success-message = You transfer {$amount}u into {$target}. injector-component-draw-success-message = You draw {$amount}u from {$target}. injector-component-target-already-full-message = {$target} is already full! -injector-component-target-is-empty-message = {$target} is empty! \ No newline at end of file +injector-component-target-is-empty-message = {$target} is empty! diff --git a/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml index 0c551f39c8..5b9ca76081 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/drinks.yml @@ -58,6 +58,18 @@ damage: types: Blunt: 5 + - type: FitsInDispenser + solution: drink + - type: DrawableSolution + solution: drink + - type: RefillableSolution + solution: drink + - type: SolutionTransfer + canChangeTransferAmount: true + - type: UserInterface + interfaces: + - key: enum.TransferAmountUiKey.Key + type: TransferAmountBoundUserInterface # Transformable container - normal glass - type: entity @@ -72,15 +84,7 @@ solutions: drink: maxVol: 50 - - type: FitsInDispenser - solution: drink - - type: SolutionTransfer - canChangeTransferAmount: true - type: TransformableContainer - - type: UserInterface - interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface - type: entity parent: DrinkGlassBase diff --git a/Resources/Prototypes/Entities/Objects/Consumable/drinks_cups.yml b/Resources/Prototypes/Entities/Objects/Consumable/drinks_cups.yml index 3b74483882..0187ecabfc 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/drinks_cups.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/drinks_cups.yml @@ -9,6 +9,12 @@ solutions: drink: maxVol: 10 + - type: FitsInDispenser + solution: drink + - type: DrawableSolution + solution: drink + - type: RefillableSolution + solution: drink - type: SolutionTransfer canChangeTransferAmount: true maxTransferAmount: 10 diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml index 688c6a35a5..eee2944fae 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml @@ -29,6 +29,10 @@ solution: beaker - type: ExaminableSolution solution: beaker + - type: DrawableSolution + solution: beaker + - type: InjectableSolution + solution: beaker - type: SolutionTransfer canChangeTransferAmount: true - type: UserInterface