From 9306d01f6fffee576116762f168ea6db1de8e07a Mon Sep 17 00:00:00 2001 From: AnturK Date: Thu, 25 Oct 2018 20:39:51 +0200 Subject: [PATCH] Adds old name tracking to player panel, cleans up some name assignments. --- code/game/objects/items/robot/robot_parts.dm | 17 ++++++----- .../objects/structures/ghost_role_spawners.dm | 12 ++++---- code/modules/admin/player_panel.dm | 28 +++++++++---------- code/modules/admin/topic.dm | 2 +- code/modules/client/player_details.dm | 15 +++++++++- code/modules/jobs/job_types/silicon.dm | 2 +- code/modules/mob/login.dm | 1 + code/modules/mob/mob.dm | 5 ++++ code/modules/mob/transform_procs.dm | 14 ++++++---- 9 files changed, 59 insertions(+), 37 deletions(-) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 7f6c192c95d..1ab381edc1d 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -295,12 +295,6 @@ SSticker.mode.remove_antag_for_borging(BM.mind) if(!istype(M.laws, /datum/ai_laws/ratvar)) remove_servant_of_ratvar(BM, TRUE) - BM.mind.transfer_to(O) - - if(O.mind && O.mind.special_role) - O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.") - to_chat(O, "You have been robotized!") - to_chat(O, "You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.") O.job = "Cyborg" @@ -311,7 +305,16 @@ if(O.mmi) //we delete the mmi created by robot/New() qdel(O.mmi) O.mmi = W //and give the real mmi to the borg. - O.updatename() + + O.updatename(BM.client) + + BM.mind.transfer_to(O) + + if(O.mind && O.mind.special_role) + O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.") + to_chat(O, "You have been robotized!") + to_chat(O, "You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.") + SSblackbox.record_feedback("amount", "cyborg_birth", 1) forceMove(O) O.robot_suit = src diff --git a/code/game/objects/structures/ghost_role_spawners.dm b/code/game/objects/structures/ghost_role_spawners.dm index 6f5e7100672..864ecd10455 100644 --- a/code/game/objects/structures/ghost_role_spawners.dm +++ b/code/game/objects/structures/ghost_role_spawners.dm @@ -19,7 +19,7 @@ /obj/effect/mob_spawn/human/seed_vault/special(mob/living/new_spawn) var/plant_name = pick("Tomato", "Potato", "Broccoli", "Carrot", "Ambrosia", "Pumpkin", "Ivy", "Kudzu", "Banana", "Moss", "Flower", "Bloom", "Root", "Bark", "Glowshroom", "Petal", "Leaf", \ "Venus", "Sprout","Cocoa", "Strawberry", "Citrus", "Oak", "Cactus", "Pepper", "Juniper") - new_spawn.real_name = plant_name + new_spawn.fully_replace_character_name(null,plant_name) if(ishuman(new_spawn)) var/mob/living/carbon/human/H = new_spawn H.underwear = "Nude" //You're a plant, partner @@ -49,7 +49,7 @@ assignedrole = "Ash Walker" /obj/effect/mob_spawn/human/ash_walker/special(mob/living/new_spawn) - new_spawn.real_name = random_unique_lizard_name(gender) + new_spawn.fully_replace_character_name(null,random_unique_lizard_name(gender)) to_chat(new_spawn, "Drag the corpses of men and beasts to your nest. It will absorb them to create more of your kind. Glory to the Necropolis!") new_spawn.grant_language(/datum/language/draconic) @@ -92,7 +92,7 @@ return ..() /obj/effect/mob_spawn/human/exile/special(mob/living/new_spawn) - new_spawn.real_name = "Wish Granter's Victim ([rand(1,999)])" + new_spawn.fully_replace_character_name(null,"Wish Granter's Victim ([rand(1,999)])") var/wish = rand(1,4) switch(wish) if(1) @@ -274,8 +274,7 @@ assignedrole = "Escaped Prisoner" /obj/effect/mob_spawn/human/prisoner_transport/special(mob/living/L) - L.real_name = "NTP #LL-0[rand(111,999)]" //Nanotrasen Prisoner #Lavaland-(numbers) - L.name = L.real_name + L.fully_replace_character_name(null,"NTP #LL-0[rand(111,999)]") //Nanotrasen Prisoner #Lavaland-(numbers) /obj/effect/mob_spawn/human/prisoner_transport/Initialize(mapload) . = ..() @@ -370,8 +369,7 @@ /obj/effect/mob_spawn/human/demonic_friend/special(mob/living/L) if(!QDELETED(owner.current) && owner.current.stat != DEAD) - L.real_name = "[owner.name]'s best friend" - L.name = L.real_name + L.fully_replace_character_name(null,"[owner.name]'s best friend") soullink(/datum/soullink/oneway, owner.current, L) spell.friend = L spell.charge_counter = spell.charge_max diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 03bd08f750a..63371d4d55e 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -2,7 +2,7 @@ if(!check_rights()) return log_admin("[key_name(usr)] checked the player panel.") - var/dat = "Player Panel" + var/dat = "Player Panel" //javascript, the part that does most of the work~ dat += {" @@ -38,14 +38,10 @@ } var ltd = tr.getElementsByTagName("td"); var td = ltd\[0\]; - var lsearch = td.getElementsByTagName("b"); + var lsearch = td.getElementsByClassName("filter_data"); var search = lsearch\[0\]; - //var inner_span = li.getElementsByTagName("span")\[1\] //Should only ever contain one element. - //document.write("

"+search.innerText+"
"+filter+"
"+search.innerText.indexOf(filter)) if ( search.innerText.toLowerCase().indexOf(filter) == -1 ) { - //document.write("a"); - //ltr.removeChild(tr); td.innerHTML = ""; i--; } @@ -61,7 +57,7 @@ } - function expand(id,job,name,real_name,image,key,ip,antagonist,ref){ + function expand(id,job,name,real_name,old_names,key,ip,antagonist,ref){ clearAll(); @@ -72,7 +68,7 @@ body += ""; - body += ""+job+" "+name+"
Real name "+real_name+"
Played by "+key+" ("+ip+")
" + body += ""+job+" "+name+"
Real name "+real_name+"
Played by "+key+" ("+ip+")
Old names :"+old_names+"
"; body += ""; @@ -102,7 +98,7 @@ var id = span.getAttribute("id"); - if(!(id.indexOf("item")==0)) + if(!id || !(id.indexOf("item")==0)) continue; var pass = 1; @@ -147,9 +143,6 @@ locked_tabs.push(id); var notice_span = document.getElementById(notice_span_id); notice_span.innerHTML = "Locked "; - //link.setAttribute("onClick","attempt('"+id+"','"+link_id+"','"+notice_span_id+"');"); - //document.write("removeFromLocked('"+id+"','"+link_id+"','"+notice_span_id+"')"); - //document.write("aa - "+link.getAttribute("onClick")); } function attempt(ab){ @@ -172,8 +165,6 @@ locked_tabs\[index\] = ""; var notice_span = document.getElementById(notice_span_id); notice_span.innerHTML = ""; - //var link = document.getElementById(link_id); - //link.setAttribute("onClick","addToLocked('"+id+"','"+link_id+"','"+notice_span_id+"')"); } function selectTextField(){ @@ -277,6 +268,12 @@ var/M_name = html_encode(M.name) var/M_rname = html_encode(M.real_name) var/M_key = html_encode(M.key) + var/previous_names = "" + if(M_key) + var/datum/player_details/P = GLOB.player_details[ckey(M_key)] + if(P) + previous_names = P.played_names.Join(",") + previous_names = html_encode(previous_names) //output for each mob dat += {" @@ -285,9 +282,10 @@ [M_name] - [M_rname] - [M_key] ([M_job]) +
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index cfc8c0c343e..2cabf0960fc 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1602,7 +1602,7 @@ message_admins("Admin [key_name_admin(usr)] AIized [key_name_admin(H)]!") log_admin("[key_name(usr)] AIized [key_name(H)].") - H.AIize() + H.AIize(H.client) else if(href_list["makealien"]) if(!check_rights(R_SPAWN)) diff --git a/code/modules/client/player_details.dm b/code/modules/client/player_details.dm index 814000ce488..7dbfbe8c1ec 100644 --- a/code/modules/client/player_details.dm +++ b/code/modules/client/player_details.dm @@ -3,4 +3,17 @@ var/list/logging = list() var/list/post_login_callbacks = list() var/list/post_logout_callbacks = list() - var/byond_version = "Unknown" \ No newline at end of file + var/list/played_names = list() //List of names this key played under this round + var/byond_version = "Unknown" + +/proc/log_played_names(ckey, ...) + if(!ckey) + return + if(args.len < 2) + return + var/list/names = args.Copy(2) + var/datum/player_details/P = GLOB.player_details[ckey] + if(P) + for(var/name in names) + if(name) + P.played_names |= name diff --git a/code/modules/jobs/job_types/silicon.dm b/code/modules/jobs/job_types/silicon.dm index 50b81d93d67..fd5e02f705b 100644 --- a/code/modules/jobs/job_types/silicon.dm +++ b/code/modules/jobs/job_types/silicon.dm @@ -18,7 +18,7 @@ AI var/do_special_check = TRUE /datum/job/ai/equip(mob/living/carbon/human/H, visualsOnly, announce, latejoin, datum/outfit/outfit_override, client/preference_source = null) - . = H.AIize(latejoin) + . = H.AIize(latejoin,preference_source) /datum/job/ai/after_spawn(mob/H, mob/M, latejoin) . = ..() diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 71c90454166..97c8ce15397 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -50,5 +50,6 @@ for(var/foo in client.player_details.post_login_callbacks) var/datum/callback/CB = foo CB.Invoke() + log_played_names(client.ckey,name,real_name) log_message("Client [key_name(src)] has taken ownership of mob [src]([src.type])", LOG_OWNERSHIP) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 4308c96bdeb..09a59cc08ea 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -800,10 +800,15 @@ log_message("[src] name changed from [oldname] to [newname]", LOG_OWNERSHIP) if(!newname) return 0 + + log_played_names(ckey,newname) + real_name = newname name = newname if(mind) mind.name = newname + if(mind.key) + log_played_names(mind.key,newname) //Just in case the mind is unsynced at the moment. if(oldname) //update the datacore records! This is goig to be a bit costly. diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 182e9ade944..6d1ddd41bd8 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -301,7 +301,7 @@ qdel(src) -/mob/living/carbon/human/AIize() +/mob/living/carbon/human/AIize(transfer_after = TRUE, client/preference_source) if (notransform) return for(var/t in bodyparts) @@ -309,7 +309,7 @@ return ..() -/mob/living/carbon/AIize() +/mob/living/carbon/AIize(transfer_after = TRUE, client/preference_source) if (notransform) return notransform = TRUE @@ -321,7 +321,7 @@ invisibility = INVISIBILITY_MAXIMUM return ..() -/mob/proc/AIize(transfer_after = TRUE) +/mob/proc/AIize(transfer_after = TRUE, client/preference_source) var/list/turf/landmark_loc = list() for(var/obj/effect/landmark/start/ai/sloc in GLOB.landmarks_list) if(locate(/mob/living/silicon/ai) in sloc.loc) @@ -348,6 +348,9 @@ . = new /mob/living/silicon/ai(pick(landmark_loc), null, src) + if(preference_source) + apply_pref_name("ai",preference_source) + qdel(src) /mob/living/carbon/human/proc/Robotize(delete_items = 0, transfer_after = TRUE) @@ -372,6 +375,9 @@ R.gender = gender R.invisibility = 0 + if(client) + R.updatename(client) + if(mind) //TODO if(!transfer_after) mind.active = FALSE @@ -379,8 +385,6 @@ else if(transfer_after) R.key = key - R.apply_pref_name("cyborg") - if(R.mmi) R.mmi.name = "[initial(R.mmi.name)]: [real_name]" if(R.mmi.brain)