mirror of
https://github.com/minetest-mods/i3.git
synced 2025-07-03 00:50:22 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
1560d59d4a | |||
e4e175a775 | |||
7a40f36611 | |||
2467e8bb0b | |||
9666834aed | |||
7670356c8c | |||
646d16afd8 |
2
init.lua
2
init.lua
@ -20,7 +20,7 @@ local function lf(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
i3 = {
|
i3 = {
|
||||||
version = 1110,
|
version = 1113,
|
||||||
data = core.deserialize(storage:get_string"data") or {},
|
data = core.deserialize(storage:get_string"data") or {},
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -10,6 +10,9 @@ local trash = create_inventory("i3_trash", {
|
|||||||
inv:set_list(listname, {})
|
inv:set_list(listname, {})
|
||||||
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
local data = i3.data[name]
|
||||||
|
data.armor_allow = nil
|
||||||
|
|
||||||
play_sound(name, "i3_trash", 1.0)
|
play_sound(name, "i3_trash", 1.0)
|
||||||
|
|
||||||
if not core.is_creative_enabled(name) then
|
if not core.is_creative_enabled(name) then
|
||||||
|
14
src/gui.lua
14
src/gui.lua
@ -131,7 +131,7 @@ local function get_inv_slots(data, fs)
|
|||||||
local legacy_inventory = data.legacy_inventory
|
local legacy_inventory = data.legacy_inventory
|
||||||
local hotbar_len = data.hotbar_len
|
local hotbar_len = data.hotbar_len
|
||||||
local inv_x = legacy_inventory and 0.23 or 0.22
|
local inv_x = legacy_inventory and 0.23 or 0.22
|
||||||
local inv_y = legacy_inventory and 6.5 or 6.9
|
local inv_y = legacy_inventory and 6.7 or 6.9
|
||||||
local spacing = legacy_inventory and 0.25 or 0.1
|
local spacing = legacy_inventory and 0.25 or 0.1
|
||||||
local size = 1
|
local size = 1
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ local function get_inv_slots(data, fs)
|
|||||||
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing),
|
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing),
|
||||||
fmt("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_y, hotbar_len))
|
fmt("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_y, hotbar_len))
|
||||||
|
|
||||||
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing))
|
fs(fmt("style_type[list;size=%f;spacing=%f,%f]", size, spacing, legacy_inventory and 0.15 or spacing))
|
||||||
|
|
||||||
fs(fmt("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y + (legacy_inventory and 1.25 or 1.15),
|
fs(fmt("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y + (legacy_inventory and 1.25 or 1.15),
|
||||||
hotbar_len, data.inv_size / hotbar_len, hotbar_len))
|
hotbar_len, data.inv_size / hotbar_len, hotbar_len))
|
||||||
@ -649,7 +649,7 @@ local function show_settings(fs, data)
|
|||||||
checkbox(2.6, 9.95, "cb_inv_compress", "Compression", tostring(data.inv_compress))
|
checkbox(2.6, 9.95, "cb_inv_compress", "Compression", tostring(data.inv_compress))
|
||||||
checkbox(2.6, 10.4, "cb_reverse_sorting", "Reverse mode", tostring(data.reverse_sorting))
|
checkbox(2.6, 10.4, "cb_reverse_sorting", "Reverse mode", tostring(data.reverse_sorting))
|
||||||
checkbox(2.6, 10.85, "cb_ignore_hotbar", "Ignore hotbar", tostring(data.ignore_hotbar))
|
checkbox(2.6, 10.85, "cb_ignore_hotbar", "Ignore hotbar", tostring(data.ignore_hotbar))
|
||||||
checkbox(5.5, 9.95, "cb_auto_sorting", "Automation", tostring(data.auto_sorting))
|
checkbox(5.4, 9.95, "cb_auto_sorting", "Automation", tostring(data.auto_sorting))
|
||||||
|
|
||||||
local methods = {}
|
local methods = {}
|
||||||
|
|
||||||
@ -658,13 +658,13 @@ local function show_settings(fs, data)
|
|||||||
insert(methods, name)
|
insert(methods, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
label(5.5, 10.4, ES"Sorting method:")
|
label(5.4, 10.4, ES"Sorting method:")
|
||||||
fs(fmt("dropdown[%f,%f;2.3,0.5;dd_sorting_method;%s;%u;true]",
|
fs(fmt("dropdown[%f,%f;2.4,0.5;dd_sorting_method;%s;%u;true]",
|
||||||
5.5, 10.6, concat(methods, ","), data.sort))
|
5.4, 10.6, concat(methods, ","), data.sort))
|
||||||
|
|
||||||
local desc = i3.sorting_methods[data.sort].description
|
local desc = i3.sorting_methods[data.sort].description
|
||||||
if desc then
|
if desc then
|
||||||
tooltip(5.5, 10.6, 2.3, 0.5, ESC(desc))
|
tooltip(5.4, 10.6, 2.4, 0.5, ESC(desc))
|
||||||
end
|
end
|
||||||
|
|
||||||
fs(fmt("tooltip[cb_inv_compress;%s;#707070;#fff]",
|
fs(fmt("tooltip[cb_inv_compress;%s;#707070;#fff]",
|
||||||
|
12
src/hud.lua
12
src/hud.lua
@ -116,25 +116,27 @@ core.register_globalstep(function(dt)
|
|||||||
|
|
||||||
data.timer = (data.timer or 0) + dt
|
data.timer = (data.timer or 0) + dt
|
||||||
|
|
||||||
local wielditem = player:get_wielded_item()
|
local wieldidx = player:get_wield_index()
|
||||||
local wieldname = wielditem:get_name()
|
|
||||||
|
|
||||||
if wieldname == data.old_wielditem then
|
if wieldidx == data.old_wieldidx then
|
||||||
if data.timer >= i3.settings.wielditem_fade_after then
|
if data.timer >= i3.settings.wielditem_fade_after then
|
||||||
return reset()
|
return reset()
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
data.timer = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
data.old_wielditem = wieldname
|
data.old_wieldidx = wieldidx
|
||||||
|
|
||||||
|
local wielditem = player:get_wielded_item()
|
||||||
local meta = wielditem:get_meta()
|
local meta = wielditem:get_meta()
|
||||||
|
|
||||||
local meta_desc = meta:get_string"short_description"
|
local meta_desc = meta:get_string"short_description"
|
||||||
meta_desc = meta_desc:gsub("\27", "")
|
meta_desc = meta_desc:gsub("\27", "")
|
||||||
meta_desc = core.strip_colors(meta_desc)
|
meta_desc = core.strip_colors(meta_desc)
|
||||||
|
|
||||||
local desc = meta_desc ~= "" and meta_desc or wielditem:get_short_description()
|
local desc = meta_desc ~= "" and meta_desc or wielditem:get_short_description()
|
||||||
|
|
||||||
player:hud_change(data.hud.wielditem, "text", desc:trim())
|
player:hud_change(data.hud.wielditem, "text", desc:trim())
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user