Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using hardware node coloring with Minetest.
local function dig_glass(pos, node, digger)
local inv = digger:get_inventory()
local can_dig = not core.is_protected(pos, digger:get_player_name())
local drops = {}
if digger:is_player() then
local meta = core.get_meta(pos)
if can_dig then
if not inv:room_for_item('main', node.name) then
table.insert(drops, node.name)
else
inv:add_item('main', node.name)
end
if meta then
local dye = meta:get_string('dye')
if dye and dye ~= '' then
if not inv:room_for_item('main', dye) then
table.insert(drops, dye)
else
inv:add_item('main', dye)
end
end
end
end
end
if can_dig then
core.remove_node(pos)
core.handle_node_drops(pos, drops, digger)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.