diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 825a4c582e9..61d6688a6f4 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -82,27 +82,27 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) return 0 if (user.a_intent == "harm") //check for Hippocratic Oath return 0 - if(M.op_stage.in_progress) //Can't operate on someone repeatedly. - user << "\red You can't operate on the patient while surgery is already in progress." + var/zone = user.zone_sel.selecting + if(zone in M.op_stage.in_progress) //Can't operate on someone repeatedly. + user << "\red You can't operate on this area while surgery is already in progress." return 1 - 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)) - var/step_is_valid = S.can_use(user, M, user.zone_sel.selecting, 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. return 1 - M.op_stage.in_progress = 1 - S.begin_step(user, M, user.zone_sel.selecting, tool) //start on it + M.op_stage.in_progress += zone + S.begin_step(user, M, zone, 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))) - S.end_step(user, M, user.zone_sel.selecting, tool) //finish successfully + S.end_step(user, M, zone, tool) //finish successfully else if ((tool in user.contents) && user.Adjacent(M)) //or - S.fail_step(user, M, user.zone_sel.selecting, tool) //malpractice~ + S.fail_step(user, M, zone, tool) //malpractice~ else // This failing silently was a pain. user << "\red You must remain close to your patient to conduct surgery." - M.op_stage.in_progress = 0 // Clear the in-progress flag. + M.op_stage.in_progress -= zone // Clear the in-progress flag. return 1 //don't want to do weapony things after surgery if (user.a_intent == "help") @@ -131,4 +131,4 @@ proc/sort_surgeries() var/face = 0 var/head_reattach = 0 var/current_organ = "organ" - var/in_progress = 0 \ No newline at end of file + var/list/in_progress = list() \ No newline at end of file