Finish animation for group buttons (yay)

This commit is contained in:
Jean-Patrick Guerrero 2022-06-18 23:16:50 +02:00
parent 8e45f303d3
commit 354561d54c
2 changed files with 16 additions and 2 deletions

View File

@ -37,10 +37,12 @@ local function cache_groups(groupname, groups)
for i = 1, nb_items do
local item = items[i]
local def = reg_items[item]
local texture = def.inventory_image or def.wield_image
local texture = def.inventory_image or def.wield_image or ""
if is_cube(def.drawtype) then
texture = get_cube(def.tiles)
elseif true_str(texture) then
texture = texture .. "\\^[resize\\:150x150"
end
sprite = sprite .. fmt(":0,%u=%s", (i - 1) * px, texture)
@ -50,6 +52,18 @@ local function cache_groups(groupname, groups)
end
end
core.register_chatcommand("test", {
func = function(name, param)
core.get_player_by_name(name):hud_add({
hud_elem_type = "image",
position = {x = 0.6, y = 0.5},
scale = {x = 1, y = 1},
text = param
})
return true
end
})
local function get_item_usages(item, recipe, added)
if is_group(item) then

View File

@ -1032,7 +1032,7 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
local _count = count * (is_recipe and data.scrbar_rcp or data.scrbar_usg or 1)
if group_cache and group_cache.sprite then
local sprite = group_cache.sprite
local sprite = ESC(group_cache.sprite)
fs("item_image_button", X, Y, btn_size, btn_size, "", btn_name, "")
fs("animated_image", X + 0.01, Y + 0.01, 1.89, 1.89, sprite, #group_cache.items, 1000)