Solution rejig (#12428)
This commit is contained in:
@@ -23,8 +23,8 @@ namespace Content.Server.Body.Components
|
||||
/// <summary>
|
||||
/// Initial internal solution storage volume
|
||||
/// </summary>
|
||||
[DataField("maxVolume")]
|
||||
public FixedPoint2 InitialMaxVolume { get; private set; } = FixedPoint2.New(50);
|
||||
[DataField("initialMaxVolume", readOnly: true)]
|
||||
public readonly FixedPoint2 InitialMaxVolume = FixedPoint2.New(50);
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds between reagents being ingested and them being
|
||||
|
||||
@@ -96,7 +96,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
continue;
|
||||
|
||||
// First, let's refresh their blood if possible.
|
||||
if (bloodstream.BloodSolution.CurrentVolume < bloodstream.BloodSolution.MaxVolume)
|
||||
if (bloodstream.BloodSolution.Volume < bloodstream.BloodSolution.MaxVolume)
|
||||
TryModifyBloodLevel(uid, bloodstream.BloodRefreshAmount, bloodstream);
|
||||
|
||||
// Next, let's remove some blood from them according to their bleed level.
|
||||
@@ -258,7 +258,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
if (!Resolve(uid, ref component))
|
||||
return 0.0f;
|
||||
|
||||
return (component.BloodSolution.CurrentVolume / component.BloodSolution.MaxVolume).Float();
|
||||
return component.BloodSolution.FillFraction;
|
||||
}
|
||||
|
||||
public void SetBloodLossThreshold(EntityUid uid, float threshold, BloodstreamComponent? comp = null)
|
||||
@@ -284,13 +284,13 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
// since we also wanna handle moving it to the temporary solution
|
||||
// and then spilling it if necessary.
|
||||
var newSol = component.BloodSolution.SplitSolution(-amount);
|
||||
component.BloodTemporarySolution.AddSolution(newSol);
|
||||
component.BloodTemporarySolution.AddSolution(newSol, _prototypeManager);
|
||||
|
||||
if (component.BloodTemporarySolution.CurrentVolume > component.BleedPuddleThreshold)
|
||||
if (component.BloodTemporarySolution.Volume > component.BleedPuddleThreshold)
|
||||
{
|
||||
// Pass some of the chemstream into the spilled blood.
|
||||
var temp = component.ChemicalSolution.SplitSolution(component.BloodTemporarySolution.CurrentVolume / 10);
|
||||
component.BloodTemporarySolution.AddSolution(temp);
|
||||
var temp = component.ChemicalSolution.SplitSolution(component.BloodTemporarySolution.Volume / 10);
|
||||
component.BloodTemporarySolution.AddSolution(temp, _prototypeManager);
|
||||
_spillableSystem.SpillAt(uid, component.BloodTemporarySolution, "PuddleBlood", false);
|
||||
component.BloodTemporarySolution.RemoveAllSolution();
|
||||
}
|
||||
@@ -324,11 +324,11 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
component.ChemicalSolution.MaxVolume;
|
||||
var tempSol = new Solution() { MaxVolume = max };
|
||||
|
||||
tempSol.AddSolution(component.BloodSolution);
|
||||
tempSol.AddSolution(component.BloodSolution, _prototypeManager);
|
||||
component.BloodSolution.RemoveAllSolution();
|
||||
tempSol.AddSolution(component.BloodTemporarySolution);
|
||||
tempSol.AddSolution(component.BloodTemporarySolution, _prototypeManager);
|
||||
component.BloodTemporarySolution.RemoveAllSolution();
|
||||
tempSol.AddSolution(component.ChemicalSolution);
|
||||
tempSol.AddSolution(component.ChemicalSolution, _prototypeManager);
|
||||
component.ChemicalSolution.RemoveAllSolution();
|
||||
_spillableSystem.SpillAt(uid, tempSol, "PuddleBlood", true);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Chemistry.Components.SolutionManager;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Shared.Body.Organ;
|
||||
@@ -47,7 +47,7 @@ namespace Content.Server.Body.Systems
|
||||
delta.Increment(stomach.UpdateInterval);
|
||||
if (delta.Lifetime > stomach.DigestionDelay)
|
||||
{
|
||||
if (stomachSolution.ContainsReagent(delta.ReagentId, out var quant))
|
||||
if (stomachSolution.TryGetReagent(delta.ReagentId, out var quant))
|
||||
{
|
||||
if (quant > delta.Quantity)
|
||||
quant = delta.Quantity;
|
||||
@@ -89,8 +89,7 @@ namespace Content.Server.Body.Systems
|
||||
|
||||
private void OnComponentInit(EntityUid uid, StomachComponent component, ComponentInit args)
|
||||
{
|
||||
var solution = _solutionContainerSystem.EnsureSolution(uid, DefaultSolutionName);
|
||||
solution.MaxVolume = component.InitialMaxVolume;
|
||||
_solutionContainerSystem.EnsureSolution(uid, DefaultSolutionName, component.InitialMaxVolume, out _);
|
||||
}
|
||||
|
||||
public bool CanTransferSolution(EntityUid uid, Solution solution,
|
||||
|
||||
Reference in New Issue
Block a user