From 6fe23a6a209e3f4091b5dd3b97fac778f66e0c42 Mon Sep 17 00:00:00 2001 From: Aylong <69762909+AyIong@users.noreply.github.com> Date: Fri, 12 Apr 2024 21:51:36 +0300 Subject: [PATCH] Another bunch of fixes for TGUI inputs (I'll be cursed...) (#25009) * Oh god, oh fuck, WHY DIDN'T I USE isnull()??? * More correct checks * That's all * That's all x2 * Flavor fix --- .../miniantags/abduction/abduction_gear.dm | 4 --- .../demons/slaughter demon/slaughter.dm | 2 +- code/game/gamemodes/nuclear/nuclearbomb.dm | 17 +++++----- code/game/machinery/computer/card.dm | 2 +- .../game/machinery/computer/communications.dm | 2 +- code/game/machinery/doors/brigdoors.dm | 15 +++++++-- code/game/machinery/navbeacon.dm | 7 ++-- code/game/machinery/requests_console.dm | 32 +++++++++---------- code/game/machinery/tcomms/tcomms_core.dm | 2 +- code/game/objects/items/stacks/stack.dm | 2 +- code/game/objects/items/weapons/AI_modules.dm | 2 +- code/game/objects/items/weapons/cards_ids.dm | 4 +-- .../objects/items/weapons/picket_signs.dm | 2 +- code/modules/admin/admin_verbs.dm | 8 ++--- .../atmospherics/machinery/airalarm.dm | 2 -- .../client/preference/link_processing.dm | 2 +- .../economy/economy_machinery/eftpos.dm | 4 +-- .../food_and_drinks/food/foods/pizza.dm | 2 +- code/modules/games/cards.dm | 4 +-- code/modules/library/book.dm | 10 +++--- .../mob/living/simple_animal/friendly/cat.dm | 7 ++-- code/modules/mob/mob.dm | 20 ++++++------ code/modules/pda/cart_apps.dm | 4 +-- code/modules/pda/core_apps.dm | 2 +- code/modules/pda/messenger.dm | 2 -- code/modules/pda/nanobank.dm | 2 +- code/modules/supply/supply_console.dm | 9 +++--- code/modules/vote/vote_verb.dm | 4 +-- 28 files changed, 87 insertions(+), 88 deletions(-) diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 6c98ab8b3f1..f6181fe104b 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -320,16 +320,12 @@ return var/command = tgui_input_text(user, "Enter the command for your target to follow. Uses Left: [G.mind_control_uses], Duration: [DisplayTimeText(G.mind_control_duration)]", "Enter command") - if(!command) return - if(QDELETED(user) || user.get_active_hand() != src || loc != user) return - if(QDELETED(G)) return - G.mind_control(command, user) to_chat(user, "You send the command to your target.") diff --git a/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm b/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm index 0ee8e70ce67..1dce1c415ff 100644 --- a/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm +++ b/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm @@ -195,7 +195,7 @@ return var/msg = tgui_input_text(usr, "What do you wish to tell [choice]?", null, "") - if(!(msg)) + if(!msg) return log_say("(SLAUGHTER to [key_name(choice)]) [msg]", usr) to_chat(usr, "You whisper to [choice]: [msg]") diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index a3410fa61f0..2c3e81c9c12 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -440,13 +440,14 @@ GLOBAL_VAR(bomb_set) return // If no code set, enter new one var/tempcode = tgui_input_number(usr, "Code", "Input Code", max_value = 999999) - if(tempcode) - code = tempcode - if(code == r_code) - yes_code = TRUE - code = null - else - code = "ERROR" + if(isnull(tempcode)) + return + code = tempcode + if(code == r_code) + yes_code = TRUE + code = null + else + code = "ERROR" return if("toggle_anchor") if(removal_stage == NUKE_MOBILE) @@ -479,7 +480,7 @@ GLOBAL_VAR(bomb_set) switch(action) if("set_time") var/time = tgui_input_number(usr, "Detonation time (seconds, min 120, max 600)", "Input Time", 120, 600, 120) - if(!time) + if(isnull(time)) return timeleft = time if("toggle_safety") diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index 53b618f108c..2727b8c110e 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -676,7 +676,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) return if("account") // card account number var/account_num = tgui_input_number(usr, "Account Number", "Input Number", modify.associated_account_number, 9999999, 1000000) - if(!scan || !modify || !account_num) + if(isnull(account_num) || !scan || !modify) return FALSE modify.associated_account_number = account_num //for future reference, you should never be able to modify the money account datum through the card computer diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index d8666b35d08..d2c2f012dc8 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -247,7 +247,7 @@ to_chat(ui.user, "Arrays recycling. Please stand by.") return var/input = tgui_input_text(ui.user, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.", encode = FALSE) - if(!input || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT)) + if(isnull(input) || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT)) return if(length(input) < COMM_CCMSGLEN_MINIMUM) to_chat(ui.user, "Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum.") diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 6dc19a744a7..fbc5c3fb08d 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -345,7 +345,10 @@ if(params["prisoner_name"]) prisoner_name = params["prisoner_name"] else - prisoner_name = tgui_input_text(usr, "Prisoner Name:", name, prisoner_name, MAX_NAME_LEN, encode = FALSE) + var/new_name = tgui_input_text(usr, "Prisoner Name:", name, prisoner_name, MAX_NAME_LEN, encode = FALSE) + if(isnull(new_name)) + return + prisoner_name = new_name if(prisoner_name) var/datum/data/record/R = find_security_record("name", prisoner_name) if(istype(R)) @@ -353,9 +356,15 @@ else prisoner_hasrecord = FALSE if("prisoner_charge") - prisoner_charge = tgui_input_text(usr, "Prisoner Charge:", name, prisoner_charge, encode = FALSE) + var/new_charge = tgui_input_text(usr, "Prisoner Charge:", name, prisoner_charge, encode = FALSE) + if(isnull(new_charge)) + return + prisoner_charge = new_charge if("prisoner_time") - prisoner_time = tgui_input_number(usr, "Prisoner Time (in minutes):", name, prisoner_time, 60) + var/new_time = tgui_input_number(usr, "Prisoner Time (in minutes):", name, prisoner_time, 60) + if(isnull(new_time)) + return + prisoner_time = new_time if("start") if(!prisoner_name || !prisoner_charge || !prisoner_time) return FALSE diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index f1dbc7792f1..f8d8a056195 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -163,9 +163,10 @@ Transponder Codes: