Files
Bubberstation/code/datums/mutations/autotomy.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

43 lines
1.3 KiB
Plaintext

/datum/mutation/self_amputation
name = "Autotomy"
desc = "Allows a creature to voluntary discard a random appendage."
quality = POSITIVE
text_gain_indication = span_notice("Your joints feel loose.")
instability = POSITIVE_INSTABILITY_MINOR
power_path = /datum/action/cooldown/spell/self_amputation
energy_coeff = 1
synchronizer_coeff = 1
/datum/action/cooldown/spell/self_amputation
name = "Drop a limb"
desc = "Concentrate to make a random limb pop right off your body."
button_icon_state = "autotomy"
cooldown_time = 10 SECONDS
spell_requirements = NONE
/datum/action/cooldown/spell/self_amputation/is_valid_target(atom/cast_on)
return iscarbon(cast_on)
/datum/action/cooldown/spell/self_amputation/cast(mob/living/carbon/cast_on)
. = ..()
if(HAS_TRAIT(cast_on, TRAIT_NODISMEMBER))
to_chat(cast_on, span_notice("You concentrate really hard, but nothing happens."))
return
var/list/parts = list()
for(var/obj/item/bodypart/to_remove as anything in cast_on.bodyparts)
if(to_remove.body_zone == BODY_ZONE_HEAD || to_remove.body_zone == BODY_ZONE_CHEST)
continue
if(to_remove.bodypart_flags & BODYPART_UNREMOVABLE)
continue
parts += to_remove
if(!length(parts))
to_chat(cast_on, span_notice("You can't shed any more limbs!"))
return
var/obj/item/bodypart/to_remove = pick(parts)
to_remove.dismember()