Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Commit

Permalink
TGUI input box conversions 1 (#63313)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsnow301 authored Dec 11, 2021
1 parent f6d15af commit 1052bc1
Show file tree
Hide file tree
Showing 32 changed files with 81 additions and 79 deletions.
6 changes: 3 additions & 3 deletions code/controllers/subsystem/vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ SUBSYSTEM_DEF(vote)
for(var/valid_map in maps)
choices.Add(valid_map)
if("custom")
question = stripped_input(usr,"What is the vote for?")
question = tgui_input_text(usr, "What is the vote for?", "Custom Vote")
if(!question)
return FALSE
for(var/i in 1 to 10)
var/option = capitalize(stripped_input(usr,"Please enter an option or hit cancel to finish"))
var/option = tgui_input_text(usr, "Please enter an option or hit cancel to finish", "Options", max_length = MAX_NAME_LEN)
if(!option || mode || !usr.client)
break
choices.Add(option)
choices.Add(capitalize(option))
else
return FALSE
mode = vote_type
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/punchcooldown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
INVOKE_ASYNC(src, .proc/do_changewarcry, user)

/datum/component/wearertargeting/punchcooldown/proc/do_changewarcry(mob/user)
var/input = stripped_input(user,"What do you want your battlecry to be? Max length of 6 characters.", ,"", 7)
var/input = tgui_input_text(user, "What do you want your battlecry to be?", "Battle Cry", max_length = 6)
if(!QDELETED(src) && !QDELETED(user) && !user.Adjacent(parent))
return
if(input)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/elements/spooky.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
change_name(H) //time for a new name!

/datum/element/spooky/proc/change_name(mob/living/carbon/human/H)
var/t = sanitize_name(stripped_input(H, "Enter your new skeleton name", H.real_name, null, MAX_NAME_LEN))
var/t = sanitize_name(tgui_input_text(H, "Enter your new skeleton name", "Spookifier", H.real_name, MAX_NAME_LEN))
if(!t)
t = "spooky skeleton"
H.fully_replace_character_name(null, t)
2 changes: 1 addition & 1 deletion code/game/machinery/computer/arena.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
log_admin("[key_name(user)] uploaded new event arena: [friendly_name].")

/obj/machinery/computer/arena/proc/load_team(user,team)
var/rawteam = stripped_multiline_input(user,"Enter team list (ckeys separated by newline)")
var/rawteam = tgui_input_text(user, "Enter team list (ckeys separated by newline)", "Team List", multiline = TRUE)
for(var/i in splittext(rawteam,"\n"))
var/key = ckey(i)
if(!i)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/dna_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@
var/datum/mutation/human/target_mutation = get_mut_by_ref(bref, search_flags)

// Prompt for modifier string
var/new_sequence_input = input(usr, "Enter replacement sequence (or nothing to cancel)", "Replace inherent gene","")
var/new_sequence_input = tgui_input_text(usr, "Enter a replacement sequence", "Inherent Gene Replacement", 32, encode = FALSE)
// Drop out if the string is the wrong length
if(length(new_sequence_input) != 32)
return
Expand Down
12 changes: 6 additions & 6 deletions code/game/machinery/newscaster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30)
usr.set_machine(src)
scan_user(usr)
if(href_list["set_channel_name"])
channel_name = stripped_input(usr, "Provide a Feed Channel Name", "Network Channel Handler", "", MAX_NAME_LEN)
channel_name = tgui_input_text(usr, "Provide a Feed Channel Name", "Network Channel Handler", max_length = MAX_NAME_LEN)
updateUsrDialog()
else if(href_list["set_channel_lock"])
c_locked = !c_locked
Expand Down Expand Up @@ -556,7 +556,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30)
channel_name = input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in sort_list(available_channels)
updateUsrDialog()
else if(href_list["set_new_message"])
var/temp_message = trim(stripped_multiline_input(usr, "Write your Feed story", "Network Channel Handler", msg))
var/temp_message = tgui_input_text(usr, "Write your Feed story", "Network Channel Handler", msg, multiline = TRUE)
if(temp_message)
msg = temp_message
updateUsrDialog()
Expand Down Expand Up @@ -601,10 +601,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30)
screen = 14
updateUsrDialog()
else if(href_list["set_wanted_name"])
channel_name = stripped_input(usr, "Provide the name of the Wanted person", "Network Security Handler")
channel_name = tgui_input_text(usr, "Provide the name of the wanted person", "Network Security Handler", max_length = MAX_NAME_LEN)
updateUsrDialog()
else if(href_list["set_wanted_desc"])
msg = stripped_input(usr, "Provide a description of the Wanted person and any other details you deem important", "Network Security Handler")
msg = tgui_input_text(usr, "Provide a description of the wanted person and any other details you deem important", "Network Security Handler", multiline = TRUE)
updateUsrDialog()
else if(href_list["submit_wanted"])
var/input_param = text2num(href_list["submit_wanted"])
Expand Down Expand Up @@ -693,7 +693,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30)
updateUsrDialog()
else if(href_list["new_comment"])
var/datum/newscaster/feed_message/FM = locate(href_list["new_comment"]) in viewing_channel.messages
var/cominput = stripped_input(usr, "Write your message:", "New comment", null, 140)
var/cominput = tgui_input_text(usr, "Write your message", "New comment", max_length = 140, multiline = TRUE)
if(cominput)
scan_user(usr)
var/datum/newscaster/feed_comment/FC = new/datum/newscaster/feed_comment
Expand Down Expand Up @@ -1027,7 +1027,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30)
if(scribble_page == curr_page)
to_chat(user, span_warning("There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?"))
else
var/s = stripped_input(user, "Write something", "Newspaper")
var/s = tgui_input_text(user, "Write something", "Newspaper")
if (!s)
return
if(!user.canUseTopic(src, BE_CLOSE))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/syndicatebomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
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|null
var/new_timer = tgui_input_number(user, "Set the timer", "Countdown", timer_set, maximum_timer, minimum_timer)

if (isnull(new_timer))
return
Expand Down
18 changes: 8 additions & 10 deletions code/game/machinery/telecomms/computers/message.dm
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
auth = FALSE
screen = MSG_MON_SCREEN_MAIN
else
var/dkey = trim(input(usr, "Please enter the decryption key.") as text|null)
var/dkey = tgui_input_text(usr, "Please enter the decryption key", "Telecomms Decryption")
if(dkey && dkey != "")
if(linkedServer.decryptkey == dkey)
auth = TRUE
Expand All @@ -289,7 +289,7 @@
message_servers += M

if(message_servers.len > 1)
linkedServer = input(usr, "Please select a server.", "Select a server.", null) as null|anything in message_servers
linkedServer = tgui_input_list(usr, "Please select a server", "Server Selection", message_servers)
message = span_alert("NOTICE: Server selected.")
else if(message_servers.len > 0)
linkedServer = message_servers[1]
Expand Down Expand Up @@ -323,14 +323,12 @@
if(LINKED_SERVER_NONRESPONSIVE)
message = noserver
else if(auth)
var/dkey = stripped_input(usr, "Please enter the decryption key.")
var/dkey = tgui_input_text(usr, "Please enter the decryption key", "Telecomms Decryption")
if(dkey && dkey != "")
if(linkedServer.decryptkey == dkey)
var/newkey = stripped_input(usr,"Please enter the new key (3 - 16 characters max):")
var/newkey = tgui_input_text(usr, "Please enter the new key (3 - 16 characters max)", "New Key", 16)
if(length(newkey) <= 3)
message = span_notice("NOTICE: Decryption key too short!")
else if(length(newkey) > 16)
message = span_notice("NOTICE: Decryption key too long!")
else if(newkey && newkey != "")
linkedServer.decryptkey = newkey
message = span_notice("NOTICE: Decryption key set.")
Expand Down Expand Up @@ -384,24 +382,24 @@

//Select Your Name
if("Sender")
customsender = stripped_input(usr, "Please enter the sender's name.") || customsender
customsender = tgui_input_text(usr, "Please enter the sender's name.", "Sender") || customsender

//Select Receiver
if("Recepient")
//Get out list of viable PDAs
var/list/obj/item/pda/sendPDAs = get_viewable_pdas()
if(GLOB.PDAs && GLOB.PDAs.len > 0)
customrecepient = input(usr, "Select a PDA from the list.") as null|anything in sendPDAs
customrecepient = tgui_input_list(usr, "Select a PDA from the list", "PDA Selection", sendPDAs)
else
customrecepient = null

//Enter custom job
if("RecJob")
customjob = stripped_input(usr, "Please enter the sender's job.") || customjob
customjob = tgui_input_text(usr, "Please enter the sender's job.", "Job") || customjob

//Enter message
if("Message")
custommessage = stripped_input(usr, "Please enter your message.") || custommessage
custommessage = tgui_input_text(usr, "Please enter your message.", "Message") || custommessage

//Send message
if("Send")
Expand Down
14 changes: 5 additions & 9 deletions code/game/machinery/telecomms/computers/telemonitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,12 @@

if(href_list["network"])

var/newnet = stripped_input(usr, "Which network do you want to view?", "Comm Monitor", network)
var/newnet = tgui_input_text(usr, "Which network do you want to view?", "Comm Monitor", network, 15)
if(newnet && ((usr in range(1, src)) || issilicon(usr)))
if(length(newnet) > 15)
temp = "<font color = #D70B00>- FAILED: NETWORK TAG STRING TOO LENGHTLY -</font color>"

else
network = newnet
screen = 0
machinelist = list()
temp = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -</font color>"
network = newnet
screen = 0
machinelist = list()
temp = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -</font color>"

updateUsrDialog()
return
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/items/charter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
to_chat(user, span_warning("You're still waiting for approval from your employers about your proposed name change, it'd be best to wait for now."))
return

var/new_name = stripped_input(user, message="What do you want to name \
var/new_name = tgui_input_text(user, "What do you want to name \
[station_name()]? Keep in mind particularly terrible names may be \
rejected by your employers, while names using the standard format, \
will automatically be accepted.", max_length=MAX_CHARTER_LEN)
rejected by your employers, while names using the standard format \
will be accepted automatically.", "Station Name", max_length = MAX_CHARTER_LEN)

if(response_timer_id)
to_chat(user, span_warning("You're still waiting for approval from your employers about your proposed name change, it'd be best to wait for now."))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/PDA/PDA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ GLOBAL_LIST_EMPTY(PDAs)
//NOTEKEEPER FUNCTIONS===================================

if ("Edit")
var/n = stripped_multiline_input(U, "Please enter message", name, note)
var/n = tgui_input_text(U, "Please enter message", name, note, multiline = TRUE)
if (in_range(src, U) && loc == U)
if (ui_mode == PDA_UI_NOTEKEEPER && n)
note = n
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/paicard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
to_chat(pai, span_notice("You have been bound to a new master."))
pai.emittersemicd = FALSE
if("set_laws")
var/newlaws = stripped_multiline_input(usr, "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], MAX_MESSAGE_LEN)
var/newlaws = tgui_input_text(usr, "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], MAX_MESSAGE_LEN, TRUE)
if(newlaws && pai)
pai.add_supplied_law(0,newlaws)
if("toggle_holo")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/grenades/chem_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
/obj/item/grenade/chem_grenade/adv_release/multitool_act(mob/living/user, obj/item/tool)
if (active)
return
var/newspread = text2num(stripped_input(user, "Please enter a new spread amount", name))
var/newspread = tgui_input_number(user, "Please enter a new spread amount", name)
if (newspread != null && user.canUseTopic(src, BE_CLOSE))
newspread = round(newspread)
unit_spread = clamp(newspread, 5, 100)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
return ..()

if(weapon.tool_behaviour == TOOL_MULTITOOL)
var/newtime = text2num(stripped_input(user, "Please enter a new detonation time", name))
var/newtime = tgui_input_number(user, "Please enter a new detonation time", name)
if (newtime != null && user.canUseTopic(src, BE_CLOSE))
if(change_det_time(newtime))
to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)]."))
Expand Down
3 changes: 1 addition & 2 deletions code/game/objects/items/stacks/stack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,7 @@
if(is_zero_amount(delete_if_zero = TRUE))
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
var/max = get_amount()
var/stackmaterial = round(input(user, "How many sheets do you wish to take out of this stack? (Maximum [max])", "Stack Split") as null|num)
max = get_amount()
var/stackmaterial = round(tgui_input_number(user, "How many sheets do you wish to take out of this stack?", "Stack Split", max_value = max))
stackmaterial = min(max, stackmaterial)
if(stackmaterial == null || stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return SECONDARY_ATTACK_CONTINUE_CHAIN
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/votingbox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
ui_interact(user)

/obj/structure/votebox/proc/set_description(mob/user)
var/new_description = stripped_multiline_input(user,"Enter new description","Vote Description",vote_description)
var/new_description = tgui_input_text(user, "Enter a new description", "Vote Description", vote_description, multiline = TRUE)
if(new_description)
vote_description = new_description

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
set category = "Admin.Events"
set name = "OSay"
set desc = "Makes an object say something."
var/message = input(usr, "What do you want the message to be?", "Make Sound") as text | null
var/message = tgui_input_text(usr, "What do you want the message to be?", "Make Sound", encode = FALSE)
if(!message)
return
O.say(message, sanitize = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/_common/antag_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ GLOBAL_LIST_EMPTY(antagonists)
return

/datum/antagonist/proc/edit_memory(mob/user)
var/new_memo = stripped_multiline_input(user, "Write new memory", "Memory", antag_memory, MAX_MESSAGE_LEN)
var/new_memo = tgui_input_text(user, "Write a new memory", "Antag Memory", antag_memory, multiline = TRUE)
if (isnull(new_memo))
return
antag_memory = new_memo
Expand Down
4 changes: 2 additions & 2 deletions code/modules/antagonists/brainwashing/brainwashing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
return
var/list/objectives = list()
do
var/objective = stripped_input(admin, "Add an objective, or leave empty to finish.", "Brainwashing", null, MAX_MESSAGE_LEN)
var/objective = tgui_input_text(admin, "Add an objective", "Brainwashing")
if(objective)
objectives += objective
while(tgui_alert(admin,"Add another objective?","More Brainwashing",list("Yes","No")) == "Yes")
while(tgui_alert(admin, "Add another objective?", "More Brainwashing", list("Yes","No")) == "Yes")

if(tgui_alert(admin,"Confirm Brainwashing?","Are you sure?",list("Yes","No")) == "No")
return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/cult/cult_comms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
button_icon_state = "cult_comms"

/datum/action/innate/cult/comm/Activate()
var/input = stripped_input(usr, "Please choose a message to tell to the other acolytes.", "Voice of Blood", "")
var/input = tgui_input_text(usr, "Message to tell to the other acolytes", "Voice of Blood")
if(!input || !IsAvailable())
return

Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/nukeop/nukeop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@

/datum/antagonist/nukeop/leader/proc/ask_name()
var/randomname = pick(GLOB.last_names)
var/newname = stripped_input(owner.current,"You are the nuke operative [title]. Please choose a last name for your family.", "Name change",randomname)
var/newname = tgui_input_text(owner.current, "You are the nuclear operative [title]. Please choose a last name for your family.", "Name change", randomname, MAX_NAME_LEN)
if (!newname)
newname = randomname
else
Expand Down
10 changes: 5 additions & 5 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@

if(href_list["add_citation"])
var/maxFine = CONFIG_GET(number/maxfine)
var/t1 = stripped_input("Please input citation crime:", "Security HUD", "", null)
var/fine = FLOOR(input("Please input citation fine, up to [maxFine]:", "Security HUD", 50) as num|null, 1)
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)
return
if(!H.canUseHUD())
Expand Down Expand Up @@ -305,7 +305,7 @@
return

if(href_list["add_crime"])
var/t1 = stripped_input("Please input crime name:", "Security HUD", "", null)
var/t1 = tgui_input_text(usr, "Crime name", "Security HUD")
if(!R || !t1 || !allowed_access)
return
if(!H.canUseHUD())
Expand All @@ -319,7 +319,7 @@
return

if(href_list["add_details"])
var/t1 = stripped_input(usr, "Please input crime details:", "Secure. records", "", null)
var/t1 = tgui_input_text(usr, "Crime details", "Security Records", multiline = TRUE)
if(!R || !t1 || !allowed_access)
return
if(!H.canUseHUD())
Expand All @@ -346,7 +346,7 @@
return

if(href_list["add_comment"])
var/t1 = stripped_multiline_input("Add Comment:", "Secure. records", null, null)
var/t1 = tgui_input_text(usr, "Add a comment", "Security Records", multiline = TRUE)
if (!R || !t1 || !allowed_access)
return
if(!H.canUseHUD())
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/bot/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
return

/obj/item/bot_assembly/proc/rename_bot()
var/t = sanitize_name(stripped_input(usr, "Enter new robot name", name, created_name,MAX_NAME_LEN), allow_numbers = TRUE)
var/t = sanitize_name(tgui_input_text(usr, "Enter a new robot name", "Robot Rename", created_name, MAX_NAME_LEN), allow_numbers = TRUE)
if(!t)
return
if(!in_range(src, usr) && loc != usr)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/bot/mulebot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
if("setid")
var/new_id
if(pda)
new_id = stripped_input(user, "Enter ID:", name, id, MAX_NAME_LEN)
new_id = tgui_input_text(user, "Enter ID", "ID Assignment", id, MAX_NAME_LEN)
else
new_id = params["value"]
if(new_id)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/paperwork/handlabeler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
if(mode)
to_chat(user, span_notice("You turn on [src]."))
//Now let them chose the text.
var/str = reject_bad_text(stripped_input(user, "Label text?", "Set label","", MAX_NAME_LEN))
if(!str || !length(str))
var/str = reject_bad_text(tgui_input_text(user, "Label text", "Set Label", max_length = 64))
if(!str)
to_chat(user, span_warning("Invalid text!"))
return
label = str
Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/paper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
H.damageoverlaytemp = 9001
H.update_damage_hud()
return
var/n_name = stripped_input(usr, "What would you like to label the paper?", "Paper Labelling", null, MAX_NAME_LEN)
var/n_name = tgui_input_text(usr, "Enter a paper label", "Paper Labelling", max_length = MAX_NAME_LEN)
if(((loc == usr || istype(loc, /obj/item/clipboard)) && usr.stat == CONSCIOUS))
name = "paper[(n_name ? text("- '[n_name]'") : null)]"
add_fingerprint(usr)
Expand Down
Loading

0 comments on commit 1052bc1

Please sign in to comment.