mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
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!
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
/datum/element/rad_insulation
|
||||
element_flags = ELEMENT_DETACH | ELEMENT_BESPOKE
|
||||
id_arg_index = 2
|
||||
var/amount // Multiplier for radiation strength passing through
|
||||
|
||||
/datum/element/rad_insulation/Attach(datum/target, _amount=RAD_MEDIUM_INSULATION, protects=TRUE, contamination_proof=TRUE)
|
||||
. = ..()
|
||||
if(!isatom(target))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
if(protects) // Does this protect things in its contents from being affected?
|
||||
RegisterSignal(target, COMSIG_ATOM_RAD_PROBE, .proc/rad_probe_react)
|
||||
if(contamination_proof) // Can this object be contaminated?
|
||||
RegisterSignal(target, COMSIG_ATOM_RAD_CONTAMINATING, .proc/rad_contaminating)
|
||||
if(_amount != 1) // If it's 1 it won't have any impact on radiation passing through anyway
|
||||
RegisterSignal(target, COMSIG_ATOM_RAD_WAVE_PASSING, .proc/rad_pass)
|
||||
|
||||
amount = _amount
|
||||
|
||||
/datum/element/rad_insulation/proc/rad_probe_react(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
return COMPONENT_BLOCK_RADIATION
|
||||
|
||||
/datum/element/rad_insulation/proc/rad_contaminating(datum/source, strength)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
return COMPONENT_BLOCK_CONTAMINATION
|
||||
|
||||
/datum/element/rad_insulation/proc/rad_pass(datum/source, datum/radiation_wave/wave, width)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
wave.intensity = wave.intensity*(1-((1-amount)/width)) // The further out the rad wave goes the less it's affected by insulation (larger width)
|
||||
return COMPONENT_RAD_WAVE_HANDLED
|
||||
@@ -0,0 +1,25 @@
|
||||
/// Marks the item as being radiation protected.
|
||||
/// Adds the TRAIT_RADIATION_PROTECTED_CLOTHING trait, as well as adding an
|
||||
/// extra bit to the examine descrpition.
|
||||
/datum/element/radiation_protected_clothing
|
||||
element_flags = ELEMENT_DETACH
|
||||
|
||||
/datum/element/radiation_protected_clothing/Attach(datum/target)
|
||||
. = ..()
|
||||
|
||||
if (!isclothing(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
ADD_TRAIT(target, TRAIT_RADIATION_PROTECTED_CLOTHING, REF(src))
|
||||
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_examine)
|
||||
|
||||
/datum/element/radiation_protected_clothing/Detach(datum/source, ...)
|
||||
REMOVE_TRAIT(source, TRAIT_RADIATION_PROTECTED_CLOTHING, REF(src))
|
||||
UnregisterSignal(source, COMSIG_PARENT_EXAMINE)
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/element/radiation_protected_clothing/proc/on_examine(datum/source, mob/user, list/examine_text)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
examine_text += span_notice("A patch with a hazmat sign on the side suggests it would <b>protect you from radiation</b>.")
|
||||
@@ -0,0 +1,38 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user