Skip to content

Commit

Permalink
yippie
Browse files Browse the repository at this point in the history
  • Loading branch information
meemofcourse committed Nov 4, 2023
1 parent 355ff7d commit b41988b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<span class='warning'>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))
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit b41988b

Please sign in to comment.