Try harder to add armor to bones

Previously, if bones were on a slab, or some non-buildable_to but walkable
node, then the armor would fail to find the bones node (which is Y+1,
typically) and the armor would disappear.  This is an attempt to address that.
This commit is contained in:
James Stevenson 2016-07-22 10:46:05 -04:00
parent ac414d3df3
commit 0157ebd683

@ -498,7 +498,14 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
minetest.after(ARMOR_BONES_DELAY, function()
local node = minetest.get_node(vector.round(pos))
if node then
if node.name == "bones:bones" then
if node.name ~= "bones:bones" then
pos.y = pos.y+1
node = minetest.get_node(vector.round(pos))
if node.name ~= "bones:bones" then
minetest.log("warning", "Failed to add armor to bones node.")
return
end
end
local meta = minetest.get_meta(vector.round(pos))
local owner = meta:get_string("owner")
local inv = meta:get_inventory()
@ -509,7 +516,6 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
armor.drop_armor(pos, stack)
end
end
end
else
for _,stack in ipairs(drop) do
armor.drop_armor(pos, stack)