Skip to content

Commit

Permalink
Cloaked mobs don't give off visible messages (+cloak logic refactor) (#…
Browse files Browse the repository at this point in the history
…4410)

# About the pull request
Pretty much the title. Visible messages (visible_message proc) don't
give off messages to others if the origin is cloaked.

I'm a bit leery of doing this on `visible_message` so this is gonna need
testing first.

Makes checking for cloaking better, adding a trait on cloak instead of
checking for user alpha

# Explain why it's good for the game
Being able to see things like "Unknown peers through the laser
designator" while they're invisible is a pretty large tell despite you
not having seen them.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Works

</details>


# Changelog
:cl:
balance: Cloaked mobs no longer give off visible messages
/:cl:

---------

Co-authored-by: forest2001 <[email protected]>
  • Loading branch information
Zonespace27 and realforest2001 authored Sep 24, 2023
1 parent ab575b2 commit da4398e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
#define TRAIT_HARDCORE "t_hardcore"
/// If the mob is able to use the vulture rifle or spotting scope
#define TRAIT_VULTURE_USER "t_vulture_user"
/// If the mob is cloaked in any form
#define TRAIT_CLOAKED "t_cloaked"

// -- ability traits --
/// Xenos with this trait cannot have plasma transfered to them
Expand Down Expand Up @@ -282,6 +284,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_LISPING" = TRAIT_LISPING,
"TRAIT_CANNOT_EAT" = TRAIT_CANNOT_EAT,
"TRAIT_VULTURE_USER" = TRAIT_VULTURE_USER,
"TRAIT_CLOAKED" = TRAIT_CLOAKED,
),
/mob/living/carbon/xenomorph = list(
"TRAIT_ABILITY_NO_PLASMA_TRANSFER" = TRAIT_ABILITY_NO_PLASMA_TRANSFER,
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/ARES/ARES_step_triggers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
return FALSE
if(!(ishuman(passer) || isxeno(passer)))
return FALSE
if(passer.alpha <= 100)//Can't be seen/detected to trigger alert.
if(HAS_TRAIT(passer, TRAIT_CLOAKED))
return FALSE
if(pass_jobs)
if(passer.job in pass_jobs)
Expand Down Expand Up @@ -117,7 +117,7 @@
return FALSE
if(!passer)
return FALSE
if(passer.alpha <= 100)//Can't be seen/detected to trigger alert.
if(HAS_TRAIT(passer, TRAIT_CLOAKED))//Can't be seen/detected to trigger alert.
return FALSE
var/area/pass_area = get_area(get_step(passer, passer.dir))
if(istype(pass_area, /area/almayer/command/airoom))//Don't want it to freak out over someone /entering/ the area. Only leaving.
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/storage/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ GLOBAL_LIST_EMPTY_TYPED(radio_packs, /obj/item/storage/backpack/marine/satchel/r
RegisterSignal(H, COMSIG_HUMAN_EXTINGUISH, PROC_REF(wrapper_fizzle_camouflage))

camo_active = TRUE
ADD_TRAIT(H, TRAIT_CLOAKED, TRAIT_SOURCE_EQUIPMENT(WEAR_BACK))
H.visible_message(SPAN_DANGER("[H] vanishes into thin air!"), SPAN_NOTICE("You activate your cloak's camouflage."), max_distance = 4)
playsound(H.loc, 'sound/effects/cloak_scout_on.ogg', 15, TRUE)
H.unset_interaction()
Expand Down Expand Up @@ -785,6 +786,7 @@ GLOBAL_LIST_EMPTY_TYPED(radio_packs, /obj/item/storage/backpack/marine/satchel/r
cloak_cooldown = world.time + 10 SECONDS

camo_active = FALSE
REMOVE_TRAIT(H, TRAIT_CLOAKED, TRAIT_SOURCE_EQUIPMENT(WEAR_BACK))
H.visible_message(SPAN_DANGER("[H] shimmers into existence!"), SPAN_WARNING("Your cloak's camouflage has deactivated!"), max_distance = 4)
playsound(H.loc, 'sound/effects/cloak_scout_off.ogg', 15, TRUE)

Expand Down
4 changes: 3 additions & 1 deletion code/modules/cm_preds/yaut_bracers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@
return FALSE

cloaked = TRUE
ADD_TRAIT(M, TRAIT_CLOAKED, TRAIT_SOURCE_EQUIPMENT(WEAR_HANDS))

RegisterSignal(M, COMSIG_HUMAN_EXTINGUISH, PROC_REF(wrapper_fizzle_camouflage))
RegisterSignal(M, COMSIG_HUMAN_PRE_BULLET_ACT, PROC_REF(bullet_hit))
Expand Down Expand Up @@ -617,7 +618,8 @@
cloak_malfunction = world.time + decloak_timer

cloaked = FALSE
log_game("[key_name_admin(usr)] has disabled their cloaking device.")
REMOVE_TRAIT(user, TRAIT_CLOAKED, TRAIT_SOURCE_EQUIPMENT(WEAR_HANDS))
log_game("[key_name_admin(user)] has disabled their cloaking device.")
user.visible_message(SPAN_WARNING("[user] shimmers into existence!"), SPAN_WARNING("Your cloaking device deactivates."))
playsound(user.loc, 'sound/effects/pred_cloakoff.ogg', 15, 1)
user.alpha = initial(user.alpha)
Expand Down
6 changes: 4 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
if (LPA && istype(LPA))
LPA.knockdown = TRUE // pounce knocks down
LPA.freeze_self = TRUE
ADD_TRAIT(bound_xeno, TRAIT_CLOAKED, TRAIT_SOURCE_ABILITY("cloak"))
bound_xeno.stealth = TRUE
can_go_invisible = FALSE
invis_start_time = world.time
Expand All @@ -130,6 +131,7 @@
LPA.knockdown = FALSE // pounce no longer knocks down
LPA.freeze_self = FALSE
bound_xeno.stealth = FALSE
REMOVE_TRAIT(bound_xeno, TRAIT_CLOAKED, TRAIT_SOURCE_ABILITY("cloak"))

// SLIGHTLY hacky because we need to maintain lots of other state on the lurker
// whenever invisibility is on/off CD and when it's active.
Expand Down Expand Up @@ -166,8 +168,8 @@
return

var/mob/living/carbon/human/bumped_into = movable_atom
if(bumped_into.alpha < 100) //ignore invisible scouts and preds
if(HAS_TRAIT(bumped_into, TRAIT_CLOAKED)) //ignore invisible scouts and preds
return

to_chat(bound_xeno, SPAN_XENOHIGHDANGER("You bumped into someone and lost your invisibility!"))
lurker_invisibility_action.invisibility_off()
12 changes: 10 additions & 2 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@
if(max_distance) view_dist = max_distance
for(var/mob/M as anything in viewers(view_dist, src))
var/msg = message
if(self_message && M==src)
if(self_message && M == src)
msg = self_message
if(flags & CHAT_TYPE_TARGETS_ME)
flags = CHAT_TYPE_BEING_HIT

else if((M != src) && HAS_TRAIT(src, TRAIT_CLOAKED))
continue

M.show_message( msg, SHOW_MESSAGE_VISIBLE, blind_message, SHOW_MESSAGE_AUDIBLE, flags)
CHECK_TICK

Expand Down Expand Up @@ -183,10 +187,14 @@
// message is output to anyone who can see, e.g. "The [src] does something!"
// blind_message (optional) is what blind people will hear e.g. "You hear something!"
/atom/proc/visible_message(message, blind_message, max_distance, message_flags = CHAT_TYPE_OTHER)
if(HAS_TRAIT(src, TRAIT_CLOAKED))
return FALSE
var/view_dist = 7
if(max_distance) view_dist = max_distance
if(max_distance)
view_dist = max_distance
for(var/mob/M as anything in viewers(view_dist, src))
M.show_message(message, SHOW_MESSAGE_VISIBLE, blind_message, SHOW_MESSAGE_AUDIBLE, message_flags)
return TRUE

// Show a message to all mobs in earshot of this atom
// Use for objects performing only audible actions
Expand Down

0 comments on commit da4398e

Please sign in to comment.