diff --git a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs
index 8c72596fc9..d2b999a8d4 100644
--- a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs
+++ b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs
@@ -60,21 +60,41 @@ namespace Content.Server.GameObjects.Components.Chemistry
///
bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
- //Get target and check if it can be poured into
+ //Get target solution component
if (!Owner.TryGetComponent(out var targetSolution))
return false;
- if (!targetSolution.CanPourIn)
+
+ //Get attack solution component
+ var attackEntity = eventArgs.Using;
+ if (!attackEntity.TryGetComponent(out var attackSolution))
return false;
- //Get attack entity and check if it can pour out.
- var attackEntity = eventArgs.Using;
- if (!attackEntity.TryGetComponent(out var attackSolution) || !attackSolution.CanPourOut)
- return false;
- if (!attackEntity.TryGetComponent(out var attackPourable))
+ // Calculate possibe solution transfer
+ if (targetSolution.CanPourIn && attackSolution.CanPourOut)
+ {
+ // default logic (beakers and glasses)
+ // transfer solution from object in hand to attacked
+ return TryTransfer(eventArgs, attackSolution, targetSolution);
+ }
+ else if (targetSolution.CanPourOut && attackSolution.CanPourIn)
+ {
+ // storage tanks and sinks logic
+ // drain solution from attacked object to object in hand
+ return TryTransfer(eventArgs, targetSolution, attackSolution);
+ }
+
+ // No transfer possible
+ return false;
+ }
+
+ bool TryTransfer(InteractUsingEventArgs eventArgs, SolutionComponent fromSolution, SolutionComponent toSolution)
+ {
+ var fromEntity = fromSolution.Owner;
+ if (!fromEntity.TryGetComponent(out var fromPourable))
return false;
//Get transfer amount. May be smaller than _transferAmount if not enough room
- var realTransferAmount = ReagentUnit.Min(attackPourable.TransferAmount, targetSolution.EmptyVolume);
+ var realTransferAmount = ReagentUnit.Min(fromPourable.TransferAmount, toSolution.EmptyVolume);
if (realTransferAmount <= 0) //Special message if container is full
{
_notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User,
@@ -83,8 +103,8 @@ namespace Content.Server.GameObjects.Components.Chemistry
}
//Move units from attackSolution to targetSolution
- var removedSolution = attackSolution.SplitSolution(realTransferAmount);
- if (!targetSolution.TryAddSolution(removedSolution))
+ var removedSolution = fromSolution.SplitSolution(realTransferAmount);
+ if (!toSolution.TryAddSolution(removedSolution))
return false;
_notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User,
diff --git a/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/fuel_tank.yml b/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/fuel_tank.yml
new file mode 100644
index 0000000000..267a29403c
--- /dev/null
+++ b/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/fuel_tank.yml
@@ -0,0 +1,20 @@
+- type: entity
+ parent: StorageTank
+ id: WeldingFuelTank
+ name: Fueltank
+ description: A storage tank containing welding fuel.
+ components:
+ - type: Sprite
+ texture: Buildings/weldtank.png
+ - type: Icon
+ texture: Buildings/weldtank.png
+ - type: Explosive
+ devastationRange: 1
+ heavyImpactRange: 2
+ lightImpactRange: 4
+ flashRange: 5
+ - type: Solution
+ contents:
+ reagents:
+ - ReagentId: chem.WeldingFuel
+ Quantity: 1500
\ No newline at end of file
diff --git a/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/storage_tank.yml b/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/storage_tank.yml
new file mode 100644
index 0000000000..f3fafa7d85
--- /dev/null
+++ b/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/storage_tank.yml
@@ -0,0 +1,29 @@
+- type: entity
+ id: StorageTank
+ name: Storage Tank
+ description: "A liquids storage tank"
+ abstract: true
+ components:
+ - type: Clickable
+ - type: InteractionOutline
+ - type: Collidable
+ shapes:
+ - !type:PhysShapeAabb
+ bounds: "-0.5,-0.5,0.5,0.5"
+ mask: 30
+ layer: 31
+ IsScrapingFloor: true
+ - type: Physics
+ mass: 15
+ Anchored: false
+ - type: Damageable
+ - type: Destructible
+ thresholdvalue: 10
+ - type: Solution
+ maxVol: 1500
+ caps: 2
+ - type: Pourable
+ transferAmount: 100.0
+ placement:
+ snap:
+ - Wall
diff --git a/Resources/Prototypes/Entities/water_tank.yml b/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/water_tank.yml
similarity index 51%
rename from Resources/Prototypes/Entities/water_tank.yml
rename to Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/water_tank.yml
index 66c8a90136..20f2bad950 100644
--- a/Resources/Prototypes/Entities/water_tank.yml
+++ b/Resources/Prototypes/Entities/Buildings/Storage/StorageTanks/water_tank.yml
@@ -1,5 +1,5 @@
-- type: entity
- parent: ReagentItem
+- type: entity
+ parent: StorageTank
id: WaterTank
name: Water Tank
suffix: Empty
@@ -7,34 +7,9 @@
components:
- type: Sprite
texture: Buildings/watertank.png
-
- type: Icon
texture: Buildings/watertank.png
- - type: Clickable
- - type: InteractionOutline
- - type: Collidable
- layer: 31
- shape:
- bounds: "-0.5,-0.25,0.5,0.25"
- IsScrapingFloor: true
- - type: Physics
- mass: 15
- Anchored: false
-
- - type: Damageable
- - type: Destructible
- thresholdvalue: 10
-
- - type: Solution
- maxVol: 1500
- caps: 3
-
-
- placement:
- snap:
- - Wall
-
- type: entity
parent: WaterTank
id: WaterTankFull
diff --git a/Resources/Prototypes/Entities/Buildings/fuel_tank.yml b/Resources/Prototypes/Entities/Buildings/fuel_tank.yml
deleted file mode 100644
index 2ecf599ebe..0000000000
--- a/Resources/Prototypes/Entities/Buildings/fuel_tank.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-- type: entity
- id: WeldingFuelTank
- name: Fueltank
- description: A storage tank containing welding fuel.
- components:
- - type: Sprite
- texture: Buildings/weldtank.png
-
- - type: Icon
- texture: Buildings/weldtank.png
-
- - type: Clickable
- - type: InteractionOutline
- - type: Collidable
- shapes:
- - !type:PhysShapeAabb
- bounds: "-0.5,-0.25,0.5,0.25"
- layer: 15
- IsScrapingFloor: true
- - type: Physics
- mass: 15
- Anchored: false
- - type: Damageable
- - type: Destructible
- thresholdvalue: 10
- - type: Explosive
- devastationRange: 1
- heavyImpactRange: 2
- lightImpactRange: 4
- flashRange: 5
-
- placement:
- snap:
- - Wall