summaryrefslogtreecommitdiff
path: root/signal_tubes.lua
diff options
context:
space:
mode:
authorTim <t4im@users.noreply.github.com>2015-01-31 16:10:25 +0100
committerTim <t4im@users.noreply.github.com>2015-01-31 16:10:25 +0100
commite60f86a5886f41636f6f189ce09a5097a9baabee (patch)
tree6e9e29ac71fa675c02f0c4798c0b8f626495a884 /signal_tubes.lua
parent810ae99008667209508f553e6b08e53e63bf1029 (diff)
downloadpipeworks-e60f86a5886f41636f6f189ce09a5097a9baabee.tar
pipeworks-e60f86a5886f41636f6f189ce09a5097a9baabee.tar.gz
pipeworks-e60f86a5886f41636f6f189ce09a5097a9baabee.tar.bz2
pipeworks-e60f86a5886f41636f6f189ce09a5097a9baabee.tar.xz
pipeworks-e60f86a5886f41636f6f189ce09a5097a9baabee.zip
switch to the minetest-conventional def-table style of registering tubes to clean up their registrations
fallback for the old call is provided
Diffstat (limited to 'signal_tubes.lua')
-rw-r--r--signal_tubes.lua75
1 files changed, 41 insertions, 34 deletions
diff --git a/signal_tubes.lua b/signal_tubes.lua
index 75a1159..f8b7bf0 100644
--- a/signal_tubes.lua
+++ b/signal_tubes.lua
@@ -1,10 +1,11 @@
if pipeworks.enable_detector_tube then
- local detector_plain_textures = { "pipeworks_detector_tube_plain.png" }
- local detector_inv_texture = "pipeworks_detector_tube_inv.png"
local detector_tube_step = 2 * tonumber(minetest.setting_get("dedicated_server_step"))
- pipeworks.register_tube("pipeworks:detector_tube_on", "Detecting Pneumatic Tube Segment on (you hacker you)",
- detector_plain_textures, nil, nil, nil, detector_inv_texture,
- {tube = {can_go = function(pos, node, velocity, stack)
+ pipeworks.register_tube("pipeworks:detector_tube_on", {
+ description = "Detecting Pneumatic Tube Segment on (you hacker you)",
+ inventory_image = "pipeworks_detector_tube_inv.png",
+ plain = { "pipeworks_detector_tube_plain.png" },
+ node_def = {
+ tube = {can_go = function(pos, node, velocity, stack)
local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name
local nitems = meta:get_int("nitems")+1
@@ -15,8 +16,7 @@ if pipeworks.enable_detector_tube then
end},
groups = {mesecon = 2, not_in_creative_inventory = 1},
drop = "pipeworks:detector_tube_off_1",
- mesecons = {receptor = {state = "on",
- rules = pipeworks.mesecons_rules}},
+ mesecons = {receptor = {state = "on", rules = pipeworks.mesecons_rules}},
item_exit = function(pos)
local meta = minetest.get_meta(pos)
local nitems = meta:get_int("nitems")-1
@@ -36,11 +36,15 @@ if pipeworks.enable_detector_tube then
local name = minetest.get_node(pos).name
local saved_pos = vector.new(pos)
minetest.after(detector_tube_step, minetest.registered_nodes[name].item_exit, saved_pos)
- end
+ end,
+ },
})
- pipeworks.register_tube("pipeworks:detector_tube_off", "Detecting Pneumatic Tube Segment",
- detector_plain_textures, nil, nil, nil, detector_inv_texture,
- {tube = {can_go = function(pos, node, velocity, stack)
+ pipeworks.register_tube("pipeworks:detector_tube_off", {
+ description = "Detecting Pneumatic Tube Segment",
+ inventory_image = "pipeworks_detector_tube_inv.png",
+ plain = { "pipeworks_detector_tube_plain.png" },
+ node_def = {
+ tube = {can_go = function(pos, node, velocity, stack)
local node = minetest.get_node(pos)
local name = node.name
local fdir = node.param2
@@ -48,9 +52,9 @@ if pipeworks.enable_detector_tube then
mesecon.receptor_on(pos, pipeworks.mesecons_rules)
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
end},
- groups = {mesecon = 2},
- mesecons = {receptor = {state = "off",
- rules = pipeworks.mesecons_rules}}
+ groups = {mesecon = 2},
+ mesecons = {receptor = {state = "off", rules = pipeworks.mesecons_rules }},
+ },
})
minetest.register_craft( {
@@ -64,31 +68,34 @@ if pipeworks.enable_detector_tube then
end
if pipeworks.enable_conductor_tube then
- local conductor_plain_textures = { "pipeworks_conductor_tube_plain.png" }
- local conductor_noctr_textures = { "pipeworks_conductor_tube_noctr.png" }
- local conductor_end_textures = { "pipeworks_conductor_tube_end.png" }
- local conductor_short_texture = "pipeworks_conductor_tube_short.png"
- local conductor_inv_texture = "pipeworks_conductor_tube_inv.png"
-
- local conductor_on_plain_textures = { "pipeworks_conductor_tube_on_plain.png" }
- local conductor_on_noctr_textures = { "pipeworks_conductor_tube_on_noctr.png" }
- local conductor_on_end_textures = { "pipeworks_conductor_tube_on_end.png" }
-
- pipeworks.register_tube("pipeworks:conductor_tube_off", "Conducting Pneumatic Tube Segment", conductor_plain_textures, conductor_noctr_textures,
- conductor_end_textures, conductor_short_texture, conductor_inv_texture,
- {groups = {mesecon = 2},
- mesecons = {conductor = {state = "off",
+ pipeworks.register_tube("pipeworks:conductor_tube_off", {
+ description = "Conducting Pneumatic Tube Segment",
+ inventory_image = "pipeworks_conductor_tube_inv.png",
+ short = "pipeworks_conductor_tube_short.png",
+ plain = { "pipeworks_conductor_tube_plain.png" },
+ noctr = { "pipeworks_conductor_tube_noctr.png" },
+ ends = { "pipeworks_conductor_tube_end.png" },
+ node_def = {
+ groups = {mesecon = 2},
+ mesecons = {conductor = {state = "off",
rules = pipeworks.mesecons_rules,
onstate = "pipeworks:conductor_tube_on_#id"}}
+ },
})
-
- pipeworks.register_tube("pipeworks:conductor_tube_on", "Conducting Pneumatic Tube Segment on (you hacker you)", conductor_on_plain_textures, conductor_on_noctr_textures,
- conductor_on_end_textures, conductor_short_texture, conductor_inv_texture,
- {groups = {mesecon = 2, not_in_creative_inventory = 1},
- drop = "pipeworks:conductor_tube_off_1",
- mesecons = {conductor = {state = "on",
+ pipeworks.register_tube("pipeworks:conductor_tube_on", {
+ description = "Conducting Pneumatic Tube Segment on (you hacker you)",
+ inventory_image = "pipeworks_conductor_tube_inv.png",
+ short = "pipeworks_conductor_tube_short.png",
+ plain_textures = { "pipeworks_conductor_tube_on_plain.png" },
+ noctr = { "pipeworks_conductor_tube_on_noctr.png" },
+ ends = { "pipeworks_conductor_tube_on_end.png" },
+ node_def = {
+ groups = {mesecon = 2, not_in_creative_inventory = 1},
+ drop = "pipeworks:conductor_tube_off_1",
+ mesecons = {conductor = {state = "on",
rules = pipeworks.mesecons_rules,
offstate = "pipeworks:conductor_tube_off_#id"}}
+ },
})
minetest.register_craft( {