aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-03 18:32:26 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-03 22:31:02 +0300
commit4b0494062e78580fcf9f9f3b9898ecf0bde12a84 (patch)
tree1aa52fe2b0d2733a701c7727ea52b07cc004e51b /games/minimal/mods
parenta09d86dd3cc3fd31404e6403cfc5d9c7020f944f (diff)
downloadminetest-4b0494062e78580fcf9f9f3b9898ecf0bde12a84.tar.gz
minetest-4b0494062e78580fcf9f9f3b9898ecf0bde12a84.tar.bz2
minetest-4b0494062e78580fcf9f9f3b9898ecf0bde12a84.zip
Add fire visualization to minimal furnace menu
Diffstat (limited to 'games/minimal/mods')
-rw-r--r--games/minimal/mods/default/init.lua36
-rw-r--r--games/minimal/mods/default/textures/default_furnace_fire_bg.pngbin0 -> 313 bytes
-rw-r--r--games/minimal/mods/default/textures/default_furnace_fire_fg.pngbin0 -> 865 bytes
3 files changed, 23 insertions, 13 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua
index b117befbd..643995c97 100644
--- a/games/minimal/mods/default/init.lua
+++ b/games/minimal/mods/default/init.lua
@@ -1245,6 +1245,14 @@ minetest.register_node("default:chest_locked", {
end,
})
+default.furnace_inactive_formspec =
+ "invsize[8,9;]"..
+ "image[2,2;1,1;default_furnace_fire_bg.png]"..
+ "list[current_name;fuel;2,3;1,1;]"..
+ "list[current_name;src;2,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,5;8,4;]"
+
minetest.register_node("default:furnace", {
description = "Furnace",
tile_images = {"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
@@ -1255,12 +1263,7 @@ minetest.register_node("default:furnace", {
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
- meta:set_string("formspec",
- "invsize[8,9;]"..
- "list[current_name;fuel;2,3;1,1;]"..
- "list[current_name;src;2,1;1,1;]"..
- "list[current_name;dst;5,1;2,2;]"..
- "list[current_player;main;0,5;8,4;]")
+ meta:set_string("formspec", default.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace")
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
@@ -1281,12 +1284,7 @@ minetest.register_node("default:furnace_active", {
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
- meta:set_string("formspec",
- "invsize[8,9;]"..
- "list[current_name;fuel;2,3;1,1;]"..
- "list[current_name;src;2,1;1,1;]"..
- "list[current_name;dst;5,1;2,2;]"..
- "list[current_player;main;0,5;8,4;]")
+ meta:set_string("formspec", default.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace");
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
@@ -1358,8 +1356,18 @@ minetest.register_abm({
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
- meta:set_string("infotext","Furnace active: "..(meta:get_float("fuel_time")/meta:get_float("fuel_totaltime")*100).."%")
+ local percent = math.floor(meta:get_float("fuel_time") /
+ meta:get_float("fuel_totaltime") * 100)
+ meta:set_string("infotext","Furnace active: "..percent.."%")
hacky_swap_node(pos,"default:furnace_active")
+ meta:set_string("formspec",
+ "invsize[8,9;]"..
+ "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
+ (100-percent)..":default_furnace_fire_fg.png]"..
+ "list[current_name;fuel;2,3;1,1;]"..
+ "list[current_name;src;2,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,5;8,4;]")
return
end
@@ -1378,6 +1386,7 @@ minetest.register_abm({
if fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
hacky_swap_node(pos,"default:furnace")
+ meta:set_string("formspec", default.furnace_inactive_formspec)
return
end
@@ -1385,6 +1394,7 @@ minetest.register_abm({
if was_active then
meta:set_string("infotext","Furnace is empty")
hacky_swap_node(pos,"default:furnace")
+ meta:set_string("formspec", default.furnace_inactive_formspec)
end
return
end
diff --git a/games/minimal/mods/default/textures/default_furnace_fire_bg.png b/games/minimal/mods/default/textures/default_furnace_fire_bg.png
new file mode 100644
index 000000000..1272e101e
--- /dev/null
+++ b/games/minimal/mods/default/textures/default_furnace_fire_bg.png
Binary files differ
diff --git a/games/minimal/mods/default/textures/default_furnace_fire_fg.png b/games/minimal/mods/default/textures/default_furnace_fire_fg.png
new file mode 100644
index 000000000..fbb19df74
--- /dev/null
+++ b/games/minimal/mods/default/textures/default_furnace_fire_fg.png
Binary files differ