mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Fix "to" and "take" toolshed commands (#5438)
This commit is contained in:
@@ -43,7 +43,7 @@ END TEMPLATE-->
|
||||
|
||||
### Bugfixes
|
||||
|
||||
*None yet*
|
||||
* Fixed the "to" and "take" toolshed commands not working as intended.
|
||||
|
||||
### Other
|
||||
|
||||
|
||||
@@ -219,9 +219,9 @@ command-description-MulVecCommand =
|
||||
command-description-DivVecCommand =
|
||||
Divides every element in the input by a scalar (single value).
|
||||
command-description-rng-to =
|
||||
Returns a number from its input to its argument (i.e. n..m inclusive)
|
||||
Returns a number between the input (inclusive) and the argument (exclusive).
|
||||
command-description-rng-from =
|
||||
Returns a number to its input from its argument (i.e. m..n inclusive)
|
||||
Returns a number between the argument (inclusive) and the input (exclusive))
|
||||
command-description-rng-prob =
|
||||
Returns a boolean based on the input probability/chance (from 0 to 1)
|
||||
command-description-sum =
|
||||
|
||||
@@ -15,5 +15,5 @@ public sealed class ToCommand : ToolshedCommand
|
||||
[CommandArgument] ValueRef<T> end
|
||||
)
|
||||
where T : INumber<T>
|
||||
=> Enumerable.Range(int.CreateTruncating(start), int.CreateTruncating(end.Evaluate(ctx)!)).Select(T.CreateTruncating);
|
||||
=> Enumerable.Range(int.CreateTruncating(start), int.CreateTruncating(end.Evaluate(ctx)! - start)).Select(T.CreateTruncating);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Robust.Shared.Toolshed.Commands.Generic;
|
||||
[ToolshedCommand]
|
||||
public sealed class TakeCommand : ToolshedCommand
|
||||
{
|
||||
[CommandImplementation]
|
||||
[CommandImplementation, TakesPipedTypeAsGeneric]
|
||||
public IEnumerable<T> Take<T>(
|
||||
[CommandInvocationContext] IInvocationContext ctx,
|
||||
[PipedArgument] IEnumerable<T> input,
|
||||
|
||||
Reference in New Issue
Block a user