Fix "to" and "take" toolshed commands (#5438)

This commit is contained in:
Leon Friedrich
2024-09-14 00:34:30 +12:00
committed by GitHub
parent 0f60ad9018
commit 4949b34c88
4 changed files with 5 additions and 5 deletions

View File

@@ -43,7 +43,7 @@ END TEMPLATE-->
### Bugfixes
*None yet*
* Fixed the "to" and "take" toolshed commands not working as intended.
### Other

View File

@@ -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 =

View File

@@ -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);
}

View File

@@ -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,