From d500a12b707b19f35d0679cf5706079a5f7cbc19 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Sun, 1 Nov 2020 14:09:38 -0700 Subject: [PATCH] adds EMOTE_BOTH and EMOTE_OMNI which is both audible/visible and ignores checks entirely. subtler/subtle is omni and regular emotes are both. (#13584) * Update say.dm * Update mob.dm * Update emotes.dm * Update say_vr.dm * Update emote.dm * Update emotes.dm * Update mob.dm * Update say_vr.dm * Update drake.dm --- code/__DEFINES/say.dm | 8 ++++- code/datums/emotes.dm | 6 +++- code/modules/mob/living/emote.dm | 13 +------ .../simple_animal/hostile/megafauna/drake.dm | 2 +- code/modules/mob/mob.dm | 34 ++++++++++++------- code/modules/mob/say_vr.dm | 20 ++--------- 6 files changed, 38 insertions(+), 45 deletions(-) diff --git a/code/__DEFINES/say.dm b/code/__DEFINES/say.dm index 5775e128f8..57484ae85b 100644 --- a/code/__DEFINES/say.dm +++ b/code/__DEFINES/say.dm @@ -76,8 +76,14 @@ #define LINGHIVE_LINK 3 //whether the emote is visible or audible. +// Requires sight #define EMOTE_VISIBLE 1 +// Requires hearing #define EMOTE_AUDIBLE 2 +// Requires sight or hearing +#define EMOTE_BOTH 3 +// Always able to be seen +#define EMOTE_OMNI 4 //Don't set this very much higher then 1024 unless you like inviting people in to dos your server with message spam #define MAX_MESSAGE_LEN 2048 //Citadel edit: What's the WORST that could happen? @@ -89,4 +95,4 @@ // Audio/Visual Flags. Used to determine what sense are required to notice a message. #define MSG_VISUAL (1<<0) -#define MSG_AUDIBLE (1<<1) \ No newline at end of file +#define MSG_AUDIBLE (1<<1) diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index e1147df225..14f3eae689 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -66,8 +66,12 @@ if(emote_type == EMOTE_AUDIBLE) user.audible_message(msg) - else + else if(emote_type == EMOTE_VISIBLE) user.visible_message(msg) + else if(emote_type == EMOTE_BOTH) + user.visible_message(msg, blind_message = msg) + else if(emote_type == EMOTE_OMNI) + user.visible_message(msg, omni = TRUE) /datum/emote/proc/replace_pronoun(mob/user, message) if(findtext(message, "their")) diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index 4ee52a08a6..ce8bbc5dab 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -443,6 +443,7 @@ key = "me" key_third_person = "custom" message = null + emote_type = EMOTE_BOTH /datum/emote/living/custom/proc/check_invalid(mob/user, input) if(stop_bad_mime.Find(input, 1, 1)) @@ -462,24 +463,12 @@ else if(!params) var/custom_emote = stripped_multiline_input_or_reflect(user, "Choose an emote to display.", "Custom Emote", null, MAX_MESSAGE_LEN) if(custom_emote && !check_invalid(user, custom_emote)) - var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable") - switch(type) - if("Visible") - emote_type = EMOTE_VISIBLE - if("Hearable") - emote_type = EMOTE_AUDIBLE - else - alert("Unable to use this emote, must be either hearable or visible.") - return message = custom_emote else message = params - if(type_override) - emote_type = type_override message = user.say_emphasis(message) . = ..() message = null - emote_type = EMOTE_VISIBLE /datum/emote/living/custom/replace_pronoun(mob/user, message) return message diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm index f0ab3fba4c..477483862b 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm @@ -87,7 +87,7 @@ Difficulty: Medium return FALSE return ..() -/mob/living/simple_animal/hostile/megafauna/dragon/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs, mob/target, target_message) +/mob/living/simple_animal/hostile/megafauna/dragon/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs, mob/target, target_message, omni = FALSE) if(swooping & SWOOP_INVULNERABLE) //to suppress attack messages without overriding every single proc that could send a message saying we got hit return return ..() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index ab2556abb5..3416a8b337 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -127,8 +127,9 @@ * * ignored_mobs (optional) doesn't show any message to any given mob in the list. * * target (optional) is the other mob involved with the visible message. For example, the attacker in many combat messages. * * target_message (optional) is what the target mob will see e.g. "[src] does something to you!" + * * omni (optional) if TRUE, will show to users no matter what. */ -/atom/proc/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, ignored_mobs, mob/target, target_message) +/atom/proc/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, ignored_mobs, mob/target, target_message, omni = FALSE) var/turf/T = get_turf(src) if(!T) return @@ -139,20 +140,26 @@ if(target_message && target && istype(target) && target.client) hearers -= target - //This entire if/else chain could be in two lines but isn't for readibilties sake. - var/msg = target_message - if(target.see_invisible[user.say_emphasis(message)]" - if(emote_type == EMOTE_AUDIBLE) - user.audible_message(message=message,hearing_distance=1, ignored_mobs = GLOB.dead_mob_list) - else - user.visible_message(message=message,self_message=message,vision_distance=1, ignored_mobs = GLOB.dead_mob_list) + user.visible_message(message = message, self_message = message, vision_distance = 1, ignored_mobs = GLOB.dead_mob_list, omni = TRUE) ///////////////// VERB CODE /mob/living/verb/subtle()