Rename some variables
This commit is contained in:
parent
1728f4beac
commit
4fcf4f5790
|
@ -205,7 +205,7 @@ function i3.get_current_tab(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local data = i3.data[name]
|
local data = i3.data[name]
|
||||||
|
|
||||||
return data.current_tab
|
return data.tab
|
||||||
end
|
end
|
||||||
|
|
||||||
function i3.set_tab(player, tabname)
|
function i3.set_tab(player, tabname)
|
||||||
|
@ -213,7 +213,7 @@ function i3.set_tab(player, tabname)
|
||||||
local data = i3.data[name]
|
local data = i3.data[name]
|
||||||
|
|
||||||
if not tabname or tabname == "" then
|
if not tabname or tabname == "" then
|
||||||
data.current_tab = 0
|
data.tab = 0
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ function i3.set_tab(player, tabname)
|
||||||
|
|
||||||
for i, def in ipairs(i3.tabs) do
|
for i, def in ipairs(i3.tabs) do
|
||||||
if not found and def.name == tabname then
|
if not found and def.name == tabname then
|
||||||
data.current_tab = i
|
data.tab = i
|
||||||
found = true
|
found = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -328,9 +328,9 @@ local function sort_by_category(data)
|
||||||
local item = items[i]
|
local item = items[i]
|
||||||
local to_add = true
|
local to_add = true
|
||||||
|
|
||||||
if data.current_itab == 2 then
|
if data.itab == 2 then
|
||||||
to_add = reg_nodes[item]
|
to_add = reg_nodes[item]
|
||||||
elseif data.current_itab == 3 then
|
elseif data.itab == 3 then
|
||||||
to_add = reg_craftitems[item] or reg_tools[item]
|
to_add = reg_craftitems[item] or reg_tools[item]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1163,7 +1163,7 @@ local function get_items_fs(fs, data, full_height)
|
||||||
local tab_len, tab_hgh = 1.8, 0.5
|
local tab_len, tab_hgh = 1.8, 0.5
|
||||||
|
|
||||||
for i, title in ipairs(_tabs) do
|
for i, title in ipairs(_tabs) do
|
||||||
local selected = i == data.current_itab
|
local selected = i == data.itab
|
||||||
|
|
||||||
fs(fmt([[style_type[image_button;fgimg=%s;fgimg_hovered=%s;noclip=true;
|
fs(fmt([[style_type[image_button;fgimg=%s;fgimg_hovered=%s;noclip=true;
|
||||||
font_size=16;textcolor=%s;content_offset=0;sound=i3_tab] ]],
|
font_size=16;textcolor=%s;content_offset=0;sound=i3_tab] ]],
|
||||||
|
@ -1256,7 +1256,7 @@ local function get_tabs_fs(player, data, fs, full_height)
|
||||||
shift = #_tabs - 3
|
shift = #_tabs - 3
|
||||||
end
|
end
|
||||||
|
|
||||||
local selected = i == data.current_tab
|
local selected = i == data.tab
|
||||||
|
|
||||||
fs(fmt([[style_type[image_button;fgimg=%s;fgimg_hovered=%s;noclip=true;
|
fs(fmt([[style_type[image_button;fgimg=%s;fgimg_hovered=%s;noclip=true;
|
||||||
font_size=16;textcolor=%s;content_offset=0;sound=i3_tab] ]],
|
font_size=16;textcolor=%s;content_offset=0;sound=i3_tab] ]],
|
||||||
|
@ -1323,7 +1323,7 @@ local function make_fs(player, data)
|
||||||
data.inv_width = 10.23
|
data.inv_width = 10.23
|
||||||
local full_height = 12
|
local full_height = 12
|
||||||
|
|
||||||
local tab = i3.tabs[data.current_tab]
|
local tab = i3.tabs[data.tab]
|
||||||
|
|
||||||
fs(fmt("formspec_version[%u]size[%f,%f]no_prepend[]bgcolor[#0000]",
|
fs(fmt("formspec_version[%u]size[%f,%f]no_prepend[]bgcolor[#0000]",
|
||||||
i3.MIN_FORMSPEC_VERSION, data.inv_width + 8, full_height), styles)
|
i3.MIN_FORMSPEC_VERSION, data.inv_width + 8, full_height), styles)
|
||||||
|
|
|
@ -44,7 +44,7 @@ local function reset_data(data)
|
||||||
data.show_setting = "home"
|
data.show_setting = "home"
|
||||||
data.items = data.items_raw
|
data.items = data.items_raw
|
||||||
|
|
||||||
if data.current_itab > 1 then
|
if data.itab > 1 then
|
||||||
sort_by_category(data)
|
sort_by_category(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -413,7 +413,7 @@ local function rcp_fields(player, data, fields)
|
||||||
|
|
||||||
search(data)
|
search(data)
|
||||||
|
|
||||||
if data.current_itab > 1 then
|
if data.itab > 1 then
|
||||||
sort_by_category(data)
|
sort_by_category(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -502,14 +502,14 @@ core.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
break
|
break
|
||||||
elseif sub(f, 1, 5) == "itab_" then
|
elseif sub(f, 1, 5) == "itab_" then
|
||||||
data.pagenum = 1
|
data.pagenum = 1
|
||||||
data.current_itab = tonumber(f:sub(-1))
|
data.itab = tonumber(f:sub(-1))
|
||||||
sort_by_category(data)
|
sort_by_category(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
rcp_fields(player, data, fields)
|
rcp_fields(player, data, fields)
|
||||||
|
|
||||||
local tab = i3.tabs[data.current_tab]
|
local tab = i3.tabs[data.tab]
|
||||||
|
|
||||||
if tab and tab.fields then
|
if tab and tab.fields then
|
||||||
return true, tab.fields(player, data, fields)
|
return true, tab.fields(player, data, fields)
|
||||||
|
|
|
@ -222,7 +222,7 @@ local function poll_new_items()
|
||||||
end
|
end
|
||||||
|
|
||||||
data.items_raw = items
|
data.items_raw = items
|
||||||
data.current_itab = 1
|
data.itab = 1
|
||||||
|
|
||||||
search(data)
|
search(data)
|
||||||
i3.set_fs(player)
|
i3.set_fs(player)
|
||||||
|
|
4
init.lua
4
init.lua
|
@ -156,8 +156,8 @@ local function init_data(player, info)
|
||||||
data.reverse_sorting = false
|
data.reverse_sorting = false
|
||||||
data.inv_compress = true
|
data.inv_compress = true
|
||||||
data.export_counts = {}
|
data.export_counts = {}
|
||||||
data.current_tab = 1
|
data.tab = 1
|
||||||
data.current_itab = 1
|
data.itab = 1
|
||||||
data.subcat = 1
|
data.subcat = 1
|
||||||
data.scrbar_inv = 0
|
data.scrbar_inv = 0
|
||||||
data.lang_code = get_lang_code(info)
|
data.lang_code = get_lang_code(info)
|
||||||
|
|
Ŝarĝante…
Reference in New Issue