summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-09-19 23:13:31 -0600
committerFaceDeer <derksenmobile@gmail.com>2017-09-19 23:13:31 -0600
commit3bc0eb82fa4796c32b6800e5833953262f8e0b0c (patch)
tree33f3db817237ae6b046cf5c946b8286288c7ee00
parentade365df1bedc3203c316b87f699b37d770e3637 (diff)
add formspec auto-upgrade when layout is read
-rw-r--r--class_layout.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/class_layout.lua b/class_layout.lua
index d516870..63ce529 100644
--- a/class_layout.lua
+++ b/class_layout.lua
@@ -6,9 +6,13 @@ DigtronLayout.__index = DigtronLayout
local get_node_image = function(pos, node)
local node_image = {node=node, pos={x=pos.x, y=pos.y, z=pos.z}}
- node_image.paramtype2 = minetest.registered_nodes[node.name].paramtype2
+ local node_def = minetest.registered_nodes[node.name]
+ node_image.paramtype2 = node_def.paramtype2
local meta = minetest.get_meta(pos)
node_image.meta = meta:to_table()
+ if node_image.meta ~= nil then
+ node_image.meta.fields.formspec = node_def._digtron_formspec -- causes formspec to be automatically upgraded whenever Digtron moves
+ end
-- Record what kind of thing we've got in a builder node so its facing can be rotated properly
if minetest.get_item_group(node.name, "digtron") == 4 then