Some cleanup

This commit is contained in:
Jean-Patrick Guerrero 2021-12-07 01:27:43 +01:00
parent cffdf77e6a
commit 2fcd559261
3 changed files with 22 additions and 10 deletions

View File

@ -352,7 +352,6 @@ local function get_recipes(player, item)
local no_recipes = not recipes or #recipes == 0
if no_recipes and not usages then return end
usages = apply_recipe_filters(usages, player)
local no_usages = not usages or #usages == 0
return not no_recipes and recipes or nil,

View File

@ -760,27 +760,38 @@ end
local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_size, _btn_size)
local custom_recipe = i3.craft_types[rcp.type]
local cooking = rcp.type == "cooking"
local fuel = rcp.type == "fuel"
if custom_recipe or shapeless or rcp.type == "cooking" then
local icon = custom_recipe and custom_recipe.icon or shapeless and "shapeless" or "furnace"
if custom_recipe or shapeless or cooking then
local icon, tooltip = PNG.blank
if not custom_recipe then
icon = fmt("i3_%s.png^\\[resize:16x16", icon)
if custom_recipe and true_str(custom_recipe.icon) then
icon = fmt("%s^\\[resize:16x16", custom_recipe.icon)
elseif shapeless then
icon = PNG.shapeless
end
local pos_x = right + btn_size + 0.42
local pos_y = data.yoffset + 0.9
if sub(icon, 1, 10) == "i3_furnace" then
if cooking then
fs("animated_image", pos_x, pos_y, 0.5, 0.5, PNG.furnace_anim, 8, 180)
else
fs("image", pos_x, pos_y, 0.5, 0.5, icon)
end
local tooltip = custom_recipe and custom_recipe.description or
shapeless and S"Shapeless" or S"Cooking"
if custom_recipe and true_str(custom_recipe.description) then
tooltip = custom_recipe.description
elseif shapeless then
tooltip = S"Shapeless"
elseif cooking then
tooltip = S"Cooking"
end
fs("tooltip", pos_x, pos_y, 0.5, 0.5, ESC(tooltip))
if tooltip then
fs("tooltip", pos_x, pos_y, 0.5, 0.5, ESC(tooltip))
end
end
local arrow_X = right + 0.2 + (_btn_size or i3.ITEM_BTN_SIZE)
@ -789,7 +800,7 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
fs("image", arrow_X, Y + 0.06, 1, 1, PNG.arrow)
if rcp.type == "fuel" then
if fuel then
fs("animated_image", X + 0.05, Y, i3.ITEM_BTN_SIZE, i3.ITEM_BTN_SIZE, PNG.fire_anim, 8, 180)
return
end

View File

@ -1,4 +1,5 @@
local PNG = {
blank = "i3_blank.png",
bg = "i3_bg.png",
bg_full = "i3_bg_full.png",
bg_content = "i3_bg_content.png",
@ -27,6 +28,7 @@ local PNG = {
tab_small = "i3_tab_small.png",
tab_top = "i3_tab.png^\\[transformFY",
furnace_anim = "i3_furnace_anim.png",
shapeless = "i3_shapeless.png",
bag = "i3_bag.png",
armor = "i3_armor.png",
awards = "i3_award.png",