Files
Bubberstation/code/datums/mutations/radioactive.dm
Ghom 14fb86e3e8 Mutation code cleanup, mutations now have sources to avoid concurrency problems. (#91346)
## About The Pull Request
This PR aims to clean or bring up to date portions of code about dna,
the dna console and mutations. This includes taking care of or removing
some of the awful choices like the pratically useless
`datum/mutation/human` pathing, or the class variable, in favor of using
sources to avoid potential issues with extraneous sources of a mutation.

The files changed are over a hundred just because I removed the
`datum/mutation/human` path, but the actual bulk of the code is mainly
shared between the datum/dna.dm, _mutations.dm and dna_console.dm.

## Why It's Good For The Game
Mutation shitcode is hurting my future plans for infusions a little.
Also it's a much needed refactor. Drafted 'till I'm sure it works
without issues.

## Changelog

🆑
refactor: Refactored mutation code backend. Report any issue.
/🆑
2025-06-08 13:57:10 +02:00

47 lines
1.6 KiB
Plaintext

/datum/mutation/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_warning("You can feel it in your bones!")
instability = NEGATIVE_STABILITY_MAJOR
difficulty = 8
power_coeff = 1
/// Weakref to our radiation emitter component
var/datum/weakref/radioactivity_source_ref
/datum/mutation/radioactive/New(datum/mutation/copymut)
. = ..()
if(!(type in visual_indicators))
visual_indicators[type] = list(mutable_appearance('icons/mob/effects/genetics.dmi', "radiation", -MUTATIONS_LAYER))
/datum/mutation/radioactive/get_visual_indicator()
return visual_indicators[type][1]
/datum/mutation/radioactive/on_acquiring(mob/living/carbon/human/acquirer)
. = ..()
if(!.)
return
var/datum/component/radioactive_emitter/radioactivity_source = make_radioactive(acquirer)
radioactivity_source_ref = WEAKREF(radioactivity_source)
/datum/mutation/radioactive/setup()
. = ..()
if(!QDELETED(owner))
make_radioactive(owner)
/**
* Makes the passed mob radioactive, or if they're already radioactive,
* update their radioactivity to the newly set values
*/
/datum/mutation/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/radioactive/on_losing(mob/living/carbon/human/owner)
QDEL_NULL(radioactivity_source_ref)
return ..()