Some cleanup
This commit is contained in:
parent
cffdf77e6a
commit
2fcd559261
|
@ -352,7 +352,6 @@ local function get_recipes(player, item)
|
||||||
local no_recipes = not recipes or #recipes == 0
|
local no_recipes = not recipes or #recipes == 0
|
||||||
if no_recipes and not usages then return end
|
if no_recipes and not usages then return end
|
||||||
usages = apply_recipe_filters(usages, player)
|
usages = apply_recipe_filters(usages, player)
|
||||||
|
|
||||||
local no_usages = not usages or #usages == 0
|
local no_usages = not usages or #usages == 0
|
||||||
|
|
||||||
return not no_recipes and recipes or nil,
|
return not no_recipes and recipes or nil,
|
||||||
|
|
27
src/gui.lua
27
src/gui.lua
|
@ -760,28 +760,39 @@ end
|
||||||
|
|
||||||
local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_size, _btn_size)
|
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 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
|
if custom_recipe or shapeless or cooking then
|
||||||
local icon = custom_recipe and custom_recipe.icon or shapeless and "shapeless" or "furnace"
|
local icon, tooltip = PNG.blank
|
||||||
|
|
||||||
if not custom_recipe then
|
if custom_recipe and true_str(custom_recipe.icon) then
|
||||||
icon = fmt("i3_%s.png^\\[resize:16x16", icon)
|
icon = fmt("%s^\\[resize:16x16", custom_recipe.icon)
|
||||||
|
elseif shapeless then
|
||||||
|
icon = PNG.shapeless
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos_x = right + btn_size + 0.42
|
local pos_x = right + btn_size + 0.42
|
||||||
local pos_y = data.yoffset + 0.9
|
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)
|
fs("animated_image", pos_x, pos_y, 0.5, 0.5, PNG.furnace_anim, 8, 180)
|
||||||
else
|
else
|
||||||
fs("image", pos_x, pos_y, 0.5, 0.5, icon)
|
fs("image", pos_x, pos_y, 0.5, 0.5, icon)
|
||||||
end
|
end
|
||||||
|
|
||||||
local tooltip = custom_recipe and custom_recipe.description or
|
if custom_recipe and true_str(custom_recipe.description) then
|
||||||
shapeless and S"Shapeless" or S"Cooking"
|
tooltip = custom_recipe.description
|
||||||
|
elseif shapeless then
|
||||||
|
tooltip = S"Shapeless"
|
||||||
|
elseif cooking then
|
||||||
|
tooltip = S"Cooking"
|
||||||
|
end
|
||||||
|
|
||||||
|
if tooltip then
|
||||||
fs("tooltip", pos_x, pos_y, 0.5, 0.5, ESC(tooltip))
|
fs("tooltip", pos_x, pos_y, 0.5, 0.5, ESC(tooltip))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local arrow_X = right + 0.2 + (_btn_size or i3.ITEM_BTN_SIZE)
|
local arrow_X = right + 0.2 + (_btn_size or i3.ITEM_BTN_SIZE)
|
||||||
local X = arrow_X + 1.2
|
local X = arrow_X + 1.2
|
||||||
|
@ -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)
|
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)
|
fs("animated_image", X + 0.05, Y, i3.ITEM_BTN_SIZE, i3.ITEM_BTN_SIZE, PNG.fire_anim, 8, 180)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local PNG = {
|
local PNG = {
|
||||||
|
blank = "i3_blank.png",
|
||||||
bg = "i3_bg.png",
|
bg = "i3_bg.png",
|
||||||
bg_full = "i3_bg_full.png",
|
bg_full = "i3_bg_full.png",
|
||||||
bg_content = "i3_bg_content.png",
|
bg_content = "i3_bg_content.png",
|
||||||
|
@ -27,6 +28,7 @@ local PNG = {
|
||||||
tab_small = "i3_tab_small.png",
|
tab_small = "i3_tab_small.png",
|
||||||
tab_top = "i3_tab.png^\\[transformFY",
|
tab_top = "i3_tab.png^\\[transformFY",
|
||||||
furnace_anim = "i3_furnace_anim.png",
|
furnace_anim = "i3_furnace_anim.png",
|
||||||
|
shapeless = "i3_shapeless.png",
|
||||||
bag = "i3_bag.png",
|
bag = "i3_bag.png",
|
||||||
armor = "i3_armor.png",
|
armor = "i3_armor.png",
|
||||||
awards = "i3_award.png",
|
awards = "i3_award.png",
|
||||||
|
|
Ŝarĝante…
Reference in New Issue