mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Implement dropped items as LuaEntities; leave the old ones as is for compatibility
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user