Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
#define COMSIG_MOB_THROW "mob_throw" //! from base of /mob/throw_item(): (atom/target)
#define COMSIG_MOB_UPDATE_SIGHT "mob_update_sight" //! from base of /mob/update_sight(): ()
#define COMSIG_MOB_EXAMINATE "mob_examinate" //from base of /mob/verb/examinate(): (atom/target)
#define COMSIG_MOB_SAY "mob_say" // from /mob/living/say(): (proc args list)
#define COMSIG_MOB_SAY "mob_say" // from /mob/living/say(): ()
#define COMPONENT_UPPERCASE_SPEECH 1
// used to access COMSIG_MOB_SAY argslist
#define SPEECH_MESSAGE 1
Expand Down
8 changes: 5 additions & 3 deletions code/datums/brain_damage/brain_trauma.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,23 @@
/datum/brain_trauma/proc/on_gain()
to_chat(owner, gain_text)
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
RegisterSignal(owner, COMSIG_MOVABLE_HEAR, .proc/handle_hearing)

//Called when removed from a mob
/datum/brain_trauma/proc/on_lose(silent)
if(!silent)
to_chat(owner, lose_text)
UnregisterSignal(owner, COMSIG_MOB_SAY)
UnregisterSignal(owner, COMSIG_MOVABLE_HEAR)

//Called when hearing a spoken message
/datum/brain_trauma/proc/on_hear(message, speaker, message_language, raw_message, radio_freq)
return message
/datum/brain_trauma/proc/handle_hearing(datum/source, list/hearing_args)
SIGNAL_HANDLER
UnregisterSignal(owner, COMSIG_MOVABLE_HEAR)

//Called when speaking
/datum/brain_trauma/proc/handle_speech(datum/source, list/speech_args)
UnregisterSignal(owner, COMSIG_MOB_SAY)

//Called when hugging. expand into generally interacting, where future coders could switch the intent?
/datum/brain_trauma/proc/on_hug(mob/living/hugger, mob/living/hugged)
return
5 changes: 2 additions & 3 deletions code/datums/brain_damage/hypnosis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@
if(2)
new /datum/hallucination/chat(owner, TRUE, FALSE, "<span class='hypnophrase'>[hypnotic_phrase]</span>")

/datum/brain_trauma/hypnosis/on_hear(message, speaker, message_language, raw_message, radio_freq)
message = target_phrase.Replace(message, "<span class='hypnophrase'>$1</span>")
return message
/datum/brain_trauma/hypnosis/handle_hearing(datum/source, list/hearing_args)
hearing_args[HEARING_RAW_MESSAGE] = target_phrase.Replace(hearing_args[HEARING_RAW_MESSAGE], "<span class='hypnophrase'>$1</span>")
11 changes: 5 additions & 6 deletions code/datums/brain_damage/phobia.dm
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,20 @@



/datum/brain_trauma/mild/phobia/on_hear(message, speaker, message_language, raw_message, radio_freq)
/datum/brain_trauma/mild/phobia/handle_hearing(datum/source, list/hearing_args)

if(!owner.can_hear()) //words can't trigger you if you can't hear them *taps head*
return message
return
if(HAS_TRAIT(owner, TRAIT_FEARLESS))
return message
return
for(var/word in trigger_words)
var/regex/reg = regex("(\\b|\\A)[REGEX_QUOTE(word)]'?s*(\\b|\\Z)", "i")

if(findtext(raw_message, reg))
if(findtext(hearing_args[HEARING_RAW_MESSAGE], reg))
if(fear_state <= (PHOBIA_STATE_CALM)) //words can put you on edge, but won't take you over it, unless you have gotten stressed already. don't call freak_out to avoid gaming the adrenaline rush
fearscore ++
message = reg.Replace(message, "<span class='phobia'>$1</span>")
hearing_args[HEARING_RAW_MESSAGE] = reg.Replace(hearing_args[HEARING_RAW_MESSAGE], "<span class='phobia'>$1</span>")
break
return message

/datum/brain_trauma/mild/phobia/handle_speech(datum/source, list/speech_args)
if(HAS_TRAIT(owner, TRAIT_FEARLESS))
Expand Down
10 changes: 5 additions & 5 deletions code/datums/brain_damage/split_personality.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@
/datum/brain_trauma/severe/split_personality/brainwashing/on_life()
return //no random switching

/datum/brain_trauma/severe/split_personality/brainwashing/on_hear(message, speaker, message_language, raw_message, radio_freq)
if(HAS_TRAIT(owner, TRAIT_DEAF) || owner == speaker)
return message
/datum/brain_trauma/severe/split_personality/brainwashing/handle_hearing(datum/source, list/hearing_args)
if(HAS_TRAIT(owner, TRAIT_DEAF) || owner == hearing_args[HEARING_SPEAKER])
return
var/message = hearing_args[HEARING_RAW_MESSAGE]
if(findtext(message, codeword))
message = replacetext(message, codeword, "<span class='warning'>[codeword]</span>")
hearing_args[HEARING_RAW_MESSAGE] = replacetext(message, codeword, "<span class='warning'>[codeword]</span>")
addtimer(CALLBACK(src, /datum/brain_trauma/severe/split_personality.proc/switch_personalities), 10)
return message

/datum/brain_trauma/severe/split_personality/brainwashing/handle_speech(datum/source, list/speech_args)
if(findtext(speech_args[SPEECH_MESSAGE], codeword))
Expand Down
10 changes: 8 additions & 2 deletions code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,20 @@
owner.remove_client_colour(/datum/client_colour/monochrome)
to_chat(owner, "<span class='warning'>You snap out of your trance!</span>")

<<<<<<< HEAD
/datum/status_effect/trance/proc/hypnotize(datum/source, message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, list/message_mods = list())
=======
/datum/status_effect/trance/proc/hypnotize(datum/source, list/hearing_args, list/spans, list/message_mods = list())
SIGNAL_HANDLER

>>>>>>> 3e6cc68be9 (Ports #44391 and #48637 from TGStation (#4755))
if(!owner.can_hear())
return
if(speaker == owner)
if(hearing_args[HEARING_SPEAKER] == owner)
return
var/mob/living/carbon/C = owner
C.cure_trauma_type(/datum/brain_trauma/hypnosis, TRAUMA_RESILIENCE_SURGERY) //clear previous hypnosis
addtimer(CALLBACK(C, /mob/living/carbon.proc/gain_trauma, /datum/brain_trauma/hypnosis, TRAUMA_RESILIENCE_SURGERY, raw_message), 10)
addtimer(CALLBACK(C, /mob/living/carbon.proc/gain_trauma, /datum/brain_trauma/hypnosis, TRAUMA_RESILIENCE_SURGERY, hearing_args[HEARING_RAW_MESSAGE]), 10)
addtimer(CALLBACK(C, /mob/living.proc/Stun, 60, TRUE, TRUE), 15) //Take some time to think about it
qdel(src)

Expand Down
14 changes: 14 additions & 0 deletions code/datums/status_effects/neutral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@
alert_type = null
var/mob/living/listening_in

/datum/status_effect/bugged/on_apply(mob/living/new_owner, mob/living/tracker)
. = ..()
if (.)
RegisterSignal(new_owner, COMSIG_MOVABLE_HEAR, .proc/handle_hearing)

/datum/status_effect/bugged/on_remove()
. = ..()
UnregisterSignal(owner, COMSIG_MOVABLE_HEAR)

/datum/status_effect/bugged/proc/handle_hearing(datum/source, list/hearing_args)
SIGNAL_HANDLER
listening_in.show_message(hearing_args[HEARING_MESSAGE])


/datum/status_effect/bugged/on_creation(mob/living/new_owner, mob/living/tracker)
. = ..()
if(.)
Expand Down
2 changes: 1 addition & 1 deletion code/game/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GLOBAL_LIST_INIT(freqtospan, list(
send_speech(message, 7, src, , spans, message_language=language)

/atom/movable/proc/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, list/message_mods = list())
SEND_SIGNAL(src, COMSIG_MOVABLE_HEAR, message, speaker, message_language, raw_message, radio_freq, spans, message_mods)
SEND_SIGNAL(src, COMSIG_MOVABLE_HEAR, args)

/atom/movable/proc/can_speak()
return 1
Expand Down
14 changes: 12 additions & 2 deletions code/modules/antagonists/traitor/datum_traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
owner.special_role = null
..()

/datum/antagonist/traitor/proc/handle_hearing(datum/source, list/hearing_args)
SIGNAL_HANDLER
var/message = hearing_args[HEARING_RAW_MESSAGE]
message = GLOB.syndicate_code_phrase_regex.Replace(message, "<span class='blue'>$1</span>")
message = GLOB.syndicate_code_response_regex.Replace(message, "<span class='red'>$1</span>")
hearing_args[HEARING_RAW_MESSAGE] = message

/datum/antagonist/traitor/proc/add_objective(datum/objective/O)
objectives += O
log_objective(owner, O.explanation_text)
Expand Down Expand Up @@ -230,16 +237,19 @@
/datum/antagonist/traitor/apply_innate_effects(mob/living/mob_override)
. = ..()
update_traitor_icons_added()
var/mob/living/silicon/ai/A = mob_override || owner.current
if(istype(A) && traitor_kind == TRAITOR_AI)
var/mob/living/M = mob_override || owner.current
if(isAI(M) && traitor_kind == TRAITOR_AI)
var/mob/living/silicon/ai/A = M
A.hack_software = TRUE
RegisterSignal(M, COMSIG_MOVABLE_HEAR, .proc/handle_hearing)

/datum/antagonist/traitor/remove_innate_effects(mob/living/mob_override)
. = ..()
update_traitor_icons_removed()
var/mob/living/silicon/ai/A = mob_override || owner.current
if(istype(A) && traitor_kind == TRAITOR_AI)
A.hack_software = FALSE
UnregisterSignal(owner.current, COMSIG_MOVABLE_HEAR, .proc/handle_hearing)

/datum/antagonist/traitor/proc/give_codewords()
if(!owner.current)
Expand Down
13 changes: 0 additions & 13 deletions code/modules/mob/living/carbon/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,3 @@
else
. = initial(dt.flags) & TONGUELESS_SPEECH

/mob/living/carbon/hear_intercept(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, list/message_mods = list())
var/datum/status_effect/bugged/B = has_status_effect(STATUS_EFFECT_BUGGED)
if(B)
B.listening_in.show_message(message)
for(var/T in get_traumas())
var/datum/brain_trauma/trauma = T
message = trauma.on_hear(message, speaker, message_language, raw_message, radio_freq)

if (src.mind.has_antag_datum(/datum/antagonist/traitor))
message = GLOB.syndicate_code_phrase_regex.Replace(message, "<span class='blue'>$1</span>")
message = GLOB.syndicate_code_response_regex.Replace(message, "<span class='red'>$1</span>")

return message
7 changes: 2 additions & 5 deletions code/modules/mob/living/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(

return new_msg

/mob/living/say(message, bubble_type,var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
/mob/living/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
var/static/list/crit_allowed_modes = list(WHISPER_MODE = TRUE, MODE_CHANGELING = TRUE, MODE_ALIEN = TRUE)
var/static/list/unconscious_allowed_modes = list(MODE_CHANGELING = TRUE, MODE_ALIEN = TRUE)

Expand Down Expand Up @@ -210,7 +210,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
return 1

/mob/living/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, list/message_mods = list())
. = ..()
SEND_SIGNAL(src, COMSIG_MOVABLE_HEAR, args)
if(!client)
return
var/deaf_message
Expand All @@ -235,9 +235,6 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
show_message(message, MSG_AUDIBLE, deaf_message, deaf_type)
return message

/mob/living/proc/hear_intercept(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, list/message_mods = list())
return message

/mob/living/send_speech(message, message_range = 6, obj/source = src, bubble_type = bubble_icon, list/spans, datum/language/message_language=null, list/message_mods = list())
var/static/list/eavesdropping_modes = list(MODE_WHISPER = TRUE, MODE_WHISPER_CRIT = TRUE)
var/eavesdrop_range = 0
Expand Down