From 6942aa37d2506ffc575d3a607982e5ee716fb38d Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sat, 21 Mar 2015 17:48:09 +0000 Subject: [PATCH] Drop excess armor items when bones are full --- 3d_armor/armor.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/3d_armor/armor.lua b/3d_armor/armor.lua index ba3a364..28898e8 100644 --- a/3d_armor/armor.lua +++ b/3d_armor/armor.lua @@ -500,28 +500,28 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then local owner = meta:get_string("owner") local inv = meta:get_inventory() if name == owner then - for _,stack in ipairs(drop) do + for i, stack in ipairs(drop) do if inv:room_for_item("main", stack) then inv:add_item("main", stack) + table.remove(drop, i) end end end end end) - else - for _,stack in ipairs(drop) do - local obj = minetest.add_item(pos, stack) - if obj then - local x = math.random(1, 5) - if math.random(1,2) == 1 then - x = -x - end - local z = math.random(1, 5) - if math.random(1,2) == 1 then - z = -z - end - obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z}) + end + for _,stack in ipairs(drop) do + local obj = minetest.add_item(pos, stack) + if obj then + local x = math.random(1, 5) + if math.random(1,2) == 1 then + x = -x end + local z = math.random(1, 5) + if math.random(1,2) == 1 then + z = -z + end + obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z}) end end end