projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
df2c474
)
Check if hitter has inventory when punching item
author
BlockMen
<nmuelll@web.de>
Sun, 25 Oct 2015 17:15:31 +0000
(18:15 +0100)
committer
BlockMen
<nmuelll@web.de>
Sun, 25 Oct 2015 17:15:31 +0000
(18:15 +0100)
Fixes #3280
builtin/game/item_entity.lua
patch
|
blob
|
history
diff --git
a/builtin/game/item_entity.lua
b/builtin/game/item_entity.lua
index 190473ceb5dca2f76ed6b5929df7b8fa3abbdd06..a8d7a186361759d95c90ffb42b8ef64956d284fa 100644
(file)
--- a/
builtin/game/item_entity.lua
+++ b/
builtin/game/item_entity.lua
@@
-200,9
+200,10
@@
core.register_entity(":__builtin:item", {
end,
on_punch = function(self, hitter)
- if self.itemstring ~= '' then
- local left = hitter:get_inventory():add_item("main", self.itemstring)
- if not left:is_empty() then
+ local inv = hitter:get_inventory()
+ if inv and self.itemstring ~= '' then
+ local left = inv:add_item("main", self.itemstring)
+ if left and not left:is_empty() then
self.itemstring = left:to_string()
return
end