Skip to content

Commit

Permalink
Merge branch 'issue-398' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
S-S-X committed Feb 20, 2025
2 parents 3b63de9 + 06f918a commit 6c111c2
Showing 1 changed file with 32 additions and 39 deletions.
71 changes: 32 additions & 39 deletions technic/machines/other/coal_alloy_furnace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,10 @@ minetest.register_abm({
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()

if inv:get_size("src") == 1 then -- Old furnace -> convert it
inv:set_size("src", 2)
inv:set_stack("src", 2, inv:get_stack("src2", 1))
inv:set_size("src2", 0)
local inv = meta:get_inventory()
local src_list = inv:get_list("src")
if not src_list then
return
end

for i, name in pairs({
Expand All @@ -126,7 +124,7 @@ minetest.register_abm({
end

-- Get what to cook if anything
local recipe = technic.get_recipe("alloy", inv:get_list("src"))
local recipe = technic.get_recipe("alloy", src_list)

local was_active = false

Expand All @@ -150,32 +148,32 @@ minetest.register_abm({
meta:set_string("infotext", S("@1 Active", machine_name).." ("..percent.."%)")
technic.swap_node(pos, "technic:coal_alloy_furnace_active")
meta:set_string("formspec",
size..
"label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100 - percent)..":default_furnace_fire_fg.png]"..
"list[context;fuel;2,3;1,1;]"..
"list[context;src;2,1;2,1;]"..
"list[context;dst;5,1;2,2;]"..

(minetest.get_modpath("mcl_formspec") and
mcl_formspec.get_itemslot_bg(2,3,1,1)..
mcl_formspec.get_itemslot_bg(2,1,2,1)..
mcl_formspec.get_itemslot_bg(5,1,2,2)..
-- player inventory
"list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1)
or "list[current_player;main;0,5;8,4;]")..

-- listrings
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;fuel]"..
"listring[current_player;main]")
size..
"label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100 - percent)..":default_furnace_fire_fg.png]"..
"list[context;fuel;2,3;1,1;]"..
"list[context;src;2,1;2,1;]"..
"list[context;dst;5,1;2,2;]"..

(minetest.get_modpath("mcl_formspec") and
mcl_formspec.get_itemslot_bg(2,3,1,1)..
mcl_formspec.get_itemslot_bg(2,1,2,1)..
mcl_formspec.get_itemslot_bg(5,1,2,2)..
-- player inventory
"list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1)
or "list[current_player;main;0,5;8,4;]")..

-- listrings
"listring[context;dst]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;fuel]"..
"listring[current_player;main]")
return
end

Expand All @@ -189,13 +187,8 @@ minetest.register_abm({
end

-- Next take a hard look at the fuel situation
local fuel = nil
local afterfuel
local fuellist = inv:get_list("fuel")

if fuellist then
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})

if fuel.time <= 0 then
meta:set_string("infotext", S("@1 Out Of Fuel", machine_name))
Expand Down

0 comments on commit 6c111c2

Please sign in to comment.