Reorder formspec elements

This commit is contained in:
Jean-Patrick Guerrero 2019-11-10 16:11:29 +01:00
parent 0d2af529ef
commit 89059f20b6

@ -733,16 +733,16 @@ local function get_output_fs(fs, L)
item = clean_item(item) item = clean_item(item)
local name = match(item, "%S*") local name = match(item, "%S*")
fs[#fs + 1] = fmt(FMT.item_image_button,
output_X, YOFFSET + (sfinv_only and 0.7 or 0) + L.spacing,
1.1, 1.1, item, name, "")
if CORE_VERSION >= 510 then if CORE_VERSION >= 510 then
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.selected) 1.1, 1.1, PNG.selected)
end end
fs[#fs + 1] = fmt(FMT.item_image_button,
output_X, YOFFSET + (sfinv_only and 0.7 or 0) + L.spacing,
1.1, 1.1, item, name, "")
local infos = { local infos = {
unknown = not reg_items[name] or nil, unknown = not reg_items[name] or nil,
burntime = fuel_cache[name], burntime = fuel_cache[name],
@ -845,6 +845,12 @@ local function get_grid_fs(fs, rcp, spacing)
end end
end end
if CORE_VERSION >= 510 and not large_recipe then
fs[#fs + 1] = fmt(FMT.image,
X, Y + (sfinv_only and 0.7 or 0),
btn_size, btn_size, PNG.selected)
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), X, Y + (sfinv_only and 0.7 or 0),
btn_size, btn_size, item, item, ESC(label)) btn_size, btn_size, item, item, ESC(label))
@ -860,12 +866,6 @@ local function get_grid_fs(fs, rcp, spacing)
if next(infos) then if next(infos) then
fs[#fs + 1] = get_tooltip(item, infos) fs[#fs + 1] = get_tooltip(item, infos)
end end
if CORE_VERSION >= 510 and not large_recipe then
fs[#fs + 1] = fmt(FMT.image,
X, Y + (sfinv_only and 0.7 or 0),
btn_size, btn_size, PNG.selected)
end
end end
if large_recipe then if large_recipe then
@ -1056,17 +1056,17 @@ local function make_formspec(name)
local X = i % ROWS local X = i % ROWS
local Y = (i % IPP - X) / ROWS + 1 local Y = (i % IPP - X) / ROWS + 1
fs[#fs + 1] = fmt("item_image_button[%f,%f;%f,%f;%s;%s_inv;]",
X - (X * (sfinv_only and 0.12 or 0.14)) - 0.05,
Y - (Y * 0.1) - 0.1,
1, 1, item, item)
if CORE_VERSION >= 510 and data.query_item == item then if CORE_VERSION >= 510 and data.query_item == item then
fs[#fs + 1] = fmt(FMT.image, fs[#fs + 1] = fmt(FMT.image,
X - (X * (sfinv_only and 0.12 or 0.14)) - 0.05, X - (X * (sfinv_only and 0.12 or 0.14)) - 0.05,
Y - (Y * 0.1) - 0.1, Y - (Y * 0.1) - 0.1,
1, 1, PNG.selected) 1, 1, PNG.selected)
end end
fs[#fs + 1] = fmt("item_image_button[%f,%f;%f,%f;%s;%s_inv;]",
X - (X * (sfinv_only and 0.12 or 0.14)) - 0.05,
Y - (Y * 0.1) - 0.1,
1, 1, item, item)
end end
if (data.recipes and #data.recipes > 0) or (data.usages and #data.usages > 0) then if (data.recipes and #data.recipes > 0) or (data.usages and #data.usages > 0) then
@ -1350,7 +1350,7 @@ local function handle_aliases(hash)
recipes_cache[newname] = {} recipes_cache[newname] = {}
end end
local is_similar local similar
for i = 1, #recipes_cache[oldname] do for i = 1, #recipes_cache[oldname] do
local rcp_old = recipes_cache[oldname][i] local rcp_old = recipes_cache[oldname][i]
@ -1361,12 +1361,12 @@ local function handle_aliases(hash)
rcp_new.method = nil rcp_new.method = nil
if table_eq(rcp_old, rcp_new) then if table_eq(rcp_old, rcp_new) then
is_similar = true similar = true
break break
end end
end end
if not is_similar then if not similar then
insert(recipes_cache[newname], rcp_old) insert(recipes_cache[newname], rcp_old)
end end
end end