Fix various solution capability issues (syringes, drinks) (#4687)
* Fix syringe message stating you're attempting to draw from yourself when you aren't * Fix various missing capabilities (syringes, beakers, drinks) * And fix mug inject/dispense/etc, too! * Injectors can now refill things, and switch over drinks and cups thereof to be refillable rather than injectable
This commit is contained in:
@@ -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<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution)
|
||||
|| solution.CurrentVolume == 0)
|
||||
@@ -233,8 +237,16 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
removedSolution.DoEntityReaction(targetEntity, ReactionMethod.Injection);
|
||||
|
||||
if (!asRefill)
|
||||
{
|
||||
EntitySystem.Get<SolutionContainerSystem>()
|
||||
.Inject(targetEntity.Uid, targetSolution, removedSolution);
|
||||
}
|
||||
else
|
||||
{
|
||||
EntitySystem.Get<SolutionContainerSystem>()
|
||||
.Refill(targetEntity.Uid, targetSolution, removedSolution);
|
||||
}
|
||||
|
||||
Owner.PopupMessage(user,
|
||||
Loc.GetString("injector-component-transfer-success-message",
|
||||
|
||||
@@ -9,9 +9,9 @@ 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}.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
solution: beaker
|
||||
- type: ExaminableSolution
|
||||
solution: beaker
|
||||
- type: DrawableSolution
|
||||
solution: beaker
|
||||
- type: InjectableSolution
|
||||
solution: beaker
|
||||
- type: SolutionTransfer
|
||||
canChangeTransferAmount: true
|
||||
- type: UserInterface
|
||||
|
||||
Reference in New Issue
Block a user