mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-28 20:00:27 +01:00
Fix furnace block fuel (#2)
* Fix blocking of fuel inventory by fuel replacement and losing of fuel replacements.
This commit is contained in:
parent
8f067db7cd
commit
23fe215721
@ -188,9 +188,26 @@ local function furnace_node_timer(pos, elapsed)
|
|||||||
-- No valid fuel in fuel list
|
-- No valid fuel in fuel list
|
||||||
fuel_totaltime = 0
|
fuel_totaltime = 0
|
||||||
src_time = 0
|
src_time = 0
|
||||||
|
else
|
||||||
|
-- prevent blocking of fuel inventory (for automatization mods)
|
||||||
|
local is_fuel = minetest.get_craft_result({method = "fuel", width = 1, items = {afterfuel.items[1]:to_string()}})
|
||||||
|
if is_fuel.time == 0 then
|
||||||
|
table.insert(fuel.replacements, afterfuel.items[1])
|
||||||
|
inv:set_stack("fuel", 1, "")
|
||||||
else
|
else
|
||||||
-- Take fuel from fuel list
|
-- Take fuel from fuel list
|
||||||
inv:set_stack("fuel", 1, afterfuel.items[1])
|
inv:set_stack("fuel", 1, afterfuel.items[1])
|
||||||
|
end
|
||||||
|
-- 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
|
||||||
|
end
|
||||||
update = true
|
update = true
|
||||||
fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime)
|
fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime)
|
||||||
src_time = src_time + elapsed
|
src_time = src_time + elapsed
|
||||||
|
Loading…
Reference in New Issue
Block a user