Skip to content

Commit

Permalink
Ray cats! (#3465)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Cats now act like fuzzy Geiger counters!


https://github.com/user-attachments/assets/77a0cdbf-51e9-420d-afad-998e46b69343

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## 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)


<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
add: Cats have been genetically engineered to detect radiation
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
FalloutFalcon authored Oct 9, 2024
1 parent 2ad9404 commit aee3a7c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 19 deletions.
12 changes: 12 additions & 0 deletions code/__DEFINES/radiation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion code/datums/components/radioactive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
16 changes: 0 additions & 16 deletions code/game/objects/items/devices/geiger_counter.dm
Original file line number Diff line number Diff line change
@@ -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."
Expand Down Expand Up @@ -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
51 changes: 49 additions & 2 deletions code/modules/mob/living/simple_animal/friendly/cat.dm
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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."))
Expand Down

0 comments on commit aee3a7c

Please sign in to comment.