From 3b8d600f9729fa1777a0226d4018d5111f4aa0c0 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:42:09 +0000 Subject: [PATCH 1/7] Runtime fix Fixes these runtime errors: runtime error: client_screen_add overridden. runtime error: client_screen_remove overridden. --- code/modules/mob/dead/observer/observer.dm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index ba84f1cca76d..7406cefdf48c 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -236,8 +236,9 @@ if(observe_target_client != new_client) observe_target_client = new_client - RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_ADD, PROC_REF(observe_target_screen_add)) - RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_REMOVE, PROC_REF(observe_target_screen_remove)) + // Override the signal from any previous targets. + RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_ADD, PROC_REF(observe_target_screen_add), TRUE) + RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_REMOVE, PROC_REF(observe_target_screen_remove), TRUE) /// When the observe target logs in our observer connect to the new client /mob/dead/observer/proc/observe_target_login(mob/living/new_character) @@ -246,8 +247,9 @@ if(observe_target_client != new_character.client) observe_target_client = new_character.client - RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_ADD, PROC_REF(observe_target_screen_add)) - RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_REMOVE, PROC_REF(observe_target_screen_remove)) + // Override the signal from any previous targets. + RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_ADD, PROC_REF(observe_target_screen_add), TRUE) + RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_REMOVE, PROC_REF(observe_target_screen_remove), TRUE) ///makes the ghost see the target hud and sets the eye at the target. /mob/dead/observer/proc/do_observe(atom/movable/target) From 883d371a5d096cebffd7231810de214b340950d1 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:44:06 +0000 Subject: [PATCH 2/7] Hide hidden actions --- code/modules/mob/living/carbon/carbon.dm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index c56ccafc85ab..08daa5348022 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -431,8 +431,12 @@ observers |= observer hud_used.show_hud(hud_used.hud_version, observer) + // Add the player's action buttons (not the actions themselves) to the observer's screen. for(var/datum/action/action as anything in actions) - // Add the action's button (not the action itself) to the observer's screen. + // Skip any hidden ones (of course). + if(action.hidden || action.player_hidden) + continue + observer.client.add_to_screen(action.button) //generates realistic-ish pulse output based on preset levels From 0771d644b217e4a945ab179413aa3e180564c7a8 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:44:14 +0000 Subject: [PATCH 3/7] Transfer on evolve/devolve --- code/modules/mob/living/carbon/xenomorph/Xenomorph.dm | 5 +++++ code/modules/mob/mob_defines.dm | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index 03ba544be6b8..69ab18431237 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -766,6 +766,11 @@ var/datum/mob_hud/MH = GLOB.huds[MOB_HUD_XENO_INFECTION] MH.add_hud_to(src, src) +// Transfer any observing players over to the xeno's new body (`target`) on evolve/de-evolve. +/mob/living/carbon/xenomorph/transfer_observers_to(atom/target) + for(var/mob/dead/observer/observer as anything in observers) + observer.clean_observe_target() + observer.do_observe(target) /mob/living/carbon/xenomorph/check_improved_pointing() //xeno leaders get a big arrow and less cooldown diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index f8df788aa5fc..0dc2a27594a7 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -28,7 +28,8 @@ I'll make some notes on where certain variable defines should probably go. Changing this around would probably require a good look-over the pre-existing code. */ - var/list/observers //The list of people observing this mob. + /// The list of people observing this mob. + var/list/mob/dead/observer/observers var/zone_selected = "chest" var/use_me = 1 //Allows all mobs to use the me verb by default, will have to manually specify they cannot @@ -429,4 +430,3 @@ return src.regenerate_icons() - From 24414f2affa88c7b646b713a7e3c143bba3bd996 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:57:55 +0000 Subject: [PATCH 4/7] Spacing --- code/modules/mob/dead/observer/observer.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 7406cefdf48c..3a27af37f669 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -268,6 +268,7 @@ client.clear_screen() client.eye = carbon_target observe_target_mob = carbon_target + carbon_target.auto_observed(src) RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(observer_move_react)) From 5763afdb6f2f1e78fb60c6d0a2659ce4ca404bab Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Fri, 23 Feb 2024 00:35:08 +0000 Subject: [PATCH 5/7] Past tense Just to "move them over" so that I can put `COMSIG_MOB_LOGIN` a bit earlier. --- code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm | 6 +++--- code/__DEFINES/dcs/signals/signals_client.dm | 4 ++-- code/__DEFINES/dcs/signals/signals_global.dm | 6 ++++-- code/controllers/subsystem/ticker.dm | 2 +- code/controllers/subsystem/vote.dm | 4 ++-- code/game/objects/items/devices/radio/headset.dm | 4 ++-- code/modules/client/client_procs.dm | 2 +- code/modules/escape_menu/escape_menu.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 4 ++-- code/modules/mob/login.dm | 6 +++--- code/modules/vehicles/van/van.dm | 6 +++--- 11 files changed, 24 insertions(+), 22 deletions(-) diff --git a/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm b/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm index 61eb757e9c4d..fb694bde834b 100644 --- a/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm +++ b/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm @@ -75,9 +75,9 @@ #define COMSIG_MOB_PRE_CLICK "mob_pre_click" #define COMPONENT_INTERRUPT_CLICK (1<<0) -///from base of /mob/Login(): () -#define COMSIG_MOB_LOGIN "mob_login" -///from base of /mob/Logout(): () +/// From base of /mob/Login(), called after a client logs into this mob: () +#define COMSIG_MOB_LOGGED_IN "mob_logged_in" +/// From base of /mob/Logout(): () #define COMSIG_MOB_LOGOUT "mob_logout" /// From /mob/proc/change_real_name(): (old_name, new_name) diff --git a/code/__DEFINES/dcs/signals/signals_client.dm b/code/__DEFINES/dcs/signals/signals_client.dm index 3968f654c486..36a60c153d0f 100644 --- a/code/__DEFINES/dcs/signals/signals_client.dm +++ b/code/__DEFINES/dcs/signals/signals_client.dm @@ -19,8 +19,8 @@ /// Called after one or more verbs are added: (list of verbs added) #define COMSIG_CLIENT_VERB_REMOVED "client_verb_removed" -/// Called after a client logs into a mob: (mob) -#define COMSIG_CLIENT_MOB_LOGIN "client_mob_changed" +/// Called from /mob/Login() after a client logs into a mob: (mob) +#define COMSIG_CLIENT_MOB_LOGGED_IN "client_mob_logged_in" /// Called when something is added to a client's screen : /client/proc/add_to_screen(screen_add) #define COMSIG_CLIENT_SCREEN_ADD "client_screen_add" diff --git a/code/__DEFINES/dcs/signals/signals_global.dm b/code/__DEFINES/dcs/signals/signals_global.dm index 8aa700f4fb3a..378948347a81 100644 --- a/code/__DEFINES/dcs/signals/signals_global.dm +++ b/code/__DEFINES/dcs/signals/signals_global.dm @@ -34,9 +34,11 @@ #define COMSIG_GLOB_REMOVE_VOTE_BUTTON "!remove_vote_button" -#define COMSIG_GLOB_CLIENT_LOGIN "!client_login" +/// Called from /client/New() when a client logs in to the game: (client) +#define COMSIG_GLOB_CLIENT_LOGGED_IN "!client_logged_in" -#define COMSIG_GLOB_MOB_LOGIN "!mob_login" +/// Called from /mob/Login() when a client logs into a mob: (mob) +#define COMSIG_GLOB_MOB_LOGGED_IN "!mob_logged_in" ///from /datum/controller/subsystem/ticker/PostSetup #define COMSIG_GLOB_POST_SETUP "!post_setup" diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 2b9812abade4..20691a1a7723 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -207,7 +207,7 @@ SUBSYSTEM_DEF(ticker) CHECK_TICK mode.announce() if(mode.taskbar_icon) - RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGIN, PROC_REF(handle_mode_icon)) + RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGGED_IN, PROC_REF(handle_mode_icon)) set_clients_taskbar_icon(mode.taskbar_icon) if(GLOB.perf_flags & PERF_TOGGLE_LAZYSS) diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 6188e38e8d60..33967fab1004 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -59,7 +59,7 @@ SUBSYSTEM_DEF(vote) voting.Cut() remove_action_buttons() - UnregisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGIN) + UnregisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGGED_IN) for(var/c in GLOB.player_list) update_static_data(c) @@ -373,7 +373,7 @@ SUBSYSTEM_DEF(vote) if(send_clients_vote) C.mob.vote() - RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGIN, PROC_REF(handle_client_joining)) + RegisterSignal(SSdcs, COMSIG_GLOB_CLIENT_LOGGED_IN, PROC_REF(handle_client_joining)) SStgui.update_uis(src) return TRUE return FALSE diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 7b987752011c..e1a28c7eb7a7 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -233,7 +233,7 @@ ), PROC_REF(turn_on)) wearer = user RegisterSignal(user, COMSIG_MOB_STAT_SET_ALIVE, PROC_REF(update_minimap_icon)) - RegisterSignal(user, COMSIG_MOB_LOGIN, PROC_REF(add_hud_tracker)) + RegisterSignal(user, COMSIG_MOB_LOGGED_IN, PROC_REF(add_hud_tracker)) RegisterSignal(user, COMSIG_MOB_DEATH, PROC_REF(update_minimap_icon)) RegisterSignal(user, COMSIG_HUMAN_SET_UNDEFIBBABLE, PROC_REF(update_minimap_icon)) if(headset_hud_on) @@ -250,7 +250,7 @@ UnregisterSignal(user, list( COMSIG_LIVING_REJUVENATED, COMSIG_HUMAN_REVIVED, - COMSIG_MOB_LOGIN, + COMSIG_MOB_LOGGED_IN, COMSIG_MOB_DEATH, COMSIG_HUMAN_SET_UNDEFIBBABLE, COMSIG_MOB_STAT_SET_ALIVE diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 44820444a955..5796d5ff505e 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -444,7 +444,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( view = GLOB.world_view_size - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_CLIENT_LOGIN, src) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_CLIENT_LOGGED_IN, src) ////////////// //DISCONNECT// diff --git a/code/modules/escape_menu/escape_menu.dm b/code/modules/escape_menu/escape_menu.dm index c31234678b62..b61bbd5b3f36 100644 --- a/code/modules/escape_menu/escape_menu.dm +++ b/code/modules/escape_menu/escape_menu.dm @@ -49,7 +49,7 @@ GLOBAL_LIST_EMPTY(escape_menus) show_page() RegisterSignal(client, COMSIG_PARENT_QDELETING, PROC_REF(on_client_qdel)) - RegisterSignal(client, COMSIG_CLIENT_MOB_LOGIN, PROC_REF(on_client_mob_login)) + RegisterSignal(client, COMSIG_CLIENT_MOB_LOGGED_IN, PROC_REF(on_client_mob_login)) if (!isnull(ckey)) GLOB.escape_menus[ckey] = src diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 3a27af37f669..28f44ebbe167 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -162,7 +162,7 @@ UnregisterSignal(observe_target_mob, COMSIG_PARENT_QDELETING) UnregisterSignal(observe_target_mob, COMSIG_MOB_GHOSTIZE) UnregisterSignal(observe_target_mob, COMSIG_MOB_NEW_MIND) - UnregisterSignal(observe_target_mob, COMSIG_MOB_LOGIN) + UnregisterSignal(observe_target_mob, COMSIG_MOB_LOGGED_IN) if(observe_target_client) UnregisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_ADD) @@ -275,7 +275,7 @@ RegisterSignal(observe_target_mob, COMSIG_PARENT_QDELETING, PROC_REF(clean_observe_target)) RegisterSignal(observe_target_mob, COMSIG_MOB_GHOSTIZE, PROC_REF(observe_target_ghosting)) RegisterSignal(observe_target_mob, COMSIG_MOB_NEW_MIND, PROC_REF(observe_target_new_mind)) - RegisterSignal(observe_target_mob, COMSIG_MOB_LOGIN, PROC_REF(observe_target_login)) + RegisterSignal(observe_target_mob, COMSIG_MOB_LOGGED_IN, PROC_REF(observe_target_login)) if(observe_target_mob.client) observe_target_client = observe_target_mob.client diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 775e69dc0b92..5fdf33354bd2 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -58,6 +58,6 @@ client.init_verbs() - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_LOGIN, src) - SEND_SIGNAL(client, COMSIG_CLIENT_MOB_LOGIN, src) - SEND_SIGNAL(src, COMSIG_MOB_LOGIN) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_LOGGED_IN, src) + SEND_SIGNAL(client, COMSIG_CLIENT_MOB_LOGGED_IN, src) + SEND_SIGNAL(src, COMSIG_MOB_LOGGED_IN) diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index c4aa64360ec0..8bf114d6b4a8 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -83,7 +83,7 @@ icon_state = null - RegisterSignal(SSdcs, COMSIG_GLOB_MOB_LOGIN, PROC_REF(add_default_image)) + RegisterSignal(SSdcs, COMSIG_GLOB_MOB_LOGGED_IN, PROC_REF(add_default_image)) for(var/I in GLOB.player_list) add_default_image(SSdcs, I) @@ -125,7 +125,7 @@ mobs_under += L RegisterSignal(L, COMSIG_PARENT_QDELETING, PROC_REF(remove_under_van)) - RegisterSignal(L, COMSIG_MOB_LOGIN, PROC_REF(add_client)) + RegisterSignal(L, COMSIG_MOB_LOGGED_IN, PROC_REF(add_client)) RegisterSignal(L, COMSIG_MOVABLE_MOVED, PROC_REF(check_under_van)) if(L.client) @@ -141,7 +141,7 @@ UnregisterSignal(L, list( COMSIG_PARENT_QDELETING, - COMSIG_MOB_LOGIN, + COMSIG_MOB_LOGGED_IN, COMSIG_MOVABLE_MOVED, )) From d9aec04e75514c621f3fce5feb76fe0a4e5875f2 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Fri, 23 Feb 2024 00:41:33 +0000 Subject: [PATCH 6/7] Mob login actions fix Late-night coding never goes well so this is probably awful, but I'll look at it again in the morning. --- code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm | 4 ++++ code/modules/mob/dead/observer/observer.dm | 2 +- code/modules/mob/login.dm | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm b/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm index fb694bde834b..f4df347c62db 100644 --- a/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm +++ b/code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm @@ -75,7 +75,11 @@ #define COMSIG_MOB_PRE_CLICK "mob_pre_click" #define COMPONENT_INTERRUPT_CLICK (1<<0) +/// From base of /mob/Login(), called when a client logs into this mob: () +/// Not to be confused with [COMSIG_MOB_LOGGED_IN] +#define COMSIG_MOB_LOGIN "mob_login" /// From base of /mob/Login(), called after a client logs into this mob: () +/// Not to be confused with [COMSIG_MOB_LOGIN] #define COMSIG_MOB_LOGGED_IN "mob_logged_in" /// From base of /mob/Logout(): () #define COMSIG_MOB_LOGOUT "mob_logout" diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 28f44ebbe167..2280408549e4 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -275,7 +275,7 @@ RegisterSignal(observe_target_mob, COMSIG_PARENT_QDELETING, PROC_REF(clean_observe_target)) RegisterSignal(observe_target_mob, COMSIG_MOB_GHOSTIZE, PROC_REF(observe_target_ghosting)) RegisterSignal(observe_target_mob, COMSIG_MOB_NEW_MIND, PROC_REF(observe_target_new_mind)) - RegisterSignal(observe_target_mob, COMSIG_MOB_LOGGED_IN, PROC_REF(observe_target_login)) + RegisterSignal(observe_target_mob, COMSIG_MOB_LOGIN, PROC_REF(observe_target_login)) if(observe_target_mob.client) observe_target_client = observe_target_mob.client diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 5fdf33354bd2..38157a067367 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -18,6 +18,8 @@ update_Login_details() + SEND_SIGNAL(src, COMSIG_MOB_LOGIN) + client.images = null client.screen = null //remove hud items just in case if(!hud_used) From dee3c6496964f92a68f19a53644ffef2ba380365 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Fri, 23 Feb 2024 00:46:27 +0000 Subject: [PATCH 7/7] And this Like I said, late-night coding... --- code/modules/mob/dead/observer/observer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 2280408549e4..3a27af37f669 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -162,7 +162,7 @@ UnregisterSignal(observe_target_mob, COMSIG_PARENT_QDELETING) UnregisterSignal(observe_target_mob, COMSIG_MOB_GHOSTIZE) UnregisterSignal(observe_target_mob, COMSIG_MOB_NEW_MIND) - UnregisterSignal(observe_target_mob, COMSIG_MOB_LOGGED_IN) + UnregisterSignal(observe_target_mob, COMSIG_MOB_LOGIN) if(observe_target_client) UnregisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_ADD)