add furnace formspec for mt 0.4.*
parent
77a54e2206
commit
85aa281d75
|
@ -6,6 +6,44 @@
|
|||
-- Node callback functions that are the same for active and inactive furnace
|
||||
--
|
||||
|
||||
function get_furnace_active_formspec(fuel_percent, item_percent)
|
||||
return "size[8,8.5]"..
|
||||
"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^[lowpart:"..
|
||||
(100-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[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
|
||||
|
||||
function get_furnace_inactive_formspec()
|
||||
return "size[8,8.5]"..
|
||||
"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
|
||||
|
||||
local function can_dig(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
|
@ -177,7 +215,7 @@ local function furnace_node_timer(pos, elapsed)
|
|||
active = "active"
|
||||
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
||||
fuel_state = fuel_percent .. "%"
|
||||
formspec = default.get_furnace_active_formspec(fuel_percent, item_percent)
|
||||
formspec = get_furnace_active_formspec(fuel_percent, item_percent)
|
||||
swap_node(pos, "default:furnace_active")
|
||||
-- make sure timer restarts automatically
|
||||
result = true
|
||||
|
@ -185,7 +223,7 @@ local function furnace_node_timer(pos, elapsed)
|
|||
if not fuellist[1]:is_empty() then
|
||||
fuel_state = "0%"
|
||||
end
|
||||
formspec = default.get_furnace_inactive_formspec()
|
||||
formspec = get_furnace_inactive_formspec()
|
||||
swap_node(pos, "default:furnace")
|
||||
-- stop timer on the inactive furnace
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
@ -229,7 +267,7 @@ minetest.register_node(":default:furnace", {
|
|||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", default.get_furnace_inactive_formspec())
|
||||
meta:set_string("formspec", get_furnace_inactive_formspec())
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('src', 1)
|
||||
inv:set_size('fuel', 1)
|
||||
|
|
Loading…
Reference in New Issue