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

View File

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