Files
Bubberstation/code/modules/surgery/core_removal.dm
John Willard 3b0794eca9 Surgery code improvements (#71182)
## About The Pull Request

* Changes a lot of things about surgeries to hopefully bring it up to
more modern code standards.
* Removes a ton of single-letter vars used in checking surgeries on
people.
* Makes use of continue/break in for() loops.
* Properly documents the vars on surgeries
* Turns 'ignore clothes', 'self operating', 'lying required', 'require
limb' and 'require real limb' from vars into surgery flags
* Removes a lot re-defines of target_mobtype being set to human, as
that's the base anyways.
* Also tries to organize the vars on each surgery a bit.
* Makes the surgery initiator hopefully a little bit more sane
* Removes the surgery's can_cancel and stomach pump's
accumulated_experience vars, as they were entirely unused.

## Why It's Good For The Game

I looked at surgery code and couldn't stand it, this is hopefully
helping bring it to something we can stand.
This however doesn't touch the individual surgery steps.

## Changelog

im exhausted i don't know if this has in-game effects
2022-11-20 23:22:46 -08:00

62 lines
1.8 KiB
Plaintext

/datum/surgery/core_removal
name = "Core removal"
target_mobtypes = list(/mob/living/simple_animal/slime)
surgery_flags = SURGERY_IGNORE_CLOTHES
possible_locs = list(
BODY_ZONE_R_ARM,
BODY_ZONE_L_ARM,
BODY_ZONE_R_LEG,
BODY_ZONE_L_LEG,
BODY_ZONE_CHEST,
BODY_ZONE_HEAD,
)
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/extract_core,
)
/datum/surgery/core_removal/can_start(mob/user, mob/living/target)
if(target.stat == DEAD)
return TRUE
return FALSE
//extract brain
/datum/surgery_step/extract_core
name = "extract core (hemostat/crowbar)"
implements = list(
TOOL_HEMOSTAT = 100,
TOOL_CROWBAR = 100)
time = 16
/datum/surgery_step/extract_core/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(
user,
target,
span_notice("You begin to extract a core from [target]..."),
span_notice("[user] begins to extract a core from [target]."),
span_notice("[user] begins to extract a core from [target]."),
)
/datum/surgery_step/extract_core/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
var/mob/living/simple_animal/slime/target_slime = target
if(target_slime.cores > 0)
target_slime.cores--
display_results(
user,
target,
span_notice("You successfully extract a core from [target]. [target_slime.cores] core\s remaining."),
span_notice("[user] successfully extracts a core from [target]!"),
span_notice("[user] successfully extracts a core from [target]!"),
)
new target_slime.coretype(target_slime.loc)
if(target_slime.cores <= 0)
target_slime.icon_state = "[target_slime.colour] baby slime dead-nocore"
return ..()
else
return FALSE
else
to_chat(user, span_warning("There aren't any cores left in [target]!"))
return ..()