Generalizes solution overflow & slightly increases space lube yield (#21094)

* generalize SolutionSpikeOverflowEvent

* let reactions overflow

* spacelube: 3 -> 5

* restore TryMixAndOverflow threshold cap
This commit is contained in:
TemporalOroboros
2023-10-28 09:46:59 -07:00
committed by GitHub
parent 17f3fc1287
commit b223e7d6ed
5 changed files with 109 additions and 80 deletions

View File

@@ -262,12 +262,6 @@ namespace Content.Shared.Chemistry.Reaction
if (products.Count == 0)
return true;
// remove excess product
// TODO spill excess?
var excessVolume = solution.Volume - maxVolume;
if (excessVolume > 0)
solution.RemoveSolution(excessVolume);
// Add any reactions associated with the new products. This may re-add reactions that were already iterated
// over previously. The new product may mean the reactions are applicable again and need to be processed.
foreach (var product in products)
@@ -279,16 +273,10 @@ namespace Content.Shared.Chemistry.Reaction
return true;
}
/// <summary>
/// Continually react a solution until no more reactions occur.
/// </summary>
public void FullyReactSolution(Solution solution, EntityUid owner) => FullyReactSolution(solution, owner, FixedPoint2.MaxValue, null);
/// <summary>
/// Continually react a solution until no more reactions occur, with a volume constraint.
/// If a reaction's products would exceed the max volume, some product is deleted.
/// </summary>
public void FullyReactSolution(Solution solution, EntityUid owner, FixedPoint2 maxVolume, ReactionMixerComponent? mixerComponent)
public void FullyReactSolution(Solution solution, EntityUid owner, FixedPoint2 maxVolume, ReactionMixerComponent? mixerComponent = null)
{
// construct the initial set of reactions to check.
SortedSet<ReactionPrototype> reactions = new();