diff options
author | Zeg9 <dazeg9@gmail.com> | 2013-04-19 21:07:02 +0200 |
---|---|---|
committer | Zeg9 <dazeg9@gmail.com> | 2013-04-19 21:07:02 +0200 |
commit | 7c071a45f5108f621d1822b23c0e6fa3a6725276 (patch) | |
tree | 84d1aaa1ac56b377e3b70afe2fa26fd9b9a49b58 | |
parent | 913540214ce3f6dcda666cd2d16b24e710beda02 (diff) |
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, |