Handle nil return value for add_item

Remove old comments. Current HEAD requires version ~0.4.16
This commit is contained in:
SmallJoker 2018-08-04 12:27:09 +02:00
parent 6492b8ec76
commit 6fdda18390
1 changed files with 4 additions and 2 deletions

View File

@ -350,8 +350,10 @@ luaentity.register_entity("pipeworks:tubed_item", {
-- compatible with Minetest 0.4.13.
-- Using item_drop here makes Minetest 0.4.13 crash.
local dropped_item = minetest.add_item(self.start_pos, stack)
dropped_item:set_velocity(vector.multiply(velocity, 5))
self:remove()
if dropped_item then
dropped_item:set_velocity(vector.multiply(velocity, 5))
self:remove()
end
return
else
velocity = vector.multiply(velocity, -1)