diff --git a/code/_globalvars/lists/mobs.dm b/code/_globalvars/lists/mobs.dm index 0c28353395d4..fb00d8bdf283 100644 --- a/code/_globalvars/lists/mobs.dm +++ b/code/_globalvars/lists/mobs.dm @@ -35,6 +35,8 @@ GLOBAL_LIST_EMPTY(aiEyes) ///underages who have been reported to security for trying to buy things they shouldn't, so they can't spam GLOBAL_LIST_EMPTY(narcd_underages) +GLOBAL_LIST_EMPTY(real_names_joined) + GLOBAL_LIST_EMPTY(language_datum_instances) GLOBAL_LIST_EMPTY(all_languages) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 6f37de4c4c77..d7865c9d2276 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -291,6 +291,12 @@ if(auth_check) return + if(!client.prefs.randomise[RANDOM_NAME]) // do they have random names enabled + var/name = client.prefs.real_name + if(GLOB.real_names_joined.Find(name)) // is there someone who spawned with the same name + to_chat(usr, "Someone has spawned with this name already.") + return FALSE + var/error = IsJobUnavailable(job, ship, check_playtime) if(error != JOB_AVAILABLE) alert(src, get_job_unavailable_error_message(error, job)) @@ -398,6 +404,7 @@ close_spawn_windows() var/mob/living/carbon/human/H = new(loc) + GLOB.joined_player_list += ckey var/frn = CONFIG_GET(flag/force_random_names) var/admin_anon_names = SSticker.anonymousnames @@ -418,6 +425,7 @@ is_antag = TRUE client.prefs.copy_to(H, antagonist = is_antag) + update_names_joined_list(H.real_name) H.dna.update_dna_identity() if(mind) if(transfer_after) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 44aa701a466d..6e60af7ed244 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1095,6 +1095,14 @@ return LAZYLEN(match_list) return FALSE +/mob/proc/update_joined_player_list(newname, oldname) + if(newname == oldname) + return + if(oldname) + GLOB.joined_player_list -= oldname + if(newname) + GLOB.joined_player_list[newname] = TRUE + /** * Fully update the name of a mob @@ -1110,6 +1118,9 @@ log_played_names(ckey,newname) + if(GLOB.joined_player_list[oldname]) + update_joined_player_list(newname, oldname) + real_name = newname name = newname if(mind) @@ -1195,6 +1206,11 @@ if(client.mouse_override_icon) client.mouse_pointer_icon = client.mouse_override_icon +/mob/proc/update_names_joined_list(new_name, old_name) + if(old_name) + GLOB.real_names_joined -= old_name + if(new_name) + GLOB.real_names_joined[new_name] = TRUE ///This mob is abile to read books /mob/proc/is_literate()