mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-11-15 23:30:19 +01:00
Fix item pickups not working sometimes
This commit is contained in:
parent
b05a49afb5
commit
3bd7d6f8ca
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user