diff --git a/code/modules/research/designs/medical_designs.dm b/code/modules/research/designs/medical_designs.dm
index 5cc1fcb3..9cdabf34 100644
--- a/code/modules/research/designs/medical_designs.dm
+++ b/code/modules/research/designs/medical_designs.dm
@@ -786,13 +786,49 @@
surgery = /datum/surgery/advanced/viral_bonding
research_icon_state = "surgery_chest"
-/datum/design/surgery/reconstruction
- name = "Reconstruction"
- desc = "A surgical procedure that gradually repairs damage done to a body without the assistance of chemicals. Unlike classic medicine, it is effective on corpses."
- id = "surgery_reconstruction"
- surgery = /datum/surgery/advanced/reconstruction
+/datum/design/surgery/healing
+ name = "Tend Wounds"
+ desc = "An upgraded version of the original surgery."
+ id = "surgery_healing_base" //holder because travis cries otherwise. Not used in techweb unlocks.
research_icon_state = "surgery_chest"
+/datum/design/surgery/healing/brute_upgrade
+ name = "Tend Wounds (Brute) Upgrade"
+ surgery = /datum/surgery/healing/brute/upgraded
+ id = "surgery_heal_brute_upgrade"
+
+/datum/design/surgery/healing/brute_upgrade_2
+ name = "Tend Wounds (Brute) Upgrade"
+ surgery = /datum/surgery/healing/brute/upgraded/femto
+ id = "surgery_heal_brute_upgrade_femto"
+
+/datum/design/surgery/healing/burn_upgrade
+ name = "Tend Wounds (Burn) Upgrade"
+ surgery = /datum/surgery/healing/burn/upgraded
+ id = "surgery_heal_burn_upgrade"
+
+/datum/design/surgery/healing/burn_upgrade_2
+ name = "Tend Wounds (Burn) Upgrade"
+ surgery = /datum/surgery/healing/brute/upgraded/femto
+ id = "surgery_heal_burn_upgrade_femto"
+
+/datum/design/surgery/healing/combo
+ name = "Tend Wounds (Mixture)"
+ desc = "A surgical procedure that repairs both bruises and burns. Repair efficiency is not as high as the individual surgeries but it is faster."
+ surgery = /datum/surgery/healing/combo
+ id = "surgery_heal_combo"
+
+/datum/design/surgery/healing/combo_upgrade
+ name = "Tend Wounds (Mixture) Upgrade"
+ surgery = /datum/surgery/healing/combo/upgraded
+ id = "surgery_heal_combo_upgrade"
+
+/datum/design/surgery/healing/combo_upgrade_2
+ name = "Tend Wounds (Mixture) Upgrade"
+ desc = "A surgical procedure that repairs both bruises and burns faster than their individual counterparts. It is more effective than both the individual surgeries."
+ surgery = /datum/surgery/healing/combo/upgraded/femto
+ id = "surgery_heal_combo_upgrade_femto"
+
/datum/design/surgery/surgery_toxinhealing
name = "Body Rejuvenation"
desc = "A surgical procedure that helps deal with oxygen deprecation, and treat toxic damaged. Works on corpses and alive alike without chemicals."
diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm
index 872a5368..87f1e4cb 100644
--- a/code/modules/research/techweb/all_nodes.dm
+++ b/code/modules/research/techweb/all_nodes.dm
@@ -130,12 +130,21 @@
export_price = 5000
/////////////////////////Advanced Surgery/////////////////////////
+/datum/techweb_node/imp_wt_surgery
+ id = "imp_wt_surgery"
+ display_name = "Improved Wound-Tending Surgery"
+ description = "Who would have known being more gentle with a hemostat decreases patient pain?"
+ prereq_ids = list("biotech")
+ design_ids = list("surgery_heal_brute_upgrade","surgery_heal_burn_upgrade")
+ research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 1000)
+ export_price = 1000
+
/datum/techweb_node/adv_surgery
id = "adv_surgery"
display_name = "Advanced Surgery"
description = "When simple medicine doesn't cut it."
- prereq_ids = list("adv_biotech")
- design_ids = list("surgery_lobotomy", "surgery_reconstruction", "surgery_toxinhealing", "organbox", "surgery_adv_dissection")
+ prereq_ids = list("imp_wt_surgery")
+ design_ids = list("surgery_revival", "surgery_lobotomy", "surgery_heal_brute_upgrade_femto","surgery_heal_burn_upgrade_femto", "surgery_heal_combo", "surgery_toxinhealing", "organbox", "surgery_adv_dissection")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000
@@ -144,7 +153,7 @@
display_name = "Experimental Surgery"
description = "When evolution isn't fast enough."
prereq_ids = list("adv_surgery")
- design_ids = list("surgery_revival","surgery_pacify","surgery_vein_thread","surgery_muscled_veins","surgery_nerve_splice","surgery_nerve_ground","surgery_ligament_hook","surgery_ligament_reinforcement","surgery_viral_bond", "surgery_exp_dissection")
+ design_ids = list("surgery_pacify","surgery_vein_thread","surgery_muscled_veins","surgery_nerve_splice","surgery_nerve_ground","surgery_ligament_hook","surgery_ligament_reinforcement","surgery_viral_bond", "surgery_exp_dissection", "surgery_heal_combo_upgrade")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 5000)
export_price = 5000
@@ -153,7 +162,7 @@
display_name = "Alien Surgery"
description = "Abductors did nothing wrong."
prereq_ids = list("exp_surgery", "alientech")
- design_ids = list("surgery_brainwashing","surgery_zombie", "surgery_ext_dissection")
+ design_ids = list("surgery_brainwashing","surgery_zombie", "surgery_ext_dissection", "surgery_heal_combo_upgrade_femto")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 10000)
export_price = 5000
diff --git a/code/modules/surgery/advanced/reconstruction.dm b/code/modules/surgery/advanced/reconstruction.dm
deleted file mode 100644
index b3c044a2..00000000
--- a/code/modules/surgery/advanced/reconstruction.dm
+++ /dev/null
@@ -1,37 +0,0 @@
-/datum/surgery/advanced/reconstruction
- name = "Reconstruction"
- desc = "A surgical procedure that gradually repairs damage done to a body without the assistance of chemicals. Unlike classic medicine, it is effective on corpses."
- steps = list(/datum/surgery_step/incise,
- /datum/surgery_step/incise,
- /datum/surgery_step/retract_skin,
- /datum/surgery_step/incise,
- /datum/surgery_step/clamp_bleeders,
- /datum/surgery_step/incise,
- /datum/surgery_step/retract_skin,
- /datum/surgery_step/reconstruct,
- /datum/surgery_step/close)
-
- target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
- possible_locs = list(BODY_ZONE_CHEST)
- requires_bodypart_type = 0
-
-/datum/surgery_step/reconstruct
- name = "repair body"
- implements = list(/obj/item/hemostat = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
- repeatable = TRUE
- time = 25
-
-/datum/surgery_step/reconstruct/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
- user.visible_message("[user] starts knitting some of [target]'s flesh back together.", "You start knitting some of [target]'s flesh back together.")
-
-/datum/surgery_step/reconstruct/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
- user.visible_message("[user] fixes some of [target]'s wounds.", "You succeed in fixing some of [target]'s wounds.")
- target.heal_bodypart_damage(10,10)
- if(target.getFireLoss() <= 20 && target.getBruteLoss() <= 20)
- target.cure_husk()
- return TRUE
-
-/datum/surgery_step/reconstruct/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
- user.visible_message("[user] screws up!", "You screwed up!")
- target.take_bodypart_damage(5,0)
- return FALSE
\ No newline at end of file
diff --git a/code/modules/surgery/healing.dm b/code/modules/surgery/healing.dm
new file mode 100644
index 00000000..d20d1d82
--- /dev/null
+++ b/code/modules/surgery/healing.dm
@@ -0,0 +1,215 @@
+/datum/surgery/healing
+ steps = list(/datum/surgery_step/incise,
+ /datum/surgery_step/retract_skin,
+ /datum/surgery_step/incise,
+ /datum/surgery_step/clamp_bleeders,
+ /datum/surgery_step/heal,
+ /datum/surgery_step/close)
+
+ target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
+ possible_locs = list(BODY_ZONE_CHEST)
+ requires_bodypart_type = FALSE
+ replaced_by = /datum/surgery
+ ignore_clothes = TRUE
+ var/healing_step_type
+ var/antispam = FALSE
+
+/datum/surgery/healing/New(surgery_target, surgery_location, surgery_bodypart)
+ ..()
+ if(healing_step_type)
+ steps = list(/datum/surgery_step/incise/nobleed,
+ healing_step_type, //hehe cheeky
+ /datum/surgery_step/close)
+
+/datum/surgery_step/heal
+ name = "repair body"
+ implements = list(TOOL_HEMOSTAT = 100, TOOL_SCREWDRIVER = 65, /obj/item/pen = 55)
+ repeatable = TRUE
+ time = 25
+ var/brutehealing = 0
+ var/burnhealing = 0
+ var/missinghpbonus = 0 //heals an extra point of damager per X missing damage of type (burn damage for burn healing, brute for brute). Smaller Number = More Healing!
+
+/datum/surgery_step/heal/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ var/woundtype
+ if(brutehealing && burnhealing)
+ woundtype = "wounds"
+ else if(brutehealing)
+ woundtype = "bruises"
+ else //why are you trying to 0,0...?
+ woundtype = "burns"
+ if(istype(surgery,/datum/surgery/healing))
+ var/datum/surgery/healing/the_surgery = surgery
+ if(!the_surgery.antispam)
+ display_results(user, target, "You attempt to patch some of [target]'s [woundtype].",
+ "[user] attempts to patch some of [target]'s [woundtype].",
+ "[user] attempts to patch some of [target]'s [woundtype].")
+
+/datum/surgery_step/heal/initiate(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, try_to_fail = FALSE)
+ if(..())
+ while((brutehealing && target.getBruteLoss()) || (burnhealing && target.getFireLoss()))
+ if(!..())
+ break
+
+/datum/surgery_step/heal/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ var/umsg = "You succeed in fixing some of [target]'s wounds" //no period, add initial space to "addons"
+ var/tmsg = "[user] fixes some of [target]'s wounds" //see above
+ var/urhealedamt_brute = brutehealing
+ var/urhealedamt_burn = burnhealing
+ if(missinghpbonus)
+ if(target.stat != DEAD)
+ urhealedamt_brute += round((target.getBruteLoss()/ missinghpbonus),0.1)
+ urhealedamt_burn += round((target.getFireLoss()/ missinghpbonus),0.1)
+ else //less healing bonus for the dead since they're expected to have lots of damage to begin with (to make TW into defib not TOO simple)
+ urhealedamt_brute += round((target.getBruteLoss()/ (missinghpbonus*5)),0.1)
+ urhealedamt_burn += round((target.getFireLoss()/ (missinghpbonus*5)),0.1)
+ if(!get_location_accessible(target, target_zone))
+ urhealedamt_brute *= 0.55
+ urhealedamt_burn *= 0.55
+ umsg += " as best as you can while they have clothing on"
+ tmsg += " as best as they can while [target] has clothing on"
+ target.heal_bodypart_damage(urhealedamt_brute,urhealedamt_burn)
+ display_results(user, target, "[umsg].",
+ "[tmsg].",
+ "[tmsg].")
+ if(istype(surgery, /datum/surgery/healing))
+ var/datum/surgery/healing/the_surgery = surgery
+ the_surgery.antispam = TRUE
+ return TRUE
+
+/datum/surgery_step/heal/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ display_results(user, target, "You screwed up!",
+ "[user] screws up!",
+ "[user] fixes some of [target]'s wounds.", TRUE)
+ var/urdamageamt_burn = brutehealing * 0.8
+ var/urdamageamt_brute = burnhealing * 0.8
+ if(missinghpbonus)
+ urdamageamt_brute += round((target.getBruteLoss()/ (missinghpbonus*2)),0.1)
+ urdamageamt_burn += round((target.getFireLoss()/ (missinghpbonus*2)),0.1)
+
+ target.take_bodypart_damage(urdamageamt_brute, urdamageamt_burn)
+ return FALSE
+
+/***************************BRUTE***************************/
+/datum/surgery/healing/brute
+ name = "Tend Wounds (Bruises)"
+
+/datum/surgery/healing/brute/basic
+ name = "Tend Wounds (Bruises, Basic)"
+ replaced_by = /datum/surgery/healing/brute/upgraded
+ healing_step_type = /datum/surgery_step/heal/brute/basic
+ desc = "A surgical procedure that provides basic treatment for a patient's brute traumas. Heals slightly more when the patient is severely injured."
+
+/datum/surgery/healing/brute/upgraded
+ name = "Tend Wounds (Bruises, Adv.)"
+ replaced_by = /datum/surgery/healing/brute/upgraded/femto
+ requires_tech = TRUE
+ healing_step_type = /datum/surgery_step/heal/brute/upgraded
+ desc = "A surgical procedure that provides advanced treatment for a patient's brute traumas. Heals more when the patient is severely injured."
+
+/datum/surgery/healing/brute/upgraded/femto
+ name = "Tend Wounds (Bruises, Exp.)"
+ replaced_by = /datum/surgery/healing/combo/upgraded/femto
+ requires_tech = TRUE
+ healing_step_type = /datum/surgery_step/heal/brute/upgraded/femto
+ desc = "A surgical procedure that provides experimental treatment for a patient's brute traumas. Heals considerably more when the patient is severely injured."
+
+/********************BRUTE STEPS********************/
+/datum/surgery_step/heal/brute/basic
+ name = "tend bruises"
+ brutehealing = 5
+ missinghpbonus = 15
+
+/datum/surgery_step/heal/brute/upgraded
+ brutehealing = 5
+ missinghpbonus = 10
+
+/datum/surgery_step/heal/brute/upgraded/femto
+ brutehealing = 5
+ missinghpbonus = 5
+
+/***************************BURN***************************/
+/datum/surgery/healing/burn
+ name = "Tend Wounds (Burn)"
+
+/datum/surgery/healing/burn/basic
+ name = "Tend Wounds (Burn, Basic)"
+ replaced_by = /datum/surgery/healing/burn/upgraded
+ healing_step_type = /datum/surgery_step/heal/burn/basic
+ desc = "A surgical procedure that provides basic treatment for a patient's burns. Heals slightly more when the patient is severely injured."
+
+/datum/surgery/healing/burn/upgraded
+ name = "Tend Wounds (Burn, Adv.)"
+ replaced_by = /datum/surgery/healing/burn/upgraded/femto
+ requires_tech = TRUE
+ healing_step_type = /datum/surgery_step/heal/burn/upgraded
+ desc = "A surgical procedure that provides advanced treatment for a patient's burns. Heals more when the patient is severely injured."
+
+/datum/surgery/healing/burn/upgraded/femto
+ name = "Tend Wounds (Burn, Exp.)"
+ replaced_by = /datum/surgery/healing/combo/upgraded/femto
+ requires_tech = TRUE
+ healing_step_type = /datum/surgery_step/heal/burn/upgraded/femto
+ desc = "A surgical procedure that provides experimental treatment for a patient's burns. Heals considerably more when the patient is severely injured."
+
+/********************BURN STEPS********************/
+/datum/surgery_step/heal/burn/basic
+ name = "tend burn wounds"
+ burnhealing = 5
+ missinghpbonus = 15
+
+/datum/surgery_step/heal/burn/upgraded
+ burnhealing = 5
+ missinghpbonus = 10
+
+/datum/surgery_step/heal/burn/upgraded/femto
+ burnhealing = 5
+ missinghpbonus = 5
+
+/***************************COMBO***************************/
+/datum/surgery/healing/combo
+
+
+/datum/surgery/healing/combo
+ name = "Tend Wounds (Mixture, Basic)"
+ replaced_by = /datum/surgery/healing/combo/upgraded
+ requires_tech = TRUE
+ healing_step_type = /datum/surgery_step/heal/combo
+ desc = "A surgical procedure that provides basic treatment for a patient's burns and brute traumas. Heals slightly more when the patient is severely injured."
+
+/datum/surgery/healing/combo/upgraded
+ name = "Tend Wounds (Mixture, Adv.)"
+ replaced_by = /datum/surgery/healing/combo/upgraded/femto
+ healing_step_type = /datum/surgery_step/heal/combo/upgraded
+ desc = "A surgical procedure that provides advanced treatment for a patient's burns and brute traumas. Heals more when the patient is severely injured."
+
+
+/datum/surgery/healing/combo/upgraded/femto //no real reason to type it like this except consistency, don't worry you're not missing anything
+ name = "Tend Wounds (Mixture, Exp.)"
+ replaced_by = null
+ healing_step_type = /datum/surgery_step/heal/combo/upgraded/femto
+ desc = "A surgical procedure that provides experimental treatment for a patient's burns and brute traumas. Heals considerably more when the patient is severely injured."
+
+/********************COMBO STEPS********************/
+/datum/surgery_step/heal/combo
+ name = "tend physical wounds"
+ brutehealing = 3
+ burnhealing = 3
+ missinghpbonus = 15
+ time = 10
+
+/datum/surgery_step/heal/combo/upgraded
+ brutehealing = 3
+ burnhealing = 3
+ missinghpbonus = 10
+
+/datum/surgery_step/heal/combo/upgraded/femto
+ brutehealing = 1
+ burnhealing = 1
+ missinghpbonus = 2.5
+
+/datum/surgery_step/heal/combo/upgraded/femto/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ display_results(user, target, "You screwed up!",
+ "[user] screws up!",
+ "[user] fixes some of [target]'s wounds.", TRUE)
+ target.take_bodypart_damage(5,5)
\ No newline at end of file
diff --git a/code/modules/surgery/organic_steps.dm b/code/modules/surgery/organic_steps.dm
index da03771a..0a80be6c 100644
--- a/code/modules/surgery/organic_steps.dm
+++ b/code/modules/surgery/organic_steps.dm
@@ -24,6 +24,16 @@
H.bleed_rate += 3
return TRUE
+/datum/surgery_step/incise/nobleed //silly friendly!
+
+/datum/surgery_step/incise/nobleed/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ display_results(user, target, "You begin to carefully make an incision in [target]'s [parse_zone(target_zone)]...",
+ "[user] begins to carefully make an incision in [target]'s [parse_zone(target_zone)].",
+ "[user] begins to carefully make an incision in [target]'s [parse_zone(target_zone)].")
+
+/datum/surgery_step/incise/nobleed/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ return TRUE
+
//clamp bleeders
/datum/surgery_step/clamp_bleeders
name = "clamp bleeders"
diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm
index 4a780c42..eb424d49 100644
--- a/code/modules/surgery/surgery.dm
+++ b/code/modules/surgery/surgery.dm
@@ -1,174 +1,174 @@
-/datum/surgery
- var/name = "surgery"
- var/desc = "surgery description"
- var/status = 1
- var/list/steps = list() //Steps in a surgery
- var/step_in_progress = 0 //Actively performing a Surgery
- var/can_cancel = 1 //Can cancel this surgery after step 1 with cautery
- var/list/target_mobtypes = list(/mob/living/carbon/human) //Acceptable Species
- var/location = BODY_ZONE_CHEST //Surgery location
- var/requires_bodypart_type = BODYPART_ORGANIC //Prevents you from performing an operation on incorrect limbs. 0 for any limb type
- var/list/possible_locs = list() //Multiple locations
- var/ignore_clothes = 0 //This surgery ignores clothes
- var/mob/living/carbon/target //Operation target mob
- var/obj/item/bodypart/operated_bodypart //Operable body part
- var/requires_bodypart = TRUE //Surgery available only when a bodypart is present, or only when it is missing.
- var/success_multiplier = 0 //Step success propability multiplier
- var/requires_real_bodypart = 0 //Some surgeries don't work on limbs that don't really exist
- var/lying_required = TRUE //Does the vicitm needs to be lying down.
- var/requires_tech = FALSE
- var/replaced_by
-
-/datum/surgery/New(surgery_target, surgery_location, surgery_bodypart)
- ..()
- if(surgery_target)
- target = surgery_target
- target.surgeries += src
- if(surgery_location)
- location = surgery_location
- if(surgery_bodypart)
- operated_bodypart = surgery_bodypart
-
-/datum/surgery/Destroy()
- if(target)
- target.surgeries -= src
- target = null
- operated_bodypart = null
- return ..()
-
-
-/datum/surgery/proc/can_start(mob/user, mob/living/patient) //FALSE to not show in list
- . = TRUE
- if(replaced_by == /datum/surgery)
- return FALSE
-
- if(HAS_TRAIT(user, TRAIT_SURGEON))
- if(replaced_by)
- return FALSE
- else
- return TRUE
-
- if(!requires_tech && !replaced_by)
- return TRUE
- // True surgeons (like abductor scientists) need no instructions
-
- if(requires_tech)
- . = FALSE
-
- if(iscyborg(user))
- var/mob/living/silicon/robot/R = user
- var/obj/item/surgical_processor/SP = locate() in R.module.modules
- if(SP)
- if (replaced_by in SP.advanced_surgeries)
- return FALSE
- if(type in SP.advanced_surgeries)
- return TRUE
-
-
- var/turf/T = get_turf(patient)
- var/obj/structure/table/optable/table = locate(/obj/structure/table/optable, T)
- if(table)
- if(!table.computer)
- return FALSE
- if(table.computer.stat & (NOPOWER|BROKEN))
- return .
- if(replaced_by in table.computer.advanced_surgeries)
- return FALSE
- if(type in table.computer.advanced_surgeries)
- return TRUE
-
-/datum/surgery/proc/next_step(mob/user, intent)
- if(step_in_progress)
- return 1
-
- var/try_to_fail = FALSE
- if(intent == INTENT_DISARM)
- try_to_fail = TRUE
-
- var/datum/surgery_step/S = get_surgery_step()
- if(S)
- var/obj/item/tool = user.get_active_held_item()
- if(S.try_op(user, target, user.zone_selected, tool, src, try_to_fail))
- return TRUE
- if(iscyborg(user) && user.a_intent != INTENT_HARM) //to save asimov borgs a LOT of heartache
- return TRUE
- if(tool.item_flags & SURGICAL_TOOL) //Just because you used the wrong tool it doesn't mean you meant to whack the patient with it
- to_chat(user, "This step requires a different tool!")
- return TRUE
-
-/datum/surgery/proc/get_surgery_step()
- var/step_type = steps[status]
- return new step_type
-
-/datum/surgery/proc/get_surgery_next_step()
- if(status < steps.len)
- var/step_type = steps[status + 1]
- return new step_type
- else
- return null
-
-/datum/surgery/proc/complete()
- SSblackbox.record_feedback("tally", "surgeries_completed", 1, type)
- qdel(src)
-
-/datum/surgery/proc/get_propability_multiplier()
- var/propability = 0.5
- var/turf/T = get_turf(target)
-
- if(locate(/obj/structure/table/optable, T))
- propability = 1
- else if(locate(/obj/structure/table, T))
- propability = 0.8
- else if(locate(/obj/machinery/stasis, T))
- propability = 0.9
- else if(locate(/obj/structure/bed, T))
- propability = 0.7
-
- return propability + success_multiplier
-
-/datum/surgery/advanced
- name = "advanced surgery"
- requires_tech = TRUE
-
-/obj/item/disk/surgery
- name = "Surgery Procedure Disk"
- desc = "A disk that contains advanced surgery procedures, must be loaded into an Operating Console."
- icon_state = "datadisk1"
- materials = list(MAT_METAL=300, MAT_GLASS=100)
- var/list/surgeries
-
-/obj/item/disk/surgery/debug
- name = "Debug Surgery Disk"
- desc = "A disk that contains all existing surgery procedures."
- icon_state = "datadisk1"
- materials = list(MAT_METAL=300, MAT_GLASS=100)
-
-/obj/item/disk/surgery/debug/Initialize()
- . = ..()
- surgeries = list()
- var/list/req_tech_surgeries = subtypesof(/datum/surgery)
- for(var/i in req_tech_surgeries)
- var/datum/surgery/beep = i
- if(initial(beep.requires_tech))
- surgeries += beep
-
-//INFO
-//Check /mob/living/carbon/attackby for how surgery progresses, and also /mob/living/carbon/attack_hand.
-//As of Feb 21 2013 they are in code/modules/mob/living/carbon/carbon.dm, lines 459 and 51 respectively.
-//Other important variables are var/list/surgeries (/mob/living) and var/list/internal_organs (/mob/living/carbon)
-// var/list/bodyparts (/mob/living/carbon/human) is the LIMBS of a Mob.
-//Surgical procedures are initiated by attempt_initiate_surgery(), which is called by surgical drapes and bedsheets.
-
-
-//TODO
-//specific steps for some surgeries (fluff text)
-//more interesting failure options
-//randomised complications
-//more surgeries!
-//add a probability modifier for the state of the surgeon- health, twitching, etc. blindness, god forbid.
-//helper for converting a zone_sel.selecting to body part (for damage)
-
-
-//RESOLVED ISSUES //"Todo" jobs that have been completed
-//combine hands/feet into the arms - Hands/feet were removed - RR
+/datum/surgery
+ var/name = "surgery"
+ var/desc = "surgery description"
+ var/status = 1
+ var/list/steps = list() //Steps in a surgery
+ var/step_in_progress = 0 //Actively performing a Surgery
+ var/can_cancel = 1 //Can cancel this surgery after step 1 with cautery
+ var/list/target_mobtypes = list(/mob/living/carbon/human) //Acceptable Species
+ var/location = BODY_ZONE_CHEST //Surgery location
+ var/requires_bodypart_type = BODYPART_ORGANIC //Prevents you from performing an operation on incorrect limbs. 0 for any limb type
+ var/list/possible_locs = list() //Multiple locations
+ var/ignore_clothes = 0 //This surgery ignores clothes
+ var/mob/living/carbon/target //Operation target mob
+ var/obj/item/bodypart/operated_bodypart //Operable body part
+ var/requires_bodypart = TRUE //Surgery available only when a bodypart is present, or only when it is missing.
+ var/success_multiplier = 0 //Step success propability multiplier
+ var/requires_real_bodypart = 0 //Some surgeries don't work on limbs that don't really exist
+ var/lying_required = TRUE //Does the vicitm needs to be lying down.
+ var/requires_tech = FALSE
+ var/replaced_by
+
+/datum/surgery/New(surgery_target, surgery_location, surgery_bodypart)
+ ..()
+ if(surgery_target)
+ target = surgery_target
+ target.surgeries += src
+ if(surgery_location)
+ location = surgery_location
+ if(surgery_bodypart)
+ operated_bodypart = surgery_bodypart
+
+/datum/surgery/Destroy()
+ if(target)
+ target.surgeries -= src
+ target = null
+ operated_bodypart = null
+ return ..()
+
+
+/datum/surgery/proc/can_start(mob/user, mob/living/patient) //FALSE to not show in list
+ . = TRUE
+ if(replaced_by == /datum/surgery)
+ return FALSE
+
+ if(HAS_TRAIT(user, TRAIT_SURGEON))
+ if(replaced_by)
+ return FALSE
+ else
+ return TRUE
+
+ if(!requires_tech && !replaced_by)
+ return TRUE
+ // True surgeons (like abductor scientists) need no instructions
+
+ if(requires_tech)
+ . = FALSE
+
+ if(iscyborg(user))
+ var/mob/living/silicon/robot/R = user
+ var/obj/item/surgical_processor/SP = locate() in R.module.modules
+ if(SP)
+ if (replaced_by in SP.advanced_surgeries)
+ return .
+ if(type in SP.advanced_surgeries)
+ return TRUE
+
+
+ var/turf/T = get_turf(patient)
+ var/obj/structure/table/optable/table = locate(/obj/structure/table/optable, T)
+ if(table)
+ if(!table.computer)
+ return .
+ if(table.computer.stat & (NOPOWER|BROKEN))
+ return .
+ if(replaced_by in table.computer.advanced_surgeries)
+ return FALSE
+ if(type in table.computer.advanced_surgeries)
+ return TRUE
+
+/datum/surgery/proc/next_step(mob/user, intent)
+ if(step_in_progress)
+ return 1
+
+ var/try_to_fail = FALSE
+ if(intent == INTENT_DISARM)
+ try_to_fail = TRUE
+
+ var/datum/surgery_step/S = get_surgery_step()
+ if(S)
+ var/obj/item/tool = user.get_active_held_item()
+ if(S.try_op(user, target, user.zone_selected, tool, src, try_to_fail))
+ return TRUE
+ if(iscyborg(user) && user.a_intent != INTENT_HARM) //to save asimov borgs a LOT of heartache
+ return TRUE
+ if(tool.item_flags & SURGICAL_TOOL) //Just because you used the wrong tool it doesn't mean you meant to whack the patient with it
+ to_chat(user, "This step requires a different tool!")
+ return TRUE
+
+/datum/surgery/proc/get_surgery_step()
+ var/step_type = steps[status]
+ return new step_type
+
+/datum/surgery/proc/get_surgery_next_step()
+ if(status < steps.len)
+ var/step_type = steps[status + 1]
+ return new step_type
+ else
+ return null
+
+/datum/surgery/proc/complete()
+ SSblackbox.record_feedback("tally", "surgeries_completed", 1, type)
+ qdel(src)
+
+/datum/surgery/proc/get_propability_multiplier()
+ var/propability = 0.5
+ var/turf/T = get_turf(target)
+
+ if(locate(/obj/structure/table/optable, T))
+ propability = 1
+ else if(locate(/obj/structure/table, T))
+ propability = 0.8
+ else if(locate(/obj/machinery/stasis, T))
+ propability = 0.9
+ else if(locate(/obj/structure/bed, T))
+ propability = 0.7
+
+ return propability + success_multiplier
+
+/datum/surgery/advanced
+ name = "advanced surgery"
+ requires_tech = TRUE
+
+/obj/item/disk/surgery
+ name = "Surgery Procedure Disk"
+ desc = "A disk that contains advanced surgery procedures, must be loaded into an Operating Console."
+ icon_state = "datadisk1"
+ materials = list(MAT_METAL=300, MAT_GLASS=100)
+ var/list/surgeries
+
+/obj/item/disk/surgery/debug
+ name = "Debug Surgery Disk"
+ desc = "A disk that contains all existing surgery procedures."
+ icon_state = "datadisk1"
+ materials = list(MAT_METAL=300, MAT_GLASS=100)
+
+/obj/item/disk/surgery/debug/Initialize()
+ . = ..()
+ surgeries = list()
+ var/list/req_tech_surgeries = subtypesof(/datum/surgery)
+ for(var/i in req_tech_surgeries)
+ var/datum/surgery/beep = i
+ if(initial(beep.requires_tech))
+ surgeries += beep
+
+//INFO
+//Check /mob/living/carbon/attackby for how surgery progresses, and also /mob/living/carbon/attack_hand.
+//As of Feb 21 2013 they are in code/modules/mob/living/carbon/carbon.dm, lines 459 and 51 respectively.
+//Other important variables are var/list/surgeries (/mob/living) and var/list/internal_organs (/mob/living/carbon)
+// var/list/bodyparts (/mob/living/carbon/human) is the LIMBS of a Mob.
+//Surgical procedures are initiated by attempt_initiate_surgery(), which is called by surgical drapes and bedsheets.
+
+
+//TODO
+//specific steps for some surgeries (fluff text)
+//more interesting failure options
+//randomised complications
+//more surgeries!
+//add a probability modifier for the state of the surgeon- health, twitching, etc. blindness, god forbid.
+//helper for converting a zone_sel.selecting to body part (for damage)
+
+
+//RESOLVED ISSUES //"Todo" jobs that have been completed
+//combine hands/feet into the arms - Hands/feet were removed - RR
//surgeries (not steps) that can be initiated on any body part (corresponding with damage locations) - Call this one done, see possible_locs var - c0
\ No newline at end of file
diff --git a/tgstation.dme b/tgstation.dme
index 7af2ce0b..f25fac9a 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -2876,6 +2876,7 @@
#include "code\modules\surgery\experimental_dissection.dm"
#include "code\modules\surgery\eye_surgery.dm"
#include "code\modules\surgery\graft_synthtissue.dm"
+#include "code\modules\surgery\healing.dm"
#include "code\modules\surgery\helpers.dm"
#include "code\modules\surgery\implant_removal.dm"
#include "code\modules\surgery\limb_augmentation.dm"
@@ -2896,7 +2897,6 @@
#include "code\modules\surgery\advanced\lobotomy.dm"
#include "code\modules\surgery\advanced\necrotic_revival.dm"
#include "code\modules\surgery\advanced\pacification.dm"
-#include "code\modules\surgery\advanced\reconstruction.dm"
#include "code\modules\surgery\advanced\revival.dm"
#include "code\modules\surgery\advanced\toxichealing.dm"
#include "code\modules\surgery\advanced\viral_bonding.dm"