1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

carts: Fix item collection (#2689)

This commit is contained in:
sfan5 2020-05-29 22:54:47 +02:00 committed by GitHub
parent 0662f96284
commit e849d54572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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