From c5b11dc28354f7c2d331ac045b8b1976ab129b95 Mon Sep 17 00:00:00 2001 From: Akrilla Date: Wed, 21 Aug 2019 00:25:41 +0100 Subject: [PATCH] Adds cancel buttons to inputs (#45825) About The Pull Request Adds cancel buttons to input boxes that didn't have them before. Why It's Good For The Game Good UX. Changelog cl add: More cancel buttons. /cl --- code/_onclick/hud/movable_screen_objects.dm | 4 ++-- code/controllers/subsystem/pai.dm | 8 ++++---- code/datums/components/gps.dm | 6 +++++- code/game/atoms.dm | 6 +++--- code/game/machinery/computer/security.dm | 17 ++++++++++++++--- code/game/machinery/syndicatebomb.dm | 6 +++++- code/game/mecha/mecha_topic.dm | 2 +- code/game/objects/items/cards_ids.dm | 8 +++++--- code/game/objects/items/devices/PDA/PDA.dm | 2 +- code/game/objects/items/devices/paicard.dm | 2 +- code/game/objects/items/grenades/plastic.dm | 6 +++++- code/modules/admin/create_poll.dm | 2 +- code/modules/admin/topic.dm | 2 +- code/modules/admin/verbs/deadsay.dm | 6 +++++- code/modules/admin/verbs/debug.dm | 8 +++++++- code/modules/admin/verbs/machine_upgrade.dm | 2 +- code/modules/admin/verbs/mapping.dm | 6 +++--- code/modules/admin/view_variables/topic.dm | 5 ++++- code/modules/antagonists/blob/powers.dm | 2 +- .../machinery/components/components_base.dm | 9 +++++++-- code/modules/discord/manipulation.dm | 4 ++-- code/modules/events/wizard/madness.dm | 2 +- .../kitchen_machinery/food_cart.dm | 5 ++++- code/modules/food_and_drinks/pizzabox.dm | 6 +++++- code/modules/mining/abandoned_crates.dm | 2 +- .../carbon/alien/humanoid/alien_powers.dm | 2 +- code/modules/mob/living/silicon/ai/say.dm | 6 +++--- code/modules/paperwork/folders.dm | 9 ++++++++- code/modules/photography/camera/camera.dm | 12 ++++++++++-- code/modules/procedural_mapping/mapGenerator.dm | 12 ++++++++++-- .../chemistry/machinery/chem_synthesizer.dm | 6 +++++- .../shuttle/spaceship_navigation_beacon.dm | 2 +- 32 files changed, 127 insertions(+), 50 deletions(-) diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm index ae116138850..3ea53daf254 100644 --- a/code/_onclick/hud/movable_screen_objects.dm +++ b/code/_onclick/hud/movable_screen_objects.dm @@ -62,7 +62,7 @@ M.maptext = "Movable" M.maptext_width = 64 - var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Movable UI Object") as text + var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Movable UI Object") as text|null if(!screen_l) return @@ -81,7 +81,7 @@ S.maptext = "Snap" S.maptext_width = 64 - var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Snap UI Object") as text + var/screen_l = input(usr,"Where on the screen? (Formatted as 'X,Y' e.g: '1,1' for bottom left)","Spawn Snap UI Object") as text|null if(!screen_l) return diff --git a/code/controllers/subsystem/pai.dm b/code/controllers/subsystem/pai.dm index 895786e8906..e9c67666202 100644 --- a/code/controllers/subsystem/pai.dm +++ b/code/controllers/subsystem/pai.dm @@ -39,19 +39,19 @@ SUBSYSTEM_DEF(pai) switch(option) if("name") - t = input("Enter a name for your pAI", "pAI Name", candidate.name) as text + t = input("Enter a name for your pAI", "pAI Name", candidate.name) as text|null if(t) candidate.name = copytext(sanitize_name(t),1,MAX_NAME_LEN) if("desc") - t = input("Enter a description for your pAI", "pAI Description", candidate.description) as message + t = input("Enter a description for your pAI", "pAI Description", candidate.description) as message|null if(t) candidate.description = copytext(sanitize(t),1,MAX_MESSAGE_LEN) if("role") - t = input("Enter a role for your pAI", "pAI Role", candidate.role) as text + t = input("Enter a role for your pAI", "pAI Role", candidate.role) as text|null if(t) candidate.role = copytext(sanitize(t),1,MAX_MESSAGE_LEN) if("ooc") - t = input("Enter any OOC comments", "pAI OOC Comments", candidate.comments) as message + t = input("Enter any OOC comments", "pAI OOC Comments", candidate.comments) as message|null if(t) candidate.comments = copytext(sanitize(t),1,MAX_MESSAGE_LEN) if("save") diff --git a/code/datums/components/gps.dm b/code/datums/components/gps.dm index 9865159529d..9920b0f9d95 100644 --- a/code/datums/components/gps.dm +++ b/code/datums/components/gps.dm @@ -137,7 +137,11 @@ GLOBAL_LIST_EMPTY(GPS_list) switch(action) if("rename") var/atom/parentasatom = parent - var/a = input("Please enter desired tag.", parentasatom.name, gpstag) as text + var/a = input("Please enter desired tag.", parentasatom.name, gpstag) as text|null + + if (!a) + return + a = copytext(sanitize(a), 1, 20) gpstag = a . = TRUE diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e7f7c831061..1876d27a76b 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -872,7 +872,7 @@ . = ..() if(href_list[VV_HK_ADD_REAGENT] && check_rights(R_VAREDIT)) if(!reagents) - var/amount = input(usr, "Specify the reagent size of [src]", "Set Reagent Size", 50) as num + var/amount = input(usr, "Specify the reagent size of [src]", "Set Reagent Size", 50) as num|null if(amount) create_reagents(amount) @@ -898,7 +898,7 @@ if("I'm feeling lucky") chosen_id = pick(subtypesof(/datum/reagent)) if(chosen_id) - var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", reagents.maximum_volume) as num + var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", reagents.maximum_volume) as num|null if(amount) reagents.add_reagent(chosen_id, amount) log_admin("[key_name(usr)] has added [amount] units of [chosen_id] to [src]") @@ -1173,4 +1173,4 @@ var/datum/material/custom_material = x custom_material.on_applied(src, materials[custom_material] * multiplier, material_flags) - custom_materials[custom_material] += materials[custom_material] * multiplier \ No newline at end of file + custom_materials[custom_material] += materials[custom_material] * multiplier diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 5f10546de83..cede0cacbaa 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -641,7 +641,11 @@ What a mess.*/ active1.fields["gender"] = "Male" if("age") if(istype(active1, /datum/data/record)) - var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num + var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num|null + + if (!t1) + return + if(!canUseSecurityRecordsConsole(usr, "age", a1)) return active1.fields["age"] = t1 @@ -728,13 +732,20 @@ What a mess.*/ if("citation_add") if(istype(active1, /datum/data/record)) var/t1 = stripped_input(usr, "Please input citation crime:", "Secure. records", "", null) - var/fine = FLOOR(input(usr, "Please input citation fine:", "Secure. records", 50) as num, 1) - if(!fine || fine < 0) + var/fine = FLOOR(input(usr, "Please input citation fine:", "Secure. records", 50) as num|null, 1) + + if (isnull(fine)) + return + + if(fine < 0) to_chat(usr, "You're pretty sure that's not how money works.") return + fine = min(fine, maxFine) + if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) return + var/crime = GLOB.data_core.createCrimeEntry(t1, "", authenticated, station_time_timestamp(), fine) for (var/obj/item/pda/P in GLOB.PDAs) if(P.owner == active1.fields["name"]) diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index df30408b55b..8bb9041d5db 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -191,7 +191,11 @@ notify_ghosts("\A [src] has been activated at [get_area(src)]!", source = src, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Bomb Planted") /obj/machinery/syndicatebomb/proc/settings(mob/user) - var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num + var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num|null + + if (isnull(new_timer)) + return + if(in_range(src, user) && isliving(user)) //No running off and setting bombs from across the station timer_set = CLAMP(new_timer, minimum_timer, maximum_timer) loc.visible_message("[icon2html(src, viewers(src))] timer set for [timer_set] seconds.") diff --git a/code/game/mecha/mecha_topic.dm b/code/game/mecha/mecha_topic.dm index 0c1103fef3c..cb373d99a1a 100644 --- a/code/game/mecha/mecha_topic.dm +++ b/code/game/mecha/mecha_topic.dm @@ -240,7 +240,7 @@ return output_access_dialog(id_card,usr) return - + if(href_list["maint_access"]) if(!maint_access) return diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index e9eb246c602..71a35dd32e7 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -194,8 +194,11 @@ . = FALSE var/datum/bank_account/old_account = registered_account - var/new_bank_id = input(user, "Enter your account ID number.", "Account Reclamation", 111111) as num + var/new_bank_id = input(user, "Enter your account ID number.", "Account Reclamation", 111111) as num | null + if (isnull(new_bank_id)) + return + if(!alt_click_can_use_id(user)) return if(!new_bank_id || new_bank_id < 111111 || new_bank_id > 999999) @@ -232,10 +235,9 @@ registered_account.bank_card_talk("ERROR: UNABLE TO LOGIN DUE TO SCHEDULED MAINTENANCE. MAINTENANCE IS SCHEDULED TO COMPLETE IN [(registered_account.withdrawDelay - world.time)/10] SECONDS.", TRUE) return - var/amount_to_remove = FLOOR(input(user, "How much do you want to withdraw? Current Balance: [registered_account.account_balance]", "Withdraw Funds", 5) as num, 1) + var/amount_to_remove = FLOOR(input(user, "How much do you want to withdraw? Current Balance: [registered_account.account_balance]", "Withdraw Funds", 5) as num|null, 1) if(!amount_to_remove || amount_to_remove < 0) - to_chat(user, "You're pretty sure that's not how money works.") return if(!alt_click_can_use_id(user)) return diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 90821e5ad45..72df8cc0f22 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -514,7 +514,7 @@ GLOBAL_LIST_EMPTY(PDAs) if("Clear")//Clears messages tnote = null if("Ringtone") - var/t = input(U, "Please enter new ringtone", name, ttone) as text + var/t = input(U, "Please enter new ringtone", name, ttone) as text|null if(in_range(src, U) && loc == U && t) if(SEND_SIGNAL(src, COMSIG_PDA_CHANGE_RINGTONE, U, t) & COMPONENT_STOP_RINGTONE_CHANGE) U << browse(null, "window=pda") diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index 7956aa8542b..a5977c323dd 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -104,7 +104,7 @@ to_chat(usr,"You [transmit_holder ? "enable" : "disable"] your pAI's [transmitting ? "outgoing" : "incoming"] radio transmissions!") to_chat(pai,"Your owner has [transmit_holder ? "enabled" : "disabled"] your [transmitting ? "outgoing" : "incoming"] radio transmissions!") if(href_list["setlaws"]) - var/newlaws = copytext(sanitize(input("Enter any additional directives you would like your pAI personality to follow. Note that these directives will not override the personality's allegiance to its imprinted master. Conflicting directives will be ignored.", "pAI Directive Configuration", pai.laws.supplied[1]) as message),1,MAX_MESSAGE_LEN) + var/newlaws = copytext(sanitize(input("Enter any additional directives you would like your pAI personality to follow. Note that these directives will not override the personality's allegiance to its imprinted master. Conflicting directives will be ignored.", "pAI Directive Configuration", pai.laws.supplied[1]) as message|null),1,MAX_MESSAGE_LEN) if(newlaws && pai) pai.add_supplied_law(0,newlaws) if(href_list["toggle_holo"]) diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index 91e9fbb45ba..31302ac083f 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -66,7 +66,11 @@ prime() /obj/item/grenade/c4/attack_self(mob/user) - var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num + var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num|null + + if (isnull(newtime)) + return + if(user.get_active_held_item() == src) newtime = CLAMP(newtime, 10, 60000) det_time = newtime diff --git a/code/modules/admin/create_poll.dm b/code/modules/admin/create_poll.dm index 9f002f92e0b..b558d609582 100644 --- a/code/modules/admin/create_poll.dm +++ b/code/modules/admin/create_poll.dm @@ -31,7 +31,7 @@ else return 0 var/starttime = SQLtime() - var/endtime = input("Set end time for poll as format YYYY-MM-DD HH:MM:SS. All times in server time. HH:MM:SS is optional and 24-hour. Must be later than starting time for obvious reasons.", "Set end time", SQLtime()) as text + var/endtime = input("Set end time for poll as format YYYY-MM-DD HH:MM:SS. All times in server time. HH:MM:SS is optional and 24-hour. Must be later than starting time for obvious reasons.", "Set end time", SQLtime()) as text|null if(!endtime) return endtime = sanitizeSQL(endtime) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index f7f6add376f..e731b3847e3 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -291,7 +291,7 @@ if(!check_rights(R_ADMIN)) return - var/ratio = input("Enter new life ratio",, CONFIG_GET(number/midround_antag_life_check) * 100) as num + var/ratio = input("Enter new life ratio",, CONFIG_GET(number/midround_antag_life_check) * 100) as num|null if(!ratio) return CONFIG_SET(number/midround_antag_life_check, ratio / 100) diff --git a/code/modules/admin/verbs/deadsay.dm b/code/modules/admin/verbs/deadsay.dm index 46ca8b1631c..f0be90b2809 100644 --- a/code/modules/admin/verbs/deadsay.dm +++ b/code/modules/admin/verbs/deadsay.dm @@ -35,5 +35,9 @@ SSblackbox.record_feedback("tally", "admin_verb", 1, "Dsay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/get_dead_say() - var/msg = input(src, null, "dsay \"text\"") as text + var/msg = input(src, null, "dsay \"text\"") as text|null + + if (isnull(msg)) + return + dsay(msg) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index b818572835e..7ffb7f391c2 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -105,7 +105,13 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that return 0 var/obj/item/paicard/card = new(T) var/mob/living/silicon/pai/pai = new(card) - pai.name = input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text + + var/chosen_name = input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text|null + + if (isnull(chosen_name)) + return + + pai.name = chosen_name pai.real_name = pai.name pai.key = choice.key card.setPersonality(pai) diff --git a/code/modules/admin/verbs/machine_upgrade.dm b/code/modules/admin/verbs/machine_upgrade.dm index 58deff2a24f..8d0ffa14f40 100644 --- a/code/modules/admin/verbs/machine_upgrade.dm +++ b/code/modules/admin/verbs/machine_upgrade.dm @@ -4,7 +4,7 @@ if (!istype(M)) return - var/new_rating = input("Enter new rating:","Num") as num + var/new_rating = input("Enter new rating:","Num") as num|null if(new_rating && M.component_parts) for(var/obj/item/stock_parts/P in M.component_parts) P.rating = new_rating diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index b59011827f8..1b02853d499 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -218,7 +218,7 @@ GLOBAL_LIST_EMPTY(dirty_vars) /client/proc/count_objects_on_z_level() set category = "Mapping" set name = "Count Objects On Level" - var/level = input("Which z-level?","Level?") as text + var/level = input("Which z-level?","Level?") as text|null if(!level) return var/num_level = text2num(level) @@ -227,7 +227,7 @@ GLOBAL_LIST_EMPTY(dirty_vars) if(!isnum(num_level)) return - var/type_text = input("Which type path?","Path?") as text + var/type_text = input("Which type path?","Path?") as text|null if(!type_text) return var/type_path = text2path(type_text) @@ -258,7 +258,7 @@ GLOBAL_LIST_EMPTY(dirty_vars) set category = "Mapping" set name = "Count Objects All" - var/type_text = input("Which type path?","") as text + var/type_text = input("Which type path?","") as text|null if(!type_text) return var/type_path = text2path(type_text) diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm index 3fc8e6b11bd..b72256e41aa 100644 --- a/code/modules/admin/view_variables/topic.dm +++ b/code/modules/admin/view_variables/topic.dm @@ -80,7 +80,10 @@ var/Text = href_list["adjustDamage"] - var/amount = input("Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0) as num + var/amount = input("Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0) as num|null + + if (isnull(amount)) + return if(!L) to_chat(usr, "Mob doesn't exist anymore") diff --git a/code/modules/antagonists/blob/powers.dm b/code/modules/antagonists/blob/powers.dm index 6274d1080cb..e3962d05125 100644 --- a/code/modules/antagonists/blob/powers.dm +++ b/code/modules/antagonists/blob/powers.dm @@ -326,7 +326,7 @@ set category = "Blob" set name = "Blob Broadcast" set desc = "Speak with your blob spores and blobbernauts as your mouthpieces." - var/speak_text = input(src, "What would you like to say with your minions?", "Blob Broadcast", null) as text + var/speak_text = input(src, "What would you like to say with your minions?", "Blob Broadcast", null) as text|null if(!speak_text) return else diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index 7f40fcfc703..06c714b9f4a 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -134,9 +134,14 @@ air_update_turf(1) /obj/machinery/atmospherics/components/proc/safe_input(var/title, var/text, var/default_set) - var/new_value = input(usr,text,title,default_set) as num + var/new_value = input(usr,text,title,default_set) as num|null + + if (isnull(new_value)) + return default_set + if(usr.canUseTopic(src)) return new_value + return default_set // Helpers @@ -165,4 +170,4 @@ // Tool acts /obj/machinery/atmospherics/components/return_analyzable_air() - return airs \ No newline at end of file + return airs diff --git a/code/modules/discord/manipulation.dm b/code/modules/discord/manipulation.dm index 3280674626e..165268ba119 100644 --- a/code/modules/discord/manipulation.dm +++ b/code/modules/discord/manipulation.dm @@ -20,7 +20,7 @@ var/lookup_choice = alert(usr, "Do you wish to lookup account by ID or ckey?", "Lookup Type", "ID", "Ckey", "Cancel") switch(lookup_choice) if("ID") - var/lookup_id = input(usr,"Enter Discord ID to lookup ckey") as text + var/lookup_id = input(usr,"Enter Discord ID to lookup ckey") as text|null var/returned_ckey = SSdiscord.lookup_id(lookup_id) if(returned_ckey) var/unlink_choice = alert(usr, "Discord ID [lookup_id] is linked to Ckey [returned_ckey]. Do you wish to unlink or cancel?", "Account Found", "Unlink", "Cancel") @@ -29,7 +29,7 @@ else to_chat(usr, "Discord ID [lookup_id] has no associated ckey") if("Ckey") - var/lookup_ckey = input(usr,"Enter Ckey to lookup ID") as text + var/lookup_ckey = input(usr,"Enter Ckey to lookup ID") as text|null var/returned_id = SSdiscord.lookup_id(lookup_ckey) if(returned_id) to_chat(usr, "Ckey [lookup_ckey] is assigned to Discord ID [returned_id]") diff --git a/code/modules/events/wizard/madness.dm b/code/modules/events/wizard/madness.dm index 6c52dabe202..a88e82013c2 100644 --- a/code/modules/events/wizard/madness.dm +++ b/code/modules/events/wizard/madness.dm @@ -12,7 +12,7 @@ var/suggested = pick(strings(REDPILL_FILE, "redpill_questions")) - forced_secret = (input(usr, "What horrifying truth will you reveal?", "Curse of Madness", suggested) as text) || suggested + forced_secret = (input(usr, "What horrifying truth will you reveal?", "Curse of Madness", suggested) as text|null) || suggested /datum/round_event/wizard/madness/start() var/datum/round_event_control/wizard/madness/C = control diff --git a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm index 1843ad0991e..45345505be2 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm @@ -121,7 +121,10 @@ break if(href_list["portion"]) - portion = CLAMP(input("How much drink do you want to dispense per glass?") as num, 0, 50) + portion = CLAMP(input("How much drink do you want to dispense per glass?") as num|null, 0, 50) + + if (isnull(portion)) + return if(href_list["pour"] || href_list["m_pour"]) if(glasses-- <= 0) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index e0838b189f2..9aed675ac99 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -124,7 +124,11 @@ update_icon() return else - bomb_timer = input(user, "Set the [bomb] timer from [BOMB_TIMER_MIN] to [BOMB_TIMER_MAX].", bomb, bomb_timer) as num + bomb_timer = input(user, "Set the [bomb] timer from [BOMB_TIMER_MIN] to [BOMB_TIMER_MAX].", bomb, bomb_timer) as num|null + + if (isnull(bomb_timer)) + return + bomb_timer = CLAMP(CEILING(bomb_timer / 2, 1), BOMB_TIMER_MIN, BOMB_TIMER_MAX) bomb_defused = FALSE diff --git a/code/modules/mining/abandoned_crates.dm b/code/modules/mining/abandoned_crates.dm index f4a55778c74..fa68421af4b 100644 --- a/code/modules/mining/abandoned_crates.dm +++ b/code/modules/mining/abandoned_crates.dm @@ -154,7 +154,7 @@ /obj/structure/closet/crate/secure/loot/attack_hand(mob/user) if(locked) to_chat(user, "The crate is locked with a Deca-code lock.") - var/input = input(usr, "Enter [codelen] digits. All digits must be unique.", "Deca-Code Lock", "") as text + var/input = input(usr, "Enter [codelen] digits. All digits must be unique.", "Deca-Code Lock", "") as text|null if(user.canUseTopic(src, BE_CLOSE)) var/list/sanitised = list() var/sanitycheck = 1 diff --git a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm index 3357a932f5d..70ae7198ad9 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm @@ -130,7 +130,7 @@ Doesn't work on other aliens/AI.*/ var/mob/living/carbon/M = input("Select who to transfer to:","Transfer plasma to?",null) as mob in aliens_around if(!M) return 0 - var/amount = input("Amount:", "Transfer Plasma to [M]") as num + var/amount = input("Amount:", "Transfer Plasma to [M]") as num|null if (amount) amount = min(abs(round(amount)), user.getPlasma()) if (get_dist(user,M) <= 1) diff --git a/code/modules/mob/living/silicon/ai/say.dm b/code/modules/mob/living/silicon/ai/say.dm index 7081ebf84f6..162ddc1745c 100644 --- a/code/modules/mob/living/silicon/ai/say.dm +++ b/code/modules/mob/living/silicon/ai/say.dm @@ -96,13 +96,13 @@ to_chat(src, "Please wait [DisplayTimeText(announcing_vox - world.time)].") return - var/message = input(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", src.last_announcement) as text - - last_announcement = message + var/message = input(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", src.last_announcement) as text|null if(!message || announcing_vox > world.time) return + last_announcement = message + if(incapacitated()) return diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index 74c4bcecb22..451c1b04371 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -44,7 +44,14 @@ if(!user.is_literate()) to_chat(user, "You scribble illegibly on the cover of [src]!") return - var/n_name = copytext(sanitize(input(user, "What would you like to label the folder?", "Folder Labelling", null) as text), 1, MAX_NAME_LEN) + + var/inputvalue = input(user, "What would you like to label the folder?", "Folder Labelling", null) as text|null + + if (isnull(inputvalue)) + return + + var/n_name = copytext(sanitize(inputvalue), 1, MAX_NAME_LEN) + if(user.canUseTopic(src, BE_CLOSE)) name = "folder[(n_name ? " - '[n_name]'" : null)]" diff --git a/code/modules/photography/camera/camera.dm b/code/modules/photography/camera/camera.dm index 281651252c1..0525c2283af 100644 --- a/code/modules/photography/camera/camera.dm +++ b/code/modules/photography/camera/camera.dm @@ -49,8 +49,16 @@ . += "Alt-click to change its focusing, allowing you to set how big of an area it will capture." /obj/item/camera/proc/adjust_zoom(mob/user) - var/desired_x = input(user, "How high do you want the camera to shoot, between [picture_size_x_min] and [picture_size_x_max]?", "Zoom", picture_size_x) as num - var/desired_y = input(user, "How wide do you want the camera to shoot, between [picture_size_y_min] and [picture_size_y_max]?", "Zoom", picture_size_y) as num + var/desired_x = input(user, "How high do you want the camera to shoot, between [picture_size_x_min] and [picture_size_x_max]?", "Zoom", picture_size_x) as num|null + + if (isnull(desired_x)) + return + + var/desired_y = input(user, "How wide do you want the camera to shoot, between [picture_size_y_min] and [picture_size_y_max]?", "Zoom", picture_size_y) as num|null + + if (isnull(desired_y)) + return + picture_size_x = min(CLAMP(desired_x, picture_size_x_min, picture_size_x_max), CAMERA_PICTURE_SIZE_HARD_LIMIT) picture_size_y = min(CLAMP(desired_y, picture_size_y_min, picture_size_y_max), CAMERA_PICTURE_SIZE_HARD_LIMIT) diff --git a/code/modules/procedural_mapping/mapGenerator.dm b/code/modules/procedural_mapping/mapGenerator.dm index 4c9e1dddead..01a6d7ac471 100644 --- a/code/modules/procedural_mapping/mapGenerator.dm +++ b/code/modules/procedural_mapping/mapGenerator.dm @@ -147,8 +147,16 @@ set category = "Debug" var/datum/mapGenerator/nature/N = new() - var/startInput = input(usr,"Start turf of Map, (X;Y;Z)", "Map Gen Settings", "1;1;1") as text - var/endInput = input(usr,"End turf of Map (X;Y;Z)", "Map Gen Settings", "[world.maxx];[world.maxy];[mob ? mob.z : 1]") as text + var/startInput = input(usr,"Start turf of Map, (X;Y;Z)", "Map Gen Settings", "1;1;1") as text|null + + if (isnull(startInput)) + return + + var/endInput = input(usr,"End turf of Map (X;Y;Z)", "Map Gen Settings", "[world.maxx];[world.maxy];[mob ? mob.z : 1]") as text|null + + if (isnull(endInput)) + return + //maxx maxy and current z so that if you fuck up, you only fuck up one entire z level instead of the entire universe if(!startInput || !endInput) to_chat(src, "Missing Input") diff --git a/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm b/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm index dea77080fab..cb7bc0d6c73 100644 --- a/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm +++ b/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm @@ -30,7 +30,11 @@ beaker = null . = TRUE if("input") - var/input_reagent = replacetext(lowertext(input("Enter the name of any reagent", "Input") as text), " ", "") //95% of the time, the reagent id is a lowercase/no spaces version of the name + var/input_reagent = replacetext(lowertext(input("Enter the name of any reagent", "Input") as text|null), " ", "") //95% of the time, the reagent id is a lowercase/no spaces version of the name + + if (isnull(input_reagent)) + return + if(shortcuts[input_reagent]) input_reagent = shortcuts[input_reagent] else diff --git a/code/modules/shuttle/spaceship_navigation_beacon.dm b/code/modules/shuttle/spaceship_navigation_beacon.dm index c25a5c56853..0704d98b951 100644 --- a/code/modules/shuttle/spaceship_navigation_beacon.dm +++ b/code/modules/shuttle/spaceship_navigation_beacon.dm @@ -42,7 +42,7 @@ obj/machinery/spaceship_navigation_beacon/emp_act() /obj/machinery/spaceship_navigation_beacon/multitool_act(mob/living/user, obj/item/multitool/I) ..() if(panel_open) - var/new_name = "Beacon_[input("Enter the custom name for this beacon", "It be Beacon ..your input..") as text]" + var/new_name = "Beacon_[input("Enter the custom name for this beacon", "It be Beacon ..your input..") as text|null]" if(new_name && Adjacent(user)) name = new_name to_chat(user, "You change beacon name to [name].")