From 230d676c3f46542ca313fffe041e45b8c9d8518d Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 2 Dec 2015 03:45:24 +0000 Subject: [PATCH] Changes the arbitrary failure return for surgery from 2 to -1. This is because ORGAN_BLEEDING in damage_organs.dm is now 2 so some statements evaluate to 2, which causes bleeding clamp surgery to fail as it triggered the "This is an error that's already been dealt with" condition coincidentally. Surgeries which report failures (like trying to stick a brain in someone who's already got one) now throw back a -1 not a 2. --- code/modules/surgery/organs_internal.dm | 12 ++++++------ code/modules/surgery/robotics.dm | 12 ++++++------ code/modules/surgery/surgery.dm | 3 ++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm index d352c4aed4..8579173218 100644 --- a/code/modules/surgery/organs_internal.dm +++ b/code/modules/surgery/organs_internal.dm @@ -273,11 +273,11 @@ if((affected.status & ORGAN_ROBOT) && !(O.status & ORGAN_ROBOT)) user << "You cannot install a naked organ into a robotic body." - return 2 + return -1 if(!target.species) user << "\red You have no idea what species this person is. Report this on the bug tracker." - return 2 + return -1 var/o_is = (O.gender == PLURAL) ? "are" : "is" var/o_a = (O.gender == PLURAL) ? "" : "a " @@ -289,22 +289,22 @@ if(O.damage > (O.max_damage * 0.75)) user << "\red \The [O.organ_tag] [o_is] in no state to be transplanted." - return 2 + return -1 if(!target.internal_organs_by_name[O.organ_tag]) organ_missing = 1 else user << "\red \The [target] already has [o_a][O.organ_tag]." - return 2 + return -1 if(O && affected.limb_name == O.parent_organ) organ_compatible = 1 else user << "\red \The [O.organ_tag] [o_do] normally go in \the [affected.name]." - return 2 + return -1 else user << "\red You're pretty sure [target.species.name_plural] don't normally have [o_a][O.organ_tag]." - return 2 + return -1 return ..() && organ_missing && organ_compatible diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm index dc626ec60a..c3a89a5dfc 100644 --- a/code/modules/surgery/robotics.dm +++ b/code/modules/surgery/robotics.dm @@ -171,7 +171,7 @@ if(istype(C)) if(!C.get_amount() >= 3) user << "You need three or more cable pieces to repair this damage." - return 2 + return -1 C.use(3) return 1 return 0 @@ -383,23 +383,23 @@ if(!M.brainmob || !M.brainmob.client || !M.brainmob.ckey || M.brainmob.stat >= DEAD) user << "That brain is not usable." - return 2 + return -1 if(!(affected.status & ORGAN_ROBOT)) user << "You cannot install a computer brain into a meat skull." - return 2 + return -1 if(!target.species) user << "You have no idea what species this person is. Report this on the bug tracker." - return 2 + return -1 if(!target.species.has_organ["brain"]) user << "You're pretty sure [target.species.name_plural] don't normally have a brain." - return 2 + return -1 if(!isnull(target.internal_organs["brain"])) user << "Your subject already has a brain." - return 2 + return -1 return 1 diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 6e57a4f37b..2a760f1f28 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -90,8 +90,9 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) //check if tool is right or close enough and if this step is possible if(S.tool_quality(tool)) var/step_is_valid = S.can_use(user, M, zone, tool) + world.log << "Is Valid = [step_is_valid]" if(step_is_valid && S.is_valid_target(M)) - if(step_is_valid == 2) // This is a failure that already has a message for failing. + if(step_is_valid == -1) // This is a failure that already has a message for failing. return 1 M.op_stage.in_progress += zone S.begin_step(user, M, zone, tool) //start on it