mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-08-28 14:17:33 -04:00
Update furnace.lua
cooking stacks that return a replacement item are lost until very last one, this fixes the issue.
This commit is contained in:
parent
8fbfc14c3f
commit
ed676d9ee0
1 changed files with 13 additions and 6 deletions
|
@ -114,6 +114,14 @@ local function swap_node(pos, name)
|
|||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
||||
local function add_item(inv, pos, item)
|
||||
local leftover = inv:add_item("dst", item)
|
||||
if not leftover:is_empty() then
|
||||
local drop_pos = minetest.find_node_near(pos, 1, {"air"})
|
||||
minetest.item_drop(item, nil, drop_pos)
|
||||
end
|
||||
end
|
||||
|
||||
local function furnace_node_timer(pos, elapsed)
|
||||
--
|
||||
-- Initialize metadata
|
||||
|
@ -169,6 +177,10 @@ local function furnace_node_timer(pos, elapsed)
|
|||
inv:set_stack("src", 1, aftercooked.items[1])
|
||||
src_time = src_time - cooked.time
|
||||
update = true
|
||||
-- add replacement item to dst so they arent lost
|
||||
if cooked.replacements[1] then
|
||||
add_item(inv, pos, cooked.replacements[1])
|
||||
end
|
||||
else
|
||||
dst_full = true
|
||||
end
|
||||
|
@ -202,12 +214,7 @@ local function furnace_node_timer(pos, elapsed)
|
|||
-- Put replacements in dst list or drop them on the furnace.
|
||||
local replacements = fuel.replacements
|
||||
if replacements[1] then
|
||||
local leftover = inv:add_item("dst", replacements[1])
|
||||
if not leftover:is_empty() then
|
||||
local above = vector.new(pos.x, pos.y + 1, pos.z)
|
||||
local drop_pos = minetest.find_node_near(above, 1, {"air"}) or above
|
||||
minetest.item_drop(replacements[1], nil, drop_pos)
|
||||
end
|
||||
add_item(inv, pos, replacements[1])
|
||||
end
|
||||
update = true
|
||||
fuel_totaltime = fuel.time + (fuel_totaltime - fuel_time)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue