mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 14:53:16 -04:00
furnace: Add default.get_furnace_formspec() to reduce code duplication.
This deprecates default.get_furnace_active_formspec() and default.get_furnace_inactive_formspec().
This commit is contained in:
parent
695f98f213
commit
59c22bf022
1 changed files with 18 additions and 20 deletions
|
@ -7,14 +7,22 @@ local S = default.get_translator
|
||||||
-- Formspecs
|
-- Formspecs
|
||||||
--
|
--
|
||||||
|
|
||||||
function default.get_furnace_active_formspec(fuel_percent, item_percent)
|
function default.get_furnace_formspec(fuel_percent, item_percent)
|
||||||
|
local furnace_image
|
||||||
|
-- active furnace
|
||||||
|
if fuel_percent then
|
||||||
|
furnace_image = "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||||
|
(fuel_percent)..":default_furnace_fire_fg.png]"..
|
||||||
|
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||||
|
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||||
|
else
|
||||||
|
furnace_image = "image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
|
||||||
|
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"
|
||||||
|
end
|
||||||
return "size[8,8.5]"..
|
return "size[8,8.5]"..
|
||||||
"list[context;src;2.75,0.5;1,1;]"..
|
"list[context;src;2.75,0.5;1,1;]"..
|
||||||
"list[context;fuel;2.75,2.5;1,1;]"..
|
"list[context;fuel;2.75,2.5;1,1;]"..
|
||||||
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
furnace_image..
|
||||||
(fuel_percent)..":default_furnace_fire_fg.png]"..
|
|
||||||
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
|
||||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
|
||||||
"list[context;dst;4.75,0.96;2,2;]"..
|
"list[context;dst;4.75,0.96;2,2;]"..
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
@ -27,22 +35,12 @@ function default.get_furnace_active_formspec(fuel_percent, item_percent)
|
||||||
default.get_hotbar_bg(0, 4.25)
|
default.get_hotbar_bg(0, 4.25)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function default.get_furnace_active_formspec(fuel_percent, item_percent)
|
||||||
|
return default.get_furnace_formspec(fuel_percent, item_percent)
|
||||||
|
end
|
||||||
|
|
||||||
function default.get_furnace_inactive_formspec()
|
function default.get_furnace_inactive_formspec()
|
||||||
return "size[8,8.5]"..
|
return default.get_furnace_formspec()
|
||||||
"list[context;src;2.75,0.5;1,1;]"..
|
|
||||||
"list[context;fuel;2.75,2.5;1,1;]"..
|
|
||||||
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
|
|
||||||
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
|
||||||
"list[context;dst;4.75,0.96;2,2;]"..
|
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
|
||||||
"listring[context;dst]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;src]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
"listring[context;fuel]"..
|
|
||||||
"listring[current_player;main]"..
|
|
||||||
default.get_hotbar_bg(0, 4.25)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
Loading…
Add table
Reference in a new issue