grindable/juiceable stacks (#4391)

* grindable/juiceable stacks

reagent grinder now takes stacks into account
added ScaleSolution that allows easy scaling of solution contents

* grindable/juiceable stacks revision

grinder/juicer stack fix now ECS
added JuiceableScalingEvent

* Update Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs

Co-authored-by: mirrorcult <lunarautomaton6@gmail.com>

* Update Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs

Co-authored-by: mirrorcult <lunarautomaton6@gmail.com>
Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
plinyvic
2021-07-31 08:06:24 -04:00
committed by GitHub
parent 8aa4f998de
commit e5956566f5
3 changed files with 74 additions and 14 deletions

View File

@@ -115,6 +115,27 @@ namespace Content.Shared.Chemistry.Solution
TotalVolume += quantity;
}
/// <summary>
/// Scales the amount of solution.
/// </summary>
/// <param name="scale">The scalar to modify the solution by.</param>
public void ScaleSolution(float scale)
{
if (scale == 1) return;
var tempContents = new List<ReagentQuantity>(_contents);
foreach(ReagentQuantity current in tempContents)
{
if(scale > 1)
{
AddReagent(current.ReagentId, current.Quantity * scale - current.Quantity);
}
else
{
RemoveReagent(current.ReagentId, current.Quantity - current.Quantity * scale);
}
}
}
/// <summary>
/// Returns the amount of a single reagent inside the solution.
/// </summary>