diff --git a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs
index 1ad4386634..439fc69ac9 100644
--- a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs
+++ b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs
@@ -28,13 +28,13 @@ namespace Content.Server.GameObjects.Components.Chemistry
public override string Name => "Pourable";
- private int _transferAmount;
+ private decimal _transferAmount;
///
/// The amount of solution to be transferred from this solution when clicking on other solutions with it.
///
[ViewVariables]
- public int TransferAmount
+ public decimal TransferAmount
{
get => _transferAmount;
set => _transferAmount = value;
@@ -43,7 +43,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
- serializer.DataField(ref _transferAmount, "transferAmount", 5);
+ serializer.DataField(ref _transferAmount, "transferAmount", 5.0M);
}
///
diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs
index fa3a65e6c5..1f8f13625e 100644
--- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs
+++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs
@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
[ViewVariables] private string _packPrototypeId;
[ViewVariables] private bool HasBeaker => _beakerContainer.ContainedEntity != null;
- [ViewVariables] private int DispenseAmount = 10;
+ [ViewVariables] private decimal _dispenseAmount = 10;
[ViewVariables]
private SolutionComponent Solution => _beakerContainer.ContainedEntity.GetComponent();
@@ -115,22 +115,22 @@ namespace Content.Server.GameObjects.Components.Chemistry
TryClear();
break;
case UiButton.SetDispenseAmount1:
- DispenseAmount = 1;
+ _dispenseAmount = 1;
break;
case UiButton.SetDispenseAmount5:
- DispenseAmount = 5;
+ _dispenseAmount = 5;
break;
case UiButton.SetDispenseAmount10:
- DispenseAmount = 10;
+ _dispenseAmount = 10;
break;
case UiButton.SetDispenseAmount25:
- DispenseAmount = 25;
+ _dispenseAmount = 25;
break;
case UiButton.SetDispenseAmount50:
- DispenseAmount = 50;
+ _dispenseAmount = 50;
break;
case UiButton.SetDispenseAmount100:
- DispenseAmount = 100;
+ _dispenseAmount = 100;
break;
case UiButton.Dispense:
if (HasBeaker)
@@ -173,12 +173,12 @@ namespace Content.Server.GameObjects.Components.Chemistry
if (beaker == null)
{
return new ReagentDispenserBoundUserInterfaceState(false, 0, 0,
- "", Inventory, Owner.Name, null, DispenseAmount);
+ "", Inventory, Owner.Name, null, _dispenseAmount);
}
var solution = beaker.GetComponent();
return new ReagentDispenserBoundUserInterfaceState(true, solution.CurrentVolume, solution.MaxVolume,
- beaker.Name, Inventory, Owner.Name, solution.ReagentList.ToList(), DispenseAmount);
+ beaker.Name, Inventory, Owner.Name, solution.ReagentList.ToList(), _dispenseAmount);
}
private void UpdateUserInterface()
@@ -228,7 +228,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
if (!HasBeaker) return;
var solution = _beakerContainer.ContainedEntity.GetComponent();
- solution.TryAddReagent(Inventory[dispenseIndex].ID, DispenseAmount, out _);
+ solution.TryAddReagent(Inventory[dispenseIndex].ID, _dispenseAmount, out _);
UpdateUserInterface();
}
diff --git a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs
index c5a815752a..9bb574a002 100644
--- a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs
+++ b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs
@@ -37,8 +37,9 @@ namespace Content.Server.GameObjects.Components.Chemistry
Init();
}
- public void Init()
+ public override void Init()
{
+ base.Init();
_reactions = _prototypeManager.EnumeratePrototypes();
_audioSystem = _entitySystemManager.GetEntitySystem();
}
diff --git a/Content.Server/GameObjects/Components/Nutrition/StomachComponent.cs b/Content.Server/GameObjects/Components/Nutrition/StomachComponent.cs
index 294fc20fcb..9923767503 100644
--- a/Content.Server/GameObjects/Components/Nutrition/StomachComponent.cs
+++ b/Content.Server/GameObjects/Components/Nutrition/StomachComponent.cs
@@ -119,7 +119,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
}
//Add reagents ready for transfer to bloodstream to transferSolution
- var transferSolution = new Solution();
+ var transferSolution = IoCManager.InjectDependencies(new Solution());
foreach (var delta in _reagentDeltas.ToList()) //Use ToList here to remove entries while iterating
{
//Increment lifetime of reagents
diff --git a/Content.Shared/Chemistry/Solution.cs b/Content.Shared/Chemistry/Solution.cs
index 109b780108..365372f91f 100644
--- a/Content.Shared/Chemistry/Solution.cs
+++ b/Content.Shared/Chemistry/Solution.cs
@@ -172,7 +172,7 @@ namespace Content.Shared.Chemistry
public Solution SplitSolution(decimal quantity)
{
if (quantity <= 0)
- return new Solution();
+ return IoCManager.InjectDependencies(new Solution());
Solution newSolution;
@@ -183,7 +183,7 @@ namespace Content.Shared.Chemistry
return newSolution;
}
- newSolution = new Solution();
+ newSolution = IoCManager.InjectDependencies(new Solution());
var newTotalVolume = 0M;
var ratio = (TotalVolume - quantity) / TotalVolume;
@@ -235,7 +235,7 @@ namespace Content.Shared.Chemistry
public Solution Clone()
{
var volume = 0M;
- var newSolution = new Solution();
+ var newSolution = IoCManager.InjectDependencies(new Solution());
for (var i = 0; i < _contents.Count; i++)
{
diff --git a/Content.Shared/GameObjects/Components/Chemistry/SolutionComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/SolutionComponent.cs
index 8a1f2b8a58..81a91b3d38 100644
--- a/Content.Shared/GameObjects/Components/Chemistry/SolutionComponent.cs
+++ b/Content.Shared/GameObjects/Components/Chemistry/SolutionComponent.cs
@@ -17,7 +17,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
#pragma warning restore 649
[ViewVariables]
- protected Solution ContainedSolution = new Solution();
+ protected Solution ContainedSolution;
private decimal _maxVolume;
private SolutionCaps _capabilities;
@@ -95,15 +95,20 @@ namespace Content.Shared.GameObjects.Components.Chemistry
base.ExposeData(serializer);
serializer.DataField(ref _maxVolume, "maxVol", 0M);
- serializer.DataField(ref ContainedSolution, "contents", ContainedSolution);
+ serializer.DataField(ref ContainedSolution, "contents", IoCManager.InjectDependencies(new Solution()));
serializer.DataField(ref _capabilities, "caps", SolutionCaps.None);
}
+ public virtual void Init()
+ {
+ ContainedSolution = IoCManager.InjectDependencies(new Solution());
+ }
+
///
protected override void Startup()
{
base.Startup();
-
+
RecalculateColor();
}
@@ -113,7 +118,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
base.Shutdown();
ContainedSolution.RemoveAllSolution();
- ContainedSolution = new Solution();
+ ContainedSolution = IoCManager.InjectDependencies(new Solution());
}
public void RemoveAllSolution()