From 56f5b18dae1e4f54046c52c620c9e4e9a093e7a9 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 29 May 2020 19:14:06 +0200 Subject: [PATCH] Fix item collection Broken since 5.3.0-dev Co-authored-by: SmallJoker --- cart_entity.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cart_entity.lua b/cart_entity.lua index 6f23613..9cc5324 100644 --- a/cart_entity.lua +++ b/cart_entity.lua @@ -340,10 +340,13 @@ function cart_entity:on_step(dtime) if self.punched then -- Collect dropped items for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if not obj_:is_player() and - obj_:get_luaentity() and - not obj_:get_luaentity().physical_state and - obj_:get_luaentity().name == "__builtin:item" then + local ent = obj_:get_luaentity() + -- Careful here: physical_state and disable_physics are item-internal APIs + if ent and ent.name == "__builtin:item" and ent.physical_state then + -- Check API to support 5.2.0 and older + if ent.disable_physics then + ent:disable_physics() + end obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}) self.attached_items[#self.attached_items + 1] = obj_