Skip to content
Snippets Groups Projects
Unverified Commit e849d545 authored by sfan5's avatar sfan5 Committed by GitHub
Browse files

carts: Fix item collection (#2689)

parent 0662f962
No related branches found
No related tags found
No related merge requests found
...@@ -328,11 +328,10 @@ local function rail_on_step(self, dtime) ...@@ -328,11 +328,10 @@ local function rail_on_step(self, dtime)
if self.punched then if self.punched then
-- Collect dropped items -- Collect dropped items
for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do
if not obj_:is_player() and local ent = obj_:get_luaentity()
obj_:get_luaentity() and -- Careful here: physical_state and disable_physics are item-internal APIs
not obj_:get_luaentity().physical_state and if ent and ent.name == "__builtin:item" and ent.physical_state then
obj_:get_luaentity().name == "__builtin:item" then ent:disable_physics()
obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}) 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_ self.attached_items[#self.attached_items + 1] = obj_
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment