From a6e2b96ca7c0dab2ea02f6f90a5021826863ae0f Mon Sep 17 00:00:00 2001 From: GwynCodes Date: Sat, 15 Feb 2025 02:14:04 +0100 Subject: [PATCH] Creates a "Secrets" panel button for debugging cargo orders (#89469) ## About The Pull Request -Creates a new button in the "Secrets" menu that can override the cooldown for ordering items from department consoles. It can be used to make the cooldown longer, shorter or non-existent. -Creates a new global var to manage this override on every console in dept_order.dm ## Why It's Good For The Game This tool assists in finding and fixing bugs related to cargo orders and cargo crates. The wait time for these cooldowns can be ten minutes or longer, and this speeds up the process significantly. It could also be used by admins during play to make the cooldown lower, or cause absolute mayhem on cargo by setting the cooldown duration to 0. ## Changelog :cl: add: Added a button in the "Secrets" menu to alter the department console order delay. qol: Button makes it easier to find cargo related bugs. code: Changed code in department_order.dm to allow for overriding the order cooldown duration. admin: Created an admin button in the "Secrets" panel. /:cl: --------- Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> --- code/modules/admin/verbs/secrets.dm | 20 +++++++++++++++++++ .../file_system/programs/dept_order.dm | 11 ++++++++-- tgui/packages/tgui/interfaces/Secrets.jsx | 12 +++++------ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/code/modules/admin/verbs/secrets.dm b/code/modules/admin/verbs/secrets.dm index b10ef0002d9..1af6dcbeb69 100644 --- a/code/modules/admin/verbs/secrets.dm +++ b/code/modules/admin/verbs/secrets.dm @@ -481,6 +481,26 @@ ADMIN_VERB(secrets, R_NONE, "Secrets", "Abuse harder than you ever have before w message_admins(span_boldannounce("[key_name_admin(holder)] changed the bomb cap to [GLOB.MAX_EX_DEVESTATION_RANGE], [GLOB.MAX_EX_HEAVY_RANGE], [GLOB.MAX_EX_LIGHT_RANGE]")) log_admin("[key_name(holder)] changed the bomb cap to [GLOB.MAX_EX_DEVESTATION_RANGE], [GLOB.MAX_EX_HEAVY_RANGE], [GLOB.MAX_EX_LIGHT_RANGE]") + if("department_cooldown_override") //Happens when the button is clicked, creates a value for GLOB.department_cd_override in dept_order.dm + if(!is_debugger) + return + if(isnull(GLOB.department_cd_override)) + var/set_override = tgui_input_number(usr, "How long would you like the console order cooldown to be?","Cooldown Override", 5) + if(isnull(set_override)) + return //user clicked cancel + GLOB.department_cd_override = set_override + else + var/choice = tgui_alert(usr, "Override is active. You can change the cooldown or end the override.", "You were trying to override...", list("Override", "End Override", "Cancel")) + if(choice == "Override") + var/set_override = tgui_input_number(usr, "How long would you like the console order cooldown to be?", "Title", 5) + GLOB.department_cd_override = set_override + return + if(choice == "End Override") + var/set_override = null + GLOB.department_cd_override = set_override + return + if(!choice || choice == "Cancel") + return //buttons that are fun for exactly you and nobody else. if("monkey") if(!is_funmin) diff --git a/code/modules/modular_computers/file_system/programs/dept_order.dm b/code/modules/modular_computers/file_system/programs/dept_order.dm index 6d0ed91f290..c24ac025e0e 100644 --- a/code/modules/modular_computers/file_system/programs/dept_order.dm +++ b/code/modules/modular_computers/file_system/programs/dept_order.dm @@ -1,3 +1,6 @@ +/// Stores an override value for the order cooldown to be used by the Dpt. Order Cooldown button in the secrets menu. When null, the override is not active. +GLOBAL_VAR(department_cd_override) + /datum/computer_file/program/department_order filename = "dept_order" filedesc = "Departmental Orders" @@ -253,8 +256,12 @@ /// Calculates the cooldown it will take for this department's free order, based on its credit cost /datum/computer_file/program/department_order/proc/calculate_cooldown(credits) - var/time_y = DEPARTMENTAL_ORDER_COOLDOWN_COEFFICIENT * (log(10, credits) ** DEPARTMENTAL_ORDER_COOLDOWN_EXPONENT) * (1 SECONDS) - department_cooldowns[linked_department] = world.time + time_y + if(isnull(GLOB.department_cd_override)) + var/time_y = DEPARTMENTAL_ORDER_COOLDOWN_COEFFICIENT * (log(10, credits) ** DEPARTMENTAL_ORDER_COOLDOWN_EXPONENT) * (1 SECONDS) + department_cooldowns[linked_department] = world.time + time_y + else + var/time_y = GLOB.department_cd_override SECONDS + department_cooldowns[linked_department] = world.time + time_y /datum/computer_file/program/department_order/process_tick(seconds_per_tick) if(!check_cooldown() || alert_silenced || !alert_able) diff --git a/tgui/packages/tgui/interfaces/Secrets.jsx b/tgui/packages/tgui/interfaces/Secrets.jsx index 055ab70e103..e3298a44bff 100644 --- a/tgui/packages/tgui/interfaces/Secrets.jsx +++ b/tgui/packages/tgui/interfaces/Secrets.jsx @@ -456,13 +456,13 @@ const FunTab = (props) => { /> - - Your admin button here, coder! - + content="Dpt Order Cooldown" + onClick={() => act('department_cooldown_override')} + />