aboutsummaryrefslogtreecommitdiff
path: root/builtin/item.lua
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-04-01 16:06:01 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-04-01 16:06:01 +0300
commitf0e7da8a63d858f3b511872cf41cde0eaff6585d (patch)
tree5586e6807b2fc442db9ee99191caf38b7b77d207 /builtin/item.lua
parent5bd32eca0f4c8afa8d933f7d7d1946cabaa8dc43 (diff)
downloaddragonfireclient-f0e7da8a63d858f3b511872cf41cde0eaff6585d.tar.xz
Implement dropped items as LuaEntities; leave the old ones as is for compatibility
Diffstat (limited to 'builtin/item.lua')
-rw-r--r--builtin/item.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/builtin/item.lua b/builtin/item.lua
index 3abf30a6d..678a5cdac 100644
--- a/builtin/item.lua
+++ b/builtin/item.lua
@@ -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,
}
-