From 04316799a3282cc4795f087a5284e7eb85fda526 Mon Sep 17 00:00:00 2001 From: Wildkins Date: Sat, 14 Jan 2023 07:12:15 -0500 Subject: [PATCH] Floating chat messages now follow you out of the closet (#15574) --- code/modules/mob/floating_messages.dm | 21 +++++++++++++++++++++ html/changelogs/johnwildkins-epicchat.yml | 6 ++++++ 2 files changed, 27 insertions(+) create mode 100644 html/changelogs/johnwildkins-epicchat.yml diff --git a/code/modules/mob/floating_messages.dm b/code/modules/mob/floating_messages.dm index 5f76b92c013..b083bf4a5d4 100644 --- a/code/modules/mob/floating_messages.dm +++ b/code/modules/mob/floating_messages.dm @@ -72,11 +72,32 @@ var/list/floating_chat_colors = list() animate(old, 2, pixel_y = old.pixel_y + 8) LAZYADD(holder.stored_chat_text, I) + if(attached_holder != holder) + attached_holder.RegisterSignal(holder, COMSIG_MOVABLE_MOVED, /atom/movable/proc/give_floating_text) + addtimer(CALLBACK(attached_holder, /atom/movable/proc/drop_floating_signal, holder), duration + 2) + addtimer(CALLBACK(GLOBAL_PROC, .proc/remove_floating_text, holder, I), duration) addtimer(CALLBACK(GLOBAL_PROC, .proc/remove_images_from_clients, I, show_to), duration + 2) return I +/atom/movable/proc/give_floating_text(atom/movable/holder) + if(!holder) + return + for(var/image/I in holder.stored_chat_text) + if(I.loc == src) + I.loc = holder + +/atom/movable/proc/drop_floating_signal(atom/movable/holder) + if(!holder) + return + for(var/image/I in holder.stored_chat_text) + if(I.loc == src) + return + UnregisterSignal(holder, COMSIG_MOVABLE_MOVED) + /proc/remove_floating_text(atom/movable/holder, image/I) animate(I, 2, pixel_y = I.pixel_y + 10, alpha = 0) LAZYREMOVE(holder.stored_chat_text, I) + if(!length(holder.stored_chat_text)) + holder.UnregisterSignal(holder, COMSIG_MOVABLE_MOVED) diff --git a/html/changelogs/johnwildkins-epicchat.yml b/html/changelogs/johnwildkins-epicchat.yml new file mode 100644 index 00000000000..35cac74451a --- /dev/null +++ b/html/changelogs/johnwildkins-epicchat.yml @@ -0,0 +1,6 @@ +author: JohnWildkins + +delete-after: True + +changes: + - bugfix: "Floating chat messages will now follow you when you speak before exiting an enclosing object (closet, charging unit, sleeper, etc)."