mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-27 03:10:39 +01:00
More cleaning
This commit is contained in:
parent
748cc9a7a1
commit
16a1865e11
52
src/gui.lua
52
src/gui.lua
@ -1200,7 +1200,7 @@ local function get_export_fs(fs, data, is_recipe, is_usage, max_stacks_rcp, max_
|
|||||||
fmt("craft_%s", name), ES("Craft (×@1)", stack_fs))
|
fmt("craft_%s", name), ES("Craft (×@1)", stack_fs))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_rcp_extra(fs, player, data, panel, is_recipe, is_usage)
|
local function get_rcp_extra(fs, data, player, panel, is_recipe, is_usage)
|
||||||
fs"container[0,0.075]"
|
fs"container[0,0.075]"
|
||||||
local rn = panel.rcp and #panel.rcp
|
local rn = panel.rcp and #panel.rcp
|
||||||
|
|
||||||
@ -1269,7 +1269,7 @@ local function hide_items(player, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_items_fs(fs, player, data, full_height)
|
local function get_items_fs(fs, data, player, full_height)
|
||||||
hide_items(player, data)
|
hide_items(player, data)
|
||||||
|
|
||||||
local items = data.alt_items or data.items or {}
|
local items = data.alt_items or data.items or {}
|
||||||
@ -1277,6 +1277,8 @@ local function get_items_fs(fs, player, data, full_height)
|
|||||||
local ipp = rows * lines
|
local ipp = rows * lines
|
||||||
local size = 0.85
|
local size = 0.85
|
||||||
|
|
||||||
|
fs("bg9", data.inv_width + 0.1, 0, 7.9, full_height, PNG.bg_full, 10)
|
||||||
|
|
||||||
fs(fmt("box[%f,0.2;4.05,0.6;#bababa25]", data.inv_width + 0.3),
|
fs(fmt("box[%f,0.2;4.05,0.6;#bababa25]", data.inv_width + 0.3),
|
||||||
"set_focus[filter]",
|
"set_focus[filter]",
|
||||||
fmt("field[%f,0.2;2.95,0.6;filter;;%s]", data.inv_width + 0.35, ESC(data.filter)),
|
fmt("field[%f,0.2;2.95,0.6;filter;;%s]", data.inv_width + 0.35, ESC(data.filter)),
|
||||||
@ -1362,43 +1364,23 @@ local function get_favs(fs, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_panels(fs, player, data, full_height)
|
local function get_panels(fs, data, player)
|
||||||
local _title = {name = "title", height = 1.4}
|
local title = {name = "title", height = 1.4, func = get_header}
|
||||||
local _favs = {name = "favs", height = 2.23}
|
local favs = {name = "favs", height = 2.23, func = get_favs}
|
||||||
local _items = {name = "items", height = full_height}
|
local recipes = {name = "recipes", rcp = data.recipes, height = 4.045, func = get_rcp_extra}
|
||||||
local _recipes = {name = "recipes", rcp = data.recipes, height = 4.045}
|
local usages = {name = "usages", rcp = data.usages, height = 4.045, func = get_rcp_extra}
|
||||||
local _usages = {name = "usages", rcp = data.usages, height = 4.045}
|
local panels = {title, recipes, usages, favs}
|
||||||
local panels
|
|
||||||
|
|
||||||
if data.query_item then
|
|
||||||
panels = {_title, _recipes, _usages, _favs}
|
|
||||||
else
|
|
||||||
panels = {_items}
|
|
||||||
end
|
|
||||||
|
|
||||||
for idx = 1, #panels do
|
|
||||||
local panel = panels[idx]
|
|
||||||
data.yoffset = 0
|
data.yoffset = 0
|
||||||
|
|
||||||
if idx > 1 then
|
for i, panel in ipairs(panels) do
|
||||||
for _idx = idx - 1, 1, -1 do
|
if i > 1 then
|
||||||
data.yoffset = data.yoffset + panels[_idx].height + 0.1
|
data.yoffset += panels[i - 1].height + 0.1
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
fs("bg9", data.inv_width + 0.1, data.yoffset, 7.9, panel.height, PNG.bg_full, 10)
|
fs("bg9", data.inv_width + 0.1, data.yoffset, 7.9, panel.height, PNG.bg_full, 10)
|
||||||
|
|
||||||
local is_recipe, is_usage = panel.name == "recipes", panel.name == "usages"
|
local is_recipe, is_usage = panel.name == "recipes", panel.name == "usages"
|
||||||
|
panel.func(fs, data, player, panel, is_recipe, is_usage)
|
||||||
if is_recipe or is_usage then
|
|
||||||
get_rcp_extra(fs, player, data, panel, is_recipe, is_usage)
|
|
||||||
elseif panel.name == "items" then
|
|
||||||
get_items_fs(fs, player, data, full_height)
|
|
||||||
elseif panel.name == "title" then
|
|
||||||
get_header(fs, data)
|
|
||||||
elseif panel.name == "favs" then
|
|
||||||
get_favs(fs, data)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1503,7 +1485,11 @@ local function make_fs(player, data)
|
|||||||
tab.formspec(player, data, fs)
|
tab.formspec(player, data, fs)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_panels(fs, player, data, full_height)
|
if data.query_item then
|
||||||
|
get_panels(fs, data, player)
|
||||||
|
else
|
||||||
|
get_items_fs(fs, data, player, full_height)
|
||||||
|
end
|
||||||
|
|
||||||
if #i3.tabs > 1 then
|
if #i3.tabs > 1 then
|
||||||
get_tabs_fs(fs, player, data, full_height)
|
get_tabs_fs(fs, player, data, full_height)
|
||||||
|
Loading…
Reference in New Issue
Block a user