Tune fs style

This commit is contained in:
Jean-Patrick Guerrero 2019-10-04 00:19:48 +02:00
parent 5d7bb6de53
commit c570fa2337

109
init.lua

@ -827,76 +827,73 @@ local function get_info_fs(data, fs)
end end
for i = 1, width * rows do for i = 1, width * rows do
local item = rcp.items[i] local item = rcp.items[i] or ""
local X = ceil((i - 1) % width - width) + XOFFSET local X = ceil((i - 1) % width - width) + XOFFSET
local Y = ceil(i / width) + YOFFSET - min(2, rows) + spacing local Y = ceil(i / width) + YOFFSET - min(2, rows) + spacing
if item or large_recipe then if large_recipe then
if large_recipe then local xof = 1 - 4 / width
item = item or "" local yof = 1 - 4 / rows
local xof = 1 - 4 / width local x_y = width > rows and xof or yof
local yof = 1 - 4 / rows
local x_y = width > rows and xof or yof
btn_size = width > rows and btn_size = width > rows and
(3.5 + (xof * 2)) / width or (3.5 + (yof * 2)) / rows (3.5 + (xof * 2)) / width or (3.5 + (yof * 2)) / rows
s_btn_size = btn_size s_btn_size = btn_size
X = (btn_size * ((i - 1) % width) + XOFFSET - X = (btn_size * ((i - 1) % width) + XOFFSET -
(sfinv_only and 2.83 or 0.5)) * (0.83 - (x_y / 5)) (sfinv_only and 2.83 or 0.5)) * (0.83 - (x_y / 5))
Y = (btn_size * floor((i - 1) / width) + Y = (btn_size * floor((i - 1) / width) +
(sfinv_only and 5.81 or 4) + x_y) * (0.86 - (x_y / 5)) (sfinv_only and 5.81 or 4) + x_y) * (0.86 - (x_y / 5))
end end
if X > rightest then if X > rightest then
rightest = X rightest = X
end end
local groups local groups
if is_group(item) then if is_group(item) then
groups = extract_groups(item) groups = extract_groups(item)
local items = groups_to_items(groups) local items = groups_to_items(groups)
item = items[1] or items item = items[1] or items
end end
local label = groups and "\nG" or "" local label = groups and "\nG" or ""
local replace local replace
if replacements then if replacements then
for j = 1, #replacements do for j = 1, #replacements do
local replacement = replacements[j] local replacement = replacements[j]
if replacement[1] == item then if replacement[1] == item then
label = "\nR" label = "\nR"
replace = replacement[2] replace = replacement[2]
end
end end
end end
end
fs[#fs + 1] = fmt(FMT.item_image_button, fs[#fs + 1] = fmt(FMT.item_image_button,
X, Y + (sfinv_only and 0.7 or 0),
btn_size, btn_size, item, clean_str(item), ESC(label))
local infos = {
unknown = not reg_items[item],
groups = groups,
burntime = fuel_cache[item],
cooktime = cooktime,
replace = replace,
}
for _, info in pairs(infos) do
if info then
fs[#fs + 1] = get_tooltip(item, infos)
break
end
end
if not large_recipe then
fs[#fs + 1] = fmt(FMT.image,
X, Y + (sfinv_only and 0.7 or 0), X, Y + (sfinv_only and 0.7 or 0),
btn_size, btn_size, item, clean_str(item), ESC(label)) btn_size, btn_size, "craftguide_selected.png")
local infos = {
unknown = not reg_items[item],
groups = groups,
burntime = fuel_cache[item],
cooktime = cooktime,
replace = replace,
}
for _, info in pairs(infos) do
if info then
fs[#fs + 1] = get_tooltip(item, infos)
break
end
end
if not large_recipe then
fs[#fs + 1] = fmt(FMT.image,
X, Y + (sfinv_only and 0.7 or 0),
btn_size, btn_size, "craftguide_selected.png")
end
end end
end end