From 576aeeade02104a41ccb60d4dda91f8e364639a1 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Thu, 14 Sep 2017 00:47:53 -0600 Subject: add ability to read node type as well as facing, simplifies programming --- nodes/node_builders.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nodes/node_builders.lua b/nodes/node_builders.lua index 19bbe9f..53edaa5 100644 --- a/nodes/node_builders.lua +++ b/nodes/node_builders.lua @@ -169,10 +169,15 @@ minetest.register_node("digtron:builder", { end elseif fields.read then - local meta = minetest.get_meta(pos) local facing = minetest.get_node(pos).param2 local buildpos = digtron.find_new_pos(pos, facing) - meta:set_int("build_facing", minetest.get_node(buildpos).param2) + local target_node = minetest.get_node(buildpos) + if target_node.name ~= "air" and minetest.get_item_group(target_node.name, "digtron") == 0 then + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_stack("main", 1, target_node.name) + meta:set_int("build_facing", target_node.param2) + end end if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built -- cgit v1.2.3