Add confirmation dialog on inventory clearing
This commit is contained in:
parent
1c4ae1df28
commit
5c96ede065
|
@ -84,6 +84,9 @@ local styles = fmt([[
|
||||||
style[craft_rcp,craft_usg;noclip=true;font_size=16;sound=i3_craft;
|
style[craft_rcp,craft_usg;noclip=true;font_size=16;sound=i3_craft;
|
||||||
bgimg=i3_btn9.png;bgimg_hovered=i3_btn9_hovered.png;
|
bgimg=i3_btn9.png;bgimg_hovered=i3_btn9_hovered.png;
|
||||||
bgimg_pressed=i3_btn9_pressed.png;bgimg_middle=4,6]
|
bgimg_pressed=i3_btn9_pressed.png;bgimg_middle=4,6]
|
||||||
|
style[confirm_trash_yes,confirm_trash_no;noclip=true;font_size=16;
|
||||||
|
bgimg=i3_btn9.png;bgimg_hovered=i3_btn9_hovered.png;
|
||||||
|
bgimg_pressed=i3_btn9_pressed.png;bgimg_middle=4,6]
|
||||||
]],
|
]],
|
||||||
PNG.slot,
|
PNG.slot,
|
||||||
PNG.exit, PNG.exit_hover,
|
PNG.exit, PNG.exit_hover,
|
||||||
|
|
20
init.lua
20
init.lua
|
@ -2314,6 +2314,7 @@ local function reset_data(data)
|
||||||
data.export_rcp = nil
|
data.export_rcp = nil
|
||||||
data.export_usg = nil
|
data.export_usg = nil
|
||||||
data.alt_items = nil
|
data.alt_items = nil
|
||||||
|
data.confirm_trash = nil
|
||||||
data.items = data.items_raw
|
data.items = data.items_raw
|
||||||
|
|
||||||
if data.current_itab > 1 then
|
if data.current_itab > 1 then
|
||||||
|
@ -2531,6 +2532,18 @@ local function get_inventory_fs(player, data, fs)
|
||||||
fs("image_button", i + 3.447 - (i * 0.4), 11.43, 0.35, 0.35, "", btn_name, "")
|
fs("image_button", i + 3.447 - (i * 0.4), 11.43, 0.35, 0.35, "", btn_name, "")
|
||||||
fs(fmt("tooltip[%s;%s]", btn_name, tooltip))
|
fs(fmt("tooltip[%s;%s]", btn_name, tooltip))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if data.confirm_trash then
|
||||||
|
fs("style_type[box;colors=#999,#999,#808080,#808080]")
|
||||||
|
|
||||||
|
for _ = 1, 3 do
|
||||||
|
fs("box", 2.95, 10.75, 4.35, 0.5, "")
|
||||||
|
end
|
||||||
|
|
||||||
|
fs("label", 3.1, 11, "Confirm trash?")
|
||||||
|
fs("image_button", 5.2, 10.75, 1, 0.5, "", "confirm_trash_yes", "Yes")
|
||||||
|
fs("image_button", 6.3, 10.75, 1, 0.5, "", "confirm_trash_no", "No")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
i3.new_tab {
|
i3.new_tab {
|
||||||
|
@ -2602,9 +2615,16 @@ i3.new_tab {
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.trash then
|
if fields.trash then
|
||||||
|
data.confirm_trash = true
|
||||||
|
|
||||||
|
elseif fields.confirm_trash_yes or fields.confirm_trash_no then
|
||||||
|
if fields.confirm_trash_yes then
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:set_list("main", {})
|
inv:set_list("main", {})
|
||||||
inv:set_list("craft", {})
|
inv:set_list("craft", {})
|
||||||
|
end
|
||||||
|
|
||||||
|
data.confirm_trash = nil
|
||||||
|
|
||||||
elseif fields.compress then
|
elseif fields.compress then
|
||||||
compress_items(player)
|
compress_items(player)
|
||||||
|
|
Ŝarĝante…
Reference in New Issue