Tweak sorting
This commit is contained in:
parent
44610b879e
commit
6dc12390db
|
@ -514,14 +514,17 @@ local function compress_items(list, start_i)
|
||||||
return new_inv
|
return new_inv
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drop_items(player, inv, list, start_i, rej)
|
local function drop_items(player, inv, list, start_i, rej, remove)
|
||||||
for i = start_i, #list do
|
for i = start_i, #list do
|
||||||
local stack = list[i]
|
local stack = list[i]
|
||||||
local name = stack:get_name()
|
local name = stack:get_name()
|
||||||
|
|
||||||
for _, it in ipairs(rej) do
|
for _, it in ipairs(rej) do
|
||||||
if name == it then
|
if name == it then
|
||||||
spawn_item(player, stack)
|
if not remove then
|
||||||
|
spawn_item(player, stack)
|
||||||
|
end
|
||||||
|
|
||||||
inv:set_stack("main", i, ItemStack(""))
|
inv:set_stack("main", i, ItemStack(""))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -537,7 +540,7 @@ local function sort_inventory(player, data)
|
||||||
local start_i = data.ignore_hotbar and (i3.settings.hotbar_len + 1) or 1
|
local start_i = data.ignore_hotbar and (i3.settings.hotbar_len + 1) or 1
|
||||||
|
|
||||||
if true_table(data.drop_items) then
|
if true_table(data.drop_items) then
|
||||||
list = drop_items(player, inv, list, start_i, data.drop_items)
|
list = drop_items(player, inv, list, start_i, data.drop_items, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.inv_compress then
|
if data.inv_compress then
|
||||||
|
|
|
@ -624,7 +624,7 @@ local function show_popup(fs, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
fs("style[drop_items;font_size=15;font=mono;textcolor=#dbeeff]",
|
fs("style[drop_items;font_size=15;font=mono;textcolor=#dbeeff]",
|
||||||
fmt("field[5.4,10.68;2.4,0.45;drop_items;Drop items:;%s]",
|
fmt("field[5.4,10.68;2.4,0.45;drop_items;Remove items:;%s]",
|
||||||
ESC(concat(data.drop_items or {}, ","))),
|
ESC(concat(data.drop_items or {}, ","))),
|
||||||
"field_close_on_enter[drop_items;false]")
|
"field_close_on_enter[drop_items;false]")
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ local function show_popup(fs, data)
|
||||||
fmt("tooltip[cb_auto_sorting;%s;#707070;#fff]",
|
fmt("tooltip[cb_auto_sorting;%s;#707070;#fff]",
|
||||||
ES"Enable this option to sort your inventory automatically"),
|
ES"Enable this option to sort your inventory automatically"),
|
||||||
fmt("tooltip[drop_items;%s;#707070;#fff]",
|
fmt("tooltip[drop_items;%s;#707070;#fff]",
|
||||||
"Add a comma-separated list of items to drop on inventory sorting.\n" ..
|
"Add a comma-separated list of items to remove on inventory sorting.\n" ..
|
||||||
"Format: " .. ("mod:item,mod:item, ..."):gsub("(%a+:%a+)", clr("#bddeff", "%1"))))
|
"Format: " .. ("mod:item,mod:item, ..."):gsub("(%a+:%a+)", clr("#bddeff", "%1"))))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Ŝarĝante…
Reference in New Issue