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

@@ -61,35 +61,11 @@ public sealed class SolutionSpikableSystem : EntitySystem
return;
}
if (_solutionSystem.TryMixAndOverflow(target,
targetSolution,
sourceSolution,
targetSolution.MaxVolume,
out var overflow))
{
if (overflow.Volume > 0)
{
RaiseLocalEvent(target, new SolutionSpikeOverflowEvent(overflow));
}
if (!_solutionSystem.ForceAddSolution(target, targetSolution, sourceSolution))
return;
_popupSystem.PopupEntity(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user);
sourceSolution.RemoveAllSolution();
_triggerSystem.Trigger(source, user);
}
}
}
public sealed class SolutionSpikeOverflowEvent : HandledEntityEventArgs
{
/// <summary>
/// The solution that's been overflowed from the spike.
/// </summary>
public Solution Overflow { get; }
public SolutionSpikeOverflowEvent(Solution overflow)
{
Overflow = overflow;
_popupSystem.PopupEntity(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user);
sourceSolution.RemoveAllSolution();
_triggerSystem.Trigger(source, user);
}
}