From fd3ecfd82900e7310c57d29b6284d3f820de30c4 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Mon, 14 Jul 2014 08:28:14 +0400 Subject: [PATCH] Fixes #5563 --- code/modules/surgery/braincore.dm | 7 +++++-- code/modules/surgery/surgery.dm | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/code/modules/surgery/braincore.dm b/code/modules/surgery/braincore.dm index 03aad05e11d..0d1b169a8a1 100644 --- a/code/modules/surgery/braincore.dm +++ b/code/modules/surgery/braincore.dm @@ -193,9 +193,12 @@ // SLIME CORE EXTRACTION // ////////////////////////////////////////////////////////////////// -/datum/surgery_step/slime/ +/datum/surgery_step/slime + is_valid_target(mob/living/carbon/slime/target) + return istype(target, /mob/living/carbon/slime/) + can_use(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - return istype(target, /mob/living/carbon/slime/) && target.stat == 2 + return target.stat == 2 /datum/surgery_step/slime/cut_flesh allowed_tools = list( diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index ae2db702d30..07d5f7df40a 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -25,8 +25,10 @@ return allowed_tools[T] return 0 - // Checks if this step applies to the mutantrace of the user. - proc/is_valid_mutantrace(mob/living/carbon/human/target) + // Checks if this step applies to the user mob at all + proc/is_valid_target(mob/living/carbon/human/target) + if(!hasorgans(target)) + return 0 if(allowed_species) for(var/species in allowed_species) @@ -40,6 +42,7 @@ return 1 + // checks whether this step can be applied with the given user and target proc/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) return 0 @@ -81,7 +84,7 @@ proc/do_surgery(mob/living/M, mob/living/user, obj/item/tool) return 0 for(var/datum/surgery_step/S in surgery_steps) //check if tool is right or close enough and if this step is possible - if( S.tool_quality(tool) && S.can_use(user, M, user.zone_sel.selecting, tool) && S.is_valid_mutantrace(M)) + if( S.tool_quality(tool) && S.can_use(user, M, user.zone_sel.selecting, tool) && S.is_valid_target(M)) S.begin_step(user, M, user.zone_sel.selecting, tool) //start on it //We had proper tools! (or RNG smiled.) and User did not move or change hands. if( prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration)))