Leaving agent card forge name blank randomizes it (#45805)

About The Pull Request

Leaving the forge name text field blank, or it being invalid for another reason, will randomize it.
Why It's Good For The Game

Leave blank to stop the 30 second thinking about what realistic name to give yourself. QoL change.
Changelog

cl
add: Agents cards randomly assign you a name if you leave the name field blank.
/cl
This commit is contained in:
Akrilla
2019-08-21 11:25:20 +12:00
committed by oranges
parent c2200cd1da
commit ab4011146f
2 changed files with 22 additions and 3 deletions
+1
View File
@@ -4,6 +4,7 @@ GLOBAL_LIST_INIT(wizard_second, world.file2list("strings/names/wizardsecond.txt"
GLOBAL_LIST_INIT(ninja_titles, world.file2list("strings/names/ninjatitle.txt"))
GLOBAL_LIST_INIT(ninja_names, world.file2list("strings/names/ninjaname.txt"))
GLOBAL_LIST_INIT(commando_names, world.file2list("strings/names/death_commando.txt"))
GLOBAL_LIST_INIT(first_names, world.file2list("strings/names/first.txt"))
GLOBAL_LIST_INIT(first_names_male, world.file2list("strings/names/first_male.txt"))
GLOBAL_LIST_INIT(first_names_female, world.file2list("strings/names/first_female.txt"))
GLOBAL_LIST_INIT(last_names, world.file2list("strings/names/last.txt"))
+21 -3
View File
@@ -371,10 +371,28 @@ update_label()
if(user.incapacitated())
return
if(popup_input == "Forge")
var/t = copytext(sanitize_name(input(user, "What name would you like to put on this card?", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name))as text | null),1,26)
if(!t)
var/input_text = input(user, "What name would you like to put on this card? Leave blank to randomise.", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name))as text | null
if (isnull(input_text))
return
registered_name = t
var/t = copytext(sanitize(input_text), 1, 26)
if(!t || t == "Unknown" || t == "floor" || t == "wall" || t == "r-wall") //Same as mob/dead/new_player/prefrences.dm
if (ishuman(user))
var/mob/living/carbon/human/human_agent = user
// Invalid/blank names give a randomly generated one.
if (human_agent.gender == "male")
registered_name = "[pick(GLOB.first_names_male)] [pick(GLOB.last_names)]"
else if (human_agent.gender == "female")
registered_name = "[pick(GLOB.first_names_female)] [pick(GLOB.last_names)]"
else
registered_name = "[pick(GLOB.first_names)] [pick(GLOB.last_names)]"
else
alert ("Invalid name.")
return
else
registered_name = t
var/u = copytext(sanitize(input(user, "What occupation would you like to put on this card?\nNote: This will not grant any access levels other than Maintenance.", "Agent card job assignment", "Assistant")as text | null),1,MAX_MESSAGE_LEN)
if(!u)