Fix github issue #213: Dropping unknown items crashes the game
The items will now just disappear when dropped.master
parent
b717b6505b
commit
0b1ab41a95
|
@ -227,10 +227,12 @@ function minetest.item_drop(itemstack, dropper, pos)
|
||||||
local v = dropper:get_look_dir()
|
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 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)
|
local obj = minetest.env:add_item(p, itemstack)
|
||||||
v.x = v.x*2
|
if obj then
|
||||||
v.y = v.y*2 + 1
|
v.x = v.x*2
|
||||||
v.z = v.z*2
|
v.y = v.y*2 + 1
|
||||||
obj:setvelocity(v)
|
v.z = v.z*2
|
||||||
|
obj:setvelocity(v)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
minetest.env:add_item(pos, itemstack)
|
minetest.env:add_item(pos, itemstack)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue