1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-06-29 23:00:49 +02:00

fix multiple crash points if luaentity.entities or values returned from

luaentity.add_entity() are nil
This commit is contained in:
Vanessa Ezekowitz
2015-06-23 12:24:35 -04:00
parent 5822f60ba9
commit d0952a97fc
2 changed files with 7 additions and 0 deletions

View File

@ -6,6 +6,7 @@ function pipeworks.tube_inject_item(pos, start_pos, velocity, item)
-- Take item in any format
local stack = ItemStack(item)
local obj = luaentity.add_entity(pos, "pipeworks:tubed_item")
if not obj then return end
obj:set_item(stack:to_string())
obj.start_pos = vector.new(start_pos)
obj:setvelocity(velocity)