diff options
author | PilzAdam <PilzAdam@gmx.de> | 2013-01-12 20:18:43 +0100 |
---|---|---|
committer | PilzAdam <PilzAdam@gmx.de> | 2013-02-21 16:58:50 +0100 |
commit | ef6b8bee07b9cefe7d463fabd199548d37ff2bee (patch) | |
tree | ebdfb27254c858ebdb2b9a423361a7ab21a39247 /builtin/item.lua | |
parent | b29834ab02b47a120616b4c807a573a851b3ccd4 (diff) | |
download | minetest-ef6b8bee07b9cefe7d463fabd199548d37ff2bee.tar.gz minetest-ef6b8bee07b9cefe7d463fabd199548d37ff2bee.tar.bz2 minetest-ef6b8bee07b9cefe7d463fabd199548d37ff2bee.zip |
Drop nodes as items when dugged and no room in inventory and dont remove dropped items when no room in inventory
Diffstat (limited to 'builtin/item.lua')
-rw-r--r-- | builtin/item.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin/item.lua b/builtin/item.lua index 69c4bd0bb..1349fdf63 100644 --- a/builtin/item.lua +++ b/builtin/item.lua @@ -290,7 +290,15 @@ function minetest.handle_node_drops(pos, drops, digger) if digger:get_inventory() then local _, dropped_item for _, dropped_item in ipairs(drops) do - digger:get_inventory():add_item("main", dropped_item) + local left = digger:get_inventory():add_item("main", dropped_item) + if not left:is_empty() then + local p = { + x = pos.x + math.random()/2-0.25, + y = pos.y + math.random()/2-0.25, + z = pos.z + math.random()/2-0.25, + } + minetest.env:add_item(p, left) + end end end end |