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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user