From 5ffcad6cd11f069b725d09b3c879823dd7249ded Mon Sep 17 00:00:00 2001 From: armrha Date: Mon, 6 Jul 2020 08:34:53 -0700 Subject: [PATCH] Makes cats glow when subjected to radiation (#9186) Makes cat pets glow when subjected to radiation as per --- code/modules/events/radiation_storm.dm | 29 +-------- code/modules/mob/living/carbon/carbon.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 21 +++++++ code/modules/mob/living/living.dm | 10 ++++ .../mob/living/simple_animal/friendly/cat.dm | 59 +++++++++++++++++++ html/changelogs/armrha-pr-9186.yml | 6 ++ 6 files changed, 99 insertions(+), 28 deletions(-) create mode 100644 html/changelogs/armrha-pr-9186.yml diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index a86b68437be..76e3785c060 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -32,34 +32,9 @@ command_announcement.Announce("The station has passed the radiation belt. Please report to medbay if you experience any unusual symptoms. Maintenance will lose all-access again shortly.", "Anomaly Alert") /datum/event/radiation_storm/proc/radiate() - for(var/mob/living/carbon/C in living_mob_list) - var/area/A = get_area(C) - if(!A) - continue - if(isNotStationLevel(A.z)) - continue - if(A.flags & RAD_SHIELDED) - continue + for(var/mob/living/C in living_mob_list) + C.apply_radiation_effects() - if(istype(C,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = C - if(H.is_diona()) - var/damage = rand(15, 30) - H.adjustToxLoss(-damage) - if(prob(5)) - damage = rand(20, 60) - H.adjustToxLoss(-damage) - to_chat(H, "You can feel flow of energy which makes you regenerate.") - - H.apply_effect((rand(15,30)),IRRADIATE,blocked = H.getarmor(null, "rad")) - if(prob(4)) - H.apply_effect((rand(20,60)),IRRADIATE,blocked = H.getarmor(null, "rad")) - if (prob(75)) - randmutb(H) // Applies bad mutation - domutcheck(H,null,MUTCHK_FORCED) - else - randmutg(H) // Applies good mutation - domutcheck(H,null,MUTCHK_FORCED) /datum/event/radiation_storm/end() revoke_maint_all_access() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 311512d7f56..b14d703343c 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -445,4 +445,4 @@ return reagents /mob/living/carbon/proc/should_have_organ(var/organ_check) - return 0 + return 0 \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 8cb37b4f11b..aad5a10a5a9 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1993,6 +1993,27 @@ var/matrix/M = new() B.transform = M.Scale(scale) +/mob/living/carbon/human/apply_radiation_effects() + . = ..() + if(. == TRUE) + if(src.is_diona()) + var/damage = rand(15, 30) + src.adjustToxLoss(-damage) + if(prob(5)) + damage = rand(20, 60) + src.adjustToxLoss(-damage) + to_chat(src, SPAN_NOTICE("You can feel flow of energy which makes you regenerate.")) + + src.apply_effect((rand(15,30)),IRRADIATE,blocked = src.getarmor(null, "rad")) + if(prob(4)) + src.apply_effect((rand(20,60)),IRRADIATE,blocked = src.getarmor(null, "rad")) + if (prob(75)) + randmutb(src) // Applies bad mutation + domutcheck(src,null,MUTCHK_FORCED) + else + randmutg(src) // Applies good mutation + domutcheck(src,null,MUTCHK_FORCED) + /mob/living/carbon/human/proc/get_accent_icon(var/datum/language/speaking = null) if(accent && speaking && speaking.allow_accents) var/used_accent = accent //starts with the mob's default accent diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index e5ad3ffad37..e866bb1d2c6 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -940,6 +940,16 @@ default behaviour is: update_icons() return TRUE +/mob/living/proc/apply_radiation_effects() + var/area/A = get_area(src) + if(!A) + return FALSE + if(isNotStationLevel(A.z)) + return FALSE + if(A.flags & RAD_SHIELDED) + return FALSE + . = TRUE + /mob/living/Destroy() if(auras) for(var/a in auras) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index c8511d6f011..cbc1537c357 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -8,6 +8,7 @@ icon_living = "cat2" icon_dead = "cat2_dead" icon_rest = "cat2_rest" + color = list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,0) can_nap = 1 speak = list("Meow!","Esp!","Purr!","HSSSSS") speak_emote = list("purrs", "meows") @@ -33,11 +34,19 @@ var/mob/living/simple_animal/rat/rattarget = null seek_speed = 5 pass_flags = PASSTABLE + //Counter for how intense the radlight is + var/radlight = 0 + //How many metabolism procs to wait before rapidly dropping the levels down so the cats stop glowing fairly quickly + var/radlight_fade_delay = 10 canbrush = TRUE possession_candidate = 1 emote_sounds = list('sound/effects/creatures/cat_meow.ogg', 'sound/effects/creatures/cat_meow2.ogg') butchering_products = list(/obj/item/stack/material/animalhide/cat = 2) +/mob/living/simple_animal/cat/Initialize() + . = ..() + src.filters += filter(type="drop_shadow", size = 2, offset = 2, color = rgb(0,208,0,0)) + /mob/living/simple_animal/cat/think() //MICE! ..() @@ -96,10 +105,60 @@ addtimer(CALLBACK(src, .proc/attack_mice), 3) ..() +/mob/living/simple_animal/cat/proc/handle_radiation_light() + radlight = clamp(radlight, 0, 98) + if (radlight > 0) + radlight_fade_delay = clamp(radlight_fade_delay-1, 0, 10) + var/cc = radlight/120.0 + if(radlight_fade_delay == 0) + radlight = clamp(radlight - 11, 0, 100) + var/cshift = list() + var/radintensity = round(radlight/33.0) + switch(radintensity) + if(0) + cc = cc+(cc/2.0) + cshift = list(1,cc,0,0, 0,1,0,0, 0,cc,1,0, 0,0,0,1, 0,0,0,0) + if(1) + cc = cc+(cc/2.0) + cshift = list(1,0,0,0, 0,1,0,0, cc,cc,1,0, 0,0,0,1, 0,0,0,0) + if(2) + cshift = list(1,0,0,0, cc,1,0,0, cc,0,1,0, 0,0,0,1, 0,0,0,0) + + if(color != cshift || radlight == 0) + animate(src, color=cshift,time=8,flags=ANIMATION_PARALLEL) + switch(radintensity) + if(0) + animate(src.filters[1], color=rgb(0,208,0,140), time=10, easing = SINE_EASING,flags=ANIMATION_PARALLEL) + set_light(1.4, radlight/15, "#2cfa1f",) + if(1) + animate(src.filters[1], color=rgb(208,208,0,140), time=10, easing = SINE_EASING,flags=ANIMATION_PARALLEL) + set_light(1.4, radlight/25, "#ffff00",) + if(2) + animate(src.filters[1], color=rgb(208,0,0,140), time=10, easing = SINE_EASING,flags=ANIMATION_PARALLEL) + set_light(1.4, radlight/30, "#ca0b00",) + if (radlight == 0) + animate(src.filters[1], color=rgb(0,255,0,0), time=5,flags=ANIMATION_PARALLEL) + color = color = list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,0) + +/mob/living/simple_animal/cat/apply_radiation(var/rads) + radlight += rads*2 + radlight_fade_delay = 10 + total_radiation += rads + if (total_radiation < 0) + total_radiation = 0 + /mob/living/simple_animal/cat/death() .=..() stat = DEAD +/mob/living/simple_animal/cat/Life() + . = ..() + handle_radiation_light() + +/mob/living/simple_animal/cat/apply_radiation_effects() + . = ..() + if(.) + apply_effect((rand(30,60)),IRRADIATE,blocked=0) /mob/living/simple_animal/cat/proc/handle_flee_target() //see if we should stop fleeing diff --git a/html/changelogs/armrha-pr-9186.yml b/html/changelogs/armrha-pr-9186.yml new file mode 100644 index 00000000000..22eac61b5c3 --- /dev/null +++ b/html/changelogs/armrha-pr-9186.yml @@ -0,0 +1,6 @@ +author: armrha + +delete-after: True + +changes: + - rscadd: "Modified mob/living/simple_animal/friendly/cat and /mob/living/simple_animal to allow cats to turn colors in radiation, modified modules/events/radiation_storm so it would apply to cats."