Toolshed is one of the three primary built-in debug tools (alongside
scsi and View Variables.) for RobustToolbox, functioning as the game’s development console. To use Toolshed, open the debug console or use the debug console in
Toolshed is not yet available on the client, so you need to use the
> prefix command on the client in order to run its commands server-side.
Toolshed is a pipeline shell, and the primary method of performing complex actions is composition of commands. You can simply write multiple commands one after the other and as long as they are compatible, they will have their inputs successively fed to one another. For example, take the following command run:
entities with Item count
This is three commands,
count. They together form a command run, a set of successive commands. You can use the
explain command to provide information about a command run’s flow. It’s highly recommended you
explain command runs you don’t understand to get an idea of their flow.
> explain entities with Item count entities: Returns all entities on the server. [none] -> IEnumerable<EntityUid> with: Filters the input entities by whether or not they have the given component. This command can be inverted with not. IEnumerable<EntityUid> -> IEnumerable<EntityUid> count: Counts the amount of entries in it's input, returning an integer. IEnumerable<EntityUid> -> Int32
explain output might suggest, Toolshed is a strongly typed language. All commands have a type signature, and this signature can vary dynamically based on the type of the piped in value and on any type arguments provided.
For example, the
comp command has the signature
IEnumerable<EntityUid> -> IEnumerable<T>, where T is any user specified component.
> explain entities comp Item entities: Returns all entities on the server. [none] -> IEnumerable<EntityUid> comp: Returns the given component from the input entities, discarding entities without that component. IEnumerable<EntityUid> -> IEnumerable<ItemComponent>
Toolshed also supports variables in which you can store values. You can use the
=> command to do this. Variables can then be used anywhere a command accepts a
ValueRef, which can be a block, constant, or variable. You can put
=> in the middle of a command run as well to tee the value.
> entities count => $myCount 1783 > explain entities count => $myCount entities: Returns all entities on the server. [none] -> IEnumerable<EntityUid> count: Counts the amount of entries in it's input, returning an integer. IEnumerable<EntityUid> -> Int32 =>: Assigns the input to a variable. Int32 -> Int32 > entities => $ents count 1783 > val IEnumerable<EntityUid> $ents (1, Sandbox), Dev (1052, StandardNanotrasenStation), Dev (3), (4), advanced capacitor (5, AdvancedCapacitorStockPart), air alarm (6, AirAlarm), Air canister (7, AirCanister), ...