mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 22:42:26 +01:00
Fixed exploit that allowed you to apply surgery step to any zone regardless of where you state it. For example it allows you to cut off heads, groins and even torsos by starting to cut off limb and then switching to other zone. Also now surgery lock is area-based, so more than one surgeon can work on different organs at same time.
This commit is contained in:
@@ -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
|
||||
var/list/in_progress = list()
|
||||
Reference in New Issue
Block a user