From 24ee6077c7d85cbfa5b77e7845d65013b6bd8bc8 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Sun, 23 Oct 2022 00:18:03 -0300 Subject: [PATCH] push changes --- code/__DEFINES/spans.dm | 1 + code/__HELPERS/game.dm | 10 ++--- code/__HELPERS/mobs.dm | 38 ++++++++++++------- code/controllers/subsystem/shuttle.dm | 4 +- .../game/machinery/computer/communications.dm | 12 +++--- code/modules/admin/verbs/randomverbs.dm | 2 +- code/modules/cargo/centcom_podlauncher.dm | 2 +- code/modules/events/_event.dm | 2 +- .../modules/mob/dead/new_player/new_player.dm | 2 +- code/modules/mob/living/death.dm | 3 +- code/modules/mob/say.dm | 8 +++- .../security_levels/keycard_authentication.dm | 4 +- code/modules/shuttle/arrivals.dm | 4 +- code/modules/spells/spell_types/curse.dm | 2 +- .../reagents/chemistry/reagents/astrogen.dm | 2 +- 15 files changed, 54 insertions(+), 42 deletions(-) diff --git a/code/__DEFINES/spans.dm b/code/__DEFINES/spans.dm index 50fc40d5ca..b6b633d91a 100644 --- a/code/__DEFINES/spans.dm +++ b/code/__DEFINES/spans.dm @@ -56,6 +56,7 @@ #define span_icon(str) ("" + str + "") #define span_info(str) ("" + str + "") #define span_interface(str) ("" + str + "") +#define span_linkify(str) ("" + str + "") #define span_looc(str) ("" + str + "") #define span_medal(str) ("" + str + "") #define span_medradio(str) ("" + str + "") diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 5578b1f22a..f0f8eb817c 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -567,14 +567,12 @@ return A.loc -/proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank) +///Send a message in common radio when a player arrives +/proc/announce_arrival(mob/living/carbon/human/character, rank) if(!SSticker.IsRoundInProgress() || QDELETED(character)) return - var/area/A = get_area(character) - var/message = "\ - [character.real_name] ([rank]) has arrived at the station at \ - [A.name]." - deadchat_broadcast(message, follow_target = character, message_type=DEADCHAT_ARRIVALRATTLE) + var/area/player_area = get_area(character) + deadchat_broadcast(" has arrived at the station at [player_area.name].", "[character.real_name] ([rank])", follow_target = character, message_type=DEADCHAT_ARRIVALRATTLE) if((!GLOB.announcement_systems.len) || (!character.mind)) return if((character.mind.assigned_role == "Cyborg") || (character.mind.assigned_role == character.mind.special_role)) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 4cd82f9e66..dca8c184f2 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -382,17 +382,27 @@ GLOBAL_LIST_EMPTY(species_datums) for(var/i in 1 to step_count) step(X, pick(NORTH, SOUTH, EAST, WEST)) -/proc/deadchat_broadcast(message, mob/follow_target=null, turf/turf_target=null, speaker_key=null, message_type=DEADCHAT_REGULAR) - message = "[message]" - for(var/mob/M in GLOB.player_list) - var/datum/preferences/prefs - if(M.client && M.client.prefs) - prefs = M.client.prefs - else - prefs = new +// Displays a message in deadchat, sent by source. source is not linkified, message is, to avoid stuff like character names to be linkified. +// Automatically gives the class deadsay to the whole message (message + source) +/proc/deadchat_broadcast(message, source=null, mob/follow_target=null, turf/turf_target=null, speaker_key=null, message_type=DEADCHAT_REGULAR, admin_only=FALSE) + message = span_deadsay("[source][span_linkify(message)]") + for(var/mob/M in GLOB.player_list) + var/chat_toggles = TOGGLES_DEFAULT_CHAT + var/toggles = TOGGLES_DEFAULT + var/list/ignoring + if(M.client?.prefs) + var/datum/preferences/prefs = M.client?.prefs + chat_toggles = prefs.chat_toggles + toggles = prefs.toggles + ignoring = prefs.ignoring + if(admin_only) + if (!M.client?.holder) + return + else + message += span_deadsay(" (This is viewable to admins only).") var/override = FALSE - if(M.client && M.client.holder && (prefs.chat_toggles & CHAT_DEAD)) + if(M.client?.holder && (chat_toggles & CHAT_DEAD)) override = TRUE if(HAS_TRAIT(M, TRAIT_SIXTHSENSE)) override = TRUE @@ -402,15 +412,15 @@ GLOBAL_LIST_EMPTY(species_datums) continue if(M.stat != DEAD && !override) continue - if(speaker_key && (speaker_key in prefs.ignoring)) + if(speaker_key && (speaker_key in ignoring)) continue switch(message_type) if(DEADCHAT_DEATHRATTLE) - if(prefs.toggles & DISABLE_DEATHRATTLE) + if(toggles & DISABLE_DEATHRATTLE) continue if(DEADCHAT_ARRIVALRATTLE) - if(prefs.toggles & DISABLE_ARRIVALRATTLE) + if(toggles & DISABLE_ARRIVALRATTLE) continue if(isobserver(M)) @@ -427,9 +437,9 @@ GLOBAL_LIST_EMPTY(species_datums) var/turf_link = TURF_LINK(M, turf_target) rendered_message = "[turf_link] [message]" - to_chat(M, rendered_message) + to_chat(M, rendered_message, avoid_highlighting = speaker_key == M.key) else - to_chat(M, message) + to_chat(M, message, avoid_highlighting = speaker_key == M.key) //Used in chemical_mob_spawn. Generates a random mob based on a given gold_core_spawnable value. /proc/create_random_mob(spawn_location, mob_class = HOSTILE_SPAWN) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index da295d70e2..dbec272fe8 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -254,7 +254,7 @@ SUBSYSTEM_DEF(shuttle) var/area/A = get_area(user) log_shuttle("[key_name(user)] has called the emergency shuttle.") - deadchat_broadcast(" has called the shuttle at [A.name].", "[user.real_name]", user) //, message_type=DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" has called the shuttle at [span_name("[A.name]")].", span_name("[user.real_name]"), user, message_type=DEADCHAT_ANNOUNCEMENT) if(call_reason) SSblackbox.record_feedback("text", "shuttle_reason", 1, "[call_reason]") log_shuttle("Shuttle call reason: [call_reason]") @@ -293,7 +293,7 @@ SUBSYSTEM_DEF(shuttle) emergency.cancel(get_area(user)) log_shuttle("[key_name(user)] has recalled the shuttle.") message_admins("[ADMIN_LOOKUPFLW(user)] has recalled the shuttle.") - deadchat_broadcast(" has recalled the shuttle from [get_area_name(user, TRUE)].", "[user.real_name]", user) //, message_type=DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" has recalled the shuttle from [span_name("[get_area_name(user, TRUE)]")].", span_name("[user.real_name]"), user, message_type=DEADCHAT_ANNOUNCEMENT) return 1 /datum/controller/subsystem/shuttle/proc/canRecall() diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 7c22846ece..fc3eaf5ca4 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -159,7 +159,7 @@ // Only notify people if an actual change happened log_game("[key_name(usr)] has changed the security level to [params["newSecurityLevel"]] with [src] at [AREACOORD(usr)].") message_admins("[ADMIN_LOOKUPFLW(usr)] has changed the security level to [params["newSecurityLevel"]] with [src] at [AREACOORD(usr)].") - deadchat_broadcast(" has changed the security level to [params["newSecurityLevel"]] with [src] at [span_name("[get_area_name(usr, TRUE)]")].", usr, src.loc, message_type=DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" has changed the security level to [params["newSecurityLevel"]] with [src] at [span_name("[get_area_name(usr, TRUE)]")].", span_name("[usr.real_name]"), usr, message_type=DEADCHAT_ANNOUNCEMENT) alert_level_tick += 1 if ("deleteMessage") @@ -198,7 +198,7 @@ var/associates = emagged ? "the Syndicate": "CentCom" usr.log_talk(message, LOG_SAY, tag = "message to [associates]") - deadchat_broadcast(" has messaged [associates], \"[message]\" at [span_name("[get_area_name(usr, TRUE)]")].", usr, src.loc, message_type = DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" has messaged [associates], \"[message]\" at [span_name("[get_area_name(usr, TRUE)]")].", span_name("[usr.real_name]"), usr, message_type = DEADCHAT_ANNOUNCEMENT) COOLDOWN_START(src, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN) if ("purchaseShuttle") var/can_buy_shuttles_or_fail_reason = can_buy_shuttles(usr) @@ -281,7 +281,7 @@ minor_announce(message, title = "Outgoing message to allied station") usr.log_talk(message, LOG_SAY, tag = "message to the other server") message_admins("[ADMIN_LOOKUPFLW(usr)] has sent a message to the other server\[s].") - deadchat_broadcast(" has sent an outgoing message to the other station(s).", usr, src.loc, message_type = DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" has sent an outgoing message to the other station(s).", "[usr.real_name]", usr, message_type = DEADCHAT_ANNOUNCEMENT) COOLDOWN_START(src, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN) if ("setState") @@ -345,12 +345,12 @@ revoke_maint_all_access() log_game("[key_name(usr)] disabled emergency maintenance access.") message_admins("[ADMIN_LOOKUPFLW(usr)] disabled emergency maintenance access.") - deadchat_broadcast(" disabled emergency maintenance access at [span_name("[get_area_name(usr, TRUE)]")].", usr, src.loc, message_type = DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" disabled emergency maintenance access at [span_name("[get_area_name(usr, TRUE)]")].", span_name("[usr.real_name]"), usr, message_type = DEADCHAT_ANNOUNCEMENT) else make_maint_all_access() log_game("[key_name(usr)] enabled emergency maintenance access.") message_admins("[ADMIN_LOOKUPFLW(usr)] enabled emergency maintenance access.") - deadchat_broadcast(" enabled emergency maintenance access at [span_name("[get_area_name(usr, TRUE)]")].", usr, src.loc, message_type = DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" enabled emergency maintenance access at [span_name("[get_area_name(usr, TRUE)]")].", span_name("[usr.real_name]"), usr, message_type = DEADCHAT_ANNOUNCEMENT) /obj/machinery/computer/communications/ui_data(mob/user) var/list/data = list( @@ -555,7 +555,7 @@ else input = user.treat_message(input) //Adds slurs and so on. Someone should make this use languages too. SScommunications.make_announcement(user, is_ai, input) - deadchat_broadcast(" made a priority announcement from [span_name("[get_area_name(usr, TRUE)]")].", user, src.loc, message_type=DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(" made a priority announcement from [span_name("[get_area_name(usr, TRUE)]")].", span_name("[user.real_name]"), user, message_type=DEADCHAT_ANNOUNCEMENT) /obj/machinery/computer/communications/proc/post_status(command, data1, data2) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 85b3d9eaa4..6f55466015 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -491,7 +491,7 @@ Traitors and the like can also be revived with the previous role mostly intact. GLOB.data_core.manifest_inject(new_character) if(alert(new_character,"Would you like an active AI to announce this character?",,"No","Yes")=="Yes") - AnnounceArrival(new_character, new_character.mind.assigned_role) + announce_arrival(new_character, new_character.mind.assigned_role) var/msg = "[admin] has respawned [player_key] as [new_character.real_name]." message_admins(msg) diff --git a/code/modules/cargo/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index e4060de1a2..8af43b8b00 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -595,7 +595,7 @@ else return //if target is null and we don't have a specific target, cancel if (effectAnnounce) - deadchat_broadcast("A special package is being launched at the station!", turf_target = target) + deadchat_broadcast("A special package is being launched at the station!", turf_target = target, message_type=DEADCHAT_ANNOUNCEMENT) var/list/bouttaDie = list() for (var/mob/living/target_mob in target) bouttaDie.Add(target_mob) diff --git a/code/modules/events/_event.dm b/code/modules/events/_event.dm index 640dbc468f..3abe65a790 100644 --- a/code/modules/events/_event.dm +++ b/code/modules/events/_event.dm @@ -118,7 +118,7 @@ if(random) log_game("Random Event triggering: [name] ([typepath])") if (alert_observers) - deadchat_broadcast("[name] has just been[random ? " randomly" : ""] triggered!") //STOP ASSUMING IT'S BADMINS! + deadchat_broadcast(" has just been[random ? " randomly" : ""] triggered!", "[name]", message_type=DEADCHAT_ANNOUNCEMENT) //STOP ASSUMING IT'S BADMINS! return E //Special admins setup diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index cfcb881977..453f654c2c 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -494,7 +494,7 @@ if(SSshuttle.arrivals) SSshuttle.arrivals.QueueAnnounce(humanc, rank) else - AnnounceArrival(humanc, rank) + announce_arrival(humanc, rank) AddEmploymentContract(humanc) if(GLOB.highlander) to_chat(humanc, "THERE CAN BE ONLY ONE!!!") diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index cbf0de51de..65433c2bd9 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -93,8 +93,7 @@ var/turf/T = get_turf(src) if(mind && mind.name && mind.active && !istype(T.loc, /area/ctf) && !(signal & COMPONENT_BLOCK_DEATH_BROADCAST)) - var/rendered = "[mind.name] has died at [get_area_name(T)]." - deadchat_broadcast(rendered, follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE) + deadchat_broadcast(" has died at [get_area_name(T)].", "[mind.name]", follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE) if (client && client.prefs && client.prefs.auto_ooc) if (!(client.prefs.chat_toggles & CHAT_OOC)) client.prefs.chat_toggles ^= CHAT_OOC diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index d8ef440ef9..f2d4e249d2 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -139,10 +139,14 @@ var/spanned = say_quote(say_emphasis(message)) message = emoji_parse(message) - var/rendered = "DEAD: [name][alt_name] [emoji_parse(spanned)]" + var/source = "DEAD: [name][alt_name]" + var/rendered = " [emoji_parse(spanned)]" log_talk(message, LOG_SAY, tag="DEAD") client?.last_activity = world.time - deadchat_broadcast(rendered, follow_target = src, speaker_key = key) + var/displayed_key = key + if(client?.holder?.fakekey) + displayed_key = null + deadchat_broadcast(rendered, source, follow_target = src, speaker_key = displayed_key) /mob/proc/check_emote(message) if(message[1] == "*") diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 562dc17182..65fc9d3278 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -116,10 +116,10 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new) message_admins("[ADMIN_LOOKUPFLW(triggerer)] triggered and [ADMIN_LOOKUPFLW(confirmer)] confirmed event [event]") var/area/A1 = get_area(triggerer) - deadchat_broadcast(" triggered [event] at [A1.name].", "[triggerer]", triggerer) + deadchat_broadcast(" triggered [event] at [span_name("[A1.name]")].", span_name("[triggerer]"), triggerer, message_type=DEADCHAT_ANNOUNCEMENT) var/area/A2 = get_area(confirmer) - deadchat_broadcast(" confirmed [event] at [A2.name].", "[confirmer]", confirmer) + deadchat_broadcast(" confirmed [event] at [span_name("[A2.name]")].", span_name("[confirmer]"), confirmer, message_type=DEADCHAT_ANNOUNCEMENT) switch(event) if(KEYCARD_RED_ALERT) set_security_level(SEC_LEVEL_RED) diff --git a/code/modules/shuttle/arrivals.dm b/code/modules/shuttle/arrivals.dm index 8322c6cdd8..e0ca10db8a 100644 --- a/code/modules/shuttle/arrivals.dm +++ b/code/modules/shuttle/arrivals.dm @@ -195,9 +195,9 @@ /obj/docking_port/mobile/arrivals/proc/QueueAnnounce(mob, rank) if(mode != SHUTTLE_CALL) - AnnounceArrival(mob, rank) + announce_arrival(mob, rank) else - LAZYADD(queued_announces, CALLBACK(GLOBAL_PROC, .proc/AnnounceArrival, mob, rank)) + LAZYADD(queued_announces, CALLBACK(GLOBAL_PROC, .proc/announce_arrival, mob, rank)) /obj/docking_port/mobile/arrivals/vv_edit_var(var_name, var_value) switch(var_name) diff --git a/code/modules/spells/spell_types/curse.dm b/code/modules/spells/spell_types/curse.dm index 9449e4a5d0..43340f98ef 100644 --- a/code/modules/spells/spell_types/curse.dm +++ b/code/modules/spells/spell_types/curse.dm @@ -8,7 +8,7 @@ GLOBAL_VAR_INIT(curse_of_madness_triggered, FALSE) GLOB.curse_of_madness_triggered = message // So latejoiners are also afflicted. - deadchat_broadcast("A Curse of Madness has stricken the station, shattering their minds with the awful secret: \"[message]\"") + deadchat_broadcast("A [span_name("Curse of Madness")] has stricken the station, shattering their minds with the awful secret: \"[message]\"", message_type=DEADCHAT_ANNOUNCEMENT) for(var/mob/living/carbon/human/H in GLOB.player_list) if(H.stat == DEAD) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm index bdc599a5e2..2be1a97873 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm @@ -163,7 +163,7 @@ I'd like to point out from my calculations it'll take about 60-80 minutes to die if(-INFINITY to 30) to_chat(M, "Your body disperses from existence, as you become one with the universe.") to_chat(M, "As your body disappears, your consciousness doesn't. Should you find a way back into the mortal coil, your memories of your previous life remain with you. (At the cost of staying in character while dead. Failure to do this may get you banned from this chem. You are still obligated to follow your directives if you play a midround antag, you do not remember the afterlife IC)")//Legalised IC OOK? I have a suspicion this won't make it past the review. At least it'll be presented as a neat idea! If this is unacceptable how about the player can retain living memories across lives if they die in this way only. - deadchat_broadcast("[M] has become one with the universe, meaning that their IC conciousness is continuous in a new life. If they find a way back to life, they are allowed to remember their previous life. Be careful what you say. If they abuse this, bwoink the FUCK outta them.") + deadchat_broadcast(" has become one with the universe, meaning that their IC conciousness is continuous in a new life. If they find a way back to life, they are allowed to remember their previous life. Be careful what you say. If they abuse this, bwoink the FUCK outta them.", "[M]", M, message_type=DEADCHAT_ANNOUNCEMENT) M.visible_message("[M] suddenly disappears, their body evaporating from existence, freeing [M] from their mortal coil.") message_admins("[M] (ckey: [M.ckey]) has become one with the universe, and have continuous memories thoughout their lives should they find a way to come back to life (such as an inteligence potion, midround antag, ghost role).") SSblackbox.record_feedback("tally", "fermi_chem", 1, "Astral obliterations")