mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-26 04:23:44 +01:00
Add animated images
This commit is contained in:
parent
5fc7e7c087
commit
a3e7031c04
20
init.lua
20
init.lua
@ -76,9 +76,11 @@ local PNG = {
|
|||||||
next = "craftguide_next_icon.png",
|
next = "craftguide_next_icon.png",
|
||||||
arrow = "craftguide_arrow.png",
|
arrow = "craftguide_arrow.png",
|
||||||
fire = "craftguide_fire.png",
|
fire = "craftguide_fire.png",
|
||||||
|
fire_anim = "craftguide_fire_anim.png",
|
||||||
book = "craftguide_book.png",
|
book = "craftguide_book.png",
|
||||||
sign = "craftguide_sign.png",
|
sign = "craftguide_sign.png",
|
||||||
selected = "craftguide_selected.png",
|
selected = "craftguide_selected.png",
|
||||||
|
furnace_anim = "craftguide_furnace_anim.png",
|
||||||
|
|
||||||
search_hover = "craftguide_search_icon_hover.png",
|
search_hover = "craftguide_search_icon_hover.png",
|
||||||
clear_hover = "craftguide_clear_icon_hover.png",
|
clear_hover = "craftguide_clear_icon_hover.png",
|
||||||
@ -94,6 +96,7 @@ local FMT = {
|
|||||||
tooltip = "tooltip[%f,%f;%f,%f;%s]",
|
tooltip = "tooltip[%f,%f;%f,%f;%s]",
|
||||||
item_image = "item_image[%f,%f;%f,%f;%s]",
|
item_image = "item_image[%f,%f;%f,%f;%s]",
|
||||||
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
|
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
|
||||||
|
animated_image = "animated_image[%f,%f;%f,%f;%s:%u,%u]",
|
||||||
item_image_button = "item_image_button[%f,%f;%f,%f;%s;%s;%s]",
|
item_image_button = "item_image_button[%f,%f;%f,%f;%s;%s;%s]",
|
||||||
arrow = "image_button[%f,%f;0.8,0.8;%s;%s;;;false;%s]",
|
arrow = "image_button[%f,%f;0.8,0.8;%s;%s;;;false;%s]",
|
||||||
}
|
}
|
||||||
@ -722,7 +725,12 @@ local function get_output_fs(data, fs, L)
|
|||||||
local pos_x = L.rightest + L.btn_size + 0.1
|
local pos_x = L.rightest + L.btn_size + 0.1
|
||||||
local pos_y = YOFFSET + (sfinv_only and 0.25 or -0.45)
|
local pos_y = YOFFSET + (sfinv_only and 0.25 or -0.45)
|
||||||
|
|
||||||
|
if data.fs_version >= 3 and sub(icon, 1, 18) == "craftguide_furnace" then
|
||||||
|
fs[#fs + 1] = fmt(FMT.animated_image,
|
||||||
|
pos_x, pos_y + L.spacing, 0.5, 0.5, PNG.furnace_anim, 8, 180)
|
||||||
|
else
|
||||||
fs[#fs + 1] = fmt(FMT.image, pos_x, pos_y + L.spacing, 0.5, 0.5, icon)
|
fs[#fs + 1] = fmt(FMT.image, pos_x, pos_y + L.spacing, 0.5, 0.5, icon)
|
||||||
|
end
|
||||||
|
|
||||||
local tooltip = custom_recipe and custom_recipe.description or
|
local tooltip = custom_recipe and custom_recipe.description or
|
||||||
L.shapeless and S"Shapeless" or S"Cooking"
|
L.shapeless and S"Shapeless" or S"Cooking"
|
||||||
@ -738,9 +746,15 @@ local function get_output_fs(data, fs, L)
|
|||||||
0.9, 0.7, PNG.arrow)
|
0.9, 0.7, PNG.arrow)
|
||||||
|
|
||||||
if L.recipe.type == "fuel" then
|
if L.recipe.type == "fuel" then
|
||||||
|
if data.fs_version >= 3 then
|
||||||
|
fs[#fs + 1] = fmt(FMT.animated_image,
|
||||||
|
output_X, YOFFSET + (sfinv_only and 0.7 or 0) + L.spacing,
|
||||||
|
1.1, 1.1, PNG.fire_anim, 8, 180)
|
||||||
|
else
|
||||||
fs[#fs + 1] = fmt(FMT.image,
|
fs[#fs + 1] = fmt(FMT.image,
|
||||||
output_X, YOFFSET + (sfinv_only and 0.7 or 0) + L.spacing,
|
output_X, YOFFSET + (sfinv_only and 0.7 or 0) + L.spacing,
|
||||||
1.1, 1.1, PNG.fire)
|
1.1, 1.1, PNG.fire)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local item = L.recipe.output
|
local item = L.recipe.output
|
||||||
item = clean_name(item)
|
item = clean_name(item)
|
||||||
@ -774,11 +788,17 @@ local function get_output_fs(data, fs, L)
|
|||||||
output_X + 1, YOFFSET + (sfinv_only and 0.7 or 0.1) + L.spacing,
|
output_X + 1, YOFFSET + (sfinv_only and 0.7 or 0.1) + L.spacing,
|
||||||
0.6, 0.4, PNG.arrow)
|
0.6, 0.4, PNG.arrow)
|
||||||
|
|
||||||
|
if data.fs_version >= 3 then
|
||||||
|
fs[#fs + 1] = fmt(FMT.animated_image,
|
||||||
|
output_X + 1.6, YOFFSET + (sfinv_only and 0.55 or 0) + L.spacing,
|
||||||
|
0.6, 0.6, PNG.fire_anim, 8, 180)
|
||||||
|
else
|
||||||
fs[#fs + 1] = fmt(FMT.image,
|
fs[#fs + 1] = fmt(FMT.image,
|
||||||
output_X + 1.6, YOFFSET + (sfinv_only and 0.55 or 0) + L.spacing,
|
output_X + 1.6, YOFFSET + (sfinv_only and 0.55 or 0) + L.spacing,
|
||||||
0.6, 0.6, PNG.fire)
|
0.6, 0.6, PNG.fire)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_grid_fs(data, fs, rcp, spacing)
|
local function get_grid_fs(data, fs, rcp, spacing)
|
||||||
|
BIN
textures/craftguide_fire_anim.png
Normal file
BIN
textures/craftguide_fire_anim.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
textures/craftguide_furnace_anim.png
Normal file
BIN
textures/craftguide_furnace_anim.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
Loading…
Reference in New Issue
Block a user