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
This commit is contained in:
Akrilla
2019-08-21 00:25:41 +01:00
committed by oranges
parent 689cd662ef
commit c5b11dc283
32 changed files with 127 additions and 50 deletions

View File

@@ -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

View File

@@ -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")

View File

@@ -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

View File

@@ -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]")

View File

@@ -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, "<span class='warning'>You're pretty sure that's not how money works.</span>")
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"])

View File

@@ -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("<span class='notice'>[icon2html(src, viewers(src))] timer set for [timer_set] seconds.</span>")

View File

@@ -194,7 +194,10 @@
. = 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
@@ -232,10 +235,9 @@
registered_account.bank_card_talk("<span class='warning'>ERROR: UNABLE TO LOGIN DUE TO SCHEDULED MAINTENANCE. MAINTENANCE IS SCHEDULED TO COMPLETE IN [(registered_account.withdrawDelay - world.time)/10] SECONDS.</span>", 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, "<span class='warning'>You're pretty sure that's not how money works.</span>")
return
if(!alt_click_can_use_id(user))
return

View File

@@ -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")

View File

@@ -104,7 +104,7 @@
to_chat(usr,"<span class='warning'>You [transmit_holder ? "enable" : "disable"] your pAI's [transmitting ? "outgoing" : "incoming"] radio transmissions!</span>")
to_chat(pai,"<span class='warning'>Your owner has [transmit_holder ? "enabled" : "disabled"] your [transmitting ? "outgoing" : "incoming"] radio transmissions!</span>")
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"])

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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")

View File

@@ -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

View File

@@ -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

View File

@@ -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, "<span class='warning'>Discord ID <b>[lookup_id]</b> has no associated ckey</span>")
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, "<span class='notice'>Ckey <b>[lookup_ckey]</b> is assigned to Discord ID <b>[returned_id]</b></span>")

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -154,7 +154,7 @@
/obj/structure/closet/crate/secure/loot/attack_hand(mob/user)
if(locked)
to_chat(user, "<span class='notice'>The crate is locked with a Deca-code lock.</span>")
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

View File

@@ -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)

View File

@@ -96,13 +96,13 @@
to_chat(src, "<span class='notice'>Please wait [DisplayTimeText(announcing_vox - world.time)].</span>")
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

View File

@@ -44,7 +44,14 @@
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the cover of [src]!</span>")
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)]"

View File

@@ -49,8 +49,16 @@
. += "<span class='notice'>Alt-click to change its focusing, allowing you to set how big of an area it will capture.</span>"
/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)

View File

@@ -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")

View File

@@ -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

View File

@@ -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, "<span class='notice'>You change beacon name to [name].</span>")