Merge pull request 'Revert to previous style of interpolated move_to with tweaks' (#1445) from jordan4ibanez/MineClone2-ManualItemPickupInterpolation:master into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1445
This commit is contained in:
jordan4ibanez 2021-04-03 02:02:58 +00:00
commit 43c47bbe0f

@ -108,6 +108,15 @@ minetest.register_globalstep(function(dtime)
object:set_velocity({x=0,y=0,z=0}) object:set_velocity({x=0,y=0,z=0})
object:set_acceleration({x=0,y=0,z=0}) object:set_acceleration({x=0,y=0,z=0})
object:move_to(checkpos)
minetest.after(0.25, function()
--safety check
if object and object:get_luaentity() then
object:remove()
end
end)
end end
end end
end end
@ -512,28 +521,11 @@ minetest.register_entity(":__builtin:item", {
on_step = function(self, dtime) on_step = function(self, dtime)
if self._removed then if self._removed then
self.object:set_properties({ self.object:set_properties({
physical = false physical = false
}) })
self.object:set_velocity({x=0,y=0,z=0}) self.object:set_velocity({x=0,y=0,z=0})
self.object:set_acceleration({x=0,y=0,z=0}) self.object:set_acceleration({x=0,y=0,z=0})
self.collection_age = self.collection_age + dtime
if not self.target then
self.object:remove()
else
local pos = self.object:get_pos()
self.object:move_to(vector.add(pos, vector.multiply(vector.subtract(self.target, pos), 0.75)))
if self.collection_age >= 1 or vector.distance(pos, self.target) <= 0.07 then
self.object:remove()
end
end
return return
end end
self.age = self.age + dtime self.age = self.age + dtime