From b5a7415c7f3a0478457d3b1aa7197dfea34abc72 Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Mon, 30 Apr 2012 08:43:54 +0000 Subject: [PATCH] Renaming mobs by clicking the big name at the top of the view-variables screen now updates real_name too. Additionally, if the mob is human, the first ID and PDA found in the mob's contents which is associated with the original name, will have their details updated. Nomore having to edit like, 6 variables everytime somebody names themself "dicks", "sanic" or "captain" ... etc. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3533 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/datumvars.dm | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 64767dc7ff0..de609d10d9f 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -167,10 +167,10 @@ client if(istype(D,/atom)) var/atom/A = D - body += "[D]" - if(A.dir) - body += "
<< [dir2text(A.dir)] >>" if(ismob(A)) + body += "[D]" + if(A.dir) + body += "
<< [dir2text(A.dir)] >>" var/mob/M = A body += "
[M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" body += {" @@ -185,6 +185,10 @@ client "} + else + body += "[D]" + if(A.dir) + body += "
<< [dir2text(A.dir)] >>" else body += "[D]" @@ -389,6 +393,30 @@ client if (href_list["Vars"]) debug_variables(locate(href_list["Vars"])) + + //~CARN: for renaming mobs (updates their real_name and their ID/PDA if applicable). + else if (href_list["rename"]) + var/new_name = input(usr,"What would you like to name this mob?","Input a name") as text|null + if(!new_name) return + var/mob/M = locate(href_list["rename"]) + if(!istype(M)) return + + message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].", 1) + if(istype(M, /mob/living/carbon/human)) + for(var/obj/item/weapon/card/id/ID in M.contents) + if(ID.registered == M.real_name) + ID.name = "[new_name]'s ID Card ([ID.assignment])" + ID.registered = new_name + break + for(var/obj/item/device/pda/PDA in M.contents) + if(PDA.owner == M.real_name) + PDA.name = "PDA-[new_name] ([PDA.ownjob])" + PDA.owner = new_name + break + M.real_name = new_name + M.name = new_name + href_list["datumrefresh"] = href_list["rename"] + else if (href_list["varnameedit"]) if(!href_list["datumedit"] || !href_list["varnameedit"]) usr << "Varedit error: Not all information has been sent Contact a coder."