mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-27 11:20:40 +01:00
Some polish to previous commit
This commit is contained in:
parent
2e7dcd714d
commit
849fadb674
5
init.lua
5
init.lua
@ -72,8 +72,7 @@ i3.files.groups()
|
|||||||
i3.files.callbacks()
|
i3.files.callbacks()
|
||||||
|
|
||||||
local storage = core.get_mod_storage()
|
local storage = core.get_mod_storage()
|
||||||
local slz, dslz, ESC, str_to_pos, add_hud_waypoint =
|
local slz, dslz, str_to_pos, add_hud_waypoint = i3.get("slz", "dslz", "str_to_pos", "add_hud_waypoint")
|
||||||
i3.get("slz", "dslz", "ESC", "str_to_pos", "add_hud_waypoint")
|
|
||||||
|
|
||||||
i3.data = dslz(storage:get_string "data") or {}
|
i3.data = dslz(storage:get_string "data") or {}
|
||||||
|
|
||||||
@ -142,7 +141,7 @@ local function init_data(player, info)
|
|||||||
i3.data[name] = i3.data[name] or {}
|
i3.data[name] = i3.data[name] or {}
|
||||||
local data = i3.data[name]
|
local data = i3.data[name]
|
||||||
|
|
||||||
data.player_name = ESC(name)
|
data.player_name = name
|
||||||
data.filter = ""
|
data.filter = ""
|
||||||
data.pagenum = 1
|
data.pagenum = 1
|
||||||
data.items = i3.init_items
|
data.items = i3.init_items
|
||||||
|
13
src/bags.lua
13
src/bags.lua
@ -1,5 +1,5 @@
|
|||||||
local S, ES, fmt, clr, msg, slz, dslz, play_sound, create_inventory =
|
local S, ES, fmt, clr, msg, slz, dslz = i3.get("S", "ES", "fmt", "clr", "msg", "slz", "dslz")
|
||||||
i3.get("S", "ES", "fmt", "clr", "msg", "slz", "dslz", "play_sound", "create_inventory")
|
local play_sound, create_inventory = i3.get("play_sound", "create_inventory")
|
||||||
|
|
||||||
local function get_content_inv(name)
|
local function get_content_inv(name)
|
||||||
return core.get_inventory {
|
return core.get_inventory {
|
||||||
@ -13,15 +13,14 @@ local function get_content(content)
|
|||||||
|
|
||||||
for i, v in pairs(content) do
|
for i, v in pairs(content) do
|
||||||
local stack = ItemStack(v.name)
|
local stack = ItemStack(v.name)
|
||||||
local meta, wear = v.meta, v.wear
|
|
||||||
|
|
||||||
if meta then
|
if v.meta then
|
||||||
local m = stack:get_meta()
|
local m = stack:get_meta()
|
||||||
m:from_table(meta)
|
m:from_table(v.meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
if wear then
|
if v.wear then
|
||||||
stack:set_wear(wear)
|
stack:set_wear(v.wear)
|
||||||
end
|
end
|
||||||
|
|
||||||
t[i] = stack
|
t[i] = stack
|
||||||
|
39
src/gui.lua
39
src/gui.lua
@ -288,7 +288,9 @@ end
|
|||||||
|
|
||||||
local function get_container(fs, data, player, yoffset, ctn_len, award_list, awards_unlocked, award_list_nb)
|
local function get_container(fs, data, player, yoffset, ctn_len, award_list, awards_unlocked, award_list_nb)
|
||||||
local name = data.player_name
|
local name = data.player_name
|
||||||
add_subtitle(fs, "player_name", 0, ctn_len, 22, true, name)
|
local esc_name = ESC(name)
|
||||||
|
|
||||||
|
add_subtitle(fs, "player_name", 0, ctn_len, 22, true, esc_name)
|
||||||
|
|
||||||
if damage_enabled then
|
if damage_enabled then
|
||||||
local hp = data.hp or player:get_hp() or 20
|
local hp = data.hp or player:get_hp() or 20
|
||||||
@ -340,17 +342,25 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
|||||||
end
|
end
|
||||||
|
|
||||||
if data.subcat == 1 then
|
if data.subcat == 1 then
|
||||||
fs(fmt("list[detached:i3_bag_%s;main;0,%f;1,1;]", name, yextra + 0.7))
|
fs(fmt("list[detached:i3_bag_%s;main;0,%f;1,1;]", esc_name, yextra + 0.7))
|
||||||
|
|
||||||
local inv = core.get_inventory {
|
local inv = core.get_inventory{type = "detached", name = fmt("i3_bag_%s", name)}
|
||||||
type = "detached",
|
|
||||||
name = fmt("i3_bag_%s", data.player_name)
|
|
||||||
}
|
|
||||||
|
|
||||||
if not inv:is_empty"main" then
|
if not inv:is_empty"main" then
|
||||||
|
local h, m, yy = 4.75, 10, 0
|
||||||
|
|
||||||
|
if data.bag_size == 1 then
|
||||||
|
h, m, yy = 1.9, 2, 0.12
|
||||||
|
elseif data.bag_size == 2 then
|
||||||
|
h, m, yy = 3.05, 5, 0.06
|
||||||
|
elseif data.bag_size == 3 then
|
||||||
|
h, m = 4.2, 10
|
||||||
|
end
|
||||||
|
|
||||||
fs("image", 0.5, yextra + 1.85, 0.6, 0.6, PNG.arrow_content)
|
fs("image", 0.5, yextra + 1.85, 0.6, 0.6, PNG.arrow_content)
|
||||||
fs(fmt("style[content;bgimg=%s;fgimg=i3_blank.png;bgimg_middle=10,10;sound=]", PNG.bg_content))
|
fs(fmt("style[content;bgimg=%s;fgimg=i3_blank.png;bgimg_middle=10,%u;sound=]",
|
||||||
fs("image_button", 1.1, yextra + 0.5, 4.75, 4.75, "", "content", "")
|
PNG.bg_content, m))
|
||||||
|
fs("image_button", 1.1, yextra + 0.5 + yy, 4.75, h, "", "content", "")
|
||||||
fs("hypertext", 1.3, yextra + 0.8, 4.3, 0.6, "content",
|
fs("hypertext", 1.3, yextra + 0.8, 4.3, 0.6, "content",
|
||||||
fmt("<global size=16><center><b>%s</b></center>", ES"Content"))
|
fmt("<global size=16><center><b>%s</b></center>", ES"Content"))
|
||||||
|
|
||||||
@ -361,13 +371,14 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
|||||||
end
|
end
|
||||||
|
|
||||||
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing))
|
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing))
|
||||||
fs(fmt("list[detached:i3_bag_content_%s;main;%f,%f;4,%u;]", name, x, yextra + 1.3, data.bag_size))
|
fs(fmt("list[detached:i3_bag_content_%s;main;%f,%f;4,%u;]",
|
||||||
|
esc_name, x, yextra + 1.3, data.bag_size))
|
||||||
fs("style_type[list;size=1;spacing=0.15]")
|
fs("style_type[list;size=1;spacing=0.15]")
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif data.subcat == 2 then
|
elseif data.subcat == 2 then
|
||||||
if i3.modules.armor then
|
if i3.modules.armor then
|
||||||
fs(fmt("list[detached:%s_armor;armor;0,%f;3,2;]", name, yextra + 0.7))
|
fs(fmt("list[detached:%s_armor;armor;0,%f;3,2;]", esc_name, yextra + 0.7))
|
||||||
|
|
||||||
local armor_def = armor.def[name]
|
local armor_def = armor.def[name]
|
||||||
|
|
||||||
@ -538,7 +549,15 @@ local function get_inventory_fs(player, data, fs)
|
|||||||
local max_val = damage_enabled and 12 or 7
|
local max_val = damage_enabled and 12 or 7
|
||||||
|
|
||||||
if data.subcat == 1 and data.bag_size then
|
if data.subcat == 1 and data.bag_size then
|
||||||
|
if data.bag_size == 1 then
|
||||||
|
max_val = max_val + 6
|
||||||
|
elseif data.bag_size == 2 then
|
||||||
|
max_val = max_val + 16
|
||||||
|
elseif data.bag_size == 3 then
|
||||||
|
max_val = max_val + 26
|
||||||
|
else
|
||||||
max_val = max_val + 32
|
max_val = max_val + 32
|
||||||
|
end
|
||||||
|
|
||||||
elseif i3.modules.armor and data.subcat == 2 then
|
elseif i3.modules.armor and data.subcat == 2 then
|
||||||
if data.scrbar_inv >= max_val then
|
if data.scrbar_inv >= max_val then
|
||||||
|
Loading…
Reference in New Issue
Block a user