diff options
author | Tim <t4im@users.noreply.github.com> | 2015-01-29 22:24:14 +0100 |
---|---|---|
committer | Tim <t4im@users.noreply.github.com> | 2015-01-29 22:37:29 +0100 |
commit | a98af7bf159a06bb1fd26902ef4c91105aabe2a0 (patch) | |
tree | b7018056dcdb1e95aca53ccdea219aa6e5039c41 /routing_tubes.lua | |
parent | b54a868c339969b8f3d88b59153b1bfba44e5fdc (diff) |
split the big tubes file up into functional modules independend from the tube registration and add their respective crafting recipes
use this opportunity to remove some whitespaces issues from it
Diffstat (limited to 'routing_tubes.lua')
-rw-r--r-- | routing_tubes.lua | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/routing_tubes.lua b/routing_tubes.lua new file mode 100644 index 0000000..acd93af --- /dev/null +++ b/routing_tubes.lua @@ -0,0 +1,82 @@ +if pipeworks.enable_accelerator_tube then + local accelerator_noctr_textures = {"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", + "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png"} + local accelerator_plain_textures = {"pipeworks_accelerator_tube_plain.png" ,"pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png", + "pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png"} + local accelerator_end_textures = {"pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png", + "pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png"} + local accelerator_short_texture = "pipeworks_accelerator_tube_short.png" + local accelerator_inv_texture = "pipeworks_accelerator_tube_inv.png" + + pipeworks.register_tube("pipeworks:accelerator_tube", "Accelerating Pneumatic Tube Segment", accelerator_plain_textures, + accelerator_noctr_textures, accelerator_end_textures, accelerator_short_texture, accelerator_inv_texture, + {tube = {can_go = function(pos, node, velocity, stack) + velocity.speed = velocity.speed+1 + return pipeworks.notvel(pipeworks.meseadjlist, velocity) + end} + }) +end + +if pipeworks.enable_crossing_tube then + local crossing_noctr_textures = {"pipeworks_crossing_tube_noctr.png", "pipeworks_crossing_tube_noctr.png", "pipeworks_crossing_tube_noctr.png", + "pipeworks_crossing_tube_noctr.png", "pipeworks_crossing_tube_noctr.png", "pipeworks_crossing_tube_noctr.png"} + local crossing_plain_textures = {"pipeworks_crossing_tube_plain.png" ,"pipeworks_crossing_tube_plain.png", "pipeworks_crossing_tube_plain.png", + "pipeworks_crossing_tube_plain.png", "pipeworks_crossing_tube_plain.png", "pipeworks_crossing_tube_plain.png"} + local crossing_end_textures = {"pipeworks_crossing_tube_end.png", "pipeworks_crossing_tube_end.png", "pipeworks_crossing_tube_end.png", + "pipeworks_crossing_tube_end.png", "pipeworks_crossing_tube_end.png", "pipeworks_crossing_tube_end.png"} + local crossing_short_texture = "pipeworks_crossing_tube_short.png" + local crossing_inv_texture = "pipeworks_crossing_tube_inv.png" + + pipeworks.register_tube("pipeworks:crossing_tube", "Crossing Pneumatic Tube Segment", crossing_plain_textures, + crossing_noctr_textures, crossing_end_textures, crossing_short_texture, crossing_inv_texture, + {tube = {can_go = function(pos, node, velocity, stack) + return {velocity} + end} + }) +end + +if pipeworks.enable_one_way_tube then + minetest.register_node("pipeworks:one_way_tube", { + description = "One way tube", + tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png", + "pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"}, + paramtype2 = "facedir", + drawtype = "nodebox", + paramtype = "light", + node_box = {type = "fixed", + fixed = {{-1/2, -9/64, -9/64, 1/2, 9/64, 9/64}}}, + groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + tube = { + connect_sides = {left = 1, right = 1}, + can_go = function(pos, node, velocity, stack) + return {velocity} + end, + can_insert = function(pos, node, stack, direction) + local dir = minetest.facedir_to_right_dir(node.param2) + return vector.equals(dir, direction) + end, + priority = 75 -- Higher than normal tubes, but lower than receivers + }, + }) + +end + +minetest.register_craft( { + output = "pipeworks:accelerator_tube_1 2", + recipe = { + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" }, + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } + }, +}) + +minetest.register_craft( { + output = "pipeworks:crossing_tube_1 5", + recipe = { + { "", "pipeworks:tube_1", "" }, + { "pipeworks:tube_1", "pipeworks:tube_1", "pipeworks:tube_1" }, + { "", "pipeworks:tube_1", "" } + }, +}) |