From bc58e4a225dc61faba1c8268c8cae68eee334ddb Mon Sep 17 00:00:00 2001 From: kay27 Date: Thu, 15 Jul 2021 01:24:36 +0400 Subject: [PATCH] Merge MineClone2/master --- mods/ITEMS/mcl_core/functions.lua | 34 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 73c6722b2..b41999ee4 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -202,21 +202,27 @@ minetest.register_abm({ interval = 1, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) - for _,object in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then - object:remove() - elseif not object:is_player() and object:get_luaentity().name == "mcl_minecarts:minecart" then - local pos = object:get_pos() - local driver = object:get_luaentity()._driver - if driver ~= nil then - mcl_player.player_attached[driver] = nil - local player = minetest.get_player_by_name(driver) - player:set_detach() - player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0}) - mcl_player.player_set_animation(player, "stand" , 30) + for _, object in pairs(minetest.get_objects_inside_radius(pos, 0.9)) do + if not object:is_player() then + local entity = object:get_luaentity() + if entity then + local entity_name = entity.name + if entity_name == "__builtin:item" then + object:remove() + elseif entity_name == "mcl_minecarts:minecart" then + local pos = object:get_pos() + local driver = entity._driver + if driver then + mcl_player.player_attached[driver] = nil + local player = minetest.get_player_by_name(driver) + player:set_detach() + player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0}) + mcl_player.player_set_animation(player, "stand" , 30) + end + minetest.add_item(pos, "mcl_minecarts:minecart") + object:remove() + end end - minetest.add_item(pos, "mcl_minecarts:minecart") - object:remove() end end end,