forked from mtcontrib/3d_armor
Improve bones locating and fallback, fixes #84
This commit is contained in:
parent
a5b650285b
commit
4b45f85687
@ -511,21 +511,21 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
|
|||||||
end
|
end
|
||||||
if ARMOR_DESTROY == false then
|
if ARMOR_DESTROY == false then
|
||||||
minetest.after(ARMOR_BONES_DELAY, function()
|
minetest.after(ARMOR_BONES_DELAY, function()
|
||||||
local node = minetest.get_node(vector.round(pos))
|
local node, meta = nil, nil
|
||||||
if node then
|
local maxp = vector.add(pos, 8)
|
||||||
if node.name ~= "bones:bones" then
|
local minp = vector.subtract(pos, 8)
|
||||||
pos.y = pos.y+1
|
local bones = minetest.find_nodes_in_area(minp, maxp, {"bones:bones"})
|
||||||
node = minetest.get_node(vector.round(pos))
|
for _, p in pairs(bones) do
|
||||||
if node.name ~= "bones:bones" then
|
meta = minetest.get_meta(p)
|
||||||
minetest.log("warning", "Failed to add armor to bones node.")
|
if meta:get_string("owner") == name then
|
||||||
return
|
node = minetest.get_node(p)
|
||||||
end
|
break
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(vector.round(pos))
|
end
|
||||||
local owner = meta:get_string("owner")
|
if node and meta then
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
for _,stack in ipairs(drop) do
|
for _,stack in ipairs(drop) do
|
||||||
if name == owner and inv:room_for_item("main", stack) then
|
if inv:room_for_item("main", stack) then
|
||||||
inv:add_item("main", stack)
|
inv:add_item("main", stack)
|
||||||
else
|
else
|
||||||
armor.drop_armor(pos, stack)
|
armor.drop_armor(pos, stack)
|
||||||
|
Loading…
Reference in New Issue
Block a user