diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 9db40438..9e2422f8 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -13,6 +13,7 @@ local function detach_driver(self) return end if not self._driver:is_player() then + self._pickup_inhibit_timer = 1 self._driver:set_detach() self._driver = nil return @@ -81,6 +82,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o _old_pos = nil, _old_vel = {x=0, y=0, z=0}, _old_switch = 0, + _pickup_inhibit_timer = 0, -- how many seconds are mobs and boats not picked up after detaching? _railtype = nil, } @@ -181,8 +183,12 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o cart.on_activate_by_rail = on_activate_by_rail function cart:on_step(dtime) + if self._pickup_inhibit_timer > 0 then + self._pickup_inhibit_timer = self._pickup_inhibit_timer - dtime + end + local entity_name = self.object:get_luaentity().name - if entity_name == "mcl_minecarts:minecart" then + if entity_name == "mcl_minecarts:minecart" and self._pickup_inhibit_timer <= 0 then for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do local entity = obj:get_luaentity() if not self._driver and entity and ( entity._cmi_is_mob or entity.name == "mcl_boats:boat" ) and not obj:get_attach() then