From 844db8aa7b6fb745a5c9040e4c0b2b7a2b65cb64 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Fri, 2 Apr 2021 22:02:19 -0400 Subject: [PATCH] Revert to previous style of interpolated move_to with tweaks --- mods/ENTITIES/mcl_item_entity/init.lua | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index acd714d19..9184b50bd 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -108,6 +108,15 @@ minetest.register_globalstep(function(dtime) object:set_velocity({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 @@ -512,28 +521,11 @@ minetest.register_entity(":__builtin:item", { on_step = function(self, dtime) if self._removed then - self.object:set_properties({ physical = false }) - self.object:set_velocity({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 end self.age = self.age + dtime