Files
Bubberstation/code/modules/surgery/brain_surgery.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

57 lines
2.7 KiB
Plaintext

/datum/surgery/brain_surgery
name = "Brain surgery"
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/saw,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/fix_brain,
/datum/surgery_step/close)
target_mobtypes = list(/mob/living/carbon/human)
possible_locs = list(BODY_ZONE_HEAD)
requires_bodypart_type = 0
/datum/surgery_step/fix_brain
name = "fix brain"
implements = list(
TOOL_HEMOSTAT = 85,
TOOL_SCREWDRIVER = 35,
/obj/item/pen = 15) //don't worry, pouring some alcohol on their open brain will get that chance to 100
repeatable = TRUE
time = 100 //long and complicated
/datum/surgery/brain_surgery/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/brain/target_brain = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!target_brain)
return FALSE
return TRUE
/datum/surgery_step/fix_brain/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, span_notice("You begin to fix [target]'s brain..."),
span_notice("[user] begins to fix [target]'s brain."),
span_notice("[user] begins to perform surgery on [target]'s brain."))
/datum/surgery_step/fix_brain/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
display_results(user, target, span_notice("You succeed in fixing [target]'s brain."),
span_notice("[user] successfully fixes [target]'s brain!"),
span_notice("[user] completes the surgery on [target]'s brain."))
if(target.mind?.has_antag_datum(/datum/antagonist/brainwashed))
target.mind.remove_antag_datum(/datum/antagonist/brainwashed)
target.setOrganLoss(ORGAN_SLOT_BRAIN, target.getOrganLoss(ORGAN_SLOT_BRAIN) - 50) //we set damage in this case in order to clear the "failing" flag
target.cure_all_traumas(TRAUMA_RESILIENCE_SURGERY)
if(target.getOrganLoss(ORGAN_SLOT_BRAIN) > 0)
to_chat(user, "[target]'s brain looks like it could be fixed further.")
return ..()
/datum/surgery_step/fix_brain/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(target.getorganslot(ORGAN_SLOT_BRAIN))
display_results(user, target, span_warning("You screw up, causing more damage!"),
span_warning("[user] screws up, causing brain damage!"),
span_notice("[user] completes the surgery on [target]'s brain."))
target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 60)
target.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_LOBOTOMY)
else
user.visible_message(span_warning("[user] suddenly notices that the brain [user.p_they()] [user.p_were()] working on is not there anymore."), span_warning("You suddenly notice that the brain you were working on is not there anymore."))
return FALSE