forked from mtcontrib/boost_cart
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
f0ce2517e5
@ -127,8 +127,13 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
|
|||||||
boost_cart:manage_attachment(player, nil)
|
boost_cart:manage_attachment(player, nil)
|
||||||
end
|
end
|
||||||
for _, obj_ in pairs(self.attached_items) do
|
for _, obj_ in pairs(self.attached_items) do
|
||||||
if obj_ then
|
local ent = obj_ and obj_:get_luaentity()
|
||||||
|
if ent then
|
||||||
obj_:set_detach()
|
obj_:set_detach()
|
||||||
|
-- Attention! Internal item API
|
||||||
|
if ent.enable_physics then
|
||||||
|
ent:enable_physics()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -348,8 +353,8 @@ function cart_entity:on_step(dtime)
|
|||||||
-- 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
|
||||||
local ent = obj_:get_luaentity()
|
local ent = obj_:get_luaentity()
|
||||||
-- Careful here: physical_state and disable_physics are item-internal APIs
|
-- Attention! Physics must be disabled prior to attach
|
||||||
if ent and ent.name == "__builtin:item" and ent.physical_state then
|
if ent and ent.name == "__builtin:item" and not obj_:get_attach() then
|
||||||
-- Check API to support 5.2.0 and older
|
-- Check API to support 5.2.0 and older
|
||||||
if ent.disable_physics then
|
if ent.disable_physics then
|
||||||
ent:disable_physics()
|
ent:disable_physics()
|
||||||
|
Loading…
Reference in New Issue
Block a user