Files
Bubberstation/code/modules/surgery/core_removal.dm
Watermelon914 375a20e49b Refactors most spans into span procs (#59645)
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
2021-06-14 13:03:53 -07:00

47 lines
1.8 KiB
Plaintext

/datum/surgery/core_removal
name = "Core removal"
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/extract_core)
target_mobtypes = list(/mob/living/simple_animal/slime)
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)
lying_required = FALSE
ignore_clothes = TRUE
/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"
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 ..()