From 6fccbb19bd0ad6887d6cd66aaa375992b3e7ce0e Mon Sep 17 00:00:00 2001 From: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Date: Wed, 9 Oct 2024 05:30:02 -0500 Subject: [PATCH] Ray cats! (#3465) ## About The Pull Request Cats now act like fuzzy Geiger counters! https://github.com/user-attachments/assets/77a0cdbf-51e9-420d-afad-998e46b69343 ## Why It's Good For The Game Imagine your own deep lore regarding the NOF here ![image](https://github.com/user-attachments/assets/618e1057-ac76-4a10-9767-c21b6a12b495) ## Changelog :cl: add: Cats have been genetically engineered to detect radiation /:cl: --- code/__DEFINES/radiation.dm | 12 +++++ code/datums/components/radioactive.dm | 2 +- .../objects/items/devices/geiger_counter.dm | 16 ------ .../mob/living/simple_animal/friendly/cat.dm | 51 ++++++++++++++++++- 4 files changed, 62 insertions(+), 19 deletions(-) diff --git a/code/__DEFINES/radiation.dm b/code/__DEFINES/radiation.dm index 2c4e41f45906e..fa66e7c3ea8eb 100644 --- a/code/__DEFINES/radiation.dm +++ b/code/__DEFINES/radiation.dm @@ -57,3 +57,15 @@ Ask ninjanomnom if they're around #define RAD_DISTANCE_COEFFICIENT 1 // Lower means further rad spread #define RAD_HALF_LIFE 90 // The half-life of contaminated objects + +#define RAD_GLOW_COLOR "#39ff1430" + +#define RAD_LEVEL_NORMAL 9 +#define RAD_LEVEL_MODERATE 100 +#define RAD_LEVEL_HIGH 400 +#define RAD_LEVEL_VERY_HIGH 800 +#define RAD_LEVEL_CRITICAL 1500 + +#define RAD_MEASURE_SMOOTHING 5 + +#define RAD_GRACE_PERIOD 2 diff --git a/code/datums/components/radioactive.dm b/code/datums/components/radioactive.dm index a6c67af2d3cdd..9306f6aae899b 100644 --- a/code/datums/components/radioactive.dm +++ b/code/datums/components/radioactive.dm @@ -30,7 +30,7 @@ //Let's make er glow //This relies on parent not being a turf or something. IF YOU CHANGE THAT, CHANGE THIS var/atom/movable/master = parent - master.add_filter("rad_glow", 2, list("type" = "outline", "color" = "#39ff1430", "size" = 2)) + master.add_filter("rad_glow", 2, list("type" = "outline", "color" = RAD_GLOW_COLOR, "size" = 2)) addtimer(CALLBACK(src, PROC_REF(glow_loop), master), rand(1,19))//Things should look uneven START_PROCESSING(SSradiation, src) diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index 4abc1a3786bbf..e1a20b508a5c7 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -1,13 +1,3 @@ -#define RAD_LEVEL_NORMAL 9 -#define RAD_LEVEL_MODERATE 100 -#define RAD_LEVEL_HIGH 400 -#define RAD_LEVEL_VERY_HIGH 800 -#define RAD_LEVEL_CRITICAL 1500 - -#define RAD_MEASURE_SMOOTHING 5 - -#define RAD_GRACE_PERIOD 2 - /obj/item/geiger_counter //DISCLAIMER: I know nothing about how real-life Geiger counters work. This will not be realistic. ~Xhuis name = "\improper Geiger counter" desc = "A handheld device used for detecting and measuring radiation pulses." @@ -222,9 +212,3 @@ . = ..() if(listeningTo) UnregisterSignal(listeningTo, COMSIG_ATOM_RAD_ACT) - -#undef RAD_LEVEL_NORMAL -#undef RAD_LEVEL_MODERATE -#undef RAD_LEVEL_HIGH -#undef RAD_LEVEL_VERY_HIGH -#undef RAD_LEVEL_CRITICAL diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 646a3eb8436bd..33c8bbdb3ed23 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -1,7 +1,6 @@ -//Cat /mob/living/simple_animal/pet/cat name = "cat" - desc = "Kitty!!" + desc = "Most modern cats hail from a solarian experimental geneline. The perfect purrtection from rats and radiation." icon = 'icons/mob/pets.dmi' icon_state = "cat2" icon_living = "cat2" @@ -40,6 +39,13 @@ footstep_type = FOOTSTEP_MOB_CLAW + var/grace = RAD_GRACE_PERIOD + var/radiation_count = 0 + var/current_tick_amount = 0 + var/last_tick_amount = 0 + var/fail_to_receive = 0 + var/glow_strength + /mob/living/simple_animal/pet/cat/Initialize() . = ..() ADD_TRAIT(src, TRAIT_HOLDABLE, INNATE_TRAIT) @@ -177,8 +183,49 @@ collar_type = "[initial(collar_type)]" regenerate_icons() +/mob/living/simple_animal/pet/cat/rad_act(amount) + . = ..() + if(amount <= RAD_BACKGROUND_RADIATION) + return + current_tick_amount += amount + update_glow() + +/mob/living/simple_animal/pet/cat/proc/update_glow() + var/old_glow_strength = glow_strength + switch(radiation_count) + if(-INFINITY to RAD_LEVEL_NORMAL) + glow_strength = 1 + if(RAD_LEVEL_NORMAL to RAD_LEVEL_MODERATE) + glow_strength = 2 + if(RAD_LEVEL_MODERATE to RAD_LEVEL_HIGH) + glow_strength = 3 + if(RAD_LEVEL_HIGH to RAD_LEVEL_VERY_HIGH) + glow_strength = 4 + if(RAD_LEVEL_VERY_HIGH to RAD_LEVEL_CRITICAL) + glow_strength = 5 + if(RAD_LEVEL_CRITICAL to INFINITY) + glow_strength = 6 + if((old_glow_strength != glow_strength) && (glow_strength > 1)) + src.add_filter("ray_cat_glow", 2, list("type" = "outline", "color" = RAD_GLOW_COLOR, "size" = glow_strength)) + if(glow_strength <= 1) + src.remove_filter("ray_cat_glow") /mob/living/simple_animal/pet/cat/Life() + radiation_count -= radiation_count/RAD_MEASURE_SMOOTHING + radiation_count += current_tick_amount/RAD_MEASURE_SMOOTHING + + if(current_tick_amount) + grace = RAD_GRACE_PERIOD + last_tick_amount = current_tick_amount + else + grace-- + if(grace <= 0) + radiation_count = 0 + + current_tick_amount = 0 + + update_glow() + if(!stat && !buckled && !client) if(prob(1)) manual_emote(pick("stretches out for a belly rub.", "wags its tail.", "lies down."))