summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 14f2288..21801ca 100644
--- a/init.lua
+++ b/init.lua
@@ -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,