Moves the username + hearts into the crafting-tab
This gives the tabs more vertical breathing-room.
This commit is contained in:
parent
b8b4c832fe
commit
58218fb30e
66
src/gui.lua
66
src/gui.lua
|
@ -361,13 +361,38 @@ local function get_waypoint_fs(fs, data, player, yextra, ctn_len)
|
|||
fs"style_type[label;font=normal;font_size=16;textcolor=#fff]"
|
||||
end
|
||||
|
||||
-- Writes the formspec for the crafting-table and item-removal trash icon.
|
||||
local function get_crafting_fs(fs, yoffset)
|
||||
fs("list[current_player;craft;%f,%f;3,3;]", 0, yoffset + .7)
|
||||
image(3.47, yoffset + 2.0, 0.85, 0.85, PNG.arrow)
|
||||
fs("list[current_player;craftpreview;%f,%f;1,1;]", 4.45, yoffset + 1.85) --2.6)
|
||||
fs("list[detached:i3_trash;main;%f,%f;1,1;]", 4.45, yoffset + 3.0) -- 3.75)
|
||||
image(4.45, yoffset + 3.0, 1, 1, PNG.trash) -- 3.75, 1,1
|
||||
-- Writes the formspec for the crafting-table and username + hearts
|
||||
local function get_crafting_tab_fs(fs, data, player, esc_name, yextra, ctn_len)
|
||||
yextra += .6
|
||||
add_subtitle(fs, "player_name", yextra, ctn_len, 22, true, esc_name)
|
||||
|
||||
if damage_enabled then
|
||||
local hp = data.hp or player:get_hp() or 20
|
||||
local half = ceil((hp / 2) % 1)
|
||||
local hearts = (hp / 2) + half
|
||||
local heart_size = 0.35
|
||||
local heart_x, heart_h = 0.65, yextra + .75
|
||||
|
||||
for i = 1, 10 do
|
||||
image(heart_x + ((i - 1) * (heart_size + 0.1)), heart_h,
|
||||
heart_size, heart_size, PNG.heart .. "^[colorize:#232428")
|
||||
end
|
||||
|
||||
for i = 1, hearts do
|
||||
image(heart_x + ((i - 1) * (heart_size + 0.1)), heart_h,
|
||||
heart_size, heart_size,
|
||||
(half == 1 and i == floor(hearts)) and PNG.heart_half or PNG.heart)
|
||||
end
|
||||
yextra += .3
|
||||
end
|
||||
|
||||
yextra += .5
|
||||
|
||||
fs("list[current_player;craft;%f,%f;3,3;]", 0, yextra + .7)
|
||||
image(3.47, yextra + 2.0, 0.85, 0.85, PNG.arrow)
|
||||
fs("list[current_player;craftpreview;%f,%f;1,1;]", 4.45, yextra + 1.85) --2.6)
|
||||
fs("list[detached:i3_trash;main;%f,%f;1,1;]", 4.45, yextra + 3.0) -- 3.75)
|
||||
image(4.45, yextra + 3.0, 1, 1, PNG.trash) -- 3.75, 1,1
|
||||
end
|
||||
|
||||
-- Writes the formspec for the backpack slot + representation.
|
||||
|
@ -499,30 +524,7 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
|||
local name = true_str(nametag.text) and nametag.text or data.player_name
|
||||
local esc_name = ESC(name)
|
||||
|
||||
add_subtitle(fs, "player_name", 0, ctn_len, 22, true, esc_name)
|
||||
|
||||
if damage_enabled then
|
||||
local hp = data.hp or player:get_hp() or 20
|
||||
local half = ceil((hp / 2) % 1)
|
||||
local hearts = (hp / 2) + half
|
||||
local heart_size = 0.35
|
||||
local heart_x, heart_h = 0.65, yoffset + 0.75
|
||||
|
||||
for i = 1, 10 do
|
||||
image(heart_x + ((i - 1) * (heart_size + 0.1)), heart_h,
|
||||
heart_size, heart_size, PNG.heart .. "^[colorize:#232428")
|
||||
end
|
||||
|
||||
for i = 1, hearts do
|
||||
image(heart_x + ((i - 1) * (heart_size + 0.1)), heart_h,
|
||||
heart_size, heart_size,
|
||||
(half == 1 and i == floor(hearts)) and PNG.heart_half or PNG.heart)
|
||||
end
|
||||
else
|
||||
yoffset -= 0.5
|
||||
end
|
||||
|
||||
local yextra = 1.5 -- damage_enabled and 5.5 or 5
|
||||
local yextra = .2
|
||||
|
||||
for i, title in ipairs(i3.categories) do
|
||||
local btn_name = fmt("btn_%s", title)
|
||||
|
@ -543,7 +545,7 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
|||
end
|
||||
|
||||
if data.subcat == 1 then
|
||||
get_crafting_fs(fs, yextra)
|
||||
get_crafting_tab_fs(fs, data, player, esc_name, yextra, ctn_len)
|
||||
|
||||
elseif data.subcat == 2 then
|
||||
if not i3.modules.armor then
|
||||
|
|
Ŝarĝante…
Reference in New Issue