Files
Bubberstation/code/modules/surgery/dissection.dm
ChungusGamer666 4f2227baf3 Implements a macro for checking mind traits (#76548)
## About The Pull Request


![image](https://github.com/tgstation/tgstation/assets/82850673/f85d0556-1806-40bf-92b8-597e46ccb4af)
Seeing this pattern repeated over various sections of code was starting
to piss me off

## Why It's Good For The Game

Lessens chance to cause errors with mind traits, ensures consistent
behavior, makes it easier to change how mind traits work if necessary.

## Changelog

hopefully not player facing

---------

Co-authored-by: san7890 <the@san7890.com>
2023-07-06 11:45:46 -06:00

86 lines
2.8 KiB
Plaintext

/datum/surgery/dissection
name = "Dissection"
target_mobtypes = list(
/mob/living/carbon/human,
/mob/living/carbon/alien,
)
surgery_flags = SURGERY_REQUIRE_RESTING | SURGERY_REQUIRE_LIMB | SURGERY_REQUIRES_REAL_LIMB | SURGERY_MORBID_CURIOSITY
possible_locs = list(BODY_ZONE_CHEST)
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/clamp_bleeders,
/datum/surgery_step/dissection,
/datum/surgery_step/close,
)
/datum/surgery/dissection/can_start(mob/user, mob/living/patient)
. = ..()
// This isn't a real advanced tech, but it doesn't make sense using it without an operating computer
if (isnull(locate_operating_computer(get_turf(patient))))
return FALSE
if (HAS_TRAIT(patient, TRAIT_DISSECTED))
return FALSE
if (patient.stat != DEAD)
return FALSE
return TRUE
/datum/surgery_step/dissection
name = "dissect (autopsy scanner)"
time = 16 SECONDS
implements = list(
/obj/item/autopsy_scanner = 100,
)
/datum/surgery_step/dissection/preop(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/ending = "..."
if (isnull(surgery.locate_operating_computer(get_turf(target))))
ending = "<b>, but without a linked operating computer, you won't get any research!</b>"
display_results(
user,
target,
span_notice("You start to dissect [target][ending]"),
span_notice("[user] starts to dissect [target]..."),
span_notice("[user] begins to start poking around inside your corpse...hey, wait a minute!"),
)
/datum/surgery_step/dissection/success(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results)
ADD_TRAIT(target, TRAIT_DISSECTED, REF(src))
var/obj/machinery/computer/operating/operating_computer = surgery.locate_operating_computer(get_turf(target))
if (!isnull(operating_computer))
SEND_SIGNAL(operating_computer, COMSIG_OPERATING_COMPUTER_DISSECTION_COMPLETE, target)
if(HAS_MIND_TRAIT(user, TRAIT_MORBID) && ishuman(user))
var/mob/living/carbon/human/morbid_weirdo = user
morbid_weirdo.add_mood_event("morbid_dissection_success", /datum/mood_event/morbid_dissection_success)
return TRUE
/datum/surgery_step/dissection/failure(mob/user, mob/living/target, target_zone, obj/item/tool, datum/surgery/surgery, fail_prob)
display_results(
user,
target,
span_notice("You mess up, damaging some of the internal organs!"),
span_notice("[user] messes up, damaging some of the internal organs!"),
span_notice("[user] messes up, damaging some of your internal organs!"),
)
target.adjustOrganLoss(pick(
ORGAN_SLOT_APPENDIX,
ORGAN_SLOT_BRAIN,
ORGAN_SLOT_HEART,
ORGAN_SLOT_LIVER,
ORGAN_SLOT_LUNGS,
ORGAN_SLOT_STOMACH,
), 20)
return FALSE
/datum/surgery_step/dissection/tool_check(mob/user, obj/item/tool)
return implement_type != /obj/item || tool.get_sharpness() > 0