sm.pipeGraph

Pipe utility functions.

Constants

Name Type Description
direction table The pipe directions type list.

direction

Value type: table

Pipe direction types

{
    any,
    incoming,
    outgoing,
}

Server + Client

getContainerShapeToCollectTo

sm.pipeGraph.getContainerShapeToCollectTo( requester, items, quantities )

Returns a chest which allows for collection of specified items of the specified quantities.

Parameters:

Name Type Description
requester Shape The shape connected to the pipe graph who requests the information.
items table The uuids of items to check.
quantities table The number of items of each uuid. Needs to match the number of uuids.

Returns:

Name Type Description
container Shape The shape of the container which was the first one that allows the collection.

getContainerShapeToSpendFrom

sm.pipeGraph.getContainerShapeToSpendFrom( requester, item, quantities )

Returns a chest which allows for spending of specific item with a given quantity.

Parameters:

Name Type Description
requester Shape The shape connected to the pipe graph who requests the information.
item Uuid The uuid of the target item.
quantities number The target spending amount.

Returns:

Name Type Description
container Shape The shape of the container which was the first one that allows spending.

getInputContainers

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:

Name Type Description
requester Shape The shape connected to the pipe graph who's connected chests you want.

Returns:

Name Type Description
containers table A table of connected container shapes sorted by closest first.

getMatchingPipedContainers

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:

Name Type Description
originInteractable Interactable The interactable where the search will start from.

Returns:

Name Type Description
containers table The container of the originInteractable as well as those of the same type connected through pipes.

getOutputContainers

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:

Name Type Description
requester Shape The shape connected to the pipe graph who's connected chests you want.

Returns:

Name Type Description
containers table A table of connected container shapes sorted by closest first.

Server-only

getInteractableConditionTicks

sm.pipeGraph.getInteractableConditionTicks( requester )

Returns the remaining of special condition, nil if no data is available.

return integer: remainingTicks The remaining ticks of the special condition.

Parameters:

Name Type Description
requester Shape The requesting shape.

removeAutomatedTask

sm.pipeGraph.removeAutomatedTask( requester, item )

Removes all stored automated tasks capable of producing the specified item from a producing shape.

Parameters:

Name Type Description
requester Shape The requesting shape.
item Uuid The production to stop.

removeAutomatedTasks

sm.pipeGraph.removeAutomatedTasks( requester )

Removes any stored automated tasks for the requesting shape.

Parameters:

Name Type Description
requester Shape The requesting shape.

setAutomatedTask

sm.pipeGraph.setAutomatedTask( requester, recipe, parallel )

Sets an automated task to be performed by the pipe graph when the body is unloaded.

Parameters:

Name Type Description
requester Shape The shape which requests the automated process.
recipe table 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).
parallel (optional) boolean 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)

setInteractableCondition

sm.pipeGraph.setInteractableCondition( requester, condition )

Sets special conditions for allowing an interactable to craft.

Parameters:

Name Type Description
requester Shape The requesting shape.
condition table Values for special conditions to allow crafting. Uses "uuid", "tickFrequency", "remainingTicks"(optional), "consumptionCount", "onlyExternal". See Prospector.lua for example.

setParallelLimit

sm.pipeGraph.setParallelLimit( requester, amount )

Sets the maximum amount of parallel crafts, 65535 if not set.

Parameters:

Name Type Description
requester Shape The requesting shape.
amount integer The number of parallel crafts allowed to be done at once.

Client-only

getContainerPath

sm.pipeGraph.getContainerPath( requester, target, direction )

Returns a table of shapes on the path between the requesting shape and target container shape.

Parameters:

Name Type Description
requester Shape The requesting shape.
target Shape The target container shape.
direction (optional) integer The direction to fetch in. Defaults to sm.pipeGraph.direction.any (Optional)

Returns:

Name Type Description
shapes table The shapes on the path between requesting shape to target. Requester not included in table.

releaseLightingOverride

sm.pipeGraph.releaseLightingOverride( requester )

Releases any glow and UV overrides made by the shape.

Parameters:

Name Type Description
requester Shape The requesting shape.

requestLightingOverride

sm.pipeGraph.requestLightingOverride( requester, target, uvIndex, glow )

Requests a glow and UV override for pipes between requesting shape and target container.

Parameters:

Name Type Description
requester Shape The requesting shape.
target Shape The target container shape.
uvIndex integer The uv frame index for the affected pipes. Ranges 0 to 3.
glow number The glow multiplier of the pipes.