Fix minetest.item_place_node() and minetest.item_drop() to always return an ItemStack
This commit is contained in:
parent
b1019a88ba
commit
86b906d015
|
@ -141,7 +141,7 @@ function minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||||
minetest.log("info", placer:get_player_name() .. " tried to place"
|
minetest.log("info", placer:get_player_name() .. " tried to place"
|
||||||
.. " node in invalid position " .. minetest.pos_to_string(above)
|
.. " node in invalid position " .. minetest.pos_to_string(above)
|
||||||
.. ", replacing " .. oldnode_above.name)
|
.. ", replacing " .. oldnode_above.name)
|
||||||
return
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Place above pointed node
|
-- Place above pointed node
|
||||||
|
@ -186,7 +186,7 @@ function minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||||
not check_attached_node(place_to, newnode) then
|
not check_attached_node(place_to, newnode) then
|
||||||
minetest.log("action", "attached node " .. def.name ..
|
minetest.log("action", "attached node " .. def.name ..
|
||||||
" can not be placed at " .. minetest.pos_to_string(place_to))
|
" can not be placed at " .. minetest.pos_to_string(place_to))
|
||||||
return
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add node and update
|
-- Add node and update
|
||||||
|
@ -262,7 +262,7 @@ function minetest.item_drop(itemstack, dropper, pos)
|
||||||
else
|
else
|
||||||
minetest.env:add_item(pos, itemstack)
|
minetest.env:add_item(pos, itemstack)
|
||||||
end
|
end
|
||||||
return ""
|
return ItemStack("")
|
||||||
end
|
end
|
||||||
|
|
||||||
function minetest.item_eat(hp_change, replace_with_item)
|
function minetest.item_eat(hp_change, replace_with_item)
|
||||||
|
|
Loading…
Reference in New Issue