1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Implement dropped items as LuaEntities; leave the old ones as is for compatibility

This commit is contained in:
Perttu Ahola 2012-04-01 16:06:01 +03:00
parent 5bd32eca0f
commit f0e7da8a63
6 changed files with 130 additions and 8 deletions

View file

@ -192,7 +192,17 @@ function minetest.item_place(itemstack, placer, pointed_thing)
end
function minetest.item_drop(itemstack, dropper, pos)
minetest.env:add_item(pos, itemstack)
if dropper.get_player_name then
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)
else
minetest.env:add_item(pos, itemstack)
end
return ""
end
@ -377,4 +387,3 @@ minetest.noneitemdef_default = { -- This is used for the hand and unknown items
on_use = nil,
}