diff --git a/code/_globalvars/lists/names.dm b/code/_globalvars/lists/names.dm index d769fd6614a..98ec6b6c7cb 100644 --- a/code/_globalvars/lists/names.dm +++ b/code/_globalvars/lists/names.dm @@ -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")) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 013b1a6cb86..e9eb246c602 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -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)