summaryrefslogtreecommitdiff
path: root/tube_registration.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 /tube_registration.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 'tube_registration.lua')
-rw-r--r--tube_registration.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/tube_registration.lua b/tube_registration.lua
index 4f387d8..ffa9576 100644
--- a/tube_registration.lua
+++ b/tube_registration.lua
@@ -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"},