mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 02:42:25 +01:00
Allow to put fuels into furnace with hoppers
This commit is contained in:
parent
e5f6837c27
commit
d8f423ac07
@ -135,8 +135,9 @@ end
|
|||||||
--- source_list: List name of the source inventory from which to take the item
|
--- source_list: List name of the source inventory from which to take the item
|
||||||
--- source_stack_id: The inventory position ID of the source inventory to take the item from (-1 for first occupied slot)
|
--- source_stack_id: The inventory position ID of the source inventory to take the item from (-1 for first occupied slot)
|
||||||
--- destination_pos: Position ({x,y,z}) of the node to put the item into
|
--- destination_pos: Position ({x,y,z}) of the node to put the item into
|
||||||
|
--- destination_list: (optional) list name of the destination inventory. If not set, the main or source list will be used
|
||||||
-- Returns true on success and false on failure
|
-- Returns true on success and false on failure
|
||||||
function mcl_util.move_item_container(source_pos, source_list, source_stack_id, destination_pos)
|
function mcl_util.move_item_container(source_pos, source_list, source_stack_id, destination_pos, destination_list)
|
||||||
local smeta = minetest.get_meta(source_pos)
|
local smeta = minetest.get_meta(source_pos)
|
||||||
local dmeta = minetest.get_meta(destination_pos)
|
local dmeta = minetest.get_meta(destination_pos)
|
||||||
|
|
||||||
@ -155,16 +156,22 @@ function mcl_util.move_item_container(source_pos, source_list, source_stack_id,
|
|||||||
|
|
||||||
-- If it's a container, put it into the container
|
-- If it's a container, put it into the container
|
||||||
if dnodedef.groups.container then
|
if dnodedef.groups.container then
|
||||||
if dnodedef.groups.container == 2 or snodedef.groups.continer == 3 then
|
-- Automatically select a destination list if omitted
|
||||||
return mcl_util.move_item(sinv, source_list, source_stack_id, dinv, "main")
|
if not destination_list then
|
||||||
elseif dnodedef.groups.container == 3 then
|
if dnodedef.groups.container == 2 or snodedef.groups.continer == 3 then
|
||||||
local stack = sinv:get_stack(source_list, source_stack_id)
|
destination_list = "main"
|
||||||
local def = minetest.registered_nodes[stack:get_name()]
|
elseif dnodedef.groups.container == 3 then
|
||||||
if stack and (not stack:is_empty()) and (not (def and def.groups and def.groups.shulker_box)) then
|
local stack = sinv:get_stack(source_list, source_stack_id)
|
||||||
return mcl_util.move_item(sinv, source_list, source_stack_id, dinv, "main")
|
local def = minetest.registered_nodes[stack:get_name()]
|
||||||
|
if stack and (not stack:is_empty()) and (not (def and def.groups and def.groups.shulker_box)) then
|
||||||
|
destination_list = "main"
|
||||||
|
end
|
||||||
|
elseif dnodedef.groups.container == 4 then
|
||||||
|
destination_list = "src"
|
||||||
end
|
end
|
||||||
elseif dnodedef.groups.container == 4 then
|
end
|
||||||
return mcl_util.move_item(sinv, source_list, source_stack_id, dinv, "src")
|
if destination_list then
|
||||||
|
return mcl_util.move_item(sinv, source_list, source_stack_id, dinv, destination_list)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
@ -221,7 +221,12 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Move an item from the hopper into the container to which the hopper points to
|
-- Move an item from the hopper into the container to which the hopper points to
|
||||||
mcl_util.move_item_container(pos, "main", -1, front)
|
local g = minetest.registered_nodes[frontnode.name].groups.container
|
||||||
|
if g == 2 or g == 3 then
|
||||||
|
mcl_util.move_item_container(pos, "main", -1, front)
|
||||||
|
elseif g == 4 then
|
||||||
|
mcl_util.move_item_container(pos, "main", -1, front, "fuel")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user