Last active
August 15, 2017 23:42
-
-
Save AntumDeluge/aeb56d1127488f430bea35444a7d3a3f to your computer and use it in GitHub Desktop.
Using hardware node coloring with Minetest.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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