More standard tgui input conversions (#63464)

This commit is contained in:
Jeremiah
2021-12-24 03:04:18 -08:00
committed by GitHub
parent 36e5fcadd3
commit dcab86ba2c
64 changed files with 246 additions and 215 deletions
+1 -1
View File
@@ -100,7 +100,7 @@
drip.vars[slot] = null
if("rename")
var/newname = stripped_input(owner, "What do you want to name this outfit?", OUTFIT_EDITOR_NAME)
var/newname = tgui_input_text(owner, "What do you want to name this outfit?", OUTFIT_EDITOR_NAME)
if(newname)
drip.name = newname
if("save")
+3 -3
View File
@@ -59,7 +59,7 @@
if("rename")
//Modify the metadata
var/old_title = chosen_painting.title
var/new_title = stripped_input(user, "New painting title?", "Painting rename", chosen_painting.title)
var/new_title = tgui_input_text(user, "New painting title?", "Painting Rename", chosen_painting.title)
if(!new_title)
return
chosen_painting.title = new_title
@@ -67,7 +67,7 @@
return TRUE
if("rename_author")
var/old_name = chosen_painting.creator_name
var/new_name = stripped_input(user, "New painting author name?", "Painting rename", chosen_painting.creator_name)
var/new_name = tgui_input_text(user, "New painting author name?", "Painting Rename", chosen_painting.creator_name)
if(!new_name)
return
chosen_painting.creator_name = new_name
@@ -86,7 +86,7 @@
log_admin("[key_name(user)] has removed tag [params["tag"]] from persistent painting made by [chosen_painting.creator_ckey] with id [chosen_painting.md5].")
return TRUE
if("add_tag")
var/tag_name = stripped_input(user, "New tag name?", "???")
var/tag_name = tgui_input_text(user, "New tag name?", "Add Tag")
if(!tag_name)
return
if(!chosen_painting.tags)
+7 -7
View File
@@ -78,7 +78,7 @@
return
var/mob/user = usr
if(href_list["edit_label"])
var/new_label = stripped_input(user, "Choose a new label.", "Sound Emitter")
var/new_label = tgui_input_text(user, "Choose a new label", "Sound Emitter")
if(!new_label)
return
maptext = MAPTEXT(new_label)
@@ -90,7 +90,7 @@
sound_file = new_file
to_chat(user, span_notice("New sound file set to [sound_file]."), confidential = TRUE)
if(href_list["edit_volume"])
var/new_volume = input(user, "Choose a volume.", "Sound Emitter", sound_volume) as null|num
var/new_volume = tgui_input_number(user, "Choose a volume", "Sound Emitter", sound_volume, 100)
if(isnull(new_volume))
return
new_volume = clamp(new_volume, 0, 100)
@@ -99,21 +99,21 @@
if(href_list["edit_mode"])
var/new_mode
var/mode_list = list("Local (normal sound)" = SOUND_EMITTER_LOCAL, "Direct (not affected by environment/location)" = SOUND_EMITTER_DIRECT)
new_mode = input(user, "Choose a new mode.", "Sound Emitter") as null|anything in mode_list
if(!new_mode)
new_mode = tgui_input_list(user, "Choose a new mode", "Sound Emitter", mode_list)
if(isnull(new_mode))
return
motus_operandi = mode_list[new_mode]
to_chat(user, span_notice("Mode set to [motus_operandi]."), confidential = TRUE)
if(href_list["edit_range"])
var/new_range
var/range_list = list("Radius (all mobs within a radius)" = SOUND_EMITTER_RADIUS, "Z-Level (all mobs on the same z)" = SOUND_EMITTER_ZLEVEL, "Global (all players)" = SOUND_EMITTER_GLOBAL)
new_range = input(user, "Choose a new range.", "Sound Emitter") as null|anything in range_list
if(!new_range)
new_range = tgui_input_list(user, "Choose a new range", "Sound Emitter", range_list)
if(isnull(new_range))
return
emitter_range = range_list[new_range]
to_chat(user, span_notice("Range set to [emitter_range]."), confidential = TRUE)
if(href_list["edit_radius"])
var/new_radius = input(user, "Choose a radius.", "Sound Emitter", sound_volume) as null|num
var/new_radius = tgui_input_number(user, "Choose a radius.", "Sound Emitter", sound_volume, 127)
if(isnull(new_radius))
return
new_radius = clamp(new_radius, 0, 127)
+1 -1
View File
@@ -458,7 +458,7 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
if(GLOB.everyone_a_traitor)
tgui_alert(usr, "The everyone is a traitor secret has already been triggered")
return
var/objective = stripped_input(holder, "Enter an objective")
var/objective = tgui_input_text(holder, "Enter an objective", "Objective")
if(!objective)
return
GLOB.everyone_a_traitor = new /datum/everyone_is_a_traitor_controller(objective)
@@ -642,7 +642,7 @@
log_spellbook("[key_name(user)] cast [src] for [cost] points")
SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name)
times++
var/message = stripped_input(user, "Whisper a secret truth to drive your victims to madness.", "Whispers of Madness")
var/message = tgui_input_text(user, "Whisper a secret truth to drive your victims to madness", "Whispers of Madness")
if(!message)
return FALSE
curse_of_madness(user, message)
+1 -1
View File
@@ -273,7 +273,7 @@
/obj/item/canvas/proc/try_rename(mob/user)
if(painting_metadata.loaded_from_json) // No renaming old paintings
return
var/new_name = stripped_input(user,"What do you want to name the painting?")
var/new_name = tgui_input_text(user, "What do you want to name the painting?", "Title Your Masterpiece")
if(new_name != painting_metadata.title && new_name && user.canUseTopic(src, BE_CLOSE))
painting_metadata.title = new_name
var/sign_choice = tgui_alert(user, "Do you want to sign it or remain anonymous?", "Sign painting?", list("Yes", "No"))
@@ -650,7 +650,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
pressure = can_max_release_pressure
. = TRUE
else if(pressure == "input")
pressure = input("New release pressure ([can_min_release_pressure]-[can_max_release_pressure] kPa):", name, release_pressure) as num|null
pressure = tgui_input_number(usr, "New release pressure", "Canister Pressure", release_pressure, can_max_release_pressure, can_min_release_pressure)
if(!isnull(pressure) && !..())
. = TRUE
else if(text2num(pressure) != null)
@@ -703,13 +703,10 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
if("increase")
timer_set = min(maximum_timer_set, timer_set + 10)
if("input")
var/user_input = input(usr, "Set time to valve toggle.", name) as null|num
if(!user_input)
var/user_input = tgui_input_number(usr, "Set time to valve toggle", "Canister Timer", timer_set, maximum_timer_set, minimum_timer_set)
if(isnull(user_input))
return
var/N = text2num(user_input)
if(!N)
return
timer_set = clamp(N,minimum_timer_set,maximum_timer_set)
timer_set = clamp(user_input, minimum_timer_set, maximum_timer_set)
log_admin("[key_name(usr)] has activated a prototype valve timer")
. = TRUE
if("toggle_timer")
+2 -2
View File
@@ -332,10 +332,10 @@
temp_pod.adminNamed = FALSE
temp_pod.setStyle(temp_pod.style) //This resets the name of the pod based on it's current style (see supplypod/setStyle() proc)
return
var/nameInput= input("Custom name", "Enter a custom name", GLOB.podstyles[temp_pod.style][POD_NAME]) as null|text //Gather input for name and desc
var/nameInput= tgui_input_text(usr, "Enter a custom name", "Custom name", GLOB.podstyles[temp_pod.style][POD_NAME], MAX_NAME_LEN) //Gather input for name and desc
if (isnull(nameInput))
return
var/descInput = input("Custom description", "Enter a custom desc", GLOB.podstyles[temp_pod.style][POD_DESC]) as null|text //The GLOB.podstyles is used to get the name, desc, or icon state based on the pod's style
var/descInput = tgui_input_text(usr, "Enter a custom desc", "Custom description", GLOB.podstyles[temp_pod.style][POD_DESC]) //The GLOB.podstyles is used to get the name, desc, or icon state based on the pod's style
if (isnull(descInput))
return
temp_pod.name = nameInput
+1 -1
View File
@@ -238,7 +238,7 @@
var/reason = ""
if(requestonly && !self_paid)
reason = stripped_input("Reason:", name, "")
reason = tgui_input_text(usr, "Reason", name)
if(isnull(reason) || ..())
return
+9 -8
View File
@@ -87,12 +87,13 @@
to_chat(user, span_alert("There is no linked console."))
/obj/item/supplypod_beacon/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/pen)) //give a tag that is visible from the linked express console
var/new_beacon_name = stripped_input(user, "What would you like the tag to be?")
if(!user.canUseTopic(src, BE_CLOSE))
return
if(new_beacon_name)
name += " ([tag])"
return
else
if(!istype(W, /obj/item/pen)) //give a tag that is visible from the linked express console
return ..()
var/new_beacon_name = tgui_input_text(user, "What would you like the tag to be?", "Beacon Tag", max_length = MAX_NAME_LEN)
if(isnull(new_beacon_name))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
name += " ([tag])"
+1 -1
View File
@@ -184,7 +184,7 @@
return ..()
/obj/item/clothing/neck/petcollar/attack_self(mob/user)
tagname = sanitize_name(stripped_input(user, "Would you like to change the name on the tag?", "Name your new pet", "Spot", MAX_NAME_LEN))
tagname = sanitize_name(tgui_input_text(user, "Would you like to change the name on the tag?", "Pet Naming", "Spot", MAX_NAME_LEN))
name = "[initial(name)] - [tagname]"
//////////////
+1 -1
View File
@@ -162,7 +162,7 @@
span_notice("You try to pin [src] on [M]'s chest."))
var/input
if(!commended && user != M)
input = stripped_input(user,"Please input a reason for this commendation, it will be recorded by Nanotrasen.", ,"", 140)
input = tgui_input_text(user, "Reason for this commendation? It will be recorded by Nanotrasen.", "Commendation", max_length = 140)
if(do_after(user, delay, target = M))
if(U.attach_accessory(src, user, 0)) //Attach it, do not notify the user of the attachment
if(user == M)
+21 -16
View File
@@ -21,7 +21,7 @@
)
var/choice = show_radial_menu(user, src, items, null, require_near = TRUE, tooltips = TRUE)
if(choice == "Rename")
var/rename_msg = stripped_input(user, "Rename the Paystand:", "Paystand Naming", name)
var/rename_msg = tgui_input_text(user, "Rename the Paystand", "Paystand Name", name)
if(!rename_msg || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
name = rename_msg
@@ -39,7 +39,7 @@
var/obj/item/card/id/new_card = W
if(!new_card.registered_account)
return
var/msg = stripped_input(user, "Name of pay stand:", "Paystand Naming", "Paystand (owned by [new_card.registered_account.account_holder])")
var/msg = tgui_input_text(user, "Name of pay stand", "Paystand Naming", "Paystand (owned by [new_card.registered_account.account_holder])")
if(!msg)
return
name = msg
@@ -54,7 +54,10 @@
return
var/credit_amount = 0
if(!force_fee)
credit_amount = input(user, "How much would you like to deposit?", "Money Deposit") as null|num
credit_amount = tgui_input_number(user, "How much would you like to deposit?", "Money Deposit")
if(isnull(credit_amount))
return
credit_amount = round(credit_amount)
else
credit_amount = force_fee
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
@@ -75,7 +78,10 @@
return
if(istype(W, /obj/item/holochip))
var/obj/item/holochip/H = W
var/cashmoney = input(user, "How much would you like to deposit?", "Money Deposit") as null|num
var/cashmoney = round(tgui_input_number(user, "How much would you like to deposit?", "Money Deposit"))
if(isnull(cashmoney))
return
cashmoney = round(cashmoney)
if(H.spend(cashmoney, FALSE))
purchase(user, cashmoney)
to_chat(user, "Thanks for purchasing! The vendor has been informed.")
@@ -97,19 +103,18 @@
if(!my_card)
to_chat(user, span_warning("ERROR: No identification card has been assigned to this paystand yet!"))
return
if(!signaler)
var/cash_limit = input(user, "Enter the minimum amount of cash needed to deposit before the signaler is activated.", "Signaler Activation Threshold") as null|num
if(cash_limit < 1)
to_chat(user, span_warning("ERROR: Invalid amount designated."))
return
if(cash_limit)
S.forceMove(src)
signaler = S
signaler_threshold = cash_limit
to_chat(user, "You attach the signaler to the paystand.")
desc += " A signaler appears to be attached to the scanner."
else
if(!isnull(signaler))
to_chat(user, span_warning("A signaler is already attached to this unit!"))
return
var/cash_limit = tgui_input_number(user, "Enter the minimum amount of cash needed to deposit before the signaler is activated.", "Signaler Activation Threshold", 1, min_value = 1)
if(isnull(cash_limit))
return
cash_limit = round(cash_limit)
S.forceMove(src)
signaler = S
signaler_threshold = cash_limit
to_chat(user, "You attach the signaler to the paystand.")
desc += " A signaler appears to be attached to the scanner."
if(default_deconstruction_screwdriver(user, "card_scanner", "card_scanner", W))
return
+2 -2
View File
@@ -70,8 +70,8 @@
if(!user.is_literate())
to_chat(user, span_notice("You scribble illegibly on [src]!"))
return
var/recipient = stripped_input(user, "Who is receiving this valentine?", "To:", null , 20)
var/sender = stripped_input(user, "Who is sending this valentine?", "From:", null , 20)
var/recipient = tgui_input_text(user, "Who is receiving this valentine?", "To:", max_length = MAX_NAME_LEN)
var/sender = tgui_input_text(user, "Who is sending this valentine?", "From:", max_length = MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(recipient && sender)
@@ -214,10 +214,10 @@
if (params["amount"])
desired = text2num(params["amount"])
else
desired = input("How many items?", "How many items would you like to take out?", 1) as null|num
if(!desired)
desired = tgui_input_number(usr, "How many items would you like to take out?", "Release", 1, min_value = 1)
if(isnull(desired))
return FALSE
desired = round(desired)
if(QDELETED(src) || QDELETED(usr) || !usr.Adjacent(src)) // Sanity checkin' in case stupid stuff happens while we wait for input()
return FALSE
+1 -1
View File
@@ -224,7 +224,7 @@
to_chat(user, span_notice("You scribble illegibly on [src]!"))
return
var/obj/item/pizzabox/box = boxes.len ? boxes[boxes.len] : src
box.boxtag += stripped_input(user, "Write on [box]'s tag:", box, "", 30)
box.boxtag += tgui_input_text(user, "Write on [box]'s tag:", box, max_length = 30)
if(!user.canUseTopic(src, BE_CLOSE))
return
to_chat(user, span_notice("You write with [I] on [src]."))
+15 -30
View File
@@ -448,50 +448,35 @@
/obj/item/seeds/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/pen))
var/choice = tgui_input_list(usr, "What would you like to change?", "Seed Alteration", list("Plant Name", "Seed Description", "Product Description"))
if(isnull(choice))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
switch(choice)
if("Plant Name")
var/newplantname = reject_bad_text(stripped_input(user, "Write a new plant name:", name, plantname))
var/newplantname = reject_bad_text(tgui_input_text(user, "Write a new plant name", "Plant Name", plantname, 20))
if(isnull(newplantname))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newplantname) > 20)
to_chat(user, span_warning("That name is too long!"))
return
if(!newplantname)
to_chat(user, span_warning("That name is invalid."))
return
else
name = "[lowertext(newplantname)]"
plantname = newplantname
name = "[lowertext(newplantname)]"
plantname = newplantname
if("Seed Description")
var/newdesc = stripped_input(user, "Write a new description:", name, desc)
var/newdesc = tgui_input_text(user, "Write a new seed description", "Seed Description", desc, 180)
if(isnull(newdesc))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newdesc) > 180)
to_chat(user, span_warning("That description is too long!"))
return
if(!newdesc)
to_chat(user, span_warning("That description is invalid."))
return
else
desc = newdesc
desc = newdesc
if("Product Description")
if(product && !productdesc)
productdesc = initial(product.desc)
var/newproductdesc = stripped_input(user, "Write a new description:", name, productdesc)
var/newproductdesc = tgui_input_text(user, "Write a new product description", "Product Description", productdesc, 180)
if(isnull(newproductdesc))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newproductdesc) > 180)
to_chat(user, span_warning("That description is too long!"))
return
if(!newproductdesc)
to_chat(user, span_warning("That description is invalid."))
return
else
productdesc = newproductdesc
else
return
productdesc = newproductdesc
..() // Fallthrough to item/attackby() so that bags can pick seeds up
+8 -2
View File
@@ -284,7 +284,10 @@
if (params["sheets"])
desired = text2num(params["sheets"])
else
desired = input("How many sheets?", "How many sheets would you like to smelt?", 1) as null|num
desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt")
if(isnull(desired))
return
desired = round(desired)
var/sheets_to_remove = round(min(desired,50,stored_amount))
@@ -331,7 +334,10 @@
if (params["sheets"])
desired = text2num(params["sheets"])
else
desired = input("How many sheets?", "How many sheets would you like to smelt?", 1) as null|num
desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt")
if(isnull(desired))
return
desired = round(desired)
var/amount = round(min(desired,50,smelt_amount))
mat_container.use_materials(alloy.materials, amount)
materials.silo_log(src, "released", -amount, "sheets", alloy.materials)
@@ -102,11 +102,11 @@
var/less_input_message
if(SSlag_switch.measures[DISABLE_DEAD_KEYLOOP])
less_input_message = " - Notice: Observer freelook is currently disabled."
var/this_is_like_playing_right = alert(usr, "Are you sure you wish to observe? You will not be able to play this round![less_input_message]","Player Setup", "Yes", "No")
if(QDELETED(src) || !src.client || this_is_like_playing_right != "Yes")
var/this_is_like_playing_right = tgui_alert(usr, "Are you sure you wish to observe? You will not be able to play this round![less_input_message]", "Observe", "Yes", "No")
if(this_is_like_playing_right != "Yes")
return FALSE
if(QDELETED(src) || !src.client)
ready = PLAYER_NOT_READY
src << browse(null, "window=playersetup") //closes the player setup window
return FALSE
var/mob/dead/observer/observer = new()
+6 -5
View File
@@ -67,13 +67,14 @@ GLOBAL_VAR(posibrain_notify_cooldown)
/obj/item/mmi/posibrain/AltClick(mob/living/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
return
var/input_seed = stripped_input(user, "Enter a personality seed", "Enter seed", ask_role, MAX_NAME_LEN)
var/input_seed = tgui_input_text(user, "Enter a personality seed", "Enter seed", ask_role, MAX_NAME_LEN)
if(isnull(input_seed))
return
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
return
if(input_seed)
to_chat(user, span_notice("You set the personality seed to \"[input_seed]\"."))
ask_role = input_seed
update_appearance()
to_chat(user, span_notice("You set the personality seed to \"[input_seed]\"."))
ask_role = input_seed
update_appearance()
/obj/item/mmi/posibrain/proc/check_success()
searching = FALSE
@@ -274,16 +274,16 @@
if(href_list["add_citation"])
var/maxFine = CONFIG_GET(number/maxfine)
var/t1 = tgui_input_text(usr, "Citation crime", "Security HUD")
var/fine = FLOOR(tgui_input_number(usr, "Citation fine", "Security HUD", 50, max_value = maxFine), 1)
if(!R || !t1 || !fine || !allowed_access)
var/fine = tgui_input_number(usr, "Citation fine", "Security HUD", 50, maxFine, 5)
if(isnull(fine))
return
if(!R || !t1 || !allowed_access)
return
if(!H.canUseHUD())
return
if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD))
return
if(fine < 0)
to_chat(usr, span_warning("You're pretty sure that's not how money works."))
return
fine = round(fine)
fine = min(fine, maxFine)
var/datum/data/crime/crime = GLOB.data_core.createCrimeEntry(t1, "", allowed_access, station_time_timestamp(), fine)
+1 -1
View File
@@ -307,7 +307,7 @@
to_chat(usr, span_alert("[can_evac_or_fail_reason]"))
return
var/reason = input(src, "What is the nature of your emergency? ([CALL_SHUTTLE_REASON_LENGTH] characters required.)", "Confirm Shuttle Call") as null|text
var/reason = tgui_input_text(src, "What is the nature of your emergency? ([CALL_SHUTTLE_REASON_LENGTH] characters required.)", "Confirm Shuttle Call")
if(incapacitated())
return
+1 -1
View File
@@ -87,7 +87,7 @@
to_chat(src, span_notice("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|null
var/message = tgui_input_text(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", src.last_announcement)
if(!message || announcing_vox > world.time)
return
@@ -299,7 +299,7 @@
to_chat(src, "<span class='big bold'>You are a cak!</span><b> You're a harmless cat/cake hybrid that everyone loves. People can take bites out of you if they're hungry, but you regenerate health \
so quickly that it generally doesn't matter. You're remarkably resilient to any damage besides this and it's hard for you to really die at all. You should go around and bring happiness and \
free cake to the station!</b>")
var/new_name = stripped_input(src, "Enter your name, or press \"Cancel\" to stick with Keeki.", "Name Change")
var/new_name = tgui_input_text(src, "Enter your name, or press \"Cancel\" to stick with Keeki.", "Name Change", max_length = MAX_NAME_LEN)
if(new_name)
to_chat(src, span_notice("Your name is now <b>\"new_name\"</b>!"))
name = new_name
@@ -163,7 +163,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
add_atom_colour(guardiancolor, FIXED_COLOUR_PRIORITY)
/mob/living/simple_animal/hostile/guardian/proc/guardianrename()
var/new_name = sanitize_name(reject_bad_text(stripped_input(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN)))
var/new_name = sanitize_name(reject_bad_text(tgui_input_text(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN)))
if(!new_name) //redo proc until we get a good name
to_chat(src, span_warning("Not a valid name, please try again."))
guardianrename()
@@ -393,7 +393,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
/mob/living/simple_animal/hostile/guardian/proc/Communicate()
if(summoner)
var/sender_key = key
var/input = stripped_input(src, "Please enter a message to tell your summoner.", "Guardian", "")
var/input = tgui_input_text(src, "Enter a message to tell your summoner", "Guardian")
if(sender_key != key || !input) //guardian got reset, or did not enter anything
return
@@ -414,7 +414,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
set name = "Communicate"
set category = "Guardian"
set desc = "Communicate telepathically with your guardian."
var/input = stripped_input(src, "Please enter a message to tell your guardian.", "Message", "")
var/input = tgui_input_text(src, "Enter a message to tell your guardian", "Message")
if(!input)
return
@@ -16,7 +16,7 @@
set name = "Set Battlecry"
set category = "Guardian"
set desc = "Choose what you shout as you punch people."
var/input = stripped_input(src,"What do you want your battlecry to be? Max length of 6 characters.", ,"", 7)
var/input = tgui_input_text(src, "What do you want your battlecry to be?", "Battle Cry", max_length = 6)
if(input)
battlecry = input
@@ -172,7 +172,7 @@
to_chat(src, "<span class='big bold'>You are a butter bear!</span><b> You're a mostly harmless bear/butter hybrid that everyone loves. People can take bites out of you if they're hungry, but you regenerate health \
so quickly that it generally doesn't matter. You're remarkably resilient to any damage besides this and it's hard for you to really die at all. You should go around and bring happiness and \
free butter to the station!</b>")
var/new_name = stripped_input(src, "Enter your name, or press \"Cancel\" to stick with Terrygold.", "Name Change")
var/new_name = sanitize_name(tgui_input_text(src, "Enter your name, or press \"Cancel\" to stick with Terrygold.", "Name Change"))
if(new_name)
to_chat(src, span_notice("Your name is now <b>\"new_name\"</b>!"))
name = new_name
@@ -502,7 +502,9 @@
if(!istype(owner, /mob/living/simple_animal/hostile/giant_spider/midwife))
return
var/mob/living/simple_animal/hostile/giant_spider/midwife/spider = owner
spider.directive = stripped_input(spider, "Enter the new directive", "Create directive", "[spider.directive]")
spider.directive = tgui_input_text(spider, "Enter the new directive", "Create directive", "[spider.directive]")
if(isnull(spider.directive))
return
message_admins("[ADMIN_LOOKUPFLW(owner)] set its directive to: '[spider.directive]'.")
log_game("[key_name(owner)] set its directive to: '[spider.directive]'.")
@@ -519,7 +521,7 @@
return TRUE
/datum/action/innate/spider/comm/Trigger()
var/input = stripped_input(owner, "Input a command for your legions to follow.", "Command", "")
var/input = tgui_input_text(owner, "Input a command for your legions to follow.", "Command")
if(QDELETED(src) || !input || !IsAvailable())
return FALSE
spider_command(owner, input)
@@ -214,7 +214,7 @@
* If the name is invalid, will re-prompt the dragon until a proper name is chosen.
*/
/mob/living/simple_animal/hostile/space_dragon/proc/dragon_name()
var/chosen_name = sanitize_name(reject_bad_text(stripped_input(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN)))
var/chosen_name = sanitize_name(reject_bad_text(tgui_input_text(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN)))
if(!chosen_name)
to_chat(src, span_warning("Not a valid name, please try again."))
dragon_name()
@@ -130,7 +130,7 @@
return
if(R.stat == DEAD) //Dead borgs will listen to you no longer
to_chat(usr, span_warning("Error -- Could not open a connection to unit:[R]"))
var/message = stripped_input(usr, message = "Enter message to be sent to remote cyborg.", title = "Send Message")
var/message = tgui_input_text(usr, "Message to be sent to remote cyborg", "Send Message")
if(!message)
return
to_chat(R, "<br><br>[span_notice("Message from [ID] -- \"[message]\"")]<br>")
@@ -221,7 +221,7 @@
var/reason = ""
if((requestonly && !self_paid) || !(card_slot?.GetID()))
reason = stripped_input("Reason:", name, "")
reason = tgui_input_text(usr, "Reason", name)
if(isnull(reason) || ..())
return
+1 -1
View File
@@ -34,7 +34,7 @@
to_chat(user, span_notice("You scribble illegibly on the cover of [src]!"))
return
var/inputvalue = stripped_input(user, "What would you like to label the folder?", "Folder Labelling", "", MAX_NAME_LEN)
var/inputvalue = tgui_input_text(user, "What would you like to label the folder?", "Folder Labelling", max_length = MAX_NAME_LEN)
if(!inputvalue)
return
+1 -1
View File
@@ -72,7 +72,7 @@
if(mode)
to_chat(user, span_notice("You turn on [src]."))
//Now let them chose the text.
var/str = reject_bad_text(tgui_input_text(user, "Label text", "Set Label", max_length = 64))
var/str = reject_bad_text(tgui_input_text(user, "Label text", "Set Label", label, MAX_NAME_LEN))
if(!str)
to_chat(user, span_warning("Invalid text!"))
return
+9 -8
View File
@@ -127,11 +127,12 @@
if(.)
return
var/deg = input(user, "What angle would you like to rotate the pen head to? (1-360)", "Rotate Pen Head") as null|num
if(deg && (deg > 0 && deg <= 360))
degrees = deg
to_chat(user, span_notice("You rotate the top of the pen to [degrees] degrees."))
SEND_SIGNAL(src, COMSIG_PEN_ROTATED, deg, user)
var/deg = tgui_input_number(user, "What angle would you like to rotate the pen head to? (1-360)", "Rotate Pen Head", max_value = 360)
if(isnull(deg))
return
degrees = round(deg)
to_chat(user, span_notice("You rotate the top of the pen to [degrees] degrees."))
SEND_SIGNAL(src, COMSIG_PEN_ROTATED, deg, user)
/obj/item/pen/attack(mob/living/M, mob/user, params)
if(force) // If the pen has a force value, call the normal attack procs. Used for e-daggers and captain's pen mostly.
@@ -147,11 +148,11 @@
. = ..()
//Changing name/description of items. Only works if they have the UNIQUE_RENAME object flag set
if(isobj(O) && proximity && (O.obj_flags & UNIQUE_RENAME))
var/penchoice = tgui_input_list(user, "What would you like to edit?", "Pen Setting", list("Rename","Change description","Reset"))
var/penchoice = tgui_alert(user, "What would you like to edit?", "Pen Setting", list("Rename","Description","Reset"))
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
return
if(penchoice == "Rename")
var/input = stripped_input(user,"What do you want to name [O]?", ,"[O.name]", MAX_NAME_LEN)
var/input = tgui_input_text(user, "What do you want to name [O]?", "Object Name", "[O.name]", MAX_NAME_LEN)
var/oldname = O.name
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
return
@@ -167,7 +168,7 @@
O.renamedByPlayer = TRUE
if(penchoice == "Change description")
var/input = stripped_input(user,"Describe [O] here:", ,"[O.desc]", 140)
var/input = tgui_input_text(user, "Describe [O]", "Description", "[O.desc]", 140)
var/olddesc = O.desc
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
return
+3 -3
View File
@@ -234,9 +234,9 @@
if(can_customise)
customise = tgui_alert(user, "Do you want to customize the photo?", "Customization", list("Yes", "No"))
if(customise == "Yes")
var/name1 = stripped_input(user, "Set a name for this photo, or leave blank. 32 characters max.", "Name", max_length = 32)
var/desc1 = stripped_input(user, "Set a description to add to photo, or leave blank. 128 characters max.", "Caption", max_length = 128)
var/caption = stripped_input(user, "Set a caption for this photo, or leave blank. 256 characters max.", "Caption", max_length = 256)
var/name1 = tgui_input_text(user, "Set a name for this photo, or leave blank.", "Name", max_length = 32)
var/desc1 = tgui_input_text(user, "Set a description to add to photo, or leave blank.", "Description", max_length = 128)
var/caption = tgui_input_text(user, "Set a caption for this photo, or leave blank.", "Caption", max_length = 256)
if(name1)
picture.picture_name = name1
if(desc1)
+2 -2
View File
@@ -66,7 +66,7 @@
if(!user.is_literate())
to_chat(user, span_notice("You scribble illegibly on [src]!"))
return
var/txt = stripped_input(user, "What would you like to write on the back?", "Photo Writing", "", 128)
var/txt = tgui_input_text(user, "What would you like to write on the back?", "Photo Writing", max_length = 128)
if(txt && user.canUseTopic(src, BE_CLOSE))
scribble = txt
else
@@ -97,7 +97,7 @@
set category = "Object"
set src in usr
var/n_name = stripped_input(usr, "What would you like to label the photo?", "Photo Labelling", "", MAX_NAME_LEN)
var/n_name = tgui_input_text(usr, "What would you like to label the photo?", "Photo Labelling", max_length = MAX_NAME_LEN)
//loc.loc check is for making possible renaming photos in clipboards
if(n_name && (loc == usr || loc.loc && loc.loc == usr) && usr.stat == CONSCIOUS && !usr.incapacitated())
name = "photo[(n_name ? text("- '[n_name]'") : null)]"
@@ -13,7 +13,7 @@
|-
"}
var/input_text = stripped_input(usr, "Input a name of a reagent, or a series of reagents split with a comma (no spaces) to get it's wiki table entry", "Recipe") //95% of the time, the reagent type is a lowercase, no spaces / underscored version of the name
var/input_text = tgui_input_text(usr, "Input a name of a reagent, or a series of reagents split with a comma (no spaces) to get it's wiki table entry", "Recipe") //95% of the time, the reagent type is a lowercase, no spaces / underscored version of the name
if(!input_text)
to_chat(usr, "Input was blank!")
return
@@ -329,7 +329,7 @@
if("save_recording")
if(!is_operational)
return
var/name = stripped_input(usr,"Name","What do you want to name this recipe?", "Recipe", MAX_NAME_LEN)
var/name = tgui_input_text(usr, "What do you want to name this recipe?", "Recipe Name", MAX_NAME_LEN)
if(!usr.canUseTopic(src, !issilicon(usr)))
return
if(saved_recipes[name] && tgui_alert(usr, "\"[name]\" already exists, do you want to overwrite it?",, list("Yes", "No")) == "No")
@@ -344,9 +344,9 @@
name_default = reagents.get_master_reagent_name()
if (name_has_units)
name_default += " ([vol_each]u)"
name = stripped_input(usr,
"Name:",
name = tgui_input_text(usr,
"Give it a name!",
"Name",
name_default,
MAX_NAME_LEN)
if(!name || !reagents.total_volume || !src || QDELETED(src) || !usr.canUseTopic(src, !issilicon(usr)))
@@ -321,7 +321,7 @@
beaker_spawn = !beaker_spawn
return TRUE
if("setTargetList")
var/text = stripped_input(usr,"List","Enter a list of Recipe product names separated by commas", "Recipe", MAX_MESSAGE_LEN)
var/text = tgui_input_text(usr, "Enter a list of Recipe product names separated by commas", "Recipe List", multiline = TRUE)
reaction_names = list()
if(!text)
say("Could not find reaction")
@@ -73,7 +73,7 @@
if(!user.is_literate())
to_chat(user, span_notice("You scribble illegibly on the label of [src]!"))
return
var/custom_label = stripped_input(user, "What would you like to label the blood pack?", name, null, 53)
var/custom_label = tgui_input_text(user, "What would you like to label the blood pack?", "Blood Pack", name, MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(user.get_active_held_item() != tool)
+2 -2
View File
@@ -63,7 +63,7 @@
if(!user.is_literate())
to_chat(user, span_notice("You scribble illegibly on the side of [src]!"))
return
var/str = stripped_input(user, "Label text?", "Set label", "", MAX_NAME_LEN)
var/str = tgui_input_text(user, "Label text?", "Set label", max_length = MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!str || !length(str))
@@ -256,7 +256,7 @@
if(!user.is_literate())
to_chat(user, span_notice("You scribble illegibly on the side of [src]!"))
return
var/str = stripped_input(user, "Label text?", "Set label", "", MAX_NAME_LEN)
var/str = tgui_input_text(user, "Label text?", "Set label", max_length = MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!str || !length(str))
@@ -153,7 +153,7 @@ Stabilized extracts:
saved_mind = null
START_PROCESSING(SSobj, src)
if(choice == "Familiar Name")
var/newname = sanitize_name(stripped_input(user, "Would you like to change the name of [mob_name]", "Name change", mob_name, MAX_NAME_LEN))
var/newname = sanitize_name(tgui_input_text(user, "Would you like to change the name of [mob_name]", "Name change", mob_name, MAX_NAME_LEN))
if(newname)
mob_name = newname
to_chat(user, span_notice("You speak softly into [src], and it shakes slightly in response."))
@@ -669,10 +669,10 @@
M.set_nutrition(700)
to_chat(M, span_warning("You absorb the potion and feel your intense desire to feed melt away."))
to_chat(user, span_notice("You feed the slime the potion, removing its hunger and calming it."))
var/newname = sanitize_name(stripped_input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime", MAX_NAME_LEN))
var/newname = sanitize_name(tgui_input_text(user, "Would you like to give the slime a name?", "Name your new pet", "Pet Slime", MAX_NAME_LEN))
if (!newname)
newname = "pet slime"
newname = "Pet Slime"
M.name = newname
M.real_name = newname
qdel(src)
@@ -976,7 +976,7 @@
to_chat(user, span_notice("You offer [src] to [user]..."))
var/new_name = sanitize_name(stripped_input(M, "What would you like your name to be?", "Input a name", M.real_name, MAX_NAME_LEN))
var/new_name = sanitize_name(tgui_input_text(M, "What would you like your name to be?", "Input a name", M.real_name, MAX_NAME_LEN))
if(!new_name || QDELETED(src) || QDELETED(M) || new_name == M.real_name || !M.Adjacent(user))
being_used = FALSE
@@ -23,7 +23,7 @@
if(!istype(trauma))
to_chat(user, span_warning("Something is wrong; Either due a bug or admemes, you are trying to cast this spell without a split personality!"))
return
var/msg = stripped_input(usr, "What would you like to tell your other self?", null , "")
var/msg = tgui_input_text(usr, "What would you like to tell your other self?", "Commune")
if(!msg)
charge_counter = charge_max
return
+1 -1
View File
@@ -418,7 +418,7 @@
* Proc which is used for a swarmer to input a message on a pop-up box, then attempt to send that message to the other swarmers
*/
/mob/living/simple_animal/hostile/swarmer/proc/contact_swarmers()
var/message = stripped_input(src, "Announce to other swarmers", "Swarmer contact")
var/message = tgui_input_text(src, "Announce to other swarmers", "Swarmer contact")
// TODO get swarmers their own colour rather than just boldtext
if(message)
swarmer_chat(message)
+14 -5
View File
@@ -15,7 +15,7 @@
* * encode - Toggling this determines if input is filtered via html_encode. Setting this to FALSE gives raw input.
* * timeout - The timeout of the textbox, after which the modal will close and qdel itself. Set to zero for no timeout.
*/
/proc/tgui_input_text(mob/user, message = null, title = "Text Input", default = null, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = TRUE, timeout = 0)
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = TRUE, timeout = 0)
if (!user)
user = usr
if (!istype(user))
@@ -24,7 +24,7 @@
user = client.mob
else
return
/// Client does NOT have tgui_input on: Returns regular input
// Client does NOT have tgui_input on: Returns regular input
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
if(max_length)
if(multiline)
@@ -54,7 +54,7 @@
* * encode - If toggled, input is filtered via html_encode. Setting this to FALSE gives raw input.
* * callback - The callback to be invoked when a choice is made.
*/
/proc/tgui_input_text_async(mob/user, message = null, title = "Text Input", default = null, max_length = null, multiline = FALSE, encode = TRUE, datum/callback/callback, timeout = 60 SECONDS)
/proc/tgui_input_text_async(mob/user, message = "", title = "Text Input", default, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = TRUE, datum/callback/callback, timeout = 60 SECONDS)
if (!user)
user = usr
if (!istype(user))
@@ -63,6 +63,15 @@
user = client.mob
else
return
// Client does NOT have tgui_input on: Returns regular input
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
if(max_length)
if(multiline)
return stripped_multiline_input(user, message, title, default, max_length)
else
return stripped_input(user, message, title, default, max_length)
else
return input(user, message, title, default)
var/datum/tgui_input_text/async/text_input = new(user, message, title, default, max_length, multiline, encode, callback, timeout)
text_input.ui_interact(user)
@@ -138,7 +147,7 @@
"max_length" = max_length,
"message" = message,
"multiline" = multiline,
"placeholder" = default, /// You cannot use default as a const
"placeholder" = default, // You cannot use default as a const
"preferences" = list(),
"title" = title
)
@@ -179,7 +188,7 @@
* An asynchronous version of tgui_input_text to be used with callbacks instead of waiting on user responses.
*/
/datum/tgui_input_text/async
/// The callback to be invoked by the tgui_input_text upon having a choice made.
// The callback to be invoked by the tgui_input_text upon having a choice made.
var/datum/callback/callback
/datum/tgui_input_text/async/New(mob/user, message, title, default, max_length, multiline, encode, callback, timeout)
@@ -55,7 +55,7 @@
var/obj/item/mecha_parts/mecha_tracking/MT = locate(params["tracker_ref"])
if(!istype(MT))
return
var/message = stripped_input(usr, "Input message", "Transmit message")
var/message = tgui_input_text(usr, "Input message", "Transmit message")
var/obj/vehicle/sealed/mecha/M = MT.chassis
if(trim(message) && M)
to_chat(M.occupants, message)