mirror of
https://github.com/minetest-mods/technic.git
synced 2025-06-30 15:20:37 +02:00
Externalize common functions and protect inventories
This commit is contained in:
@ -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({
|
||||
|
Reference in New Issue
Block a user