Fix item speed not reset when magnet activates

This fixes items sometimes flying upwards when near the player
This commit is contained in:
Wuzzy 2017-06-10 21:39:26 +02:00
parent 5d1c38cb5f
commit 53791c4f9d

View file

@ -88,15 +88,14 @@ minetest.register_globalstep(function(dtime)
object:get_luaentity()._magnet_active = true object:get_luaentity()._magnet_active = true
object:get_luaentity()._collector_timer = 0 object:get_luaentity()._collector_timer = 0
--modified simplemobs api
-- Move object to player -- Move object to player
disable_physics(object, object:get_luaentity())
local opos = object:getpos() local opos = object:getpos()
local vec = vector.subtract(checkpos, opos) local vec = vector.subtract(checkpos, opos)
vec = vector.add(opos, vector.divide(vec, 2)) vec = vector.add(opos, vector.divide(vec, 2))
object:moveto(vec) object:moveto(vec)
disable_physics(object, object:get_luaentity(), false, false)
--fix eternally falling items --fix eternally falling items
minetest.after(0, function(object) minetest.after(0, function(object)