whole bunch of surgery changes

early cautery not compiling yet
This commit is contained in:
datlo
2019-01-26 00:50:18 +00:00
parent 225c470944
commit fdc841be8e
4 changed files with 58 additions and 26 deletions
@@ -153,10 +153,9 @@
modules += new /obj/item/stack/medical/ointment/advanced(src)
modules += new /obj/item/stack/medical/splint(src)
modules += new /obj/item/stack/nanopaste(src)
modules += new /obj/item/scalpel(src)
modules += new /obj/item/scalpel/laser(src)
modules += new /obj/item/hemostat(src)
modules += new /obj/item/retractor(src)
modules += new /obj/item/cautery(src)
modules += new /obj/item/bonegel(src)
modules += new /obj/item/FixOVein(src)
modules += new /obj/item/bonesetter(src)
@@ -416,10 +415,9 @@
modules += new /obj/item/stack/medical/ointment/advanced(src)
modules += new /obj/item/stack/medical/splint(src)
modules += new /obj/item/stack/nanopaste(src)
modules += new /obj/item/scalpel(src)
modules += new /obj/item/scalpel/laser(src)
modules += new /obj/item/hemostat(src)
modules += new /obj/item/retractor(src)
modules += new /obj/item/cautery(src)
modules += new /obj/item/bonegel(src)
modules += new /obj/item/FixOVein(src)
modules += new /obj/item/bonesetter(src)
+54 -12
View File
@@ -3,6 +3,13 @@
var/mob/living/carbon/human/H
var/obj/item/organ/external/affecting
var/selected_zone = user.zone_sel.selecting
var/list/cautery_tools = list(
/obj/item/scalpel/laser = 100, \
/obj/item/cautery = 100, \
/obj/item/clothing/mask/cigarette = 90, \
/obj/item/lighter = 60, \
/obj/item/weldingtool = 30
)
if(istype(M, /mob/living/carbon/human))
H = M
@@ -61,26 +68,49 @@
user.visible_message("[user] prepares to operate on [M]'s [parse_zone(selected_zone)].", \
"<span class='notice'>You prepare to operate on [M]'s [parse_zone(selected_zone)].</span>")
else if(!current_surgery.step_in_progress)
if(current_surgery.status == 1 )
else if(!current_surgery.step_in_progress && ishuman(M)) //early surgery cautery
var/datum/surgery_step/generic/cauterize/C = new
var/target_zone = check_zone(selected_zone)
if(current_surgery.status == 1)
M.surgeries -= current_surgery
to_chat(user, "You stop the surgery.")
qdel(current_surgery)
else if(istype(user.get_inactive_hand(), /obj/item/cautery) && current_surgery.can_cancel)
M.surgeries -= current_surgery
user.visible_message("[user] mends the incision on [M]'s [parse_zone(selected_zone)] with the [I] .", \
"<span class='notice'>You mend the incision on [M]'s [parse_zone(selected_zone)].</span>")
if(affecting)
affecting.open = 0
affecting.germ_level = 0
qdel(current_surgery)
else if(current_surgery.can_cancel)
to_chat(user, "<span class='warning'>You need to hold a cautery in inactive hand to stop [M]'s surgery!</span>")
else if(current_surgery.can_cancel)
var/cautery_chance = 0
var/obj/item/cautery_tool = null
if(isrobot(user))
if(istype(I, /obj/item/scalpel/laser))
cautery_chance = 100
cautery_tool = I
else
for(var/T in cautery_tools)
if(istype(user.get_inactive_hand(), T))
cautery_chance = cautery_tools[T]
cautery_tool = user.get_inactive_hand()
if(cautery_chance)
C.begin_step(user, H, selected_zone, target_zone, cautery_tool, current_surgery)
if(do_after(user, C.time * cautery_tool.toolspeed, target = M))
if(!isrobot(user))
cautery_chance *= get_location_modifier(target)
cautery_chance *= get_pain_modifier(target)
if(prob(cautery_chance))
C.end_step(user, H, selected_zone, target_zone, cautery_tool, current_surgery)
M.surgeries -= current_surgery
qdel(current_surgery)
else
C.fail_step(user, H, selected_zone, target_zone, cautery_tool, current_surgery)
else if(!isrobot(user))
to_chat(user, "<span class='notice'>You need to hold a cautery or equivalent in your inactive hand to stop the surgery in progress.</span>")
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) //stat=0 if CONSCIOUS, 1=UNCONSCIOUS and 2=DEAD. Operating on dead people is easy, too. Just sleeping won't work, though.
return 1
@@ -111,6 +141,18 @@
else
return 0.5
//check if mob is lying down on something we can operate him on.
/proc/can_operate(mob/living/carbon/M)
if(locate(/obj/machinery/optable, M.loc) && (M.lying || M.resting))
return TRUE
if(locate(/obj/structure/bed, M.loc) && (M.buckled || M.lying || M.weakened || M.stunned || M.paralysis || M.sleeping || M.stat))
return TRUE
if(locate(/obj/structure/table, M.loc) && (M.lying || M.weakened || M.stunned || M.paralysis || M.sleeping || M.stat))
return TRUE
if((istype(M.loc, /turf/simulated/floor) || istype(M.loc, /turf/unsimulated/floor)) && (M.lying || M.weakened || M.stunned || M.paralysis || M.sleeping || M.stat))
return TRUE
return FALSE
// Called when a limb containing this object is placed back on a body
/atom/movable/proc/attempt_become_organ(obj/item/organ/external/parent,mob/living/carbon/human/H)
return 0