| | |
| | | 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 |
| | | return true |
| | | end |
| | | |
| | | return true |
| | | end |
| | | |
| | | function technic.machine_after_dig_node(pos, oldnode, oldmetadata, player) |
| | | if oldmetadata.inventory then |
| | | if oldmetadata.inventory.upgrade1 and oldmetadata.inventory.upgrade1[1] then |
| | | local stack = ItemStack(oldmetadata.inventory.upgrade1[1]) |
| | | if not stack:is_empty() then |
| | | minetest.item_drop(stack, "", pos) |
| | | end |
| | | end |
| | | if oldmetadata.inventory.upgrade2 and oldmetadata.inventory.upgrade2[1] then |
| | | local stack = ItemStack(oldmetadata.inventory.upgrade2[1]) |
| | | if not stack:is_empty() then |
| | | minetest.item_drop(stack, "", pos) |
| | | end |
| | | end |
| | | end |
| | | |
| | | if minetest.registered_nodes[oldnode.name].tube then |
| | | pipeworks.after_dig(pos, oldnode, oldmetadata, player) |
| | | end |
| | | end |
| | | |