From fd32a9013a618093862675a6e7ab6ee760c7b4a7 Mon Sep 17 00:00:00 2001 From: workstation Date: Tue, 17 Mar 2026 16:04:59 +0300 Subject: [PATCH 1/2] A button to request 20-40mm munition by 1000 --- content/scripts/screen_inventory.lua | 53 +++++++++++++++++----------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/content/scripts/screen_inventory.lua b/content/scripts/screen_inventory.lua index e6279ac..4088390 100644 --- a/content/scripts/screen_inventory.lua +++ b/content/scripts/screen_inventory.lua @@ -162,6 +162,10 @@ g_screen_h = 128 g_barge_count = 0 g_barge_max = 1 +local ammo_options_1000_txt = { "X", "-1000", "-100", "+100", "+1000" } +local ammo_options_1000 = { 100, 1000 } +local ammo_options_100_txt = { "X", "-100", "-10", "+10", "+100" } +local ammo_options_100 = { 10, 100 } -------------------------------------------------------------------------------- -- -- BEGIN @@ -2447,27 +2451,30 @@ function tab_stock_render(screen_w, screen_h, x, y, w, h, is_tab_active, screen_ local order_amount = screen_vehicle:get_inventory_order(item_data.index) local is_active = is_tab_active and g_tab_stock.is_confirm_discard == false - local window = ui:begin_window(item_data.name .. "##item", 30, 10, w - 60, h - 28, atlas_icons.column_pending, is_active, 2) - imgui_item_description(ui, screen_vehicle, item_data, true, is_active) - ui:header(update_get_loc(e_loc.upp_order)) - - local total_modify_amount = g_tab_stock.selected_item_modify_amount + order_amount - total_modify_amount = ui:selector(update_get_loc(e_loc.quantity), total_modify_amount, -99999, 99999, 1, "%+d") - g_tab_stock.selected_item_modify_amount = total_modify_amount - order_amount - - local button_action = ui:button_group({ "X", "-100", "-10", "+10", "+100" }, true) - - if button_action == 0 then - g_tab_stock.selected_item_modify_amount = -order_amount - elseif button_action == 1 then - g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount - 100 - elseif button_action == 2 then - g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount - 10 - elseif button_action == 3 then - g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount + 10 - elseif button_action == 4 then - g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount + 100 - end + ui:begin_window(item_data.name .. "##item", 30, 10, w - 60, h - 28, atlas_icons.column_pending, is_active, 2) + local is_small_caliber = is_small_caliber(g_tab_stock.selected_item) + local ammo_options_txt + local ammo_options + if is_small_caliber then + ammo_options_txt = ammo_options_1000_txt + ammo_options = ammo_options_1000 + else + ammo_options_txt = ammo_options_100_txt + ammo_options = ammo_options_100 + end + local button_action = ui:button_group(ammo_options_txt, true) + + if button_action == 0 then + g_tab_stock.selected_item_modify_amount = -order_amount + elseif button_action == 1 then + g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount - ammo_options[2] + elseif button_action == 2 then + g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount - ammo_options[1] + elseif button_action == 3 then + g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount + ammo_options[1] + elseif button_action == 4 then + g_tab_stock.selected_item_modify_amount = g_tab_stock.selected_item_modify_amount + ammo_options[2] + end ui:end_window() if g_tab_stock.is_confirm_discard then @@ -2517,6 +2524,10 @@ function tab_stock_render(screen_w, screen_h, x, y, w, h, is_tab_active, screen_ update_ui_pop_offset() end +function is_small_caliber(selected_ammo_id) + return selected_ammo_id == 0 or selected_ammo_id == 32 or selected_ammo_id == 48 +end + function get_ordered_weight(vehicle) local ordered_weight = 0.0 for _, category in pairs(g_item_categories) do From 87a389a27b2955b262d8a39a988b9e0556e6712e Mon Sep 17 00:00:00 2001 From: workstation Date: Tue, 17 Mar 2026 16:11:31 +0300 Subject: [PATCH 2/2] merge fix --- content/scripts/screen_inventory.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/scripts/screen_inventory.lua b/content/scripts/screen_inventory.lua index 4088390..16e7bf7 100644 --- a/content/scripts/screen_inventory.lua +++ b/content/scripts/screen_inventory.lua @@ -2452,6 +2452,12 @@ function tab_stock_render(screen_w, screen_h, x, y, w, h, is_tab_active, screen_ local is_active = is_tab_active and g_tab_stock.is_confirm_discard == false ui:begin_window(item_data.name .. "##item", 30, 10, w - 60, h - 28, atlas_icons.column_pending, is_active, 2) + imgui_item_description(ui, screen_vehicle, item_data, true, is_active) + ui:header(update_get_loc(e_loc.upp_order)) + + local total_modify_amount = g_tab_stock.selected_item_modify_amount + order_amount + total_modify_amount = ui:selector(update_get_loc(e_loc.quantity), total_modify_amount, -99999, 99999, 1, "%+d") + g_tab_stock.selected_item_modify_amount = total_modify_amount - order_amount local is_small_caliber = is_small_caliber(g_tab_stock.selected_item) local ammo_options_txt local ammo_options