Skip to content
wsor4035 edited this page Dec 14, 2021 · 1 revision

Pipeworks has an api that allows other mods to use its functionality.
Here is documented how to use the api.

Note: This may be incomplete and can change at any time.

Tube functions

  • pipeworks.tube_inject_item(pos, start_pos, velocity, item, owner)
    • Injects an item into a tube.
    • owner should be a playername but can be nil.
    • Returns the newly added object.
  • pipeworks.scan_for_tube_objects(pos)
  • pipeworks.notvel(possibilities, vel)
    • possibilities is a list of vectors.
    • Returns the all entries val of possibilities where val.x ~= -vel.x or val.y ~= -vel.y or val.z ~= -vel.z in a new list.
  • pipeworks.register_tube(name, def, ...)
  • pipeworks.after_dig(pos)
  • pipeworks.after_place(pos)

Tube definition in node definition

(incomplete)

tube = {
	insert_object = func(pos, node, stack, direction, owner),
	can_insert = func(pos, node, stack, direction, owner),
	input_inventory = "main",
	return_input_invref = func(pos, node, direction, player_name),
	connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1},
	can_remove = func(frompos, fromnode, stack, dir, frominvname, spos),
	remove_items(frompos, fromnode, stack, dir, count, frominvname, spos),
}

Pipe functions

  • pipeworks.scan_for_pipe_objects(pos)
  • pipeworks.spigot_check(pos, node)
  • pipeworks.check_for_liquids(pos)
  • pipeworks.get_axis_dir(nodetable, pattern)
  • pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
    • Can be used as on_place for pipe devices.
  • pipeworks.scan_pipe_surroundings(pos)
  • pipeworks.check_for_inflows(pos,node)
  • pipeworks.fountainhead_check(pos,node)
  • pipeworks.look_for_stackable_tanks(pos)
  • pipeworks.fix_after_rotation(pos, node, user, mode, new_param2)
  • pipeworks.check_sources = function(pos,node)

Helper functions

  • pipeworks.load_position(pos)
  • pipeworks.vector_dot(a, b)
  • pipeworks.may_configure(pos, player)
  • pipeworks.facedir_to_right_dir(facedir)
  • pipeworks.facedir_to_top_dir(facedir)
  • pipeworks.table_contains(tbl, element)
  • pipeworks.vector_cross(a, b)
  • pipeworks.replace_name(tbl,tr,name)
    • never used
  • pipeworks.fix_image_names(table, replacement)
    • never used
  • pipeworks.table_recursive_replace(tbl, pattern, replace_with)
  • pipeworks.string_startswith(str, substr)
  • pipeworks.add_node_box(t, b)
    • never used
  • pipeworks.table_extend(tbl, tbl2)
Clone this wiki locally