diff options
author | Thomas--S <Thomas--S@users.noreply.github.com> | 2016-10-03 12:14:34 +0200 |
---|---|---|
committer | Hugo Locurcio <calinou@opmbx.org> | 2016-10-03 12:14:34 +0200 |
commit | 7f06db2200909e7e501b5092ae7b330bcef05d2a (patch) | |
tree | cb4419846ef58c0929dd9cc48914fb3950bc72ad /stairsplus/panels.lua | |
parent | ab2c63270f9289de717ccaf0aa21f0b871b7bc78 (diff) |
Add Alias Functions (#54)
* register_alias
* register_alias_force
Diffstat (limited to 'stairsplus/panels.lua')
-rw-r--r-- | stairsplus/panels.lua | 91 |
1 files changed, 53 insertions, 38 deletions
diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua index ab6ef83..314939b 100644 --- a/stairsplus/panels.lua +++ b/stairsplus/panels.lua @@ -20,52 +20,67 @@ function register_panel(modname, subname, recipeitem, groups, images, descriptio }) end -function stairsplus:register_panel(modname, subname, recipeitem, fields) - local defs = { - [""] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, - }, +local panels_defs = { + [""] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, + }, + }, + ["_1"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5}, }, - ["_1"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5}, - }, + }, + ["_2"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5}, }, - ["_2"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5}, - }, + }, + ["_4"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5}, }, - ["_4"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5}, - }, + }, + ["_12"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5}, }, - ["_12"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5}, - }, + }, + ["_14"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5}, }, - ["_14"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5}, - }, + }, + ["_15"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5}, }, - ["_15"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5}, - }, - } } +} + +function stairsplus:register_panel_alias(modname_old, subname_old, modname_new, subname_new) + local defs = stairsplus.copytable(panels_defs) + for alternate, def in pairs(defs) do + minetest.register_alias(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate) + end +end +function stairsplus:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new) + local defs = stairsplus.copytable(panels_defs) + for alternate, def in pairs(defs) do + minetest.register_alias_force(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate) + end +end + +function stairsplus:register_panel(modname, subname, recipeitem, fields) + local defs = stairsplus.copytable(panels_defs) local desc = S("%s Panel"):format(fields.description) for alternate, def in pairs(defs) do for k, v in pairs(fields) do |