sm.pipeGraph
Pipe utility functions.
Constants:
Functions:
sm.pipeGraph.direction table
Pipe direction types
| any |
| incoming |
| outgoing |
sm.pipeGraph.getContainerPath(requester, target, direction?)
Client only
Returns a table of shapes on the path between the requesting shape and target container shape.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
| Shape | target | The target container shape. |
| integer | direction? | The direction to fetch in. Defaults to sm.pipeGraph.direction.any (Optional) |
Returns:
| Type | Description |
|---|---|
| table | shapes The shapes on the path between requesting shape to target. Requester not included in table. |
sm.pipeGraph.getContainerShapeToCollectTo(requester, items, quantities)
Returns a chest which allows for collection of specified items of the specified quantities.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The shape connected to the pipe graph who requests the information. |
| table | items | The uuids of items to check. |
| table | quantities | The number of items of each uuid. Needs to match the number of uuids. |
Returns:
| Type | Description |
|---|---|
| Shape | container The shape of the container which was the first one that allows the collection. |
sm.pipeGraph.getContainerShapeToSpendFrom(requester, item, quantities)
Returns a chest which allows for spending of specific item with a given quantity.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The shape connected to the pipe graph who requests the information. |
| Uuid | item | The uuid of the target item. |
| number | quantities | The target spending amount. |
Returns:
| Type | Description |
|---|---|
| Shape | container The shape of the container which was the first one that allows spending. |
sm.pipeGraph.getInputContainers(requester)
Returns a table of all connected input containers sorted by closest first. If the asking shape doesn't have input and output directions it returns all connected containers.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The shape connected to the pipe graph who's connected chests you want. |
Returns:
| Type | Description |
|---|---|
| table | containers A table of connected container shapes sorted by closest first. |
sm.pipeGraph.getInteractableConditionTicks(requester)
Server only
Returns the remaining of special condition, nil if no data is available.
return integer: remainingTicks The remaining ticks of the special condition.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
sm.pipeGraph.getMatchingPipedContainers(originInteractable)
Returns the containers of all chests connected to the given shape through the pipe connections. Will only return containers from shapes of the same type as the original.
Parameters:
| Type | Name | Description |
|---|---|---|
| Interactable | originInteractable | The interactable where the search will start from. |
Returns:
| Type | Description |
|---|---|
| table | containers The container of the originInteractable as well as those of the same type connected through pipes. |
sm.pipeGraph.getOutputContainers(requester)
Returns a table of all connected output containers sorted by closest first. If the asking shape doesn't have input and output directions it returns all connected containers.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The shape connected to the pipe graph who's connected chests you want. |
Returns:
| Type | Description |
|---|---|
| table | containers A table of connected container shapes sorted by closest first. |
sm.pipeGraph.releaseLightingOverride(requester)
Client only
Releases any glow and UV overrides made by the shape.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
sm.pipeGraph.removeAutomatedTask(requester, item)
Server only
Removes all stored automated tasks capable of producing the specified item from a producing shape.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
| Uuid | item | The production to stop. |
sm.pipeGraph.removeAutomatedTasks(requester)
Server only
Removes any stored automated tasks for the requesting shape.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
sm.pipeGraph.requestLightingOverride(requester, target, uvIndex, glow)
Client only
Requests a glow and UV override for pipes between requesting shape and target container.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
| Shape | target | The target container shape. |
| integer | uvIndex | The uv frame index for the affected pipes. Ranges 0 to 3. |
| number | glow | The glow multiplier of the pipes. |
sm.pipeGraph.setAutomatedTask(requester, recipe, parallel?)
Server only
Sets an automated task to be performed by the pipe graph when the body is unloaded.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The shape which requests the automated process. |
| table | recipe | A table with information on the recipe. Uses the crafter recipe format. Can have "craftTime", "quantity", "itemId", "externalContainers"(containers targeted outside pipe graph for consumption, example: refinery), "selfOutputContainer"(if the shape has it's own collection container), "ingredientList", "randomCraftList" random weighted crafts (see prospector), "specialCrafting" used to target specific container slots with custom information (see ore crusher). |
| boolean | parallel? | Whether the craft tasks should be carried out in parallel or not, off by default. A parallel task will be carried out independently of other automated tasks on this shape. (Optional) |
sm.pipeGraph.setInteractableCondition(requester, condition)
Server only
Sets special conditions for allowing an interactable to craft.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
| table | condition | Values for special conditions to allow crafting. Uses "uuid", "tickFrequency", "remainingTicks"(optional), "consumptionCount", "onlyExternal". See Prospector.lua for example. |
sm.pipeGraph.setParallelLimit(requester, amount)
Server only
Sets the maximum amount of parallel crafts, 65535 if not set.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | requester | The requesting shape. |
| integer | amount | The number of parallel crafts allowed to be done at once. |