1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-06-29 13:20:44 +02:00

Always return the ItemStack for on_rightclick to comply with the API.

This commit is contained in:
Tim
2016-07-31 01:17:23 +02:00
parent b33428b907
commit 337dc05e70
19 changed files with 78 additions and 40 deletions

View File

@ -27,11 +27,12 @@ computer.register = function (name, def)
node_box = def.node_box,
selection_box = def.node_box,
on_rightclick = function (pos, node, clicker, itemstack)
if (def.on_turn_off) then
if (def.on_turn_off(pos, node, clicker, itemstack)) then return end
if def.on_turn_off and def.on_turn_off(pos, node, clicker, itemstack) then
return itemstack
end
node.name = OFFSTATE
minetest.set_node(pos, node)
return itemstack
end
})
minetest.register_node(OFFSTATE, {
@ -50,11 +51,12 @@ computer.register = function (name, def)
node_box = def.node_box_off or def.node_box,
selection_box = def.node_box_off or def.node_box,
on_rightclick = function (pos, node, clicker, itemstack)
if (def.on_turn_on) then
if (def.on_turn_on(pos, node, clicker, itemstack)) then return end
if def.on_turn_on and def.on_turn_on(pos, node, clicker, itemstack) then
return itemstack
end
node.name = ONSTATE
minetest.set_node(pos, node)
return itemstack
end,
drop = ONSTATE
})