[MIRROR] rad_insulation component is now an element. (#1496)

* rad_insulation component is now an element. (#54625)

* rad_insulation component is now an element.

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-10-27 22:51:52 +00:00
committed by GitHub
co-authored by Ghom
parent 193babf94b
commit 0afaaa89d1
4 changed files with 15 additions and 12 deletions
-31
View File
@@ -1,31 +0,0 @@
/datum/component/rad_insulation
var/amount // Multiplier for radiation strength passing through
/datum/component/rad_insulation/Initialize(_amount=RAD_MEDIUM_INSULATION, protects=TRUE, contamination_proof=TRUE)
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE
if(protects) // Does this protect things in its contents from being affected?
RegisterSignal(parent, COMSIG_ATOM_RAD_PROBE, .proc/rad_probe_react)
if(contamination_proof) // Can this object be contaminated?
RegisterSignal(parent, 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(parent, COMSIG_ATOM_RAD_WAVE_PASSING, .proc/rad_pass)
amount = _amount
/datum/component/rad_insulation/proc/rad_probe_react(datum/source)
SIGNAL_HANDLER
return COMPONENT_BLOCK_RADIATION
/datum/component/rad_insulation/proc/rad_contaminating(datum/source, strength)
SIGNAL_HANDLER
return COMPONENT_BLOCK_CONTAMINATION
/datum/component/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