From 3a3bdc8ff1e50e5f33fc2bd95410cfdf0930876e Mon Sep 17 00:00:00 2001 From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:08:15 -0500 Subject: [PATCH] TRAIT_UNKNOWN (#27471) --- code/__HELPERS/trait_helpers.dm | 1 + code/_globalvars/traits.dm | 4 ++-- code/game/data_huds.dm | 4 ++-- code/modules/mob/living/carbon/examine.dm | 2 ++ code/modules/mob/living/carbon/human/human_mob.dm | 6 ++++++ code/modules/mob/living/carbon/human/human_say.dm | 3 +++ code/modules/mob/living/init_signals.dm | 12 ++++++++++++ code/modules/mob/living/living.dm | 2 ++ 8 files changed, 30 insertions(+), 4 deletions(-) diff --git a/code/__HELPERS/trait_helpers.dm b/code/__HELPERS/trait_helpers.dm index ca4bb8fe2ea0..f7d77fad8073 100644 --- a/code/__HELPERS/trait_helpers.dm +++ b/code/__HELPERS/trait_helpers.dm @@ -243,6 +243,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_EMP_RESIST "emp_resist" //The mob will take less damage from EMPs #define TRAIT_MINDFLAYER_NULLIFIED "flayer_nullified" //The mindflayer will not be able to activate their abilities, or drain swarms from people #define TRAIT_FLYING "flying" +#define TRAIT_UNKNOWN "unknown" // The person with this trait always appears as 'unknown'. #define TRAIT_CRYO_DESPAWNING "cryo_despawning" // dont adminbus this please //***** MIND TRAITS *****/ diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 2b58a529175f..f86cd7e55eab 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -104,8 +104,8 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_NON_INFECTIOUS_ZOMBIE" = TRAIT_NON_INFECTIOUS_ZOMBIE, "TRAIT_CANNOT_PULL" = TRAIT_CANNOT_PULL, "TRAIT_BSG_IMMUNE" = TRAIT_BSG_IMMUNE, - "TRAIT_FLYING" = TRAIT_FLYING - + "TRAIT_FLYING" = TRAIT_FLYING, + "TRAIT_UNKNOWN" = TRAIT_UNKNOWN ), /datum/mind = list( diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 7081814e916f..c0c0a7fca2ed 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -222,10 +222,10 @@ //HOOKS -/mob/living/carbon/human/proc/sec_hud_set_ID() +/mob/living/carbon/human/sec_hud_set_ID() var/image/holder = hud_list[ID_HUD] holder.icon_state = "hudunknown" - if(wear_id) + if(wear_id && ! HAS_TRAIT(src, TRAIT_UNKNOWN)) holder.icon_state = "hud[ckey(wear_id.get_job_name())]" sec_hud_set_security_status() diff --git a/code/modules/mob/living/carbon/examine.dm b/code/modules/mob/living/carbon/examine.dm index bba2f1c9e9fa..c634b429d711 100644 --- a/code/modules/mob/living/carbon/examine.dm +++ b/code/modules/mob/living/carbon/examine.dm @@ -88,6 +88,8 @@ return "" /mob/living/carbon/examine(mob/user) + if(HAS_TRAIT(src, TRAIT_UNKNOWN)) + return list("You're struggling to make out any details...") var/skipgloves = FALSE var/skipsuitstorage = FALSE var/skipjumpsuit = FALSE diff --git a/code/modules/mob/living/carbon/human/human_mob.dm b/code/modules/mob/living/carbon/human/human_mob.dm index f4b5626df388..436ae3a25849 100644 --- a/code/modules/mob/living/carbon/human/human_mob.dm +++ b/code/modules/mob/living/carbon/human/human_mob.dm @@ -284,6 +284,8 @@ // Get rank from ID, ID inside PDA, PDA, ID in wallet, etc. /mob/living/carbon/human/proc/get_authentification_rank(if_no_id = "No id", if_no_job = "No job") + if(HAS_TRAIT(src, TRAIT_UNKNOWN)) + return if_no_id var/obj/item/card/id/id = wear_id?.GetID() if(istype(id)) return id.rank || if_no_job @@ -292,6 +294,8 @@ //gets assignment from ID, PDA, Wallet, etc. //This should not be relied on for authentication, because PDAs show their owner's job, even if an ID is not inserted /mob/living/carbon/human/proc/get_assignment(if_no_id = "No id", if_no_job = "No job") + if(HAS_TRAIT(src, TRAIT_UNKNOWN)) + return if_no_id if(!wear_id) return if_no_id var/obj/item/card/id/id = wear_id.GetID() @@ -331,6 +335,8 @@ //repurposed proc. Now it combines get_id_name() and get_face_name() to determine a mob's name variable. Made into a seperate proc as it'll be useful elsewhere /mob/living/carbon/human/get_visible_name(id_override = FALSE) + if(HAS_TRAIT(src, TRAIT_UNKNOWN)) + return "Unknown" if(name_override) return name_override if(wear_mask && (wear_mask.flags_inv & HIDEFACE)) //Wearing a mask which hides our face, use id-name if possible diff --git a/code/modules/mob/living/carbon/human/human_say.dm b/code/modules/mob/living/carbon/human/human_say.dm index 4c87b39d007b..17a83087031f 100644 --- a/code/modules/mob/living/carbon/human/human_say.dm +++ b/code/modules/mob/living/carbon/human/human_say.dm @@ -47,6 +47,9 @@ return FALSE /mob/living/carbon/human/GetVoice() + if(HAS_TRAIT(src, TRAIT_UNKNOWN)) + return "Unknown" + var/has_changer = HasVoiceChanger() if(has_changer) diff --git a/code/modules/mob/living/init_signals.dm b/code/modules/mob/living/init_signals.dm index b2fd6735f89b..07baa8e3c926 100644 --- a/code/modules/mob/living/init_signals.dm +++ b/code/modules/mob/living/init_signals.dm @@ -27,6 +27,10 @@ RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED), PROC_REF(on_restrained_trait_gain)) RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_RESTRAINED), PROC_REF(on_restrained_trait_loss)) + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_UNKNOWN), PROC_REF(on_unknown_trait)) + RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_UNKNOWN), PROC_REF(on_unknown_trait)) + + /// Called when [TRAIT_KNOCKEDOUT] is added to the mob. /mob/living/proc/on_knockedout_trait_gain(datum/source) SIGNAL_HANDLER @@ -160,3 +164,11 @@ REMOVE_TRAIT(src, TRAIT_KNOCKEDOUT, TRAIT_FAKEDEATH) remove_status_effect(STATUS_EFFECT_REVIVABLE) +/// Gaining or losing [TRAIT_UNKNOWN] updates our name and our sechud +/mob/living/proc/on_unknown_trait(datum/source) + SIGNAL_HANDLER // SIGNAL_ADDTRAIT(TRAIT_UNKNOWN), SIGNAL_REMOVETRAIT(TRAIT_UNKNOWN) + addtimer(CALLBACK(src, PROC_REF(on_unknown_trait_part_2)), 0.1 SECONDS) // Remove signal is sent before the trait is removed, we need to wait a tick + +/mob/living/proc/on_unknown_trait_part_2() + name = get_visible_name() + sec_hud_set_ID() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 50bf380187bc..fd05477e2d39 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1189,3 +1189,5 @@ /mob/living/proc/can_remote_apc_interface(obj/machinery/power/apc/ourapc) return FALSE +/mob/living/proc/sec_hud_set_ID() + return