diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 163ff45a635..d0f1ef32b8c 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -177,82 +177,8 @@ Turf and target are seperate in case you want to teleport some distance from a t return 0 return 1 -//This will update a mob's name, real_name, mind.name, data_core records, pda, id and traitor text -//Calling this proc without an oldname will only update the mob and skip updating the pda, id and records ~Carn -/mob/proc/fully_replace_character_name(oldname,newname) - if(!newname) return 0 - real_name = newname - name = newname - if(mind) - mind.name = newname - if(istype(src, /mob/living/carbon)) - var/mob/living/carbon/C = src - if(C.dna) - C.dna.real_name = real_name - - if(isAI(src)) - var/mob/living/silicon/ai/AI = src - if(oldname != real_name) - if(AI.eyeobj) - AI.eyeobj.name = "[newname] (AI Eye)" - - // Set ai pda name - if(AI.aiPDA) - AI.aiPDA.owner = newname - AI.aiPDA.name = newname + " (" + AI.aiPDA.ownjob + ")" - - // Notify Cyborgs - for(var/mob/living/silicon/robot/Slave in AI.connected_robots) - Slave.show_laws() - - if(isrobot(src)) - var/mob/living/silicon/robot/R = src - if(oldname != real_name) - R.notify_ai(3, oldname, newname) - if(R.camera) - R.camera.c_tag = real_name - - if(oldname) - //update the datacore records! This is goig to be a bit costly. - for(var/list/L in list(data_core.general,data_core.medical,data_core.security,data_core.locked)) - var/datum/data/record/R = find_record("name", oldname, L) - if(R) R.fields["name"] = newname - - //update our pda and id if we have them on our person - var/list/searching = GetAllContents() - var/search_id = 1 - var/search_pda = 1 - - for(var/A in searching) - if( search_id && istype(A,/obj/item/weapon/card/id) ) - var/obj/item/weapon/card/id/ID = A - if(ID.registered_name == oldname) - ID.registered_name = newname - ID.update_label() - if(!search_pda) break - search_id = 0 - - else if( search_pda && istype(A,/obj/item/device/pda) ) - var/obj/item/device/pda/PDA = A - if(PDA.owner == oldname) - PDA.owner = newname - PDA.update_label() - if(!search_id) break - search_pda = 0 - - for(var/datum/mind/T in ticker.minds) - for(var/datum/objective/obj in T.objectives) - // Only update if this player is a target - if(obj.target && obj.target.current && obj.target.current.real_name == name) - obj.update_explanation_text() - - return 1 - - - //Generalised helper proc for letting mobs rename themselves. Used to be clname() and ainame() - -/mob/proc/rename_self(role, allow_numbers=0) +/mob/proc/rename_self(role) var/oldname = real_name var/newname var/loop = 1 @@ -284,13 +210,8 @@ Turf and target are seperate in case you want to teleport some distance from a t loop-- safety++ - if(isAI(src)) - oldname = null//don't bother with the records update crap if(newname) fully_replace_character_name(oldname,newname) - if(isrobot(src)) - var/mob/living/silicon/robot/A = src - A.custom_name = newname //Picks a string of symbols to display as the law number for hacked or ion laws diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 0a3fef54602..1af4bf3838a 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -612,3 +612,8 @@ var/const/GALOSHES_DONT_HELP = 4 nutrition -= lost_nutrition adjustToxLoss(-3) return 1 + +/mob/living/carbon/fully_replace_character_name(oldname,newname) + ..() + if(dna) + dna.real_name = real_name \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 27a04ad3fd7..dd769db25f5 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -870,4 +870,10 @@ last_special = world.time + CLICK_CD_BREAKOUT cuff_resist(wear_suit) else - ..() \ No newline at end of file + ..() + +/mob/living/carbon/human/replace_records_name(oldname,newname) // Only humans have records right now, move this up if changed. + for(var/list/L in list(data_core.general,data_core.medical,data_core.security,data_core.locked)) + var/datum/data/record/R = find_record("name", oldname, L) + if(R) + R.fields["name"] = newname \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index c00a198bb3e..bbfc1082cad 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -77,7 +77,7 @@ var/list/ai_list = list() /mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0) ..() - rename_self("ai", 1) + rename_self("ai") name = real_name anchored = 1 canmove = 0 @@ -121,6 +121,7 @@ var/list/ai_list = list() else if (B.brainmob.mind) B.brainmob.mind.transfer_to(src) + rename_self("ai") if(mind.special_role) mind.store_memory("As an AI, you must obey your silicon laws above all else. Your objectives will consider you to be dead.") src << "You have been installed as an AI! " @@ -848,4 +849,19 @@ var/list/ai_list = list() raw_message = lang_treat(speaker, message_langs, raw_message, spans) var/name_used = speaker.GetVoice() var/rendered = "Relayed Speech: [name_used] [raw_message]" - show_message(rendered, 2) \ No newline at end of file + show_message(rendered, 2) + +/mob/living/silicon/ai/fully_replace_character_name(oldname,newname) + ..() + if(oldname != real_name) + if(eyeobj) + eyeobj.name = "[newname] (AI Eye)" + + // Notify Cyborgs + for(var/mob/living/silicon/robot/Slave in connected_robots) + Slave.show_laws() + +/mob/living/silicon/ai/replace_identification_name(oldname,newname) + if(aiPDA) + aiPDA.owner = newname + aiPDA.name = newname + " (" + aiPDA.ownjob + ")" \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index b63b1cd4139..ac3bdbfd83c 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1171,3 +1171,11 @@ if(health < -maxHealth*0.5) if(uneq_module(module_state_1)) src << "CRITICAL ERROR: All modules OFFLINE." + +/mob/living/silicon/robot/fully_replace_character_name(oldname,newname) + ..() + if(oldname != real_name) + notify_ai(3, oldname, newname) + if(camera) + camera.c_tag = real_name + custom_name = newname \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 377ddabf388..1dcd9efb815 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -966,3 +966,90 @@ var/next_mob_id = 0 if(F in target.faction) return 1 return 0 + + +//This will update a mob's name, real_name, mind.name, data_core records, pda, id and traitor text +//Calling this proc without an oldname will only update the mob and skip updating the pda, id and records ~Carn +/mob/proc/fully_replace_character_name(oldname,newname) + if(!newname) + return 0 + real_name = newname + name = newname + if(mind) + mind.name = newname + + if(oldname) + //update the datacore records! This is goig to be a bit costly. + replace_records_name(oldname,newname) + + //update our pda and id if we have them on our person + replace_identification_name(oldname,newname) + + for(var/datum/mind/T in ticker.minds) + for(var/datum/objective/obj in T.objectives) + // Only update if this player is a target + if(obj.target && obj.target.current && obj.target.current.real_name == name) + obj.update_explanation_text() + return 1 + +/mob/living/carbon/fully_replace_character_name(oldname,newname) + ..() + if(dna) + dna.real_name = real_name + +/mob/living/silicon/ai/fully_replace_character_name(oldname,newname) + ..() + if(oldname != real_name) + if(eyeobj) + eyeobj.name = "[newname] (AI Eye)" + + // Notify Cyborgs + for(var/mob/living/silicon/robot/Slave in connected_robots) + Slave.show_laws() + +/mob/living/silicon/robot/fully_replace_character_name(oldname,newname) + ..() + if(oldname != real_name) + notify_ai(3, oldname, newname) + if(camera) + camera.c_tag = real_name + custom_name = newname + +//Updates data_core records with new name , see mob/living/carbon/human +/mob/proc/replace_records_name(oldname,newname) + return + +/mob/living/carbon/human/replace_records_name(oldname,newname) // Only humans have records right now, move this up if changed. + for(var/list/L in list(data_core.general,data_core.medical,data_core.security,data_core.locked)) + var/datum/data/record/R = find_record("name", oldname, L) + if(R) + R.fields["name"] = newname + +/mob/proc/replace_identification_name(oldname,newname) + var/list/searching = GetAllContents() + var/search_id = 1 + var/search_pda = 1 + + for(var/A in searching) + if( search_id && istype(A,/obj/item/weapon/card/id) ) + var/obj/item/weapon/card/id/ID = A + if(ID.registered_name == oldname) + ID.registered_name = newname + ID.update_label() + if(!search_pda) + break + search_id = 0 + + else if( search_pda && istype(A,/obj/item/device/pda) ) + var/obj/item/device/pda/PDA = A + if(PDA.owner == oldname) + PDA.owner = newname + PDA.update_label() + if(!search_id) + break + search_pda = 0 + +/mob/living/silicon/ai/replace_identification_name(oldname,newname) + if(aiPDA) + aiPDA.owner = newname + aiPDA.name = newname + " (" + aiPDA.ownjob + ")" diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 80bd2d7deb7..1e4d87e03cb 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -303,7 +303,7 @@ O.job = "AI" - O.rename_self("ai",1) + O.rename_self("ai") . = O qdel(src) return @@ -348,7 +348,7 @@ O.update_pipe_vision() if (config.rename_cyborg) - O.rename_self("cyborg", 1) + O.rename_self("cyborg") O.loc = loc O.job = "Cyborg" @@ -441,7 +441,7 @@ G.key = key G.job = "Deity" - G.rename_self("deity", 0) + G.rename_self("deity") G.update_icons() . = G diff --git a/code/modules/projectiles/guns/medbeam.dm b/code/modules/projectiles/guns/medbeam.dm index 67a768ee3f8..8c6252489f2 100644 --- a/code/modules/projectiles/guns/medbeam.dm +++ b/code/modules/projectiles/guns/medbeam.dm @@ -74,7 +74,7 @@ if(!istype(user_turf)) return 0 var/obj/dummy = new(user_turf) - dummy.pass_flags |= PASSTABLE & PASSGLASS & PASSGRILLE //Grille/Glass so it can be used through common windows + dummy.pass_flags |= PASSTABLE|PASSGLASS|PASSGRILLE //Grille/Glass so it can be used through common windows for(var/turf/turf in getline(user_turf,target)) if(turf.density) qdel(dummy)