From a3c6beb28b058ee543406351170fea102f9e6dc0 Mon Sep 17 00:00:00 2001
From: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
Date: Tue, 31 Aug 2021 07:28:22 -0500
Subject: [PATCH] runechat_msg_location UID (#16444)
---
code/modules/mob/hear_say.dm | 4 ++--
code/modules/mob/living/carbon/brain/brain.dm | 6 +++---
code/modules/mob/living/carbon/human/human.dm | 4 ++--
code/modules/mob/living/silicon/ai/ai.dm | 6 +++---
code/modules/mob/living/silicon/pai/pai.dm | 4 ++--
code/modules/mob/living/simple_animal/shade.dm | 4 ++--
code/modules/mob/mob.dm | 5 +++--
code/modules/mob/mob_defines.dm | 4 ++--
8 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/code/modules/mob/hear_say.dm b/code/modules/mob/hear_say.dm
index 79ac1299164..b5bd17ed1e9 100644
--- a/code/modules/mob/hear_say.dm
+++ b/code/modules/mob/hear_say.dm
@@ -106,8 +106,8 @@
to_chat(src, "[speaker_name][speaker.GetAltName()] [track][verb], \"[message]\"")
// Create map text message
- if (client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) // can_hear is checked up there on L99
- create_chat_message(speaker.runechat_msg_location, message_clean, italics)
+ if(client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) // can_hear is checked up there on L99
+ create_chat_message(locateUID(speaker.runechat_msg_location), message_clean, italics)
if(speech_sound && (get_dist(speaker, src) <= world.view && src.z == speaker.z))
var/turf/source = speaker? get_turf(speaker) : get_turf(src)
diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm
index 76a5d0bbb50..5452dc84d19 100644
--- a/code/modules/mob/living/carbon/brain/brain.dm
+++ b/code/modules/mob/living/carbon/brain/brain.dm
@@ -111,8 +111,8 @@ I'm using this for Stat to give it a more nifty interface to work with
/mob/living/carbon/brain/update_runechat_msg_location()
if(ismecha(loc))
- runechat_msg_location = loc
+ runechat_msg_location = loc.UID()
else if(container)
- runechat_msg_location = container
+ runechat_msg_location = container.UID()
else
- runechat_msg_location = src
+ return ..()
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 9c8635afa9e..9cbec689ade 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -1939,9 +1939,9 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
/mob/living/carbon/human/update_runechat_msg_location()
if(ismecha(loc))
- runechat_msg_location = loc
+ runechat_msg_location = loc.UID()
else
- runechat_msg_location = src
+ return ..()
/mob/living/carbon/human/verb/Examine_OOC()
set name = "Examine Meta-Info (OOC)"
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 9ac4200faec..6c646d2509e 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -1251,7 +1251,7 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
var/rendered = "Relayed Speech: [name_used] [message]"
if(client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT)
var/message_clean = combine_message(message_pieces, null, M)
- create_chat_message(M.runechat_msg_location, message_clean)
+ create_chat_message(locateUID(M.runechat_msg_location), message_clean)
show_message(rendered, 2)
/mob/living/silicon/ai/proc/malfhacked(obj/machinery/power/apc/apc)
@@ -1371,8 +1371,8 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
/mob/living/silicon/ai/update_runechat_msg_location()
if(istype(loc, /obj/item/aicard) || ismecha(loc))
- runechat_msg_location = loc
+ runechat_msg_location = loc.UID()
else
- runechat_msg_location = src
+ return ..()
#undef TEXT_ANNOUNCEMENT_COOLDOWN
diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm
index 9ddbaf61a03..677f67ebf13 100644
--- a/code/modules/mob/living/silicon/pai/pai.dm
+++ b/code/modules/mob/living/silicon/pai/pai.dm
@@ -520,6 +520,6 @@
/mob/living/silicon/pai/update_runechat_msg_location()
if(istype(loc, /obj/item/paicard))
- runechat_msg_location = loc
+ runechat_msg_location = loc.UID()
else
- runechat_msg_location = src
+ return ..()
diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm
index 3e4686e146d..1df0f15bcf4 100644
--- a/code/modules/mob/living/simple_animal/shade.dm
+++ b/code/modules/mob/living/simple_animal/shade.dm
@@ -65,6 +65,6 @@
/mob/living/simple_animal/shade/update_runechat_msg_location()
if(istype(loc, /obj/item/soulstone))
- runechat_msg_location = loc
+ runechat_msg_location = loc.UID()
else
- runechat_msg_location = src
+ return ..()
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 91a6bad69ff..f801c0f072f 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -32,7 +32,6 @@
GLOB.alive_mob_list += src
set_focus(src)
prepare_huds()
- runechat_msg_location = src
update_runechat_msg_location()
. = ..()
@@ -1455,9 +1454,11 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
/**
* Updates the mob's runechat maptext display location.
+ *
+ * By default, we set this to the src mob's `UID()`.
*/
/mob/proc/update_runechat_msg_location()
- return
+ runechat_msg_location = UID()
/**
diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm
index 423908e689d..2f7511e3b04 100644
--- a/code/modules/mob/mob_defines.dm
+++ b/code/modules/mob/mob_defines.dm
@@ -201,5 +201,5 @@
/// Overrides the health HUD element state if set.
var/health_hud_override = HEALTH_HUD_OVERRIDE_NONE
- /// The location our runechat message should appear. Should be src by default.
- var/atom/runechat_msg_location
+ /// A soft reference to the location where this mob's runechat message will appear. Uses `UID()`.
+ var/runechat_msg_location