diff --git a/cart_entity.lua b/cart_entity.lua index 5368b5e..94cac15 100644 --- a/cart_entity.lua +++ b/cart_entity.lua @@ -127,8 +127,13 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, boost_cart:manage_attachment(player, nil) end for _, obj_ in pairs(self.attached_items) do - if obj_ then + local ent = obj_ and obj_:get_luaentity() + if ent then obj_:set_detach() + -- Attention! Internal item API + if ent.enable_physics then + ent:enable_physics() + end end end @@ -348,8 +353,8 @@ function cart_entity:on_step(dtime) -- Collect dropped items for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do 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 + -- Attention! Physics must be disabled prior to attach + if ent and ent.name == "__builtin:item" and not obj_:get_attach() then -- Check API to support 5.2.0 and older if ent.disable_physics then ent:disable_physics()