The player name is now added in the field "dropped_by" on the created
entity.
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()
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
return core.serialize({
itemstring = self.itemstring,
always_collect = self.always_collect,
- age = self.age
+ age = self.age,
+ dropped_by = self.dropped_by
})
end,
else
self.age = dtime_s
end
+ self.dropped_by = data.dropped_by
end
else
self.itemstring = staticdata