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 data = i3.data[name]
|
||||
|
||||
return data.current_tab
|
||||
return data.tab
|
||||
end
|
||||
|
||||
function i3.set_tab(player, tabname)
|
||||
|
@ -213,7 +213,7 @@ function i3.set_tab(player, tabname)
|
|||
local data = i3.data[name]
|
||||
|
||||
if not tabname or tabname == "" then
|
||||
data.current_tab = 0
|
||||
data.tab = 0
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -221,7 +221,7 @@ function i3.set_tab(player, tabname)
|
|||
|
||||
for i, def in ipairs(i3.tabs) do
|
||||
if not found and def.name == tabname then
|
||||
data.current_tab = i
|
||||
data.tab = i
|
||||
found = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -328,9 +328,9 @@ local function sort_by_category(data)
|
|||
local item = items[i]
|
||||
local to_add = true
|
||||
|
||||
if data.current_itab == 2 then
|
||||
if data.itab == 2 then
|
||||
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]
|
||||
end
|
||||
|
||||
|
|
|
@ -1163,7 +1163,7 @@ local function get_items_fs(fs, data, full_height)
|
|||
local tab_len, tab_hgh = 1.8, 0.5
|
||||
|
||||
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;
|
||||
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
|
||||
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;
|
||||
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
|
||||
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]",
|
||||
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.items = data.items_raw
|
||||
|
||||
if data.current_itab > 1 then
|
||||
if data.itab > 1 then
|
||||
sort_by_category(data)
|
||||
end
|
||||
end
|
||||
|
@ -413,7 +413,7 @@ local function rcp_fields(player, data, fields)
|
|||
|
||||
search(data)
|
||||
|
||||
if data.current_itab > 1 then
|
||||
if data.itab > 1 then
|
||||
sort_by_category(data)
|
||||
end
|
||||
|
||||
|
@ -502,14 +502,14 @@ core.register_on_player_receive_fields(function(player, formname, fields)
|
|||
break
|
||||
elseif sub(f, 1, 5) == "itab_" then
|
||||
data.pagenum = 1
|
||||
data.current_itab = tonumber(f:sub(-1))
|
||||
data.itab = tonumber(f:sub(-1))
|
||||
sort_by_category(data)
|
||||
end
|
||||
end
|
||||
|
||||
rcp_fields(player, data, fields)
|
||||
|
||||
local tab = i3.tabs[data.current_tab]
|
||||
local tab = i3.tabs[data.tab]
|
||||
|
||||
if tab and tab.fields then
|
||||
return true, tab.fields(player, data, fields)
|
||||
|
|
|
@ -222,7 +222,7 @@ local function poll_new_items()
|
|||
end
|
||||
|
||||
data.items_raw = items
|
||||
data.current_itab = 1
|
||||
data.itab = 1
|
||||
|
||||
search(data)
|
||||
i3.set_fs(player)
|
||||
|
|
Ŝarĝante…
Reference in New Issue