Moves amputation to be a basic surgery step as it does not need the extra checks of surgery_step/generic (#9582)

This commit is contained in:
mikomyazaki
2020-08-03 11:46:52 +02:00
committed by GitHub
parent 389efceb84
commit ee69f614ed
3 changed files with 77 additions and 71 deletions
+1 -71
View File
@@ -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()
target.apply_damage(5, BURN, affected, tool)
+70
View File
@@ -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()