forked from minetest-mods/technic
drop upgrade list items if dug (but protect other inventories)
This commit is contained in:
parent
72d541a607
commit
48e02b8452
@ -138,18 +138,22 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
|
|||||||
meta:set_int("tube_time", tube_time)
|
meta:set_int("tube_time", tube_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function technic.machine_can_dig(pos, player)
|
function technic.machine_can_dig(pos, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
|
|
||||||
if player then
|
if player then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
minetest.chat_send_player(player:get_player_name(),
|
||||||
S("Machine cannot be removed because it is not empty"))
|
S("Machine cannot be removed because it is not empty"))
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
else
|
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
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user