Cleaning
This commit is contained in:
parent
4ce919d1ef
commit
3e48d288db
244
init.lua
244
init.lua
|
@ -1738,122 +1738,7 @@ local function add_subtitle(fs, title, x, y, ctn_len, font_size)
|
|||
"style_type[label;font=normal;font_size=+0]", fmt("box", x, y + 0.3, ctn_len, 0.05, "#666"))
|
||||
end
|
||||
|
||||
local function get_inventory_mode(player, fs, data, full_height)
|
||||
fs(fmt("bg9", 0, 0, data.xoffset, full_height, PNG.bg_full, 10))
|
||||
|
||||
for i = 0, 7 do
|
||||
fs(fmt("image", i + 0.234 + (i * 0.25), 6.1, 1, 1, "i3_hb_bg.png"))
|
||||
end
|
||||
|
||||
fs("listcolors[#bababa50;#bababa99]",
|
||||
"listring[current_player;main]",
|
||||
"list[current_player;main;0.234,6.1;8,1;]",
|
||||
"list[current_player;main;0.234,7.4;8,3;8]")
|
||||
|
||||
local props = player:get_properties()
|
||||
local name = player:get_player_name()
|
||||
|
||||
if props.mesh ~= "" then
|
||||
local anim = player:get_local_animation()
|
||||
--fs("style[player_model;bgcolor=black]")
|
||||
|
||||
fs(fmt("model", (__3darmor or __skinsdb) and 0.2 or 0, 0.2, 4, 5.5, "player_model",
|
||||
props.mesh, concat(props.textures, ","), "0,-150", "false", "false",
|
||||
sprintf("%u,%u", anim.x, anim.y)))
|
||||
else
|
||||
local size = 2.5
|
||||
fs(fmt("image", 0.7, 0.2, size, size * props.visual_size.y, props.textures[1]))
|
||||
end
|
||||
|
||||
local extras = __3darmor or __skinsdb or __awards
|
||||
|
||||
local ctn_len = 5.6
|
||||
local xoffset = extras and 0 or 4.5
|
||||
local yoffset = extras and 0 or 0.2
|
||||
|
||||
local award_list, award_list_nb
|
||||
local awards_unlocked = 0
|
||||
|
||||
if extras then
|
||||
local max_val = 15
|
||||
|
||||
if __3darmor then
|
||||
max_val = max_val + 15
|
||||
end
|
||||
|
||||
if __skinsdb then
|
||||
max_val = max_val + 20
|
||||
end
|
||||
|
||||
if __awards then
|
||||
award_list = awards.get_award_states(name)
|
||||
award_list_nb = #award_list
|
||||
|
||||
for _, award in ipairs(award_list) do
|
||||
if award.unlocked then
|
||||
awards_unlocked = awards_unlocked + 1
|
||||
end
|
||||
end
|
||||
|
||||
max_val = max_val + (award_list_nb * 13.2)
|
||||
end
|
||||
|
||||
fs(sprintf([[
|
||||
scrollbaroptions[arrows=hide;thumbsize=%u;max=%u]
|
||||
scrollbar[9.69,0.2;0.3,5.5;vertical;scrbar_inv;%u]
|
||||
scrollbaroptions[arrows=default;thumbsize=0;max=1000]
|
||||
]],
|
||||
(max_val * 3) / 15, max_val, data.scrbar_inv or 0))
|
||||
|
||||
fs(sprintf("scroll_container[3.9,0.2;%f,5.5;scrbar_inv;vertical]", ctn_len))
|
||||
end
|
||||
|
||||
add_subtitle(fs, ESC(name), xoffset, yoffset + 0.2, ctn_len, "+6")
|
||||
|
||||
local hp = data.hp or player:get_hp()
|
||||
local half = ceil((hp / 2) % 1)
|
||||
local hearts = (hp / 2) + half
|
||||
|
||||
for i = 1, hearts do
|
||||
fs(fmt("image", xoffset + ((i - 1) * 0.4), yoffset + 0.7, 0.4, 0.4,
|
||||
(half == 1 and i == floor(hearts)) and "i3_heart_half.png" or "i3_heart.png"))
|
||||
end
|
||||
|
||||
fs(sprintf("list[current_player;craft;%f,%f;3,3;]", xoffset, yoffset + 1.45),
|
||||
fmt("image", xoffset + 3.64, yoffset + 2.88, 0.7, 0.7, PNG.arrow),
|
||||
sprintf("list[current_player;craftpreview;%f,%f;1,1;]", xoffset + 4.45, yoffset + 2.7),
|
||||
"listring[detached:i3_trash;main]",
|
||||
sprintf("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.95),
|
||||
fmt("image", xoffset + 4.45, yoffset + 3.95, 1, 1, PNG.trash))
|
||||
|
||||
local yextra = 5.6
|
||||
|
||||
if __3darmor then
|
||||
add_subtitle(fs, ES"Armor", 0, yextra, ctn_len, "+2")
|
||||
|
||||
fs(sprintf("list[detached:%s_armor;armor;0,%f;3,2;]", name, yextra + 0.6))
|
||||
|
||||
fs(fmt("label", 3.75, yextra + 1.55, sprintf("%s: %s", ES"Level", armor.def[name].level)),
|
||||
fmt("label", 3.75, yextra + 1.95, sprintf("%s: %s", ES"Heal", armor.def[name].heal)))
|
||||
end
|
||||
|
||||
if __skinsdb then
|
||||
local _skins = skins.get_skinlist_for_player(name)
|
||||
local t = {}
|
||||
|
||||
for _, skin in ipairs(_skins) do
|
||||
t[#t + 1] = skin.name
|
||||
end
|
||||
|
||||
yextra = __3darmor and (yextra + 3.5) or yextra
|
||||
|
||||
add_subtitle(fs, ES"Skins", 0, yextra, ctn_len, "+2")
|
||||
|
||||
fs(sprintf("dropdown[0,%f;3.55,0.6;skins;%s;%u;true]",
|
||||
yextra + 0.6, concat(t, ","), data.skin_id or 1))
|
||||
end
|
||||
|
||||
if __awards then
|
||||
local function get_award_list(fs, ctn_len, yextra, award_list, awards_unlocked, award_list_nb)
|
||||
if (__3darmor and __skinsdb) or __skinsdb then
|
||||
yextra = yextra + 1.8
|
||||
elseif __3darmor then
|
||||
|
@ -1896,8 +1781,7 @@ local function get_inventory_mode(player, fs, data, full_height)
|
|||
fs(fmt("box", icon_size + 0.1, y + 0.8, box_len, 0.3, "#101010"),
|
||||
fmt("box", icon_size + 0.1, y + 0.8, curr_bar, 0.3, "#9dc34c"),
|
||||
"style_type[label;font=normal;font_size=-2]",
|
||||
fmt("label", icon_size + 0.5, y + 0.97,
|
||||
sprintf("%u / %u", current, target)))
|
||||
fmt("label", icon_size + 0.5, y + 0.97, sprintf("%u / %u", current, target)))
|
||||
|
||||
y = y - 0.14
|
||||
end
|
||||
|
@ -1908,8 +1792,132 @@ local function get_inventory_mode(player, fs, data, full_height)
|
|||
fmt("label", icon_size + 0.2, y + 0.75, clr("#bbbbbb", desc)),
|
||||
"style_type[label;font=normal;font_size=+0]")
|
||||
end
|
||||
end
|
||||
|
||||
local function get_ctn_content(fs, data, player, xoffset, yoffset, ctn_len, yextra,
|
||||
award_list, awards_unlocked, award_list_nb)
|
||||
local name = player:get_player_name()
|
||||
add_subtitle(fs, ESC(name), xoffset, yoffset + 0.2, ctn_len, "+6")
|
||||
|
||||
local hp = data.hp or player:get_hp()
|
||||
local half = ceil((hp / 2) % 1)
|
||||
local hearts = (hp / 2) + half
|
||||
|
||||
for i = 1, hearts do
|
||||
fs(fmt("image", xoffset + ((i - 1) * 0.4), yoffset + 0.7, 0.4, 0.4,
|
||||
(half == 1 and i == floor(hearts)) and "i3_heart_half.png" or "i3_heart.png"))
|
||||
end
|
||||
|
||||
fs(sprintf("list[current_player;craft;%f,%f;3,3;]", xoffset, yoffset + 1.45),
|
||||
fmt("image", xoffset + 3.64, yoffset + 2.88, 0.7, 0.7, PNG.arrow),
|
||||
sprintf("list[current_player;craftpreview;%f,%f;1,1;]", xoffset + 4.45, yoffset + 2.7),
|
||||
"listring[detached:i3_trash;main]",
|
||||
sprintf("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.95),
|
||||
fmt("image", xoffset + 4.45, yoffset + 3.95, 1, 1, PNG.trash))
|
||||
|
||||
if __3darmor then
|
||||
add_subtitle(fs, ES"Armor", 0, yextra, ctn_len, "+2")
|
||||
|
||||
fs(sprintf("list[detached:%s_armor;armor;0,%f;3,2;]", name, yextra + 0.6))
|
||||
|
||||
fs(fmt("label", 3.75, yextra + 1.55, sprintf("%s: %s", ES"Level", armor.def[name].level)),
|
||||
fmt("label", 3.75, yextra + 1.95, sprintf("%s: %s", ES"Heal", armor.def[name].heal)))
|
||||
end
|
||||
|
||||
if __skinsdb then
|
||||
local _skins = skins.get_skinlist_for_player(name)
|
||||
local t = {}
|
||||
|
||||
for _, skin in ipairs(_skins) do
|
||||
t[#t + 1] = skin.name
|
||||
end
|
||||
|
||||
yextra = __3darmor and (yextra + 3.5) or yextra
|
||||
|
||||
add_subtitle(fs, ES"Skins", 0, yextra, ctn_len, "+2")
|
||||
|
||||
fs(sprintf("dropdown[0,%f;3.55,0.6;skins;%s;%u;true]",
|
||||
yextra + 0.6, concat(t, ","), data.skin_id or 1))
|
||||
end
|
||||
|
||||
if __awards then
|
||||
get_award_list(fs, ctn_len, yextra, award_list, awards_unlocked, award_list_nb)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_inventory_mode(player, fs, data, full_height)
|
||||
fs(fmt("bg9", 0, 0, data.xoffset, full_height, PNG.bg_full, 10))
|
||||
|
||||
for i = 0, 7 do
|
||||
fs(fmt("image", i + 0.234 + (i * 0.25), 6.1, 1, 1, "i3_hb_bg.png"))
|
||||
end
|
||||
|
||||
fs("listcolors[#bababa50;#bababa99]",
|
||||
"listring[current_player;main]",
|
||||
"list[current_player;main;0.234,6.1;8,1;]",
|
||||
"list[current_player;main;0.234,7.4;8,3;8]")
|
||||
|
||||
local props = player:get_properties()
|
||||
local name = player:get_player_name()
|
||||
|
||||
if props.mesh ~= "" then
|
||||
local anim = player:get_local_animation()
|
||||
--fs("style[player_model;bgcolor=black]")
|
||||
|
||||
fs(fmt("model", (__3darmor or __skinsdb) and 0.2 or 0, 0.2, 4, 5.5, "player_model",
|
||||
props.mesh, concat(props.textures, ","), "0,-150", "false", "false",
|
||||
sprintf("%u,%u", anim.x, anim.y)))
|
||||
else
|
||||
local size = 2.5
|
||||
fs(fmt("image", 0.7, 0.2, size, size * props.visual_size.y, props.textures[1]))
|
||||
end
|
||||
|
||||
local extras = __3darmor or __skinsdb or __awards
|
||||
|
||||
local ctn_len, yextra = 5.6, 5.6
|
||||
local xoffset = extras and 0 or 4.5
|
||||
local yoffset = extras and 0 or 0.2
|
||||
|
||||
local award_list, award_list_nb
|
||||
local awards_unlocked = 0
|
||||
|
||||
if extras then
|
||||
local max_val = 15
|
||||
|
||||
if __3darmor then
|
||||
max_val = max_val + 15
|
||||
end
|
||||
|
||||
if __skinsdb then
|
||||
max_val = max_val + 20
|
||||
end
|
||||
|
||||
if __awards then
|
||||
award_list = awards.get_award_states(name)
|
||||
award_list_nb = #award_list
|
||||
|
||||
for _, award in ipairs(award_list) do
|
||||
if award.unlocked then
|
||||
awards_unlocked = awards_unlocked + 1
|
||||
end
|
||||
end
|
||||
|
||||
max_val = max_val + (award_list_nb * 13.2)
|
||||
end
|
||||
|
||||
fs(sprintf([[
|
||||
scrollbaroptions[arrows=hide;thumbsize=%u;max=%u]
|
||||
scrollbar[9.69,0.2;0.3,5.5;vertical;scrbar_inv;%u]
|
||||
scrollbaroptions[arrows=default;thumbsize=0;max=1000]
|
||||
]],
|
||||
(max_val * 3) / 15, max_val, data.scrbar_inv or 0))
|
||||
|
||||
fs(sprintf("scroll_container[3.9,0.2;%f,5.5;scrbar_inv;vertical]", ctn_len))
|
||||
end
|
||||
|
||||
get_ctn_content(fs, data, player, xoffset, yoffset, ctn_len, yextra,
|
||||
award_list, awards_unlocked, award_list_nb)
|
||||
|
||||
if extras then
|
||||
fs("scroll_container_end[]")
|
||||
end
|
||||
|
|
Ŝarĝante…
Reference in New Issue