Files
Letter NandGitHub 31751a9729 update filters (#7456)
<!-- 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

<!-- 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

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Please note that
maintainers freely reserve the right to remove and add tags should they
deem it appropriate. You can attempt to finagle the system all you want,
but it's best to shoot for clear communication right off the bat. -->

🆑
code: update filters
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 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. -->
2026-01-08 01:35:37 -05:00

132 lines
4.0 KiB
Plaintext

#define RAD_AMOUNT_LOW 50
#define RAD_AMOUNT_MEDIUM 200
#define RAD_AMOUNT_HIGH 500
#define RAD_AMOUNT_EXTREME 1000
/datum/component/radioactive
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
registered_type = /datum/component/radioactive
/// half life in deciseconds
var/hl3_release_date
var/strength
var/can_contaminate
/// distance falloff
var/falloff = RAD_FALLOFF_CONTAMINATION_NORMAL
/datum/component/radioactive/Initialize(_strength=0, _half_life = RAD_HALF_LIFE_DEFAULT, _can_contaminate = TRUE, falloff)
strength = _strength
hl3_release_date = _half_life
can_contaminate = _can_contaminate
if(falloff)
src.falloff = falloff
if(istype(parent, /atom))
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(rad_examine))
else
. = COMPONENT_INCOMPATIBLE
CRASH("Something that wasn't an atom was given /datum/component/radioactive")
if(strength > RAD_MINIMUM_CONTAMINATION)
SSradiation.warn(src)
create_glow()
SSradiation.sources += src
/datum/component/radioactive/Destroy()
var/atom/movable/parent_movable = parent
if (istype(parent_movable))
parent_movable.remove_filter("rad_glow")
SSradiation.sources -= src
return ..()
/datum/component/radioactive/proc/emit(ds)
if(!prob(50))
return
if(!hl3_release_date)
radiation_pulse(parent, strength, falloff, FALSE, can_contaminate)
return
// strength -= (1 / 2) ** ((ds) / RAD_HALF_LIFE_DEFAULT
var/becoming = strength * ((1 / 2) ** (ds / (hl3_release_date)))
radiation_pulse(parent, (strength - becoming) * RAD_CONTAMINATION_CHEAT_FACTOR, falloff, FALSE, can_contaminate)
strength = becoming
if(strength <= RAD_BACKGROUND_RADIATION)
addtimer(CALLBACK(src, PROC_REF(check_dissipate)), 5 SECONDS)
SSradiation.sources -= src
/datum/component/radioactive/proc/check_dissipate()
if(strength <= RAD_BACKGROUND_RADIATION)
qdel(src)
return
if(!(datum_flags & DF_ISPROCESSING)) // keep going
SSradiation.sources += src
/datum/component/radioactive/proc/create_glow()
var/atom/movable/parent_movable = parent
if (!istype(parent_movable))
return
parent_movable.add_filter("rad_glow", 2, list("type" = "outline", "color" = "#14fff714", "size" = 2))
addtimer(CALLBACK(src, PROC_REF(start_glow_loop), parent_movable), rand(0.1 SECONDS, 1.9 SECONDS)) // Things should look uneven
/datum/component/radioactive/proc/start_glow_loop(atom/movable/parent_movable)
var/filter = parent_movable.get_filter("rad_glow")
if (!filter)
return
animate(filter, alpha = 110, time = 1.5 SECONDS, loop = -1)
animate(alpha = 40, time = 2.5 SECONDS)
/datum/component/radioactive/InheritComponent(datum/component/C, i_am_original, _strength, _source, _half_life, _can_contaminate)
if(!i_am_original)
return
if(C)
var/datum/component/radioactive/other = C
constructive_interference(other.strength, other.strength)
else
constructive_interference(_strength, _strength)
/**
* returns amount added
*/
/datum/component/radioactive/proc/constructive_interference(limit, amt)
// permanent ones shouldn't
if(!hl3_release_date)
return 0
. = min(amt, limit - strength)
if(. < 0)
return 0
strength += .
/datum/component/radioactive/proc/rad_examine(datum/source, mob/user, list/examine_list)
var/atom/master = parent
var/list/out = list()
if(get_dist(master, user) <= 1)
out += "The air around [master] feels warm"
switch(strength)
if(RAD_AMOUNT_LOW to RAD_AMOUNT_MEDIUM)
out += "[out ? " and it " : "[master] "]feels weird to look at."
if(RAD_AMOUNT_MEDIUM to RAD_AMOUNT_HIGH)
out += "[out ? " and it " : "[master] "]seems to be glowing a bit."
if(RAD_AMOUNT_HIGH to INFINITY) //At this level the object can contaminate other objects
out += "[out ? " and it " : "[master] "]hurts to look at."
if(!LAZYLEN(out))
return
out += "."
examine_list += out.Join()
/datum/component/radioactive/proc/rad_attack(datum/source, atom/movable/target, mob/living/user)
emit(1 SECONDS)
/datum/component/radioactive/proc/clean(str, mul)
strength -= strength * mul + str
if(strength < RAD_BACKGROUND_RADIATION)
qdel(src)
#undef RAD_AMOUNT_LOW
#undef RAD_AMOUNT_MEDIUM
#undef RAD_AMOUNT_HIGH
#undef RAD_AMOUNT_EXTREME