From ee69f614ed7ca6a3178387d741cda8cbe021c587 Mon Sep 17 00:00:00 2001 From: mikomyazaki <47489928+mikomyazaki@users.noreply.github.com> Date: Mon, 3 Aug 2020 10:46:52 +0100 Subject: [PATCH] Moves amputation to be a basic surgery step as it does not need the extra checks of surgery_step/generic (#9582) --- code/modules/surgery/generic.dm | 72 +-------------------------- code/modules/surgery/other.dm | 70 ++++++++++++++++++++++++++ html/changelogs/amputation_bugfix.yml | 6 +++ 3 files changed, 77 insertions(+), 71 deletions(-) create mode 100644 html/changelogs/amputation_bugfix.yml diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm index aec0f984145..4d50b316873 100644 --- a/code/modules/surgery/generic.dm +++ b/code/modules/surgery/generic.dm @@ -332,74 +332,4 @@ var/obj/item/organ/external/affected = target.get_organ(target_zone) user.visible_message(SPAN_WARNING("[user]'s hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!"), \ SPAN_WARNING("Your hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!")) - target.apply_damage(5, BURN, affected, tool) - -/decl/surgery_step/generic/amputate - name = "Amputate limb" - allowed_tools = list( - /obj/item/surgery/circular_saw = 100, - /obj/item/melee/energy = 100, - /obj/item/melee/chainsword = 100, - /obj/item/material/hatchet = 55 - ) - - min_duration = 110 - max_duration = 160 - -/decl/surgery_step/generic/amputate/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - if(!..()) - return FALSE - - if(target_zone == BP_EYES) //there are specific steps for eye surgery - return FALSE - var/obj/item/organ/external/affected = target.get_organ(target_zone) - if(affected == null) - return FALSE - - if(istype(tool, /obj/item/melee/energy)) - var/obj/item/melee/energy/E = tool - if(!E.active) - to_chat(user, SPAN_WARNING("The energy blade is not turned on!")) - return FALSE - - if(istype(tool, /obj/item/melee/chainsword)) - var/obj/item/melee/chainsword/E = tool - if(!E.active) - to_chat(user, SPAN_WARNING("The blades aren't spinning, you can't cut anything!")) - return FALSE - - return (affected.limb_flags & ORGAN_CAN_AMPUTATE) - -/decl/surgery_step/generic/amputate/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/obj/item/organ/external/affected = target.get_organ(target_zone) - user.visible_message(SPAN_DANGER("[user] is beginning to amputate [target]'s [affected.name] with \the [tool].") , \ - SPAN_DANGER("You begin to cut through [target]'s [affected.amputation_point] with \the [tool].")) - target.custom_pain("Your [affected.amputation_point] is being ripped apart!", 75) - ..() - -/decl/surgery_step/generic/amputate/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/obj/item/organ/external/affected = target.get_organ(target_zone) - user.visible_message(SPAN_DANGER("[user] amputates [target]'s [affected.name] at the [affected.amputation_point] with \the [tool]."), \ - SPAN_DANGER("You amputate [target]'s [affected.name] with \the [tool].")) - - var/clean = TRUE - if(istype(tool, /obj/item/melee/chainsword))//Chainswords rip and tear, so the limb removal is not clean - clean = FALSE - - var/obj/item/organ/external/parent = affected.parent//Cache the parent organ of the limb before we sever it - affected.droplimb(clean,DROPLIMB_EDGE) - - if(istype(tool, /obj/item/melee/energy))//Code for energy weapons cauterising the cut - affected = parent - affected.open = ORGAN_CLOSED//Close open wounds - for(var/datum/wound/lost_limb/W in affected.wounds) - W.disinfected = TRUE//Cleanse the wound of any germs - W.autoheal_cutoff = INFINITY//Allow the wound to auto-heal, regardless of damage - W.max_bleeding_stage = 0//Stop bleeding - -/decl/surgery_step/generic/amputate/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/obj/item/organ/external/affected = target.get_organ(target_zone) - user.visible_message(SPAN_WARNING("[user]'s hand slips, sawing through the bone in [target]'s [affected.name] with \the [tool]!"), \ - SPAN_WARNING("Your hand slips, sawwing through the bone in [target]'s [affected.name] with \the [tool]!")) - target.apply_damage(30, BRUTE, target_zone, 0, tool, damage_flags = tool.damage_flags()) - affected.fracture() \ No newline at end of file + target.apply_damage(5, BURN, affected, tool) \ No newline at end of file diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm index 5e75b76511b..8bfbd3c6f28 100644 --- a/code/modules/surgery/other.dm +++ b/code/modules/surgery/other.dm @@ -260,3 +260,73 @@ rig.reset() user.visible_message(SPAN_NOTICE("[user] has cut through the support systems of [target]'s [rig] with \the [tool]."), \ SPAN_NOTICE("You have cut through the support systems of [target]'s [rig] with \the [tool].")) + +/decl/surgery_step/amputate + name = "Amputate limb" + allowed_tools = list( + /obj/item/surgery/circular_saw = 100, + /obj/item/melee/energy = 100, + /obj/item/melee/chainsword = 100, + /obj/item/material/hatchet = 55 + ) + + min_duration = 110 + max_duration = 160 + +/decl/surgery_step/amputate/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) + if(!..()) + return FALSE + + if(target_zone == BP_EYES) //there are specific steps for eye surgery + return FALSE + var/obj/item/organ/external/affected = target.get_organ(target_zone) + if(affected == null) + return FALSE + + if(istype(tool, /obj/item/melee/energy)) + var/obj/item/melee/energy/E = tool + if(!E.active) + to_chat(user, SPAN_WARNING("The energy blade is not turned on!")) + return FALSE + + if(istype(tool, /obj/item/melee/chainsword)) + var/obj/item/melee/chainsword/E = tool + if(!E.active) + to_chat(user, SPAN_WARNING("The blades aren't spinning, you can't cut anything!")) + return FALSE + + return (affected.limb_flags & ORGAN_CAN_AMPUTATE) + +/decl/surgery_step/amputate/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) + var/obj/item/organ/external/affected = target.get_organ(target_zone) + user.visible_message(SPAN_DANGER("[user] is beginning to amputate [target]'s [affected.name] with \the [tool].") , \ + SPAN_DANGER("You begin to cut through [target]'s [affected.amputation_point] with \the [tool].")) + target.custom_pain("Your [affected.amputation_point] is being ripped apart!", 75) + ..() + +/decl/surgery_step/amputate/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) + var/obj/item/organ/external/affected = target.get_organ(target_zone) + user.visible_message(SPAN_DANGER("[user] amputates [target]'s [affected.name] at the [affected.amputation_point] with \the [tool]."), \ + SPAN_DANGER("You amputate [target]'s [affected.name] with \the [tool].")) + + var/clean = TRUE + if(istype(tool, /obj/item/melee/chainsword))//Chainswords rip and tear, so the limb removal is not clean + clean = FALSE + + var/obj/item/organ/external/parent = affected.parent//Cache the parent organ of the limb before we sever it + affected.droplimb(clean,DROPLIMB_EDGE) + + if(istype(tool, /obj/item/melee/energy))//Code for energy weapons cauterising the cut + affected = parent + affected.open = ORGAN_CLOSED//Close open wounds + for(var/datum/wound/lost_limb/W in affected.wounds) + W.disinfected = TRUE//Cleanse the wound of any germs + W.autoheal_cutoff = INFINITY//Allow the wound to auto-heal, regardless of damage + W.max_bleeding_stage = 0//Stop bleeding + +/decl/surgery_step/amputate/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) + var/obj/item/organ/external/affected = target.get_organ(target_zone) + user.visible_message(SPAN_WARNING("[user]'s hand slips, sawing through the bone in [target]'s [affected.name] with \the [tool]!"), \ + SPAN_WARNING("Your hand slips, sawwing through the bone in [target]'s [affected.name] with \the [tool]!")) + target.apply_damage(30, BRUTE, target_zone, 0, tool, damage_flags = tool.damage_flags()) + affected.fracture() \ No newline at end of file diff --git a/html/changelogs/amputation_bugfix.yml b/html/changelogs/amputation_bugfix.yml new file mode 100644 index 00000000000..19e7b5f357b --- /dev/null +++ b/html/changelogs/amputation_bugfix.yml @@ -0,0 +1,6 @@ +author: mikomyazaki + +delete-after: True + +changes: + - bugfix: "Amputation of stumps and robotic limbs will now work properly again." \ No newline at end of file