From 5c9d8639982809e96f011e45198ff0c2fb77e570 Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Sat, 24 Sep 2022 03:26:31 -0400 Subject: [PATCH] Demoralization fixes (#69924) * Demoralization fixes Blind mobs will no longer be demoralized by posters and graffiti. Illiterate mobs will no longer be demoralized by the words on posters. Mobs will no longer be demoralized by posters & graffiti if it's too dark to see them. Also makes can_read use reading check flags, one for literacy and one for light. --- code/__DEFINES/mobs.dm | 5 +++++ code/game/machinery/_machinery.dm | 2 +- .../antagonists/traitor/components/demoraliser.dm | 8 ++++++++ code/modules/mob/dead/observer/observer.dm | 2 +- code/modules/mob/mob.dm | 13 ++++++++----- .../modular_computers/computers/item/computer_ui.dm | 2 +- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 7ca8dd2125f..75a033b684a 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -725,3 +725,8 @@ /// Possible value of [/atom/movable/buckle_lying]. If set to a different (positive-or-zero) value than this, the buckling thing will force a lying angle on the buckled. #define NO_BUCKLE_LYING -1 + +/// Checking flags for [/mob/proc/can_read()] +#define READING_CHECK_LITERACY (1<<0) +#define READING_CHECK_LIGHT (1<<1) + diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 11da05bd40e..b64d3455b1a 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -562,7 +562,7 @@ return FALSE // machines have their own lit up display screens and LED buttons so we don't need to check for light - if((interaction_flags_machine & INTERACT_MACHINE_REQUIRES_LITERACY) && !user.can_read(src, check_for_light = FALSE)) + if((interaction_flags_machine & INTERACT_MACHINE_REQUIRES_LITERACY) && !user.can_read(src, READING_CHECK_LITERACY)) return FALSE if(panel_open && !(interaction_flags_machine & INTERACT_MACHINE_OPEN)) diff --git a/code/modules/antagonists/traitor/components/demoraliser.dm b/code/modules/antagonists/traitor/components/demoraliser.dm index 6f505a2ab1f..b6c02dc252f 100644 --- a/code/modules/antagonists/traitor/components/demoraliser.dm +++ b/code/modules/antagonists/traitor/components/demoraliser.dm @@ -44,8 +44,13 @@ // If you're not conscious you're too busy or dead to look at propaganda if (viewer.stat != CONSCIOUS) return + if(viewer.is_blind()) + return if (!should_demoralise(viewer)) return + if(!viewer.can_read(host, moods.reading_requirements, TRUE)) //if it's a text based demoralization datum, make sure the mob has the capability to read. if it's only an image, make sure it's just bright enough for them to see it. + return + if (is_special_character(viewer)) to_chat(viewer, span_notice("[moods.antag_notification]")) @@ -86,6 +91,8 @@ var/datum/mood_event/crew_mood /// Text to display to a head of staff upon receiving this mood var/authority_notification + /// For literacy checks + var/reading_requirements = READING_CHECK_LIGHT /// Mood datum to apply to a head of staff or security var/datum/mood_event/authority_mood @@ -97,6 +104,7 @@ crew_mood = /datum/mood_event/traitor_poster_crew authority_notification = "Hey! Who put up that poster?" authority_mood = /datum/mood_event/traitor_poster_auth + reading_requirements = (READING_CHECK_LITERACY | READING_CHECK_LIGHT) /datum/mood_event/traitor_poster_antag description = "I am doing the right thing." diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index e7af260a595..7b6a13a8f9c 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -846,7 +846,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/is_literate() return TRUE -/mob/dead/observer/can_read(obj/O, check_for_light = FALSE) +/mob/dead/observer/can_read(atom/viewed_atom, reading_check_flags, silent) return TRUE // we want to bypass all the checks /mob/dead/observer/vv_edit_var(var_name, var_value) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 109b385adb9..16b24e2ce8a 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1187,14 +1187,17 @@ var/turf/mob_location = get_turf(src) return mob_location.get_lumcount() > light_amount + /// Can this mob read -/mob/proc/can_read(obj/O, check_for_light = TRUE) - if(!is_literate()) - to_chat(src, span_warning("You try to read [O], but can't comprehend any of it.")) +/mob/proc/can_read(atom/viewed_atom, reading_check_flags = (READING_CHECK_LITERACY|READING_CHECK_LIGHT), silent = FALSE) + if((reading_check_flags & READING_CHECK_LITERACY) && !is_literate()) + if(!silent) + to_chat(src, span_warning("You try to read [viewed_atom], but can't comprehend any of it.")) return FALSE - if(check_for_light && !has_light_nearby() && !has_nightvision()) - to_chat(src, span_warning("It's too dark in here to read!")) + if((reading_check_flags & READING_CHECK_LIGHT) && !has_light_nearby() && !has_nightvision()) + if(!silent) + to_chat(src, span_warning("It's too dark in here to read!")) return FALSE return TRUE diff --git a/code/modules/modular_computers/computers/item/computer_ui.dm b/code/modules/modular_computers/computers/item/computer_ui.dm index 1e31e441662..dc06395e2a3 100644 --- a/code/modules/modular_computers/computers/item/computer_ui.dm +++ b/code/modules/modular_computers/computers/item/computer_ui.dm @@ -13,7 +13,7 @@ ui.close() return - if(!user.can_read(src, check_for_light = FALSE)) + if(!user.can_read(src, READING_CHECK_LITERACY)) return if(HAS_TRAIT(user, TRAIT_CHUNKYFINGERS) && !allow_chunky)