diff options
author | PilzAdam <pilzadam@minetest.net> | 2013-05-03 15:37:04 -0700 |
---|---|---|
committer | PilzAdam <pilzadam@minetest.net> | 2013-05-03 15:37:04 -0700 |
commit | 7c7d3e2292f16b91dc8760e741cdd0988d8f5052 (patch) | |
tree | 84d1aaa1ac56b377e3b70afe2fa26fd9b9a49b58 | |
parent | 913540214ce3f6dcda666cd2d16b24e710beda02 (diff) | |
parent | 7c071a45f5108f621d1822b23c0e6fa3a6725276 (diff) |
Merge pull request #1 from Zeg9/master
Update to the "take items only if inventory is not full" behavior
-rw-r--r-- | init.lua | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -171,7 +171,11 @@ minetest.register_entity(":__builtin:item", { on_punch = function(self, hitter) if self.itemstring ~= '' then - hitter:get_inventory():add_item("main", self.itemstring) + local left = hitter:get_inventory():add_item("main", self.itemstring) + if not left:is_empty() then + self.itemstring = left:to_string() + return + end end self.object:remove() end, |