From 297ee64977c1b6845a17c3d3332adfe0638c2d31 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Thu, 12 Oct 2023 15:45:35 -0300 Subject: [PATCH] push --- code/__DEFINES/dcs/signals.dm | 1 + code/datums/elements/flavor_text.dm | 23 +++++++++++++++++-- .../modules/mob/dead/new_player/new_player.dm | 5 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index cd2c735e09..4477c8aee8 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -358,6 +358,7 @@ #define COMSIG_MOB_CLIENT_MOVE "mob_client_move" //sent when client/Move() finishes with no early returns: (client, direction, n, oldloc) #define COMSIG_MOB_CLIENT_CHANGE_VIEW "mob_client_change_view" //from base of /client/change_view(): (client, old_view, view) #define COMSIG_MOB_CLIENT_MOUSEMOVE "mob_client_mousemove" //from base of /client/MouseMove(): (object, location, control, params) +#define COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY "mob_client_joined_from_lobby" //sent when a player joins/latejoins the game: (new_character, client, late_transfer) ///sent when a mob/login() finishes: (client) #define COMSIG_MOB_CLIENT_LOGIN "comsig_mob_client_login" diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm index b61bacbd19..d5d07ae7b5 100644 --- a/code/datums/elements/flavor_text.dm +++ b/code/datums/elements/flavor_text.dm @@ -41,12 +41,17 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code LAZYOR(GLOB.mobs_with_editable_flavor_text[M], src) add_verb(M, /mob/proc/manage_flavor_tests) - if(save_key && ishuman(target)) + if(!save_key) + return + if(ishuman(target)) RegisterSignal(target, COMSIG_HUMAN_PREFS_COPIED_TO, .proc/update_prefs_flavor_text) + else if(iscyborg(target)) + RegisterSignal(target, COMSIG_MOB_ON_NEW_MIND, .proc/borged_update_flavor_text) + RegisterSignal(target, COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY, .proc/borged_update_flavor_text) /datum/element/flavor_text/Detach(atom/A) . = ..() - UnregisterSignal(A, list(COMSIG_PARENT_EXAMINE, COMSIG_HUMAN_PREFS_COPIED_TO)) + UnregisterSignal(A, list(COMSIG_PARENT_EXAMINE, COMSIG_HUMAN_PREFS_COPIED_TO, COMSIG_MOB_ON_NEW_MIND, COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY)) texts_by_atom -= A if(can_edit && ismob(A)) var/mob/M = A @@ -149,6 +154,20 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code if(P.features.Find(save_key)) texts_by_atom[H] = P.features[save_key] +/datum/element/flavor_text/proc/borged_update_flavor_text(mob/new_character, client/C) + C = C || GET_CLIENT(new_character) + if(!C) + LAZYREMOVE(texts_by_atom, new_character) + return + var/datum/preferences/P = C.prefs + if(!P) + LAZYREMOVE(texts_by_atom, new_character) + return + if(P.custom_names["cyborg"] == new_character.real_name) + LAZYSET(texts_by_atom, new_character, P.features[save_key]) + else + LAZYREMOVE(texts_by_atom, new_character) + //subtypes with additional hooks for DNA and preferences. /datum/element/flavor_text/carbon //list of antagonists etcetera that should have nothing to do with people's snowflakes. diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 9b9cceee84..b627d4cb69 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -702,13 +702,14 @@ . = H new_character = . if(transfer_after) - transfer_character() + transfer_character(TRUE) -/mob/dead/new_player/proc/transfer_character() +/mob/dead/new_player/proc/transfer_character(late_transfer = FALSE) . = new_character if(.) new_character.key = key //Manually transfer the key to log them in new_character.stop_sound_channel(CHANNEL_LOBBYMUSIC) + SEND_SIGNAL(new_character, COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY, new_character?.client, late_transfer) new_character = null qdel(src)