From bde40bd95efd9d5a600e52ff00e4308b3afac2ad Mon Sep 17 00:00:00 2001 From: Segrain Date: Fri, 31 Jan 2014 16:28:24 +0300 Subject: [PATCH] Surgery tracking. --- code/modules/mob/living/carbon/human/human.dm | 1 + code/modules/organs/organ_external.dm | 2 ++ code/modules/surgery/headreattach.dm | 7 +++++-- code/modules/surgery/robolimbs.dm | 8 ++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 736770a9788..46745011a57 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1121,6 +1121,7 @@ O.status &= ~ORGAN_BROKEN O.status &= ~ORGAN_BLEEDING O.status &= ~ORGAN_SPLINTED + O.status &= ~ORGAN_CUT_AWAY O.status &= ~ORGAN_ATTACHABLE if (!O.amputated) O.status &= ~ORGAN_DESTROYED diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 5837c2a25ae..1cd26a4f610 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -637,9 +637,11 @@ This function completely restores a damaged organ to perfect condition. src.status &= ~ORGAN_BROKEN src.status &= ~ORGAN_BLEEDING src.status &= ~ORGAN_SPLINTED + src.status &= ~ORGAN_CUT_AWAY src.status &= ~ORGAN_ATTACHABLE src.status &= ~ORGAN_DESTROYED src.status |= ORGAN_ROBOT + src.destspawn = 0 for (var/datum/organ/external/T in children) if(T) T.robotize() diff --git a/code/modules/surgery/headreattach.dm b/code/modules/surgery/headreattach.dm index 4bfe2419f26..598e7eb6776 100644 --- a/code/modules/surgery/headreattach.dm +++ b/code/modules/surgery/headreattach.dm @@ -14,7 +14,7 @@ if (affected.parent) if (affected.parent.status & ORGAN_DESTROYED) return 0 - return target_zone == "head" + return affected.name == "head" /datum/surgery_step/head/peel @@ -27,6 +27,9 @@ min_duration = 80 max_duration = 100 + can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) + var/datum/organ/external/affected = target.get_organ(target_zone) + return ..() && !(affected.status & ORGAN_CUT_AWAY) begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) user.visible_message("[user] starts peeling back tattered flesh where [target]'s head used to be with \the [tool].", \ @@ -59,7 +62,7 @@ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) - return ..() && affected.status & ORGAN_CUT_AWAY + return ..() && affected.status & ORGAN_CUT_AWAY && affected.open < 3 && !(affected.status & ORGAN_ATTACHABLE) begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) diff --git a/code/modules/surgery/robolimbs.dm b/code/modules/surgery/robolimbs.dm index cda3d9fd96c..8e249887772 100644 --- a/code/modules/surgery/robolimbs.dm +++ b/code/modules/surgery/robolimbs.dm @@ -16,7 +16,7 @@ if (affected.parent) if (affected.parent.status & ORGAN_DESTROYED) return 0 - return 1 + return affected.name != "head" /datum/surgery_step/limb/cut @@ -29,6 +29,10 @@ min_duration = 80 max_duration = 100 + can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) + var/datum/organ/external/affected = target.get_organ(target_zone) + return ..() && !(affected.status & ORGAN_CUT_AWAY) + begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) user.visible_message("[user] starts cutting away flesh where [target]'s [affected.display_name] used to be with \the [tool].", \ @@ -61,7 +65,7 @@ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) - return ..() && affected.status & ORGAN_CUT_AWAY + return ..() && affected.status & ORGAN_CUT_AWAY && affected.open < 3 && !(affected.status & ORGAN_ATTACHABLE) begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone)