mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-06 15:42:28 +00:00
* Initial commit Fixes up surgery.dm Adds some tool behavior * More basic changes * Checkpointing: this is a little gross right now * Add signal COMPONENT_CANCEL_ATTACK_CHAIN * Cleans up surgery initiator * Mostly gets surgery (and canceling it) working * Add abstract proxy surgery steps Also adds them to organ manipulation * Clean up most existing surgeries * Rework organ openness, adds define for aborting a beginstep * surgery works again, also implements retry defines * fix surgery computer * add limb repair to synth implant removal * retry implant checks * Clean up abductor surgeries as well as some other things * A lot - Reworks organ manipulation to use a series of surgery steps instead - Fixes some runtimes with open hands - Lets mito zero out the germ level while treating necrosis - Adds a debug surgery tool * add debug surgery tool, note some TODOs for later * Add conditional check for surgeries repeating * update surgery retry logic to make it more of a bonus * Lets abductors automatically retry any failed surgery steps * Rework robotic surgery to use abstract/proxy steps * Bunch of bugfixes and more! - Limb reattachment works properly now, you can just slap a limb onto a person - If the limb isn't robotic, it'll be useless until the surgery is finished with a hemostat, though it might be enough to get the patient out of the OR. * Remove more now-implicit checks * Slight reorganization * more fixes across the board * Remove unused variable * Trying not to lose my mind here - Does away with can_run() entirely - Cleans up visible messages in code - begin steps should now all have ..() afterwards - slime bone surgery should be fixed now - more docs * Robotic surgery is stoppable with a crowbar, all surgery can_start now checks parent * Fix some broken robotic typepaths * Typepath fixes, do away with some last TODOs * Forgor * Last cleanups before we go gold * jk lol * Make early surgery termination clearer * More "last" cleanups * Fixes tool flags, surgery initiation - Fixes surgery not being startable by sharp objects - Moves surgical tool flags to item traits * Clean up surgery cancellation, especially for borgos * I think this should GC better * Apply suggestions from code review Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com> * Status is now step number * Add a 20% chance to find nothing during organ manipulation * Improve documentation, make forced_surgery a normal arg * Charlie's reviews * Why are abductors like this * Little more verification, ensuring limb augmentation and organ manip healing work properly * Fix torso organ manip being unfinishable * Fix cavity implants, open-hand/any item steps * Make sharp objects not try to start an operation with help intent * Comments, quick target fix * Re-order list so advanced bruise pack is pulled first * Make surgical gripper function like an open hand * Make mito only use one unit per organ for now * Check if user is on operable surface before trying to operate * Reduce admin logging * Fix some bugs that appeared during the testmerge - you can no longer start robotic surgeries with a scalpel (lol) - you can now cancel surgeries on the first step after I fixed some bugs that I introduced (woo hoo) - Synthetic limb attachment is now combined into a single startable surgery step, though still retains the fun flavor of both * Swats some more bugs - (hopefully) fixes a huge source of runtimes where we tried to check if we could run surgeries before checking if the surgery used an organ - In doing so, moves the logic for determining if a surgery can start to the mob-level - Fixes robotic reattachment surgery not working * multi-bug drifting??? - Fixes a bug where a branching surgery with an any tool option could possibly override a step with a matching tool - Fixes some intermediate surgeries failing due to not having specified possible_locs * A few more fixes - Fixes any surgery tool steps again - Fixes cavity surgery again * Hopefully fixes getting stuck in robotic organ manip * Remove extra parent call * Steel review * Steel review * Fix spacing for possible locs * Roundstart traits * Advanced surgical traits and other hal fixes Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
285 lines
14 KiB
Plaintext
285 lines
14 KiB
Plaintext
//Procedures in this file: Generic surgery steps
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// COMMON STEPS //
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/datum/surgery_step/generic
|
|
can_infect = TRUE
|
|
|
|
/datum/surgery_step/generic/cut_open
|
|
name = "make incision"
|
|
|
|
allowed_tools = list(
|
|
TOOL_SCALPEL = 100,
|
|
/obj/item/kitchen/knife = 90,
|
|
/obj/item/shard = 60,
|
|
/obj/item/scissors = 12,
|
|
/obj/item/twohanded/chainsaw = 1,
|
|
/obj/item/claymore = 6,
|
|
/obj/item/melee/energy = 6,
|
|
/obj/item/pen/edagger = 6,
|
|
)
|
|
|
|
time = 1.6 SECONDS
|
|
|
|
/datum/surgery_step/generic/cut_open/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"[user] starts the incision on [target]'s [affected.name] with \the [tool].",
|
|
"You start the incision on [target]'s [affected.name] with \the [tool]."
|
|
)
|
|
target.custom_pain("You feel a horrible pain as if from a sharp knife in your [affected.name]!")
|
|
return ..()
|
|
|
|
/datum/surgery_step/generic/cut_open/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='notice'> [user] has made an incision on [target]'s [affected.name] with \the [tool].</span>",
|
|
"<span class='notice'> You have made an incision on [target]'s [affected.name] with \the [tool].</span>"
|
|
)
|
|
affected.open = ORGAN_ORGANIC_OPEN
|
|
return SURGERY_STEP_CONTINUE
|
|
|
|
/datum/surgery_step/generic/cut_open/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='warning'> [user]'s hand slips, slicing open [target]'s [affected.name] in a wrong spot with \the [tool]!</span>",
|
|
"<span class='warning'> Your hand slips, slicing open [target]'s [affected.name] in a wrong spot with \the [tool]!</span>"
|
|
)
|
|
affected.receive_damage(10)
|
|
return SURGERY_STEP_RETRY
|
|
|
|
/datum/surgery_step/generic/clamp_bleeders
|
|
name = "clamp bleeders"
|
|
|
|
allowed_tools = list(
|
|
TOOL_HEMOSTAT = 100,
|
|
/obj/item/scalpel/laser = 100,
|
|
/obj/item/stack/cable_coil = 90,
|
|
/obj/item/assembly/mousetrap = 25
|
|
)
|
|
|
|
time = 2.4 SECONDS
|
|
|
|
|
|
/datum/surgery_step/generic/clamp_bleeders/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"[user] starts clamping bleeders in [target]'s [affected.name] with \the [tool].",
|
|
"You start clamping bleeders in [target]'s [affected.name] with \the [tool]."
|
|
)
|
|
target.custom_pain("The pain in your [affected.name] is maddening!")
|
|
return ..()
|
|
|
|
/datum/surgery_step/generic/clamp_bleeders/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='notice'> [user] clamps bleeders in [target]'s [affected.name] with \the [tool]</span>.",
|
|
"<span class='notice'> You clamp bleeders in [target]'s [affected.name] with \the [tool].</span>"
|
|
)
|
|
spread_germs_to_organ(affected, user, tool)
|
|
return SURGERY_STEP_CONTINUE
|
|
|
|
/datum/surgery_step/generic/clamp_bleeders/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='warning'> [user]'s hand slips, tearing blood vessels and causing massive bleeding in [target]'s [affected.name] with \the [tool]!</span>",
|
|
"<span class='warning'> Your hand slips, tearing blood vessels and causing massive bleeding in [target]'s [affected.name] with \the [tool]!</span>"
|
|
)
|
|
affected.receive_damage(10)
|
|
return SURGERY_STEP_RETRY
|
|
|
|
/datum/surgery_step/generic/retract_skin
|
|
name = "retract skin"
|
|
|
|
allowed_tools = list(
|
|
TOOL_RETRACTOR = 100,
|
|
/obj/item/scalpel/laser/manager = 100,
|
|
/obj/item/retractor = 100,
|
|
/obj/item/crowbar = 90,
|
|
/obj/item/kitchen/utensil/fork = 60
|
|
)
|
|
|
|
time = 2.4 SECONDS
|
|
|
|
/datum/surgery_step/generic/retract_skin/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
var/msg = "[user] starts to pry open the incision on [target]'s [affected.name] with \the [tool]."
|
|
var/self_msg = "You start to pry open the incision on [target]'s [affected.name] with \the [tool]."
|
|
if(target_zone == BODY_ZONE_CHEST)
|
|
msg = "[user] starts to separate the ribcage and rearrange the organs in [target]'s torso with \the [tool]."
|
|
self_msg = "You start to separate the ribcage and rearrange the organs in [target]'s torso with \the [tool]."
|
|
if(target_zone == BODY_ZONE_PRECISE_GROIN)
|
|
msg = "[user] starts to pry open the incision and rearrange the organs in [target]'s lower abdomen with \the [tool]."
|
|
self_msg = "You start to pry open the incision and rearrange the organs in [target]'s lower abdomen with \the [tool]."
|
|
user.visible_message(msg, self_msg)
|
|
target.custom_pain("It feels like the skin on your [affected.name] is on fire!")
|
|
return ..()
|
|
|
|
/datum/surgery_step/generic/retract_skin/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
var/msg = "<span class='notice'> [user] keeps the incision open on [target]'s [affected.name] with \the [tool].</span>"
|
|
var/self_msg = "<span class='notice'> You keep the incision open on [target]'s [affected.name] with \the [tool].</span>"
|
|
if(target_zone == BODY_ZONE_CHEST)
|
|
msg = "<span class='notice'> [user] keeps the ribcage open on [target]'s torso with \the [tool].</span>"
|
|
self_msg = "<span class='notice'> You keep the ribcage open on [target]'s torso with \the [tool]."
|
|
if(target_zone == BODY_ZONE_PRECISE_GROIN)
|
|
msg = "<span class='notice'> [user] keeps the incision open on [target]'s lower abdomen with \the [tool].</span>"
|
|
self_msg = "<span class='notice'> You keep the incision open on [target]'s lower abdomen with \the [tool].</span>"
|
|
user.visible_message(msg, self_msg)
|
|
affected.open = ORGAN_ORGANIC_ENCASED_OPEN
|
|
return SURGERY_STEP_CONTINUE
|
|
|
|
/datum/surgery_step/generic/retract_skin/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
var/msg = "<span class='warning'>[user]'s hand slips, tearing the edges of incision on [target]'s [affected.name] with \the [tool]!</span>"
|
|
var/self_msg = "<span class='warning'> Your hand slips, tearing the edges of incision on [target]'s [affected.name] with \the [tool]!</span>"
|
|
if(target_zone == BODY_ZONE_CHEST)
|
|
msg = "<span class='warning'>[user]'s hand slips, damaging several organs [target]'s torso with \the [tool]!</span>"
|
|
self_msg = "<span class='warning'> Your hand slips, damaging several organs [target]'s torso with \the [tool]!</span>"
|
|
if(target_zone == BODY_ZONE_PRECISE_GROIN)
|
|
msg = "<span class='warning'>[user]'s hand slips, damaging several organs [target]'s lower abdomen with \the [tool]</span>"
|
|
self_msg = "<span class='warning'> Your hand slips, damaging several organs [target]'s lower abdomen with \the [tool]!</span>"
|
|
user.visible_message(msg, self_msg)
|
|
target.apply_damage(12, BRUTE, affected, sharp = TRUE)
|
|
return SURGERY_STEP_RETRY
|
|
|
|
/datum/surgery_step/generic/cauterize
|
|
|
|
name = "cauterize incision"
|
|
|
|
allowed_tools = list(
|
|
/obj/item/scalpel/laser = 100,
|
|
TOOL_CAUTERY = 100,
|
|
/obj/item/clothing/mask/cigarette = 90,
|
|
/obj/item/lighter = 60,
|
|
TOOL_WELDER = 30
|
|
)
|
|
|
|
time = 2.4 SECONDS
|
|
|
|
/datum/surgery_step/generic/cauterize/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"[user] is beginning to cauterize the incision on [target]'s [affected.name] with \the [tool].",
|
|
"You are beginning to cauterize the incision on [target]'s [affected.name] with \the [tool]."
|
|
)
|
|
target.custom_pain("Your [affected.name] is being burned!")
|
|
return ..()
|
|
|
|
/datum/surgery_step/generic/cauterize/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='notice'>[user] cauterizes the incision on [target]'s [affected.name] with \the [tool].</span>",
|
|
"<span class='notice'>You cauterize the incision on [target]'s [affected.name] with \the [tool].</span>"
|
|
)
|
|
affected.open = ORGAN_CLOSED
|
|
affected.germ_level = 0
|
|
return SURGERY_STEP_CONTINUE
|
|
|
|
/datum/surgery_step/generic/cauterize/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='warning'>[user]'s hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!</span>",
|
|
"<span class='warning'>Your hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!</span>"
|
|
)
|
|
target.apply_damage(3, BURN, affected)
|
|
return SURGERY_STEP_RETRY
|
|
|
|
/datum/surgery_step/generic/cauterize/premature
|
|
name = "cauterize incision (premature)"
|
|
|
|
/datum/surgery_step/generic/cauterize/premature/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"[user] is beginning to cauterize the incision on [target]'s [affected.name] with \the [tool].",
|
|
// give a little heads up to the surgeon that they're stopping the surgery prematurely in case that wasn't the intention.
|
|
"<span class='warning'>You are interrupting the current surgery</span>, beginning to cauterize the incision on [target]'s [affected.name] with \the [tool]."
|
|
)
|
|
target.custom_pain("Your [affected.name] is being burned!")
|
|
return ..()
|
|
|
|
|
|
//drill bone
|
|
/datum/surgery_step/generic/drill
|
|
name = "drill bone"
|
|
allowed_tools = list(
|
|
TOOL_DRILL = 100,
|
|
/obj/item/screwdriver/power = 80,
|
|
/obj/item/pickaxe/drill = 60,
|
|
/obj/item/mecha_parts/mecha_equipment/drill = 60,
|
|
/obj/item/screwdriver = 20
|
|
)
|
|
time = 3 SECONDS
|
|
|
|
/datum/surgery_step/generic/drill/begin_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
user.visible_message(
|
|
"[user] begins to drill into the bone in [target]'s [parse_zone(target_zone)].",
|
|
"<span class='notice'>You begin to drill into the bone in [target]'s [parse_zone(target_zone)]...</span>"
|
|
)
|
|
return ..()
|
|
|
|
/datum/surgery_step/generic/drill/end_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
user.visible_message("[user] drills into [target]'s [parse_zone(target_zone)]!", "<span class='notice'>You drill into [target]'s [parse_zone(target_zone)].</span>")
|
|
return SURGERY_STEP_CONTINUE
|
|
|
|
/datum/surgery_step/generic/drill/fail_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='warning'>[user]'s [tool] doesn't get a firm grip and tears at the bone in [target]'s [parse_zone(target_zone)]!</span>",
|
|
"<span class='warning'>Your [tool] doesn't get a firm grip and tears at the bone in [target]'s [parse_zone(target_zone)]!</span>"
|
|
)
|
|
|
|
affected.receive_damage(15)
|
|
return SURGERY_STEP_RETRY
|
|
|
|
|
|
/datum/surgery_step/generic/amputate
|
|
name = "amputate limb"
|
|
|
|
allowed_tools = list(
|
|
TOOL_SAW = 100,
|
|
/obj/item/hatchet = 90,
|
|
/obj/item/melee/arm_blade = 75
|
|
)
|
|
|
|
time = 10 SECONDS
|
|
|
|
/datum/surgery_step/generic/amputate/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"[user] is beginning to amputate [target]'s [affected.name] with \the [tool].",
|
|
"You are beginning to cut through [target]'s [affected.amputation_point] with \the [tool]."
|
|
)
|
|
target.custom_pain("Your [affected.amputation_point] is being ripped apart!")
|
|
return ..()
|
|
|
|
/datum/surgery_step/generic/amputate/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='notice'> [user] amputates [target]'s [affected.name] at the [affected.amputation_point] with \the [tool].</span>",
|
|
"<span class='notice'> You amputate [target]'s [affected.name] with \the [tool].</span>"
|
|
)
|
|
|
|
add_attack_logs(user, target, "Surgically removed [affected.name]. INTENT: [uppertext(user.a_intent)]")//log it
|
|
|
|
var/atom/movable/thing = affected.droplimb(1, DROPLIMB_SHARP)
|
|
|
|
if(istype(target) && target.can_feel_pain())
|
|
// okay if you can feel your arm getting chopped off you aren't gonna be singing
|
|
to_chat(target, "<span class='userdanger'>Your [affected] goes completely numb at the [affected.amputation_point]!</span>")
|
|
target.emote("scream")
|
|
if(istype(thing, /obj/item))
|
|
user.put_in_hands(thing)
|
|
return SURGERY_STEP_CONTINUE
|
|
|
|
/datum/surgery_step/generic/amputate/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
|
user.visible_message(
|
|
"<span class='warning'> [user]'s hand slips, sawing through the bone in [target]'s [affected.name] with \the [tool]!</span>",
|
|
"<span class='warning'> Your hand slips, sawing through the bone in [target]'s [affected.name] with \the [tool]!</span>"
|
|
)
|
|
affected.receive_damage(30)
|
|
affected.fracture()
|
|
return SURGERY_STEP_RETRY
|