Files
Bubberstation/code/datums/mutations/radioactive.dm
MrMelbert 3bf0fe4932 Adds a new event, "Radiation Leak" (#72655)
Adds a new random event, "Radiation Leak". 

A random machine in a random department will begin leaking radiation. 

This includes a radiation aura around it, and semi-regular puffs of
smoke clouds containing mutagen and polonium.

The machine will stop leaking after some time, but can also be stopped
by using a random tool on it, indicated in its examine text.

I added a new "radiation emitter" component, for simple "emits
radiation" behavior. Then I made the radioactive mutation use it. This
means that the radioactive gene emits radiation while on stasis and
dead, rather than only in life.
2023-01-22 20:19:18 +00:00

44 lines
1.6 KiB
Plaintext

/datum/mutation/human/radioactive
name = "Radioactivity"
desc = "A volatile mutation that causes the host to sent out deadly beta radiation. This affects both the hosts and their surroundings."
quality = NEGATIVE
text_gain_indication = "<span class='warning'>You can feel it in your bones!</span>"
instability = 5
difficulty = 8
power_coeff = 1
/// Weakref to our radiation emitter component
var/datum/weakref/radioactivity_source_ref
/datum/mutation/human/radioactive/New(class_ = MUT_OTHER, timer, datum/mutation/human/copymut)
. = ..()
if(!(type in visual_indicators))
visual_indicators[type] = list(mutable_appearance('icons/effects/genetics.dmi', "radiation", -MUTATIONS_LAYER))
/datum/mutation/human/radioactive/get_visual_indicator()
return visual_indicators[type][1]
/datum/mutation/human/radioactive/on_acquiring(mob/living/carbon/human/acquirer)
. = ..()
var/datum/component/radioactive_emitter/radioactivity_source = make_radioactive(acquirer)
radioactivity_source_ref = WEAKREF(radioactivity_source)
/datum/mutation/human/radioactive/modify()
. = ..()
make_radioactive(owner)
/**
* Makes the passed mob radioactive, or if they're already radioactive,
* update their radioactivity to the newly set values
*/
/datum/mutation/human/radioactive/proc/make_radioactive(mob/living/carbon/human/who)
return who.AddComponent(
/datum/component/radioactive_emitter, \
cooldown_time = 5 SECONDS, \
range = 1 * (GET_MUTATION_POWER(src) * 2), \
threshold = RAD_MEDIUM_INSULATION, \
)
/datum/mutation/human/radioactive/on_losing(mob/living/carbon/human/owner)
QDEL_NULL(radioactivity_source_ref)
return ..()