adjreagent now accepts float (#38134)
* adjreagent now accepts float * var
This commit is contained in:
@@ -38,18 +38,21 @@ public sealed class SolutionCommand : ToolshedCommand
|
||||
public SolutionRef AdjReagent(
|
||||
[PipedArgument] SolutionRef input,
|
||||
ProtoId<ReagentPrototype> proto,
|
||||
FixedPoint2 amount
|
||||
float amount
|
||||
)
|
||||
{
|
||||
_solutionContainer ??= GetSys<SharedSolutionContainerSystem>();
|
||||
|
||||
if (amount > 0)
|
||||
// Convert float to FixedPoint2
|
||||
var amountFixed = FixedPoint2.New(amount);
|
||||
|
||||
if (amountFixed > 0)
|
||||
{
|
||||
_solutionContainer.TryAddReagent(input.Solution, proto, amount, out _);
|
||||
_solutionContainer.TryAddReagent(input.Solution, proto, amountFixed, out _);
|
||||
}
|
||||
else if (amount < 0)
|
||||
else if (amountFixed < 0)
|
||||
{
|
||||
_solutionContainer.RemoveReagent(input.Solution, proto, -amount);
|
||||
_solutionContainer.RemoveReagent(input.Solution, proto, -amountFixed);
|
||||
}
|
||||
|
||||
return input;
|
||||
@@ -59,7 +62,7 @@ public sealed class SolutionCommand : ToolshedCommand
|
||||
public IEnumerable<SolutionRef> AdjReagent(
|
||||
[PipedArgument] IEnumerable<SolutionRef> input,
|
||||
ProtoId<ReagentPrototype> name,
|
||||
FixedPoint2 amount
|
||||
float amount
|
||||
)
|
||||
=> input.Select(x => AdjReagent(x, name, amount));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user