Files
Bubberstation/code/datums/elements/radioactive.dm
oranges 4c48966ff8 Renames delta time to be a more obvious name (#74654)
This tracks the seconds per tick of a subsystem, however note that it is
not completely accurate, as subsystems can be delayed, however it's
useful to have this number as a multiplier or ratio, so that if in
future someone changes the subsystem wait time code correctly adjusts
how fast it applies effects

regexes used

git grep --files-with-matches --name-only 'DT_PROB' | xargs -l sed -i
's/DT_PROB/SPT_PROB/g'
git grep --files-with-matches --name-only 'delta_time' | xargs -l sed -i
's/delta_time/seconds_per_tick/g'
2023-04-11 21:31:07 -07:00

39 lines
1.1 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_ON_HOST_DESTROY
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(seconds_per_tick)
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