1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Add the player name to dropped items

The player name is now added in the field "dropped_by" on the created
entity.
This commit is contained in:
Robert Zenz 2015-11-05 19:56:19 +01:00 committed by est31
parent 76c9abe4c8
commit 0876623aed
2 changed files with 5 additions and 2 deletions

View file

@ -348,7 +348,7 @@ function core.item_place(itemstack, placer, pointed_thing, param2)
end
function core.item_drop(itemstack, dropper, pos)
if dropper.is_player then
if dropper and dropper:is_player() then
local v = dropper:get_look_dir()
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
local cs = itemstack:get_count()
@ -362,6 +362,7 @@ function core.item_drop(itemstack, dropper, pos)
v.y = v.y*2 + 2
v.z = v.z*2
obj:setvelocity(v)
obj:get_luaentity().dropped_by = dropper:get_player_name()
return itemstack
end