Skip to content
Snippets Groups Projects
Commit 0b1ab41a authored by Perttu Ahola's avatar Perttu Ahola
Browse files

Fix github issue #213: Dropping unknown items crashes the game

The items will now just disappear when dropped.
parent b717b650
No related branches found
No related tags found
No related merge requests found
......@@ -227,10 +227,12 @@ function minetest.item_drop(itemstack, dropper, pos)
local v = dropper:get_look_dir()
local p = {x=pos.x+v.x, y=pos.y+1.5+v.y, z=pos.z+v.z}
local obj = minetest.env:add_item(p, itemstack)
v.x = v.x*2
v.y = v.y*2 + 1
v.z = v.z*2
obj:setvelocity(v)
if obj then
v.x = v.x*2
v.y = v.y*2 + 1
v.z = v.z*2
obj:setvelocity(v)
end
else
minetest.env:add_item(pos, itemstack)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment