forked from mtcontrib/builtin_item
Merge pull request #1 from Zeg9/master
Update to the "take items only if inventory is not full" behavior
This commit is contained in:
commit
7c7d3e2292
6
init.lua
6
init.lua
@ -171,7 +171,11 @@ minetest.register_entity(":__builtin:item", {
|
|||||||
|
|
||||||
on_punch = function(self, hitter)
|
on_punch = function(self, hitter)
|
||||||
if self.itemstring ~= '' then
|
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
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user