summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--class_layout.lua7
-rw-r--r--nodes/node_duplicator.lua5
-rw-r--r--nodes/node_item_ejector.lua3
3 files changed, 12 insertions, 3 deletions
diff --git a/class_layout.lua b/class_layout.lua
index 7c263a6..14c116b 100644
--- a/class_layout.lua
+++ b/class_layout.lua
@@ -18,7 +18,10 @@ local get_node_image = function(pos, node)
-- 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
- local build_item = node_image.meta.inventory.main[1]
+ local build_item = ""
+ if node_image.meta.inventory.main then
+ build_item = node_image.meta.inventory.main[1]
+ end
if build_item ~= "" then
local build_item_def = minetest.registered_nodes[ItemStack(build_item):get_name()]
if build_item_def ~= nil then
@@ -462,4 +465,4 @@ function DigtronLayout.deserialize(layout_string)
self.old_pos_pointset = Pointset.create() -- needed by the write_layout method, leave empty
return self
-end \ No newline at end of file
+end
diff --git a/nodes/node_duplicator.lua b/nodes/node_duplicator.lua
index 7d20a65..4533bae 100644
--- a/nodes/node_duplicator.lua
+++ b/nodes/node_duplicator.lua
@@ -146,6 +146,9 @@ minetest.register_node("digtron:duplicator", {
-- clear inventories of image's nodes
for _, node_image in pairs(layout.inventories) do
local main_inventory = node_image.meta.inventory.main
+ if type(main_inventory) ~= "table" then
+ main_inventory = {}
+ end
for index, _ in pairs(main_inventory) do
main_inventory[index] = ItemStack(nil)
end
@@ -175,4 +178,4 @@ minetest.register_node("digtron:duplicator", {
end
end,
-}) \ No newline at end of file
+})
diff --git a/nodes/node_item_ejector.lua b/nodes/node_item_ejector.lua
index 6f9c64e..aa09909 100644
--- a/nodes/node_item_ejector.lua
+++ b/nodes/node_item_ejector.lua
@@ -67,6 +67,9 @@ local function eject_items(pos, node, player, eject_even_without_pipeworks)
local source_index = nil
local source_stack = nil
for _, node_image in pairs(layout.inventories) do
+ if type(node_image.meta.inventory.main) ~= "table" then
+ node_image.meta.inventory.main = {}
+ end
for index, item_stack in pairs(node_image.meta.inventory.main) do
if item_stack:get_count() > 0 and not filter_items[item_stack:get_name()] then
source_node = node_image