Skip to content

Commit

Permalink
TRAIT_UNKNOWN (#27471)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwertytoforty authored Dec 20, 2024
1 parent 083f358 commit 3a3bdc8
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions code/__HELPERS/trait_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 *****/
Expand Down
4 changes: 2 additions & 2 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
return ""

/mob/living/carbon/examine(mob/user)
if(HAS_TRAIT(src, TRAIT_UNKNOWN))
return list("<span class='notice'>You're struggling to make out any details...</span>")
var/skipgloves = FALSE
var/skipsuitstorage = FALSE
var/skipjumpsuit = FALSE
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/carbon/human/human_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/human_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions code/modules/mob/living/init_signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
2 changes: 2 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3a3bdc8

Please sign in to comment.