From 44271b3f9f110bc58e425ecdf166d551fe91b634 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 16 Oct 2023 08:05:15 +0200 Subject: [PATCH] [MIRROR] Fixes announcements font scaling [MDB IGNORE] (#24357) * Fixes announcements font scaling (#78995) ## About The Pull Request Creates CSS spans for priority announcement and minor announcement so they scale properly with the player's chosen font size ![image](https://github.com/tgstation/tgstation/assets/83487515/0706891d-05e9-4f00-b24f-ebf37efdd18d) ## Why It's Good For The Game Fixes https://github.com/tgstation/tgstation/issues/78875 ## Changelog :cl: LT3 fix: Fixed font scaling for announcements /:cl: * Fixes announcements font scaling --------- Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com> --- code/__DEFINES/span.dm | 4 +++ code/__HELPERS/priority_announce.dm | 34 +++++++++++-------- code/controllers/subsystem/ticker.dm | 2 +- code/modules/hallucination/station_message.dm | 30 +++++++--------- .../tgui-panel/styles/tgchat/chat-dark.scss | 28 +++++++++++++++ .../tgui-panel/styles/tgchat/chat-light.scss | 17 ++++++++++ 6 files changed, 81 insertions(+), 34 deletions(-) diff --git a/code/__DEFINES/span.dm b/code/__DEFINES/span.dm index 7b23869988b..361c4d41b81 100644 --- a/code/__DEFINES/span.dm +++ b/code/__DEFINES/span.dm @@ -74,6 +74,7 @@ #define span_message(str) ("" + str + "") #define span_mind_control(str) ("" + str + "") #define span_minorannounce(str) ("" + str + "") +#define span_minoralert(str) ("" + str + "") #define span_monkey(str) ("" + str + "") #define span_name(str) ("" + str + "") #define span_narsie(str) ("" + str + "") @@ -85,6 +86,9 @@ #define span_papyrus(str) ("" + str + "") #define span_phobia(str) ("" + str + "") #define span_prefix(str) ("" + str + "") +#define span_priorityalert(str) ("" + str + "") +#define span_priorityannounce(str) ("" + str + "") +#define span_prioritytitle(str) ("" + str + "") #define span_purple(str) ("" + str + "") #define span_radio(str) ("" + str + "") #define span_reallybig(str) ("" + str + "") diff --git a/code/__HELPERS/priority_announce.dm b/code/__HELPERS/priority_announce.dm index 7f343f00da5..0b57e9851d7 100644 --- a/code/__HELPERS/priority_announce.dm +++ b/code/__HELPERS/priority_announce.dm @@ -38,23 +38,25 @@ else if(SSstation.announcer.event_sounds[sound]) sound = SSstation.announcer.event_sounds[sound] + announcement += "

" + if(type == "Priority") - announcement += "

Priority Announcement

" + announcement += "[span_priorityannounce("Priority Announcement")]" if (title && length(title) > 0) - announcement += "

[title]

" + announcement += "[span_prioritytitle("
[title]")]" else if(type == "Captain") - announcement += "

Captain Announces

" + announcement += "[span_priorityannounce("Captain Announces")]" GLOB.news_network.submit_article(text, "Captain's Announcement", "Station Announcements", null) else if(type == "Syndicate Captain") - announcement += "

Syndicate Captain Announces

" + announcement += "[span_priorityannounce("Syndicate Captain Announces")]" else if(!sender_override) - announcement += "

[command_name()] Update

" + announcement += "[span_priorityannounce("[command_name()] Update")]" else - announcement += "

[sender_override]

" + announcement += "[span_priorityannounce("[sender_override]")]" if (title && length(title) > 0) - announcement += "

[title]

" + announcement += "[span_prioritytitle("
[title]")]" if(!sender_override) if(title == "") @@ -64,10 +66,11 @@ ///If the announcer overrides alert messages, use that message. if(SSstation.announcer.custom_alert_message && !has_important_message) - announcement += SSstation.announcer.custom_alert_message + announcement += "[span_priorityalert("
[SSstation.announcer.custom_alert_message]
")]" else - announcement += "
[span_alert(text)]
" - announcement += "
" + announcement += "[span_priorityalert("
[text]
")]" + + announcement += "

" if(!players) players = GLOB.player_list @@ -86,11 +89,11 @@ if(announce) priority_announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", SSstation.announcer.get_rand_report_sound(), has_important_message = TRUE) - var/datum/comm_message/M = new - M.title = title - M.content = text + var/datum/comm_message/message = new + message.title = title + message.content = text - SScommunications.send_message(M) + SScommunications.send_message(message) /** * Sends a minor annoucement to players. @@ -122,7 +125,8 @@ if(!target.can_hear()) continue - to_chat(target, "[span_minorannounce("[title]
[message]")]
") + to_chat(target, "
[span_minorannounce(title)]
") + to_chat(target, "[span_minoralert(message)]


") if(should_play_sound && target.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements)) var/sound_to_play = sound_override || (alert ? 'sound/misc/notice1.ogg' : 'sound/misc/notice2.ogg') SEND_SOUND(target, sound(sound_to_play)) diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 1aaf01ee85f..97b2c85b2aa 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -300,7 +300,7 @@ SUBSYSTEM_DEF(ticker) to_chat(world, span_notice("and...")) for(var/holidayname in GLOB.holidays) var/datum/holiday/holiday = GLOB.holidays[holidayname] - to_chat(world, "

[holiday.greet()]

") + to_chat(world, span_info(holiday.greet())) PostSetup() diff --git a/code/modules/hallucination/station_message.dm b/code/modules/hallucination/station_message.dm index fa51e103cca..02488d2016e 100644 --- a/code/modules/hallucination/station_message.dm +++ b/code/modules/hallucination/station_message.dm @@ -1,6 +1,3 @@ -#define ALERT_TITLE(text) ("

" + text + "

") -#define ALERT_BODY(text) ("

" + span_alert(text) + "

") - /datum/hallucination/station_message abstract_hallucination_parent = /datum/hallucination/station_message random_hallucination_weight = 1 @@ -12,16 +9,16 @@ /datum/hallucination/station_message/blob_alert /datum/hallucination/station_message/blob_alert/start() - to_chat(hallucinator, ALERT_TITLE("Biohazard Alert")) - to_chat(hallucinator, ALERT_BODY("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.")) + to_chat(hallucinator, span_priorityannounce("Biohazard Alert")) + to_chat(hallucinator, span_priorityalert("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.")) SEND_SOUND(hallucinator, sound(SSstation.announcer.event_sounds[ANNOUNCER_OUTBREAK5])) return ..() /datum/hallucination/station_message/shuttle_dock /datum/hallucination/station_message/shuttle_dock/start() - to_chat(hallucinator, ALERT_TITLE("Priority Announcement")) - to_chat(hallucinator, ALERT_BODY("[SSshuttle.emergency || "The Emergency Shuttle"] has docked with the station. You have 3 minutes to board the Emergency Shuttle.")) + to_chat(hallucinator, span_priorityannounce("Priority Announcement")) + to_chat(hallucinator, span_priorityalert("[SSshuttle.emergency || "The Emergency Shuttle"] has docked with the station. You have 3 minutes to board the Emergency Shuttle.")) SEND_SOUND(hallucinator, sound(SSstation.announcer.event_sounds[ANNOUNCER_SHUTTLEDOCK])) return ..() @@ -31,8 +28,8 @@ if(!(locate(/mob/living/silicon/ai) in GLOB.silicon_mobs)) return FALSE - to_chat(hallucinator, ALERT_TITLE("Anomaly Alert")) - to_chat(hallucinator, ALERT_BODY("Hostile runtimes detected in all station systems, please deactivate your AI to prevent possible damage to its morality core.")) + to_chat(hallucinator, span_priorityannounce("Anomaly Alert")) + to_chat(hallucinator, span_priorityalert("Hostile runtimes detected in all station systems, please deactivate your AI to prevent possible damage to its morality core.")) SEND_SOUND(hallucinator, sound(SSstation.announcer.event_sounds[ANNOUNCER_AIMALF])) return ..() @@ -56,8 +53,8 @@ var/message_with_name = pick(ascension_bodies) message_with_name = replacetext(message_with_name, "%FAKENAME%", totally_real_heretic.real_name) - to_chat(hallucinator, ALERT_TITLE(generate_heretic_text())) - to_chat(hallucinator, ALERT_BODY("[generate_heretic_text()] [message_with_name] [generate_heretic_text()]")) + to_chat(hallucinator, span_priorityannounce("[generate_heretic_text()]")) + to_chat(hallucinator, span_priorityalert("[generate_heretic_text()] [message_with_name] [generate_heretic_text()]")) SEND_SOUND(hallucinator, sound(SSstation.announcer.event_sounds[ANNOUNCER_SPANOMALIES])) return ..() @@ -74,8 +71,8 @@ var/area/fake_summon_area_type = pick(GLOB.the_station_areas - hallucinator_area.type) var/area/fake_summon_area = GLOB.areas_by_type[fake_summon_area_type] - to_chat(hallucinator, ALERT_TITLE("Central Command Higher Dimensional Affairs")) - to_chat(hallucinator, ALERT_BODY("Figments from an eldritch god are being summoned by [totally_real_cult_leader.real_name] \ + to_chat(hallucinator, span_priorityannounce("Central Command Higher Dimensional Affairs")) + to_chat(hallucinator, span_priorityalert("Figments from an eldritch god are being summoned by [totally_real_cult_leader.real_name] \ into [fake_summon_area] from an unknown dimension. Disrupt the ritual at all costs!")) SEND_SOUND(hallucinator, 'sound/ambience/antag/bloodcult/bloodcult_scribe.ogg') @@ -85,8 +82,8 @@ random_hallucination_weight = 2 /datum/hallucination/station_message/meteors/start() - to_chat(hallucinator, ALERT_TITLE("Meteor Alert")) - to_chat(hallucinator, ALERT_BODY("Meteors have been detected on collision course with the station.")) + to_chat(hallucinator, span_priorityannounce("Meteor Alert")) + to_chat(hallucinator, span_priorityalert("Meteors have been detected on collision course with the station.")) SEND_SOUND(hallucinator, sound(SSstation.announcer.event_sounds[ANNOUNCER_METEORS])) return ..() @@ -113,6 +110,3 @@ hallucinator.playsound_local(get_turf(hallucinator), 'sound/effects/explosion_distant.ogg', 50, FALSE, pressure_affected = FALSE) qdel(src) - -#undef ALERT_TITLE -#undef ALERT_BODY diff --git a/tgui/packages/tgui-panel/styles/tgchat/chat-dark.scss b/tgui/packages/tgui-panel/styles/tgchat/chat-dark.scss index 43e2fa93343..b3fa0eb66fa 100644 --- a/tgui/packages/tgui-panel/styles/tgchat/chat-dark.scss +++ b/tgui/packages/tgui-panel/styles/tgchat/chat-dark.scss @@ -437,8 +437,36 @@ em { } .minorannounce { + color: #c51e1e; font-weight: bold; font-size: 185%; + margin-top: 1rem; +} + +.minoralert { + color: #a4bad6; + font-size: 125%; + margin-top: 1rem; +} + +.priorityannounce { + color: #a4bad6; + font-weight: bold; + font-size: 225%; + margin-top: 1rem; +} + +.prioritytitle { + color: #9ab0ff; + font-weight: bold; + font-size: 185%; + margin-top: 1rem; +} + +.priorityalert { + color: #c51e1e; + font-size: 140%; + margin-top: 1rem; } .greenannounce { diff --git a/tgui/packages/tgui-panel/styles/tgchat/chat-light.scss b/tgui/packages/tgui-panel/styles/tgchat/chat-light.scss index e685cded774..efa16db9fc4 100644 --- a/tgui/packages/tgui-panel/styles/tgchat/chat-light.scss +++ b/tgui/packages/tgui-panel/styles/tgchat/chat-light.scss @@ -469,10 +469,27 @@ h2.alert { } .minorannounce { + color: #ff0000; font-weight: bold; font-size: 185%; } +.minoralert { + color: #000000; + font-size: 125%; +} + +.priorityannounce { + color: #000000; + font-weight: bold; + font-size: 210%; +} + +.priorityalert { + color: #ff0000; + font-size: 140%; +} + .greenannounce { color: #00ff00; font-weight: bold;