Files
Bubberstation/code/datums/elements/radioactive.dm
Mothblocks 0f3c4e51f7 Modernizing Radiation -- TL;DR: Radiation is now a status effect healed by tox healing, and contamination is removed (#62265)
Implements the Modernizing radiation design document ( https://hackmd.io/@tgstation/rJNIyeBHt ) and replaces the current radiation sources with the new system, as well as replacing/removing a bunch of old consumers of radiation that either had no reason to exist, or could be replaced by something else.

Diverges from the doc in that items radiation don't go up like explained. I was going to, but items get irradiated so easily that it just feels pretty lame. Items still get irradiated, but it's mostly just so that radiation sources look cooler (wow, lots of stuff around going green), and for things like the geiger counter.

Instead of the complicated radiation_wave system, radiation now just checks everything between the radiation source and the potential target, losing power along the way based on the radiation insulation of whats in between. If this reaches too low a point (specified by radiation_pulse consumers), then the radiation will not pass. Otherwise, will roll a chance to irradiate. Uranium structures allow a delay before irradiating, so stay away!
2021-11-01 04:20:39 -03:00

39 lines
1.0 KiB
Plaintext

#define DELAY_BETWEEN_RADIATION_PULSES (3 SECONDS)
/// This atom will regularly pulse radiation.
/// As this is only applied on uranium objects for now, this defaults to uranium constants.
/datum/element/radioactive
element_flags = ELEMENT_DETACH
var/list/radioactive_objects = list()
/datum/element/radioactive/New()
START_PROCESSING(SSdcs, src)
/datum/element/radioactive/Attach(datum/target)
. = ..()
radioactive_objects[target] = world.time
/datum/element/radioactive/Detach(datum/source, ...)
radioactive_objects -= source
return ..()
/datum/element/radioactive/process(delta_time)
for (var/radioactive_object in radioactive_objects)
if (world.time - radioactive_objects[radioactive_object] < DELAY_BETWEEN_RADIATION_PULSES)
continue
radiation_pulse(
radioactive_object,
max_range = 3,
threshold = RAD_LIGHT_INSULATION,
chance = URANIUM_IRRADIATION_CHANCE,
minimum_exposure_time = URANIUM_RADIATION_MINIMUM_EXPOSURE_TIME,
)
radioactive_objects[radioactive_object] = world.time
#undef DELAY_BETWEEN_RADIATION_PULSES