-- Override the default dig function
local old_dig = minetest.node_dig

minetest.node_dig = function(pos, node, digger)
    -- Check if the player has permission to dig (optional)
    if not minetest.check_player_privs(digger, {dig = true}) then
        -- Prevent the dig action
        minetest.chat_send_player(digger:get_player_name(), "You don't have permission to dig here.")
        return
    end
    -- Call the default dig function
    old_dig(pos, node, digger)
end

-- Override the default punch function
local old_punch = minetest.node_punch

minetest.node_punch = function(pos, node, puncher)
    -- Check if the player has permission to mine (optional)
    if not minetest.check_player_privs(puncher, {interact = true}) then
        -- Prevent the punch action
        minetest.chat_send_player(puncher:get_player_name(), "You don't have permission to mine here.")
        return
    end
    -- Call the default punch function
    old_punch(pos, node, puncher)
end

Изменить пасту