From 90fd477217234c72beaa9073300821434bd51aa3 Mon Sep 17 00:00:00 2001 From: BrunoMine Date: Thu, 9 Aug 2018 11:13:55 -0300 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20lib=20tror?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tror.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/tror.lua b/lib/tror.lua index 2bb0a4b..260f9cc 100644 --- a/lib/tror.lua +++ b/lib/tror.lua @@ -134,12 +134,14 @@ tror.trocar_plus = function(player, item_rem, item_add) -- Transfere todos os itens ao jogador (e dropa os que nao couberem no inventario) local dropou = false - for _,item in ipairs(item_add) do - if inv:room_for_item("main", item) then - inv:add_item("main", item) - else - dropou = true - minetest.env:add_item({x = pos.x + math.random() * 2 - 1, y = pos.y+1, z = pos.z + math.random() * 2 - 1}, item) + if item_add ~= nil then + for _,item in ipairs(item_add) do + if inv:room_for_item("main", item) then + inv:add_item("main", item) + else + dropou = true + minetest.env:add_item({x = pos.x + math.random() * 2 - 1, y = pos.y+1, z = pos.z + math.random() * 2 - 1}, item) + end end end