From 0afaaa89d1e25a6d32b6cdba228c7364912e54a9 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 27 Oct 2020 23:51:52 +0100 Subject: [PATCH] [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> --- .../rad_insulation.dm | 21 +++++++++++-------- code/game/objects/items/storage/bags.dm | 2 +- code/modules/mining/satchel_ore_boxdm.dm | 2 +- tgstation.dme | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) rename code/datums/{components => elements}/rad_insulation.dm (50%) diff --git a/code/datums/components/rad_insulation.dm b/code/datums/elements/rad_insulation.dm similarity index 50% rename from code/datums/components/rad_insulation.dm rename to code/datums/elements/rad_insulation.dm index e46173a2815..e1dd57a9c18 100644 --- a/code/datums/components/rad_insulation.dm +++ b/code/datums/elements/rad_insulation.dm @@ -1,30 +1,33 @@ -/datum/component/rad_insulation +/datum/element/rad_insulation + element_flags = ELEMENT_DETACH | ELEMENT_BESPOKE + id_arg_index = 2 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)) +/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(parent, COMSIG_ATOM_RAD_PROBE, .proc/rad_probe_react) + RegisterSignal(target, 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) + 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(parent, COMSIG_ATOM_RAD_WAVE_PASSING, .proc/rad_pass) + RegisterSignal(target, COMSIG_ATOM_RAD_WAVE_PASSING, .proc/rad_pass) amount = _amount -/datum/component/rad_insulation/proc/rad_probe_react(datum/source) +/datum/element/rad_insulation/proc/rad_probe_react(datum/source) SIGNAL_HANDLER return COMPONENT_BLOCK_RADIATION -/datum/component/rad_insulation/proc/rad_contaminating(datum/source, strength) +/datum/element/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) +/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) diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index f73186c6b2f..7326fc85b8b 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -120,7 +120,7 @@ /obj/item/storage/bag/ore/ComponentInitialize() . = ..() - AddComponent(/datum/component/rad_insulation, 0.01) //please datum mats no more cancer + AddElement(/datum/element/rad_insulation, 0.01) //please datum mats no more cancer var/datum/component/storage/concrete/stack/STR = GetComponent(/datum/component/storage/concrete/stack) STR.allow_quick_empty = TRUE STR.set_holdable(list(/obj/item/stack/ore)) diff --git a/code/modules/mining/satchel_ore_boxdm.dm b/code/modules/mining/satchel_ore_boxdm.dm index 87476fcf349..a7fe98e8b44 100644 --- a/code/modules/mining/satchel_ore_boxdm.dm +++ b/code/modules/mining/satchel_ore_boxdm.dm @@ -20,7 +20,7 @@ /obj/structure/ore_box/ComponentInitialize() . = ..() - AddComponent(/datum/component/rad_insulation, 0.01) //please datum mats no more cancer + AddElement(/datum/element/rad_insulation, 0.01) //please datum mats no more cancer /obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I) if(I.use_tool(src, user, 50, volume=50)) diff --git a/tgstation.dme b/tgstation.dme index 054e0af31c5..9b185f27532 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -469,7 +469,6 @@ #include "code\datums\components\pellet_cloud.dm" #include "code\datums\components\pricetag.dm" #include "code\datums\components\punchcooldown.dm" -#include "code\datums\components\rad_insulation.dm" #include "code\datums\components\radioactive.dm" #include "code\datums\components\religious_tool.dm" #include "code\datums\components\remote_materials.dm" @@ -596,6 +595,7 @@ #include "code\datums\elements\forced_gravity.dm" #include "code\datums\elements\light_blocking.dm" #include "code\datums\elements\obj_regen.dm" +#include "code\datums\elements\rad_insulation.dm" #include "code\datums\elements\selfknockback.dm" #include "code\datums\elements\snail_crawl.dm" #include "code\datums\elements\squish.dm"