From b6ca0e6af5d863451ba348e4df1247d8389c449a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 6 Aug 2024 19:03:13 -0500 Subject: [PATCH] Rewrite mcl_util.hopper_pull in terms of mcl_util.hopper_pull_to_inventory --- mods/CORE/mcl_util/init.lua | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index c1ecbc411..e401aa11c 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -369,7 +369,6 @@ function mcl_util.hopper_push(pos, dst_pos) end function mcl_util.hopper_pull_to_inventory(hop_inv, hop_list, src_pos, pos) - -- TODO: merge together with hopper_pull after https://git.minetest.land/MineClone2/MineClone2/pulls/4190 is merged -- Get node pos' for item transfer local src = minetest.get_node(src_pos) if not minetest.registered_nodes[src.name] then return end @@ -399,33 +398,7 @@ end ---@param pos Vector ---@param src_pos Vector function mcl_util.hopper_pull(pos, src_pos) - local hop_inv = minetest.get_meta(pos):get_inventory() - local hop_list = 'main' - - -- Get node pos' for item transfer - local src = minetest.get_node(src_pos) - if not minetest.registered_nodes[src.name] then return end - local src_type = minetest.get_item_group(src.name, "container") - if src_type ~= 2 then return end - local src_def = minetest.registered_nodes[src.name] - - local src_list = 'main' - local src_inv, stack_id - - if src_def._mcl_hoppers_on_try_pull then - src_inv, src_list, stack_id = src_def._mcl_hoppers_on_try_pull(src_pos, pos, hop_inv, hop_list) - else - local src_meta = minetest.get_meta(src_pos) - src_inv = src_meta:get_inventory() - stack_id = mcl_util.select_stack(src_inv, src_list, hop_inv, hop_list, nil, 1) - end - - if stack_id ~= nil then - local ok = mcl_util.move_item(src_inv, src_list, stack_id, hop_inv, hop_list) - if src_def._mcl_hoppers_on_after_pull then - src_def._mcl_hoppers_on_after_pull(src_pos) - end - end + return mcl_util.hopper_pull_to_inventory(minetest.get_meta(pos):get_inventory(), 'main', src_pos, pos) end local function drop_item_stack(pos, stack)