summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--technic/machines/register/common.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/technic/machines/register/common.lua b/technic/machines/register/common.lua
index 6d4c066..0168c40 100644
--- a/technic/machines/register/common.lua
+++ b/technic/machines/register/common.lua
@@ -138,18 +138,22 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
meta:set_int("tube_time", tube_time)
end
-
function technic.machine_can_dig(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
- if not inv:is_empty("src") or not inv:is_empty("dst") or
- not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
+ if not inv:is_empty("src") or not inv:is_empty("dst") then
if player then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
end
return false
else
+ if not inv:is_empty("upgrade1") then
+ minetest.item_drop(inv:get_stack("upgrade1", 1), "", pos)
+ end
+ if not inv:is_empty("upgrade2") then
+ minetest.item_drop(inv:get_stack("upgrade2", 1), "", pos)
+ end
return true
end
end