Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ray cats! #3465

Merged
merged 5 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading