From 897e201775ab2a45eaf100fb8942de549cfaee7b Mon Sep 17 00:00:00 2001 From: TDSSS <32099540+TDSSS@users.noreply.github.com> Date: Tue, 19 Sep 2017 21:08:42 +0200 Subject: [PATCH] Started on surgery stuff Adds pain modifier to surgery if patient is conscious Now actually compiles Makes surgery easier if patient is drunk, allowing for easier ghetto surgery. Now reduces failure chance if painkillers are in the patient's system. Fixed argument spacing (hopefully) Repairing robotic limbs no longer needs anesthesia. Revert "Repairing robotic limbs no longer needs anesthesia." This reverts commit 12c1f4140a31cceb1d2b6b11b09c68088d829159. Repairing robotic limbs doesn't cause a pain modifier, because they don't feel pain. Now actually works. Moves typecasting from the helper proc to outside fo it and checks for sleeping. Now correctly checks for repair to robotic limbs. Increased effectiveness of Hydrocodone and Morphine to 99% on maintainer recommendation. --- code/modules/surgery/helpers.dm | 19 ++++++++++++++++++- code/modules/surgery/surgery.dm | 6 ++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/code/modules/surgery/helpers.dm b/code/modules/surgery/helpers.dm index afa0429bdc0..1c54b24ba6b 100644 --- a/code/modules/surgery/helpers.dm +++ b/code/modules/surgery/helpers.dm @@ -81,7 +81,24 @@ return 1 return 0 - +/proc/get_pain_modifier(mob/living/carbon/human/M) //returns modfier to make surgery harder if patient is conscious and feels pain + if(M.stat && !M.sleeping) //stat=0 if CONSCIOUS, 1=UNCONSCIOUS and 2=DEAD. Operating on dead people is easy, too. Just sleeping won't work, though. + return 1 + if(NO_PAIN in M.species.species_traits)//if you don't feel pain, you can hold still + return 1 + if(M.reagents.has_reagent("hydrocodone"))//really good pain killer + return 0.99 + if(M.reagents.has_reagent("morphine"))//Just as effective as Hydrocodone, but has an addiction chance + return 0.99 + if(M.drunk >= 80)//really damn drunk + return 0.95 + if(M.drunk >= 40)//pretty drunk + return 0.9 + if(M.reagents.has_reagent("sal_acid")) //it's better than nothing, as far as painkillers go. + return 0.85 + if(M.drunk >= 15)//a little drunk + return 0.85 + return 0.8 //20% failure chance /proc/get_location_modifier(mob/M) var/turf/T = get_turf(M) diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 8861380527a..1d836259cbe 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -116,6 +116,12 @@ prob_chance = allowed_tools[implement_type] prob_chance *= get_location_modifier(target) + + if(!ispath(surgery.steps[surgery.status], /datum/surgery_step/robotics))//Repairing robotic limbs doesn't hurt + if(ishuman(target)) + var/mob/living/carbon/human/H = target //typecast to human + prob_chance *= get_pain_modifier(H)//operating on conscious people is hard. + if(prob(prob_chance) || isrobot(user)) if(end_step(user, target, target_zone, tool, surgery)) advance = 1