mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-17 07:50:31 +01:00
switch to the minetest-conventional def-table style of registering tubes to clean up their registrations
fallback for the old call is provided
This commit is contained in:
parent
810ae99008
commit
e60f86a588
@ -10,20 +10,20 @@ minetest.register_craft( {
|
||||
})
|
||||
|
||||
if pipeworks.enable_accelerator_tube then
|
||||
local accelerator_noctr_textures = { "pipeworks_accelerator_tube_noctr.png" }
|
||||
local accelerator_plain_textures = { "pipeworks_accelerator_tube_plain.png" }
|
||||
local accelerator_end_textures = { "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)
|
||||
pipeworks.register_tube("pipeworks:accelerator_tube", {
|
||||
description = "Accelerating Pneumatic Tube Segment",
|
||||
inventory_image = "pipeworks_accelerator_tube_inv.png",
|
||||
plain = { "pipeworks_accelerator_tube_plain.png" },
|
||||
noctr = { "pipeworks_accelerator_tube_noctr.png" },
|
||||
ends = { "pipeworks_accelerator_tube_end.png" },
|
||||
short = "pipeworks_accelerator_tube_short.png",
|
||||
node_def = {
|
||||
tube = {can_go = function(pos, node, velocity, stack)
|
||||
velocity.speed = velocity.speed+1
|
||||
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
|
||||
end}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "pipeworks:accelerator_tube_1 2",
|
||||
recipe = {
|
||||
@ -32,23 +32,20 @@ if pipeworks.enable_accelerator_tube then
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||
},
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if pipeworks.enable_crossing_tube then
|
||||
local crossing_noctr_textures = { "pipeworks_crossing_tube_noctr.png" }
|
||||
local crossing_plain_textures = { "pipeworks_crossing_tube_plain.png" }
|
||||
local crossing_end_textures = { "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}
|
||||
pipeworks.register_tube("pipeworks:crossing_tube", {
|
||||
description = "Crossing Pneumatic Tube Segment",
|
||||
inventory_image = "pipeworks_crossing_tube_inv.png",
|
||||
plain = { "pipeworks_crossing_tube_plain.png" },
|
||||
noctr = { "pipeworks_crossing_tube_noctr.png" },
|
||||
ends = { "pipeworks_crossing_tube_end.png" },
|
||||
short = "pipeworks_crossing_tube_short.png",
|
||||
node_def = {
|
||||
tube = {can_go = function(pos, node, velocity, stack) return {velocity} end }
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "pipeworks:crossing_tube_1 5",
|
||||
recipe = {
|
||||
|
@ -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( {
|
||||
|
@ -1,11 +1,4 @@
|
||||
if pipeworks.enable_mese_tube then
|
||||
local mese_noctr_textures = {"pipeworks_mese_tube_noctr_1.png", "pipeworks_mese_tube_noctr_2.png", "pipeworks_mese_tube_noctr_3.png",
|
||||
"pipeworks_mese_tube_noctr_4.png", "pipeworks_mese_tube_noctr_5.png", "pipeworks_mese_tube_noctr_6.png"}
|
||||
local mese_plain_textures = {"pipeworks_mese_tube_plain_1.png", "pipeworks_mese_tube_plain_2.png", "pipeworks_mese_tube_plain_3.png",
|
||||
"pipeworks_mese_tube_plain_4.png", "pipeworks_mese_tube_plain_5.png", "pipeworks_mese_tube_plain_6.png"}
|
||||
local mese_end_textures = { "pipeworks_mese_tube_end.png" }
|
||||
local mese_short_texture = "pipeworks_mese_tube_short.png"
|
||||
local mese_inv_texture = "pipeworks_mese_tube_inv.png"
|
||||
local function update_formspec(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local old_formspec = meta:get_string("formspec")
|
||||
@ -40,9 +33,19 @@ if pipeworks.enable_mese_tube then
|
||||
buttons_formspec..
|
||||
"list[current_player;main;0,7;8,4;]")
|
||||
end
|
||||
pipeworks.register_tube("pipeworks:mese_tube", "Sorting Pneumatic Tube Segment", mese_plain_textures, mese_noctr_textures,
|
||||
mese_end_textures, mese_short_texture, mese_inv_texture,
|
||||
{tube = {can_go = function(pos, node, velocity, stack)
|
||||
|
||||
pipeworks.register_tube("pipeworks:mese_tube", {
|
||||
description = "Sorting Pneumatic Tube Segment",
|
||||
inventory_image = "pipeworks_mese_tube_inv.png",
|
||||
noctr = {"pipeworks_mese_tube_noctr_1.png", "pipeworks_mese_tube_noctr_2.png", "pipeworks_mese_tube_noctr_3.png",
|
||||
"pipeworks_mese_tube_noctr_4.png", "pipeworks_mese_tube_noctr_5.png", "pipeworks_mese_tube_noctr_6.png"},
|
||||
plain = {"pipeworks_mese_tube_plain_1.png", "pipeworks_mese_tube_plain_2.png", "pipeworks_mese_tube_plain_3.png",
|
||||
"pipeworks_mese_tube_plain_4.png", "pipeworks_mese_tube_plain_5.png", "pipeworks_mese_tube_plain_6.png"},
|
||||
ends = { "pipeworks_mese_tube_end.png" },
|
||||
short = "pipeworks_mese_tube_short.png",
|
||||
no_facedir = true, -- Must use old tubes, since the textures are rotated with 6d ones
|
||||
node_def = {
|
||||
tube = {can_go = function(pos, node, velocity, stack)
|
||||
local tbl, tbln = {}, 0
|
||||
local found, foundn = {}, 0
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -108,7 +111,8 @@ if pipeworks.enable_mese_tube then
|
||||
inv:set_stack(from_list, from_index, ItemStack(""))
|
||||
return 0
|
||||
end,
|
||||
}, true) -- Must use old tubes, since the textures are rotated with 6d ones
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "pipeworks:mese_tube_1 2",
|
||||
|
@ -105,12 +105,6 @@ local function get_receivers(pos, channel)
|
||||
return receivers
|
||||
end
|
||||
|
||||
local teleport_noctr_textures={ "pipeworks_teleport_tube_noctr.png" }
|
||||
local teleport_plain_textures={ "pipeworks_teleport_tube_plain.png" }
|
||||
local teleport_end_textures={ "pipeworks_teleport_tube_end.png" }
|
||||
local teleport_short_texture="pipeworks_teleport_tube_short.png"
|
||||
local teleport_inv_texture="pipeworks_teleport_tube_inv.png"
|
||||
|
||||
local function update_meta(meta, can_receive)
|
||||
meta:set_int("can_receive", can_receive and 1 or 0)
|
||||
local cr_state = can_receive and "on" or "off"
|
||||
@ -126,99 +120,105 @@ local function update_meta(meta, can_receive)
|
||||
default.gui_bg_img)
|
||||
end
|
||||
|
||||
pipeworks.register_tube("pipeworks:teleport_tube","Teleporting Pneumatic Tube Segment",teleport_plain_textures,
|
||||
teleport_noctr_textures,teleport_end_textures,teleport_short_texture,teleport_inv_texture, {
|
||||
is_teleport_tube = true,
|
||||
tube = {
|
||||
can_go = function(pos,node,velocity,stack)
|
||||
velocity.x = 0
|
||||
velocity.y = 0
|
||||
velocity.z = 0
|
||||
pipeworks.register_tube("pipeworks:teleport_tube", {
|
||||
description = "Teleporting Pneumatic Tube Segment",
|
||||
inventory_image = "pipeworks_teleport_tube_inv.png",
|
||||
noctr = { "pipeworks_teleport_tube_noctr.png" },
|
||||
plain = { "pipeworks_teleport_tube_plain.png" },
|
||||
ends = { "pipeworks_teleport_tube_end.png" },
|
||||
short = "pipeworks_teleport_tube_short.png",
|
||||
node_def = {
|
||||
is_teleport_tube = true,
|
||||
tube = {
|
||||
can_go = function(pos,node,velocity,stack)
|
||||
velocity.x = 0
|
||||
velocity.y = 0
|
||||
velocity.z = 0
|
||||
|
||||
local channel = minetest.get_meta(pos):get_string("channel")
|
||||
if channel == "" then return {} end
|
||||
local channel = minetest.get_meta(pos):get_string("channel")
|
||||
if channel == "" then return {} end
|
||||
|
||||
local target = get_receivers(pos, channel)
|
||||
if target[1] == nil then return {} end
|
||||
local target = get_receivers(pos, channel)
|
||||
if target[1] == nil then return {} end
|
||||
|
||||
local d = math.random(1,#target)
|
||||
pos.x = target[d].x
|
||||
pos.y = target[d].y
|
||||
pos.z = target[d].z
|
||||
return pipeworks.meseadjlist
|
||||
end
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
update_meta(meta, true)
|
||||
meta:set_string("infotext", "unconfigured Teleportation Tube")
|
||||
end,
|
||||
on_receive_fields = function(pos,formname,fields,sender)
|
||||
if not fields.channel then
|
||||
return -- ignore escaping or clientside manipulation of the form
|
||||
end
|
||||
local d = math.random(1,#target)
|
||||
pos.x = target[d].x
|
||||
pos.y = target[d].y
|
||||
pos.z = target[d].z
|
||||
return pipeworks.meseadjlist
|
||||
end
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
update_meta(meta, true)
|
||||
meta:set_string("infotext", "unconfigured Teleportation Tube")
|
||||
end,
|
||||
on_receive_fields = function(pos,formname,fields,sender)
|
||||
if not fields.channel then
|
||||
return -- ignore escaping or clientside manipulation of the form
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local can_receive = meta:get_int("can_receive")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local can_receive = meta:get_int("can_receive")
|
||||
|
||||
-- check for private channels each time before actually changing anything
|
||||
-- to not even allow switching between can_receive states of private channels
|
||||
if fields.channel ~= "" then
|
||||
local sender_name = sender:get_player_name()
|
||||
local name, mode = fields.channel:match("^([^:;]+)([:;])")
|
||||
if name and mode and name ~= sender_name then
|
||||
--channels starting with '[name]:' can only be used by the named player
|
||||
if mode == ":" then
|
||||
minetest.chat_send_player(sender_name, "Sorry, channel '"..fields.channel.."' is reserved for exclusive use by "..name)
|
||||
return
|
||||
-- check for private channels each time before actually changing anything
|
||||
-- to not even allow switching between can_receive states of private channels
|
||||
if fields.channel ~= "" then
|
||||
local sender_name = sender:get_player_name()
|
||||
local name, mode = fields.channel:match("^([^:;]+)([:;])")
|
||||
if name and mode and name ~= sender_name then
|
||||
--channels starting with '[name]:' can only be used by the named player
|
||||
if mode == ":" then
|
||||
minetest.chat_send_player(sender_name, "Sorry, channel '"..fields.channel.."' is reserved for exclusive use by "..name)
|
||||
return
|
||||
|
||||
--channels starting with '[name];' can be used by other players, but cannot be received from
|
||||
elseif mode == ";" and (fields.cr1 or (can_receive ~= 0 and not fields.cr0)) then
|
||||
minetest.chat_send_player(sender_name, "Sorry, receiving from channel '"..fields.channel.."' is reserved for "..name)
|
||||
return
|
||||
--channels starting with '[name];' can be used by other players, but cannot be received from
|
||||
elseif mode == ";" and (fields.cr1 or (can_receive ~= 0 and not fields.cr0)) then
|
||||
minetest.chat_send_player(sender_name, "Sorry, receiving from channel '"..fields.channel.."' is reserved for "..name)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local dirty = false
|
||||
local dirty = false
|
||||
|
||||
-- was the channel changed?
|
||||
local channel = meta:get_string("channel")
|
||||
if fields.channel ~= channel then
|
||||
channel = fields.channel
|
||||
meta:set_string("channel", channel)
|
||||
dirty = true
|
||||
end
|
||||
|
||||
-- test if a can_receive button was pressed
|
||||
if fields.cr0 and can_receive ~= 0 then
|
||||
can_receive = 0
|
||||
update_meta(meta, false)
|
||||
dirty = true
|
||||
elseif fields.cr1 and can_receive ~= 1 then
|
||||
can_receive = 1
|
||||
update_meta(meta, true)
|
||||
dirty = true
|
||||
end
|
||||
|
||||
-- save if we changed something, handle the empty channel while we're at it
|
||||
if dirty then
|
||||
if channel ~= "" then
|
||||
set_tube(pos, channel, can_receive)
|
||||
local cr_description = (can_receive == 1) and "sending and receiving" or "sending"
|
||||
meta:set_string("infotext", string.format("Teleportation Tube %s on '%s'", cr_description, channel))
|
||||
else
|
||||
-- remove empty channel tubes, to not have to search through them
|
||||
remove_tube(pos)
|
||||
meta:set_string("infotext", "unconfigured Teleportation Tube")
|
||||
-- was the channel changed?
|
||||
local channel = meta:get_string("channel")
|
||||
if fields.channel ~= channel then
|
||||
channel = fields.channel
|
||||
meta:set_string("channel", channel)
|
||||
dirty = true
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
remove_tube(pos)
|
||||
end
|
||||
})
|
||||
|
||||
-- test if a can_receive button was pressed
|
||||
if fields.cr0 and can_receive ~= 0 then
|
||||
can_receive = 0
|
||||
update_meta(meta, false)
|
||||
dirty = true
|
||||
elseif fields.cr1 and can_receive ~= 1 then
|
||||
can_receive = 1
|
||||
update_meta(meta, true)
|
||||
dirty = true
|
||||
end
|
||||
|
||||
-- save if we changed something, handle the empty channel while we're at it
|
||||
if dirty then
|
||||
if channel ~= "" then
|
||||
set_tube(pos, channel, can_receive)
|
||||
local cr_description = (can_receive == 1) and "sending and receiving" or "sending"
|
||||
meta:set_string("infotext", string.format("Teleportation Tube %s on '%s'", cr_description, channel))
|
||||
else
|
||||
-- remove empty channel tubes, to not have to search through them
|
||||
remove_tube(pos)
|
||||
meta:set_string("infotext", "unconfigured Teleportation Tube")
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
remove_tube(pos)
|
||||
end
|
||||
},
|
||||
})
|
||||
minetest.register_craft( {
|
||||
output = "pipeworks:teleport_tube_1 2",
|
||||
recipe = {
|
||||
|
@ -147,7 +147,7 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
||||
minetest.register_node(rname, nodedef)
|
||||
end
|
||||
|
||||
pipeworks.register_tube = function(name, desc, plain, noctrs, ends, short, inv, special, old_registration)
|
||||
local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv, special, old_registration)
|
||||
if old_registration then
|
||||
for xm = 0, 1 do
|
||||
for xp = 0, 1 do
|
||||
@ -228,6 +228,20 @@ pipeworks.register_tube = function(name, desc, plain, noctrs, ends, short, inv,
|
||||
end
|
||||
end
|
||||
|
||||
pipeworks.register_tube = function(name, def, ...)
|
||||
if type(def) == "table" then
|
||||
register_all_tubes(name, def.description,
|
||||
def.plain, def.noctr, def.ends, def.short,
|
||||
def.inventory_image, def.node_def, def.no_facedir)
|
||||
else
|
||||
-- we assert to be the old function with the second parameter being the description
|
||||
-- function(name, desc, plain, noctrs, ends, short, inv, special, old_registration)
|
||||
assert(type(def) == "string", "invalid arguments to pipeworks.register_tube")
|
||||
register_all_tubes(name, def, ...)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if REGISTER_COMPATIBILITY then
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:tube_to_update"},
|
||||
|
@ -1,13 +1,13 @@
|
||||
if pipeworks.enable_sand_tube then
|
||||
local sand_noctr_textures = { "pipeworks_sand_tube_noctr.png" }
|
||||
local sand_plain_textures = { "pipeworks_sand_tube_plain.png" }
|
||||
local sand_end_textures = { "pipeworks_sand_tube_end.png" }
|
||||
local sand_short_texture = "pipeworks_sand_tube_short.png"
|
||||
local sand_inv_texture = "pipeworks_sand_tube_inv.png"
|
||||
|
||||
pipeworks.register_tube("pipeworks:sand_tube", "Vacuuming Pneumatic Tube Segment", sand_plain_textures, sand_noctr_textures, sand_end_textures,
|
||||
sand_short_texture, sand_inv_texture,
|
||||
{groups = {vacuum_tube = 1}})
|
||||
pipeworks.register_tube("pipeworks:sand_tube", {
|
||||
description = "Vacuuming Pneumatic Tube Segment",
|
||||
inventory_image = "pipeworks_sand_tube_inv.png",
|
||||
short = "pipeworks_sand_tube_short.png",
|
||||
noctr = { "pipeworks_sand_tube_noctr.png" },
|
||||
plain = { "pipeworks_sand_tube_plain.png" },
|
||||
ends = { "pipeworks_sand_tube_end.png" },
|
||||
node_def = { groups = {vacuum_tube = 1}},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "pipeworks:sand_tube_1 2",
|
||||
@ -36,15 +36,15 @@ if pipeworks.enable_sand_tube then
|
||||
end
|
||||
|
||||
if pipeworks.enable_mese_sand_tube then
|
||||
local mese_sand_noctr_textures = { "pipeworks_mese_sand_tube_noctr.png" }
|
||||
local mese_sand_plain_textures = { "pipeworks_mese_sand_tube_plain.png" }
|
||||
local mese_sand_end_textures = { "pipeworks_mese_sand_tube_end.png" }
|
||||
local mese_sand_short_texture = "pipeworks_mese_sand_tube_short.png"
|
||||
local mese_sand_inv_texture = "pipeworks_mese_sand_tube_inv.png"
|
||||
|
||||
pipeworks.register_tube("pipeworks:mese_sand_tube", "Adjustable Vacuuming Pneumatic Tube Segment", mese_sand_plain_textures, mese_sand_noctr_textures,
|
||||
mese_sand_end_textures, mese_sand_short_texture,mese_sand_inv_texture,
|
||||
{groups = {vacuum_tube = 1},
|
||||
pipeworks.register_tube("pipeworks:mese_sand_tube", {
|
||||
description = "Adjustable Vacuuming Pneumatic Tube Segment",
|
||||
inventory_image = "pipeworks_mese_sand_tube_inv.png",
|
||||
short = "pipeworks_mese_sand_tube_short.png",
|
||||
noctr = { "pipeworks_mese_sand_tube_noctr.png" },
|
||||
plain = { "pipeworks_mese_sand_tube_plain.png" },
|
||||
ends = { "pipeworks_mese_sand_tube_end.png" },
|
||||
node_def = {
|
||||
groups = {vacuum_tube = 1},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("dist", 0)
|
||||
@ -63,6 +63,7 @@ if pipeworks.enable_mese_sand_tube then
|
||||
meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist))
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
|
Loading…
Reference in New Issue
Block a user