diff options
author | rubenwardy <rubenwardy@gmail.com> | 2017-08-26 07:11:59 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-08-26 08:11:59 +0200 |
commit | ad9677a14fb8ad1b4048e83a779e5ad36a99f2d0 (patch) | |
tree | 154f892044018b81a3c8fa614fafe9f8b53783dc /builtin | |
parent | 3cea7a349ac55df93b3eac1bf40365e00e472480 (diff) | |
download | minetest-ad9677a14fb8ad1b4048e83a779e5ad36a99f2d0.tar.gz minetest-ad9677a14fb8ad1b4048e83a779e5ad36a99f2d0.tar.bz2 minetest-ad9677a14fb8ad1b4048e83a779e5ad36a99f2d0.zip |
Check item_drop amount clientside (#6242)
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/game/item.lua | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua index b416a34b0..2c7200524 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -420,19 +420,16 @@ end function core.item_drop(itemstack, dropper, pos) 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() - if dropper:get_player_control().sneak then - cs = 1 - end - local item = itemstack:take_item(cs) + local dir = dropper:get_look_dir() + local p = {x = pos.x, y = pos.y + 1.2, z = pos.z} + local cnt = itemstack:get_count() + local item = itemstack:take_item(cnt) local obj = core.add_item(p, item) if obj then - v.x = v.x*2 - v.y = v.y*2 + 2 - v.z = v.z*2 - obj:setvelocity(v) + dir.x = dir.x * 2 + dir.y = dir.y * 2 + 2 + dir.z = dir.z * 2 + obj:set_velocity(dir) obj:get_luaentity().dropped_by = dropper:get_player_name() return itemstack end |