From bf9ad1919e7144d573288b4455a955f4847faa68 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 29 Dec 2024 07:04:02 -0600 Subject: [PATCH] Prevent players getting in the same cart as a mob, don't allow mobs already in a cart to be moved to another one --- mods/ENTITIES/mcl_minecarts/carts/minecart.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_minecarts/carts/minecart.lua b/mods/ENTITIES/mcl_minecarts/carts/minecart.lua index 600eedc5a..004426d80 100644 --- a/mods/ENTITIES/mcl_minecarts/carts/minecart.lua +++ b/mods/ENTITIES/mcl_minecarts/carts/minecart.lua @@ -22,9 +22,13 @@ function mod.attach_driver(cart, player) -- Make sure we have a player if not player or not player:is_player() then return end + -- Prevent more than one player getting in the cart local player_name = player:get_player_name() if cart._driver or player:get_player_control().sneak then return end + -- Prevent getting into a cart that already has a passenger + if cart._passenger then return end + -- Update cart information cart._driver = player_name cart._start_pos = cart.object:get_pos() @@ -82,7 +86,7 @@ mod.register_minecart({ local mobsnear = minetest.get_objects_inside_radius(self.object:get_pos(), 1.3) for n=1, #mobsnear do local mob = mobsnear[n] - if mob then + if mob and not mob:get_attach() then local entity = mob:get_luaentity() if entity and entity.is_mob then self._passenger = entity