Externalize common functions and protect inventories

This commit is contained in:
ShadowNinja
2013-11-27 12:28:56 -05:00
parent 76a8acbe5b
commit 0809dd747e
17 changed files with 162 additions and 298 deletions

View File

@ -33,16 +33,9 @@ minetest.register_node("technic:tool_workshop", {
local inv = meta:get_inventory()
inv:set_size("src", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
end
return true
end,
can_dig = technic.machine_can_dig,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
})
minetest.register_abm({