From ec4f2237f3e3d2212a1128f81baffd9c0b9a364e Mon Sep 17 00:00:00 2001 From: Gael-de-Sailly Date: Sun, 25 Jan 2015 10:18:56 +0100 Subject: [PATCH] Drop item when inventory is full (bushes_classic) --- bushes_classic/nodes.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bushes_classic/nodes.lua b/bushes_classic/nodes.lua index 220b1dd..bb00754 100644 --- a/bushes_classic/nodes.lua +++ b/bushes_classic/nodes.lua @@ -86,8 +86,13 @@ plantlife_bushes.after_dig_node = function(pos, oldnode, oldmetadata, digger) -- give the harvested result to the player if harvested then --minetest.chat_send_player("singleplayer","you would now get "..tostring( harvested ) ); + local itemstack = ItemStack(harvested) local inventory = digger:get_inventory() - inventory:add_item( "main", harvested ); + if inventory:room_for_item("main", itemstack) then + inventory:add_item("main", itemstack) + else + minetest.item_drop(itemstack, digger, pos) + end end end