From ec1b49875fe2189002dacd9264b77c02c2036f10 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Thu, 16 Sep 2021 18:18:55 +0100 Subject: [PATCH] Colourblind fixing fix (#16698) --- code/__HELPERS/unsorted.dm | 18 ------------------ .../hostile/megafauna/colossus.dm | 7 +++---- .../hostile/megafauna/hierophant.dm | 3 +-- code/modules/mob/mob_helpers.dm | 14 ++++++++++++++ .../ruins/objects_and_mobs/necropolis_gate.dm | 4 ++-- 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 4bbc7d03d07..8b4cea27947 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1926,24 +1926,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) return pois -/proc/flash_color(mob_or_client, flash_color="#960000", flash_time=20) - var/client/C - if(istype(mob_or_client, /mob)) - var/mob/M = mob_or_client - if(M.client) - C = M.client - else - return - else if(istype(mob_or_client, /client)) - C = mob_or_client - - if(!istype(C)) - return - - C.color = flash_color - spawn(0) - animate(C, color = initial(C.color), time = flash_time) - #define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255))) /proc/make_bit_triplet() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index 6324e8bb7a6..c0dcff97bb9 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -205,10 +205,9 @@ Difficulty: Very Hard shoot_projectile(E) /mob/living/simple_animal/hostile/megafauna/colossus/proc/telegraph() - for(var/mob/M in range(10,src)) - if(M.client) - flash_color(M.client, "#C80000", 1) - shake_camera(M, 4, 3) + for(var/mob/M in range(10, src)) + M.flash_screen_color("#C80000", 1) + shake_camera(M, 4, 3) playsound(src, 'sound/magic/narsie_attack.ogg', 200, TRUE) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index c83cf6c3c18..e7fe3f53632 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -670,8 +670,7 @@ Difficulty: Hard hit_things += L if((friendly_fire_check && caster && caster.faction_check_mob(L)) || L.stat == DEAD) continue - if(L.client) - flash_color(L.client, "#660099", 1) + L.flash_screen_color("#660099", 1) playsound(L,'sound/weapons/sear.ogg', 50, TRUE, -4) to_chat(L, "You're struck by a [name]!") var/limb_to_hit = L.get_organ(pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 8276d06f126..38669dba55f 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -13,6 +13,7 @@ return 0 /mob/proc/get_screen_colour() + return /mob/proc/update_client_colour(time = 10) //Update the mob's client.color with an animation the specified time in length. if(!client) //No client_colour without client. If the player logs back in they'll be back through here anyway. @@ -31,6 +32,19 @@ else if(eyes) //If they're not, check to see if their eyes got one of them there colour matrices. Will be null if eyes are robotic/the mob isn't colourblind and they have no default colour matrix. return eyes.get_colourmatrix() +/** + * Flash up a color as an overlay on a player's screen, then fade back to normal. + * + * Arguments: + * * flash_color - The color to overlay on the screen. + * * flash_time - The time it takes for the color to fade back to normal. + */ +/mob/proc/flash_screen_color(flash_color, flash_time) + if(!client) + return + client.color = flash_color + INVOKE_ASYNC(client, /client/.proc/colour_transition, get_screen_colour(), flash_time) + /proc/ismindshielded(A) //Checks to see if the person contains a mindshield implant, then checks that the implant is actually inside of them for(var/obj/item/implant/mindshield/L in A) if(L && L.implanted) diff --git a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm index d5f7a1e1aa2..2277e096a30 100644 --- a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm +++ b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm @@ -182,10 +182,10 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) var/sound/legion_sound = sound('sound/creatures/legion_spawn.ogg') for(var/mob/M in GLOB.player_list) - if(M.z == z) + if(M.z == z && M.client) to_chat(M, "Discordant whispers flood your mind in a thousand voices. Each one speaks your name, over and over. Something horrible has been released.") M.playsound_local(T, null, 100, FALSE, 0, FALSE, pressure_affected = FALSE, S = legion_sound) - flash_color(M, flash_color = "#FF0000", flash_time = 50) + M.flash_screen_color("#FF0000", 5 SECONDS) var/mutable_appearance/release_overlay = mutable_appearance('icons/effects/effects.dmi', "legiondoor") notify_ghosts("Legion has been released in the [get_area(src)]!", source = src, alert_overlay = release_overlay, action = NOTIFY_JUMP)