Fixes hemostat surgery.

Port of https://github.com/PolarisSS13/Polaris/pull/381.
This commit is contained in:
PsiOmegaDelta
2015-12-02 08:56:58 +01:00
parent 5a0d76d876
commit 2560c13816
6 changed files with 17 additions and 13 deletions
+1
View File
@@ -0,0 +1 @@
#define SURGERY_FAILURE -1
+6 -6
View File
@@ -273,11 +273,11 @@
if((affected.status & ORGAN_ROBOT) && !(O.status & ORGAN_ROBOT))
user << "<span class='danger'>You cannot install a naked organ into a robotic body.</span>"
return 2
return SURGERY_FAILURE
if(!target.species)
user << "\red You have no idea what species this person is. Report this on the bug tracker."
return 2
return SURGERY_FAILURE
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 SURGERY_FAILURE
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 SURGERY_FAILURE
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 SURGERY_FAILURE
else
user << "\red You're pretty sure [target.species.name_plural] don't normally have [o_a][O.organ_tag]."
return 2
return SURGERY_FAILURE
return ..() && organ_missing && organ_compatible
+6 -6
View File
@@ -171,7 +171,7 @@
if(istype(C))
if(!C.get_amount() >= 3)
user << "<span class='danger'>You need three or more cable pieces to repair this damage.</span>"
return 2
return SURGERY_FAILURE
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 << "<span class='danger'>That brain is not usable.</span>"
return 2
return SURGERY_FAILURE
if(!(affected.status & ORGAN_ROBOT))
user << "<span class='danger'>You cannot install a computer brain into a meat skull.</span>"
return 2
return SURGERY_FAILURE
if(!target.species)
user << "<span class='danger'>You have no idea what species this person is. Report this on the bug tracker.</span>"
return 2
return SURGERY_FAILURE
if(!target.species.has_organ["brain"])
user << "<span class='danger'>You're pretty sure [target.species.name_plural] don't normally have a brain.</span>"
return 2
return SURGERY_FAILURE
if(!isnull(target.internal_organs["brain"]))
user << "<span class='danger'>Your subject already has a brain.</span>"
return 2
return SURGERY_FAILURE
return 1
+1 -1
View File
@@ -91,7 +91,7 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool)
if(S.tool_quality(tool))
var/step_is_valid = S.can_use(user, M, zone, tool)
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 == SURGERY_FAILURE) // 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
+1
View File
@@ -0,0 +1 @@
#undef SURGERY_FAILURE