diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index 3664da4a5d..2d40d91023 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -98,6 +98,7 @@ //the define for visible message range in combat #define COMBAT_MESSAGE_RANGE 3 +#define DEFAULT_MESSAGE_RANGE 7 //Shove knockdown lengths (deciseconds) #define SHOVE_KNOCKDOWN_SOLID 30 diff --git a/code/__DEFINES/say.dm b/code/__DEFINES/say.dm index d582728acb..beeee22df9 100644 --- a/code/__DEFINES/say.dm +++ b/code/__DEFINES/say.dm @@ -84,3 +84,7 @@ #define MAX_NAME_LEN 42 #define MAX_BROADCAST_LEN 512 #define MAX_CHARTER_LEN 80 + +// 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 diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index dd189137a5..c52427b546 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -57,7 +57,7 @@ var/screen_start_x = 4 //These two are where the storage starts being rendered, screen_loc wise. var/screen_start_y = 2 //End - + var/limited_random_access = FALSE //Quick if statement in accessible_items to determine if we care at all about what people can access at once. var/limited_random_access_stack_position = 0 //If >0, can only access top items var/limited_random_access_stack_bottom_up = FALSE //If TRUE, above becomes bottom items @@ -647,9 +647,9 @@ if(M == viewing) to_chat(usr, "You put [I] [insert_preposition]to [parent].") else if(in_range(M, viewing)) //If someone is standing close enough, they can tell what it is... - viewing.show_message("[M] puts [I] [insert_preposition]to [parent].", 1) + viewing.show_message("[M] puts [I] [insert_preposition]to [parent].", MSG_VISUAL) else if(I && I.w_class >= 3) //Otherwise they can only see large or normal items from a distance... - viewing.show_message("[M] puts [I] [insert_preposition]to [parent].", 1) + viewing.show_message("[M] puts [I] [insert_preposition]to [parent].", MSG_VISUAL) /datum/component/storage/proc/update_icon() if(isobj(parent)) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 37d2c77373..836caeaf04 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -1044,7 +1044,7 @@ GLOBAL_LIST_EMPTY(PDAs) if (ismob(loc)) var/mob/M = loc - M.show_message("Your [src] explodes!", 1) + M.show_message("Your [src] explodes!", MSG_VISUAL, "You hear a loud *pop*!", MSG_AUDIBLE) else visible_message("[src] explodes!", "You hear a loud *pop*!") diff --git a/code/game/objects/items/devices/PDA/virus_cart.dm b/code/game/objects/items/devices/PDA/virus_cart.dm index 28bc559b93..d90399461b 100644 --- a/code/game/objects/items/devices/PDA/virus_cart.dm +++ b/code/game/objects/items/devices/PDA/virus_cart.dm @@ -72,12 +72,12 @@ difficulty += 2 var/datum/component/uplink/hidden_uplink = target.GetComponent(/datum/component/uplink) if(!target.detonatable || prob(difficulty * 15) || (hidden_uplink)) - U.show_message("An error flashes on your [src].", 1) + U.show_message("An error flashes on your [src].", MSG_VISUAL) else message_admins("[!is_special_character(U) ? "Non-antag " : ""][ADMIN_LOOKUPFLW(U)] triggered a PDA explosion on [target.name] at [ADMIN_VERBOSEJMP(target)].") var/message_log = "triggered a PDA explosion on [target.name] at [AREACOORD(target)]." U.log_message(message_log, LOG_ATTACK) - U.show_message("Success!", 1) + U.show_message("Success!", MSG_VISUAL) target.explode() else to_chat(U, "PDA not found.") diff --git a/code/game/objects/items/grenades/flashbang.dm b/code/game/objects/items/grenades/flashbang.dm index e8b5704e41..48ecf8273a 100644 --- a/code/game/objects/items/grenades/flashbang.dm +++ b/code/game/objects/items/grenades/flashbang.dm @@ -21,7 +21,7 @@ /obj/item/grenade/flashbang/proc/bang(turf/T , mob/living/M) if(M.stat == DEAD) //They're dead! return - M.show_message("BANG", 2) + M.show_message("BANG", MSG_AUDIBLE) var/distance = max(0,get_dist(get_turf(src),T)) //Flash diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index 78a15c8af4..705dcad6c6 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -162,7 +162,7 @@ //we are not catholic if(young == TRUE || Kisser.young == TRUE) - user.show_message("[src] plays tag with [Kisser].", 1, + user.show_message("[src] plays tag with [Kisser].", MSG_VISUAL, "They're happy.", 0) Kisser.cheer_up() cheer_up() @@ -170,10 +170,10 @@ //never again else if(Kisser in scorned) //message, visible, alternate message, neither visible nor audible - user.show_message("[src] rejects the advances of [Kisser]!", 1, + user.show_message("[src] rejects the advances of [Kisser]!", MSG_VISUAL, "That didn't feel like it worked.", 0) else if(src in Kisser.scorned) - user.show_message("[Kisser] realises who [src] is and turns away.", 1, + user.show_message("[Kisser] realises who [src] is and turns away.", MSG_VISUAL, "That didn't feel like it worked.", 0) //first comes love @@ -194,7 +194,7 @@ new_lover(Kisser) Kisser.new_lover(src) else - user.show_message("[src] rejects the advances of [Kisser], maybe next time?", 1, + user.show_message("[src] rejects the advances of [Kisser], maybe next time?", MSG_VISUAL, "That didn't feel like it worked, this time.", 0) //then comes marriage diff --git a/code/game/objects/items/storage/boxes.dm b/code/game/objects/items/storage/boxes.dm index b4f058eede..6c11745f1a 100644 --- a/code/game/objects/items/storage/boxes.dm +++ b/code/game/objects/items/storage/boxes.dm @@ -884,12 +884,12 @@ else if(W.get_sharpness()) if(!contents.len) if(item_state == "paperbag_None") - user.show_message("You cut eyeholes into [src].", 1) + user.show_message("You cut eyeholes into [src].", MSG_VISUAL) new /obj/item/clothing/head/papersack(user.loc) qdel(src) return 0 else if(item_state == "paperbag_SmileyFace") - user.show_message("You cut eyeholes into [src] and modify the design.", 1) + user.show_message("You cut eyeholes into [src] and modify the design.", MSG_VISUAL) new /obj/item/clothing/head/papersack/smiley(user.loc) qdel(src) return 0 diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index e0e875b739..92b0036ee0 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -201,7 +201,7 @@ if(!current_location || current_area.noteleport || is_away_level(current_location.z) || !isturf(user.loc))//If turf was not found or they're on z level 2 or >7 which does not currently exist. or if user is not located on a turf to_chat(user, "\The [src] is malfunctioning.") return - user.show_message("Locked In.", 2) + user.show_message("Locked In.", MSG_AUDIBLE) var/list/obj/effect/portal/created = create_portal_pair(current_location, get_teleport_turf(get_turf(T)), src, 300, 1, null, atmos_link_override) if(!(LAZYLEN(created) == 2)) return diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 0fcc034371..8d3a64b3d5 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -182,7 +182,7 @@ return src.add_fingerprint(user) if (src.bullets < 1) - user.show_message("*click*", 2) + user.show_message("*click*", MSG_AUDIBLE) playsound(src, "gun_dry_fire", 30, 1) return playsound(user, 'sound/weapons/gunshot.ogg', 100, 1) diff --git a/code/game/objects/structures/loom.dm b/code/game/objects/structures/loom.dm index 1b4cac9d1f..28427469ba 100644 --- a/code/game/objects/structures/loom.dm +++ b/code/game/objects/structures/loom.dm @@ -25,20 +25,20 @@ if(!istype(S) || !S.is_fabric) return FALSE if(!anchored) - user.show_message("The loom needs to be wrenched down.", 1) + user.show_message("The loom needs to be wrenched down.", MSG_VISUAL) return FALSE if(S.amount < FABRIC_PER_SHEET) user.show_message("You need at least [FABRIC_PER_SHEET] units of fabric before using this.", 1) return FALSE - user.show_message("You start weaving \the [S.name] through the loom..", 1) + user.show_message("You start weaving \the [S.name] through the loom..", MSG_VISUAL) if(S.use_tool(src, user, S.pull_effort)) if(S.amount >= FABRIC_PER_SHEET) new S.loom_result(drop_location()) S.use(FABRIC_PER_SHEET) - user.show_message("You weave \the [S.name] into a workable fabric.", 1) + user.show_message("You weave \the [S.name] into a workable fabric.", MSG_VISUAL) return TRUE /obj/structure/loom/unanchored anchored = FALSE -#undef FABRIC_PER_SHEET +#undef FABRIC_PER_SHEET \ No newline at end of file diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index e7032ead13..eda12d66a9 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -65,7 +65,7 @@ /obj/item/clothing/head/helmet/space/hardsuit/proc/display_visor_message(var/msg) var/mob/wearer = loc if(msg && ishuman(wearer)) - wearer.show_message("[icon2html(src, wearer)][msg]", 1) + wearer.show_message("[icon2html(src, wearer)][msg]", MSG_VISUAL) /obj/item/clothing/head/helmet/space/hardsuit/rad_act(severity) . = ..() diff --git a/code/modules/hydroponics/grown/cotton.dm b/code/modules/hydroponics/grown/cotton.dm index 4787d62230..a898b76ee8 100644 --- a/code/modules/hydroponics/grown/cotton.dm +++ b/code/modules/hydroponics/grown/cotton.dm @@ -32,7 +32,7 @@ var/cotton_name = "raw cotton" /obj/item/grown/cotton/attack_self(mob/user) - user.show_message("You pull some [cotton_name] out of the [name]!", 1) + user.show_message("You pull some [cotton_name] out of the [name]!", MSG_VISUAL) var/seed_modifier = 0 if(seed) seed_modifier = round(seed.potency / 25) diff --git a/code/modules/hydroponics/grown/pumpkin.dm b/code/modules/hydroponics/grown/pumpkin.dm index 02bc776b78..46dc49a169 100644 --- a/code/modules/hydroponics/grown/pumpkin.dm +++ b/code/modules/hydroponics/grown/pumpkin.dm @@ -29,7 +29,7 @@ /obj/item/reagent_containers/food/snacks/grown/pumpkin/attackby(obj/item/W as obj, mob/user as mob, params) if(W.get_sharpness()) - user.show_message("You carve a face into [src]!", 1) + user.show_message("You carve a face into [src]!", MSG_VISUAL) new /obj/item/clothing/head/hardhat/pumpkinhead(user.loc) qdel(src) return diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm index 9a660ac282..9d7081ad65 100644 --- a/code/modules/hydroponics/grown/towercap.dm +++ b/code/modules/hydroponics/grown/towercap.dm @@ -51,7 +51,7 @@ /obj/item/grown/log/attackby(obj/item/W, mob/user, params) if(W.sharpness) - user.show_message("You make [plank_name] out of \the [src]!", 1) + user.show_message("You make [plank_name] out of \the [src]!", MSG_VISUAL) var/seed_modifier = 0 if(seed) seed_modifier = round(seed.potency / 25) diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 70e5e28365..48ce55a052 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -862,27 +862,27 @@ if(M.stat == DEAD) //F return if(M == H) - H.show_message("You cringe with pain as your body rings around you!", 2) + H.show_message("You cringe with pain as your body rings around you!", MSG_AUDIBLE) H.playsound_local(H, 'sound/effects/gong.ogg', 100, TRUE) H.soundbang_act(2, 0, 100, 1) H.jitteriness += 7 var/distance = max(0,get_dist(get_turf(H),get_turf(M))) switch(distance) if(0 to 1) - M.show_message("GONG!", 2) + M.show_message("GONG!", MSG_AUDIBLE) M.playsound_local(H, 'sound/effects/gong.ogg', 100, TRUE) M.soundbang_act(1, 0, 30, 3) M.confused += 10 M.jitteriness += 4 SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "gonged", /datum/mood_event/loud_gong) if(2 to 3) - M.show_message("GONG!", 2) + M.show_message("GONG!", MSG_AUDIBLE) M.playsound_local(H, 'sound/effects/gong.ogg', 75, TRUE) M.soundbang_act(1, 0, 15, 2) M.jitteriness += 3 SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "gonged", /datum/mood_event/loud_gong) else - M.show_message("GONG!", 2) + M.show_message("GONG!", MSG_AUDIBLE) M.playsound_local(H, 'sound/effects/gong.ogg', 50, TRUE) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index f0c8de7e76..660a866271 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -233,7 +233,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list( // Recompose message for AI hrefs, language incomprehension. message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode) - show_message(message, 2, deaf_message, deaf_type) + show_message(message, MSG_AUDIBLE, deaf_message, deaf_type) return message /mob/living/send_speech(message, message_range = 6, obj/source = src, bubble_type = bubble_icon, list/spans, datum/language/message_language=null, message_mode) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index b9e289be5b..28208e27e4 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -827,7 +827,7 @@ var/rendered = "[start][hrefpart][namepart] ([jobpart]) [raw_message]" - show_message(rendered, 2) + show_message(rendered, MSG_AUDIBLE) /mob/living/silicon/ai/fully_replace_character_name(oldname,newname) ..() 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 b1694a6172..78dc050ee0 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm @@ -80,7 +80,7 @@ Difficulty: Medium return FALSE return ..() -/mob/living/simple_animal/hostile/megafauna/dragon/visible_message() +/mob/living/simple_animal/hostile/megafauna/dragon/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs) 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 7a4603228a..d4528fb91f 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -85,106 +85,120 @@ msg = copytext(msg, 1, MAX_MESSAGE_LEN) if(type) - if(type & 1 && eye_blind )//Vision related + if(type & MSG_VISUAL && eye_blind )//Vision related if(!alt_msg) return else msg = alt_msg type = alt_type - if(type & 2 && !can_hear())//Hearing related + if(type & MSG_AUDIBLE && !can_hear())//Hearing related if(!alt_msg) return else msg = alt_msg type = alt_type - if(type & 1 && eye_blind) + if(type & MSG_VISUAL && eye_blind) return // voice muffling if(stat == UNCONSCIOUS) - if(type & 2) //audio + if(type & MSG_AUDIBLE) //audio to_chat(src, "... You can almost hear something ...") - else - to_chat(src, msg) + return + to_chat(src, msg) -// Show a message to all player mobs who sees this atom -// Show a message to the src mob (if the src is a mob) -// Use for atoms performing visible actions -// message is output to anyone who can see, e.g. "The [src] does something!" -// self_message (optional) is what the src mob sees e.g. "You do something!" -// blind_message (optional) is what blind people will hear e.g. "You hear something!" -// vision_distance (optional) define how many tiles away the message can be seen. -// ignored_mob (optional) doesn't show any message to a given mob if TRUE. - -/atom/proc/visible_message(message, self_message, blind_message, vision_distance, list/ignored_mobs, no_ghosts = FALSE) +/** + * Generate a visible message from this atom + * + * Show a message to all player mobs who sees this atom + * + * Show a message to the src mob (if the src is a mob) + * + * Use for atoms performing visible actions + * + * message is output to anyone who can see, e.g. "The [src] does something!" + * + * Vars: + * * self_message (optional) is what the src mob sees e.g. "You do something!" + * * blind_message (optional) is what blind people will hear e.g. "You hear something!" + * * vision_distance (optional) define how many tiles away the message can be seen. + * * ignored_mobs (optional) doesn't show any message to any given mob in the list. + */ +/atom/proc/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs) var/turf/T = get_turf(src) if(!T) return + var/list/hearers = get_hearers_in_view(vision_distance, src) //caches the hearers and then removes ignored mobs. + if(!length(hearers)) + return if(!islist(ignored_mobs)) ignored_mobs = list(ignored_mobs) - var/range = 7 - if(vision_distance) - range = vision_distance - for(var/mob/M in get_hearers_in_view(range, src)) + hearers -= ignored_mobs + if(self_message) + hearers -= src + for(var/mob/M in hearers) if(!M.client) continue - if(M in ignored_mobs) - continue + //This entire if/else chain could be in two lines but isn't for readibilties sake. var/msg = message - if(isobserver(M) && no_ghosts) + //CITADEL EDIT, required for vore code to remove (T != loc && T != src)) as a check + if(M.see_invisible[message]" if(emote_type == EMOTE_AUDIBLE) - user.audible_message(message=message,hearing_distance=1, no_ghosts = TRUE) + 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, no_ghosts = TRUE) + user.visible_message(message=message,self_message=message,vision_distance=1, ignored_mobs = GLOB.dead_mob_list) log_emote("[key_name(user)] : (SUBTLER) [message]") message = null diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 28e5774e93..68ffcb909a 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -677,10 +677,10 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) for(var/mob/living/L in range(10)) investigate_log("has irradiated [key_name(L)] after consuming [AM].", INVESTIGATE_SUPERMATTER) if(L in view()) - L.show_message("As \the [src] slowly stops resonating, you find your skin covered in new radiation burns.", 1,\ - "The unearthly ringing subsides and you notice you have new radiation burns.", 2) + L.show_message("As \the [src] slowly stops resonating, you find your skin covered in new radiation burns.", MSG_VISUAL,\ + "The unearthly ringing subsides and you notice you have new radiation burns.", MSG_AUDIBLE) else - L.show_message("You hear an unearthly ringing and notice your skin is covered in fresh radiation burns.", 2) + L.show_message("You hear an unearthly ringing and notice your skin is covered in fresh radiation burns.", MSG_AUDIBLE) //Do not blow up our internal radio /obj/machinery/power/supermatter_crystal/contents_explosion(severity, target) diff --git a/code/modules/projectiles/pins.dm b/code/modules/projectiles/pins.dm index 9103340790..1e2070de1b 100644 --- a/code/modules/projectiles/pins.dm +++ b/code/modules/projectiles/pins.dm @@ -60,10 +60,10 @@ /obj/item/firing_pin/proc/auth_fail(mob/living/user) if(user) - user.show_message(fail_message, 1) + user.show_message(fail_message, MSG_VISUAL) if(selfdestruct) if(user) - user.show_message("SELF-DESTRUCTING...
", 1) + user.show_message("SELF-DESTRUCTING...
", MSG_VISUAL) to_chat(user, "[gun] explodes!") explosion(get_turf(gun), -1, 0, 2, 3) if(gun) diff --git a/code/modules/recycling/disposal/holder.dm b/code/modules/recycling/disposal/holder.dm index dfc58f8c2d..2e36a9deaa 100644 --- a/code/modules/recycling/disposal/holder.dm +++ b/code/modules/recycling/disposal/holder.dm @@ -117,7 +117,7 @@ if(user.incapacitated()) return for(var/mob/M in range(5, get_turf(src))) - M.show_message("CLONG, clong!", 2) + M.show_message("CLONG, clong!", MSG_AUDIBLE) playsound(src.loc, 'sound/effects/clang.ogg', 50, 0, 0) // called to vent all gas in holder to a location diff --git a/code/modules/vore/eating/belly_obj.dm b/code/modules/vore/eating/belly_obj.dm index 5c2b45dace..ad54c8a0c8 100644 --- a/code/modules/vore/eating/belly_obj.dm +++ b/code/modules/vore/eating/belly_obj.dm @@ -595,7 +595,7 @@ for(var/mob/living/H in hearing_mobs) if(H && H.client && (isturf(H.loc))) - H.show_message(struggle_outer_message, 1) // visible + H.show_message(struggle_outer_message, MSG_VISUAL) // visible to_chat(R,struggle_user_message)