Skip to content

Instantly share code, notes, and snippets.

@GreenXenith
Last active April 26, 2017 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GreenXenith/69679abeeb0d3b3cf4762f701d3dc8c5 to your computer and use it in GitHub Desktop.
Save GreenXenith/69679abeeb0d3b3cf4762f701d3dc8c5 to your computer and use it in GitHub Desktop.
remove item
minetest.register_craftitem("waffles:toaster_waffle_pack_2", {
description = "Pack of 2 Toaster Waffles",
inventory_image = "toaster_waffle_pack_2.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local pname = user:get_player_name()
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
return
end
local node = minetest.get_node(pos)
if node.name == "homedecor:toaster"
or node.name == "waffles:toaster" then
itemstack:take_item()
minetest.set_node(pos, {name = "waffles:toaster_with_waffle", param2 = node.param2})
return itemstack
end
end,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment