diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm
index 500553e1f28..8e8f2ca2485 100644
--- a/code/__HELPERS/global_lists.dm
+++ b/code/__HELPERS/global_lists.dm
@@ -15,8 +15,10 @@
//socks
init_sprite_accessory_subtypes(/datum/sprite_accessory/socks, socks_list, socks_m, socks_f)
- init_subtypes(/datum/surgery_step, surgery_steps)
- sort_surgeries()
+ //init_subtypes(/datum/surgery_step, surgery_steps)
+
+ for(var/path in (subtypesof(/datum/surgery)))
+ surgeries_list += new path()
init_datum_subtypes(/datum/job, joblist, list(/datum/job/ai, /datum/job/cyborg), "title")
init_datum_subtypes(/datum/superheroes, all_superheroes, null, "name")
diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm
index 8cca8a70898..67e27c9697b 100644
--- a/code/_globalvars/lists/objects.dm
+++ b/code/_globalvars/lists/objects.dm
@@ -26,4 +26,6 @@ var/global/list/power_monitors = list()
var/global/list/tracking_implants = list() //list of all tracking implants to work out what treks everyone are on. Sadly not on lavaworld not implemented...
var/global/list/beacons = list()
-var/global/list/shuttle_caller_list = list() //list of all communication consoles and AIs, for automatic shuttle calls when there are none.
\ No newline at end of file
+var/global/list/shuttle_caller_list = list() //list of all communication consoles and AIs, for automatic shuttle calls when there are none.
+
+var/global/list/surgeries_list = list() //list of all surgeries by name, associated with their path.
\ No newline at end of file
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index 17ba0c69436..11edd047df3 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -247,7 +247,7 @@ REAGENT SCANNER
user.show_message("\blue Subject's pulse: [H.get_pulse(GETPULSE_TOOL)] bpm.")
var/implant_detect
for(var/obj/item/organ/internal/cyberimp/CI in H.internal_organs)
- if(CI.status == ORGAN_ROBOT && !(H.species && H.species.name == "Machine"))
+ if(CI.status == ORGAN_ROBOT )
implant_detect += "[H.name] is modified with a [CI.name].
"
if(implant_detect)
user.show_message("Detected cybernetic modifications:")
diff --git a/code/modules/mob/living/carbon/carbon_defenses.dm b/code/modules/mob/living/carbon/carbon_defenses.dm
index ab1c27ca2ee..45c15d35f8a 100644
--- a/code/modules/mob/living/carbon/carbon_defenses.dm
+++ b/code/modules/mob/living/carbon/carbon_defenses.dm
@@ -19,4 +19,14 @@
/mob/living/carbon/water_act(volume, temperature, source)
if(volume > 10) //anything over 10 volume will make the mob wetter.
wetlevel = min(wetlevel + 1,5)
+ ..()
+
+
+/mob/living/carbon/attackby(obj/item/I, mob/user, params)
+ if(lying)
+ if(surgeries.len)
+ if(user != src && user.a_intent == "help")
+ for(var/datum/surgery/S in surgeries)
+ if(S.next_step(user, src))
+ return 1
..()
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm
index 5c1458a73e1..43e782eecfa 100644
--- a/code/modules/mob/living/carbon/carbon_defines.dm
+++ b/code/modules/mob/living/carbon/carbon_defines.dm
@@ -20,7 +20,8 @@
var/obj/item/clothing/suit/wear_suit = null //TODO: necessary? Are they even used? ~Carn
//Surgery info
- var/datum/surgery_status/op_stage = new/datum/surgery_status
+ //var/datum/surgery_status/op_stage = new/datum/surgery_status
+
//Active emote/pose
var/pose = null
diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm
index cb16f0eec19..38cdbe5bac3 100644
--- a/code/modules/mob/living/carbon/human/examine.dm
+++ b/code/modules/mob/living/carbon/human/examine.dm
@@ -257,7 +257,7 @@
msg += "[t_He] [t_has] suddenly fallen asleep.\n"
if(!src.get_int_organ(/obj/item/organ/internal/brain))
- msg += "It appears that thier brain is missing...\n"
+ msg += "It appears that their brain is missing...\n"
var/list/wound_flavor_text = list()
var/list/is_destroyed = list()
diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm
index 5a01fa7ffca..e79d35e00f8 100644
--- a/code/modules/mob/living/carbon/human/species/species.dm
+++ b/code/modules/mob/living/carbon/human/species/species.dm
@@ -133,6 +133,9 @@
/datum/species/proc/create_organs(var/mob/living/carbon/human/H) //Handles creation of mob organs.
+ if(!ticker) return //FUCKING MONKIES!
+
+
for(var/obj/item/organ/organ in H.contents)
if((organ in H.organs))
qdel(organ)
@@ -157,7 +160,7 @@
for(var/index in has_organ)
var/organ = has_organ[index]
- H.internal_organs += new organ(null)
+ H.internal_organs += new organ(H)
for(var/obj/item/organ/internal/I in H.internal_organs)
I.insert(H)
diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm
index 104eb6048c0..0cfa3657d47 100644
--- a/code/modules/mob/living/living_defines.dm
+++ b/code/modules/mob/living/living_defines.dm
@@ -51,4 +51,6 @@
var/last_played_vent
var/list/datum/action/actions = list()
- var/step_count = 0
\ No newline at end of file
+ var/step_count = 0
+
+ var/list/surgeries = list() //a list of surgery datums. generally empty, they're added when the player wants them.
\ No newline at end of file
diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm
index b3bce76f8b3..ab26322d958 100644
--- a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm
@@ -296,7 +296,7 @@
var/mob/living/carbon/human/H = owner
var/datum/reagent/blood/B = locate() in H.vessel.reagent_list //Grab some blood
var/blood_volume = round(H.vessel.get_reagent_amount("blood"))
- if(B && blood_volume < 560 && blood_volume)
+ if(B && blood_volume < H.max_blood && blood_volume)
B.volume += 2 // Fast blood regen
/obj/item/organ/internal/hivelord_core/attack(mob/living/M as mob, mob/living/user as mob)
diff --git a/code/modules/surgery/bones.dm b/code/modules/surgery/bones.dm
index 9bfb67034ab..8eb9f9e0b72 100644
--- a/code/modules/surgery/bones.dm
+++ b/code/modules/surgery/bones.dm
@@ -3,6 +3,18 @@
// BONE SURGERY //
//////////////////////////////////////////////////////////////////
+/datum/surgery/bone_repair
+ name = "bone repair"
+ steps = list(/datum/surgery_step/generic/cut_open, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/glue_bone, /datum/surgery_step/set_bone,/datum/surgery_step/finish_bone,/datum/surgery_step/generic/cauterize)
+ possible_locs = list("chest","l_arm", "l_hand","r_arm","r_hand","r_leg","r_foot","l_leg","l_foot","groin")
+
+
+/datum/surgery/bone_repair/skull
+ name = "bone repair"
+ steps = list(/datum/surgery_step/generic/cut_open, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/glue_bone, /datum/surgery_step/mend_skull,/datum/surgery_step/finish_bone,/datum/surgery_step/generic/cauterize)
+ possible_locs = list("head")
+
+
/datum/surgery_step/glue_bone
allowed_tools = list(
/obj/item/weapon/bonegel = 100, \
diff --git a/code/modules/surgery/encased.dm b/code/modules/surgery/encased.dm
index 1e59a3ea458..6bf7d56de19 100644
--- a/code/modules/surgery/encased.dm
+++ b/code/modules/surgery/encased.dm
@@ -6,7 +6,7 @@
priority = 2
can_infect = 1
blood_level = 1
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return 0
@@ -25,13 +25,13 @@
min_duration = 50
max_duration = 70
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return ..() && affected && affected.open == 2
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -42,7 +42,7 @@
target.custom_pain("Something hurts horribly in your [affected.name]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -52,7 +52,7 @@
"\blue You have cut [target]'s [affected.encased] open with \the [tool].")
affected.open = 2.5
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -74,13 +74,13 @@
min_duration = 30
max_duration = 40
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return ..() && affected && affected.open == 2.5
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -92,7 +92,7 @@
target.custom_pain("Something hurts horribly in your [affected.name]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -108,7 +108,7 @@
if(prob(10))
affected.fracture()
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -130,14 +130,14 @@
min_duration = 20
max_duration = 40
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return ..() && affected && affected.open == 3
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -149,7 +149,7 @@
target.custom_pain("Something hurts horribly in your [affected.name]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -161,7 +161,7 @@
affected.open = 2.5
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -187,14 +187,14 @@
min_duration = 20
max_duration = 40
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return ..() && affected && affected.open == 2.5
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -206,7 +206,7 @@
target.custom_pain("Something hurts horribly in your [affected.name]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
diff --git a/code/modules/surgery/face.dm b/code/modules/surgery/face.dm
index 9513bbe8f07..57c4dc29011 100644
--- a/code/modules/surgery/face.dm
+++ b/code/modules/surgery/face.dm
@@ -2,11 +2,15 @@
//////////////////////////////////////////////////////////////////
// FACE SURGERY //
//////////////////////////////////////////////////////////////////
+/datum/surgery/plastic_surgery
+ name = "plastic surgery"
+ steps = list(/datum/surgery_step/generic/cut_face, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/face/mend_vocal, /datum/surgery_step/face/fix_face,/datum/surgery_step/face/cauterize)
+ possible_locs = list("head")
/datum/surgery_step/face
priority = 2
can_infect = 0
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return 0
var/obj/item/organ/external/affected = target.get_organ(target_zone)
@@ -24,20 +28,20 @@
min_duration = 90
max_duration = 110
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- return ..() && target_zone == "mouth" && target.op_stage.face == 0
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ return ..() //&& target_zone == "mouth" && target.op_stage.face == 0//I NEED TO REPLACE THE OPSTAGE SHIT!
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("[user] starts to cut open [target]'s face and neck with \the [tool].", \
"You start to cut open [target]'s face and neck with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\blue [user] has cut open [target]'s face and neck with \the [tool]." , \
"\blue You have cut open [target]'s face and neck with \the [tool].",)
- target.op_stage.face = 1
+ //target.op_stage.face = 1//DID I MENTION I NEED TO REPLACE THE OPSTAGE SHIT!
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, slicing [target]'s throat wth \the [tool]!" , \
"\red Your hand slips, slicing [target]'s throat wth \the [tool]!" )
@@ -54,20 +58,20 @@
min_duration = 70
max_duration = 90
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- return ..() && target.op_stage.face == 1
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ return ..()// && target.op_stage.face == 1 //NO REALLY NED TO REPLACE, MAYBE WITH FUCKING istype(S.get_surgery_step(), /datum/surgery_step/cut_face)) OR SOMETHING
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("[user] starts mending [target]'s vocal cords with \the [tool].", \
"You start mending [target]'s vocal cords with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\blue [user] mends [target]'s vocal cords with \the [tool].", \
"\blue You mend [target]'s vocal cords with \the [tool].")
- target.op_stage.face = 2
+ //target.op_stage.face = 2//I NEED TO REPLACE THE OPSTAGE SHIT!
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\red [user]'s hand slips, clamping [target]'s trachea shut for a moment with \the [tool]!", \
"\red Your hand slips, clamping [user]'s trachea shut for a moment with \the [tool]!")
target.losebreath += 4
@@ -81,20 +85,20 @@
min_duration = 80
max_duration = 100
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- return ..() && target.op_stage.face == 2
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ return ..() //&& target.op_stage.face == 2//I NEED TO REPLACE THE OPSTAGE SHIT!
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("[user] starts pulling skin on [target]'s face back in place with \the [tool].", \
"You start pulling skin on [target]'s face back in place with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\blue [user] pulls skin on [target]'s face back in place with \the [tool].", \
"\blue You pull skin on [target]'s face back in place with \the [tool].")
- target.op_stage.face = 3
+ //target.op_stage.face = 3//I NEED TO REPLACE THE OPSTAGE SHIT!
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, tearing skin on [target]'s face with \the [tool]!", \
"\red Your hand slips, tearing skin on [target]'s face with \the [tool]!")
@@ -111,28 +115,28 @@
min_duration = 70
max_duration = 100
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- return ..() && target.op_stage.face > 0
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ return ..()// && target.op_stage.face > 0//I NEED TO REPLACE THE OPSTAGE SHIT!
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("[user] is beginning to cauterize the incision on [target]'s face and neck with \the [tool]." , \
"You are beginning to cauterize the incision on [target]'s face and neck with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] cauterizes the incision on [target]'s face and neck with \the [tool].", \
"\blue You cauterize the incision on [target]'s face and neck with \the [tool].")
affected.open = 0
affected.status &= ~ORGAN_BLEEDING
- if (target.op_stage.face == 3)
- var/obj/item/organ/external/head/h = affected
- h.disfigured = 0
- h.update_icon()
- target.regenerate_icons()
- target.op_stage.face = 0
+ //if (target.op_stage.face == 3)//I NEED TO REPLACE THE OPSTAGE SHIT!
+ var/obj/item/organ/external/head/h = affected
+ h.disfigured = 0
+ h.update_icon()
+ target.regenerate_icons()
+ //target.op_stage.face = 0//I NEED TO REPLACE THE OPSTAGE SHIT!
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, leaving a small burn on [target]'s face with \the [tool]!", \
"\red Your hand slips, leaving a small burn on [target]'s face with \the [tool]!")
diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm
index 611963ed915..6deab483af8 100644
--- a/code/modules/surgery/generic.dm
+++ b/code/modules/surgery/generic.dm
@@ -5,19 +5,20 @@
/datum/surgery_step/generic/
can_infect = 1
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if (target_zone == "eyes") //there are specific steps for eye surgery
- return 0
- if (!hasorgans(target))
- return 0
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- if (affected == null)
- return 0
- if (affected.status & ORGAN_DESTROYED)
- return 0
- if (affected.status & ORGAN_ROBOT)
- return 0
- return 1
+
+/datum/surgery_step/generic/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if (target_zone == "eyes") //there are specific steps for eye surgery
+ return 0
+ if (!hasorgans(target))
+ return 0
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ if (affected == null)
+ return 0
+ if (affected.status & ORGAN_DESTROYED)
+ return 0
+ if (affected.status & ORGAN_ROBOT)
+ return 0
+ return 1
/datum/surgery_step/generic/cut_with_laser
allowed_tools = list(
@@ -30,38 +31,38 @@
min_duration = 90
max_duration = 110
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if(..())
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return affected.open == 0 && target_zone != "mouth"
+/datum/surgery_step/generic/cut_with_laser/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if(..())
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return affected.open == 0 && target_zone != "mouth"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/cut_with_laser/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts the bloodless incision on [target]'s [affected.name] with \the [tool].", \
"You start the bloodless incision on [target]'s [affected.name] with \the [tool].")
target.custom_pain("You feel a horrible, searing pain in your [affected.name]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("\blue [user] has made a bloodless incision on [target]'s [affected.name] with \the [tool].", \
- "\blue You have made a bloodless incision on [target]'s [affected.name] with \the [tool].",)
- //Could be cleaner ...
- affected.open = 1
+/datum/surgery_step/generic/cut_with_laser/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message(" [user] has made a bloodless incision on [target]'s [affected.name] with \the [tool].", \
+ " You have made a bloodless incision on [target]'s [affected.name] with \the [tool].",)
+ //Could be cleaner ...
+ affected.open = 1
- if(istype(target) && !(target.species.flags & NO_BLOOD))
- affected.status |= ORGAN_BLEEDING
+ if(istype(target) && !(target.species.flags & NO_BLOOD))
+ affected.status |= ORGAN_BLEEDING
- affected.createwound(CUT, 1)
- affected.clamp()
- spread_germs_to_organ(affected, user)
+ affected.createwound(CUT, 1)
+ affected.clamp()
+ spread_germs_to_organ(affected, user)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("\red [user]'s hand slips as the blade sputters, searing a long gash in [target]'s [affected.name] with \the [tool]!", \
- "\red Your hand slips as the blade sputters, searing a long gash in [target]'s [affected.name] with \the [tool]!")
- affected.createwound(CUT, 7.5)
- affected.createwound(BURN, 12.5)
+/datum/surgery_step/generic/cut_with_laser/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message(" [user]'s hand slips as the blade sputters, searing a long gash in [target]'s [affected.name] with \the [tool]!", \
+ "\red Your hand slips as the blade sputters, searing a long gash in [target]'s [affected.name] with \the [tool]!")
+ affected.createwound(CUT, 7.5)
+ affected.createwound(BURN, 12.5)
/datum/surgery_step/generic/incision_manager
allowed_tools = list(
@@ -71,32 +72,32 @@
min_duration = 80
max_duration = 120
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if(..())
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return affected.open == 0 && target_zone != "mouth"
+/datum/surgery_step/generic/incision_manager/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if(..())
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return affected.open == 0 && target_zone != "mouth"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/incision_manager/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts to construct a prepared incision on and within [target]'s [affected.name] with \the [tool].", \
"You start to construct a prepared incision on and within [target]'s [affected.name] with \the [tool].")
target.custom_pain("You feel a horrible, searing pain in your [affected.name] as it is pushed apart!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("\blue [user] has constructed a prepared incision on and within [target]'s [affected.name] with \the [tool].", \
- "\blue You have constructed a prepared incision on and within [target]'s [affected.name] with \the [tool].",)
- affected.open = 1
+/datum/surgery_step/generic/incision_manager/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("\blue [user] has constructed a prepared incision on and within [target]'s [affected.name] with \the [tool].", \
+ "\blue You have constructed a prepared incision on and within [target]'s [affected.name] with \the [tool].",)
+ affected.open = 1
- if(istype(target) && !(target.species.flags & NO_BLOOD))
- affected.status |= ORGAN_BLEEDING
+ if(istype(target) && !(target.species.flags & NO_BLOOD))
+ affected.status |= ORGAN_BLEEDING
- affected.createwound(CUT, 1)
- affected.clamp()
- affected.open = 2
+ affected.createwound(CUT, 1)
+ affected.clamp()
+ affected.open = 2
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/incision_manager/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand jolts as the system sparks, ripping a gruesome hole in [target]'s [affected.name] with \the [tool]!", \
"\red Your hand jolts as the system sparks, ripping a gruesome hole in [target]'s [affected.name] with \the [tool]!")
@@ -113,30 +114,30 @@
min_duration = 90
max_duration = 110
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if (!ishuman(target))
- return 0
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return ..() && affected.open == 0 && target_zone != "mouth"
+/datum/surgery_step/generic/cut_open/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if (!ishuman(target) || !isalien(target))
+ return 0
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return ..() && affected.open == 0 && target_zone != "mouth"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/cut_open/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts the incision on [target]'s [affected.name] with \the [tool].", \
"You start the incision on [target]'s [affected.name] with \the [tool].")
target.custom_pain("You feel a horrible pain as if from a sharp knife in your [affected.name]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/cut_open/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has made an incision on [target]'s [affected.name] with \the [tool].", \
"\blue You have made an incision on [target]'s [affected.name] with \the [tool].",)
affected.open = 1
affected.status |= ORGAN_BLEEDING
affected.createwound(CUT, 1)
- if (target_zone == "head")
- target.brain_op_stage = 1
+ //if (target_zone == "head")
+ // target.brain_op_stage = 1
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/cut_open/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, slicing open [target]'s [affected.name] in a wrong spot with \the [tool]!", \
"\red Your hand slips, slicing open [target]'s [affected.name] in a wrong spot with \the [tool]!")
@@ -152,25 +153,27 @@
min_duration = 40
max_duration = 60
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+
+/datum/surgery_step/generic/clamp_bleeders/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return ..() && affected.open && (affected.status & ORGAN_BLEEDING)
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+
+/datum/surgery_step/generic/clamp_bleeders/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts clamping bleeders in [target]'s [affected.name] with \the [tool].", \
"You start clamping bleeders in [target]'s [affected.name] with \the [tool].")
target.custom_pain("The pain in your [affected.name] is maddening!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/clamp_bleeders/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] clamps bleeders in [target]'s [affected.name] with \the [tool].", \
"\blue You clamp bleeders in [target]'s [affected.name] with \the [tool].")
affected.clamp()
spread_germs_to_organ(affected, user)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/clamp_bleeders/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, tearing blood vessals and causing massive bleeding in [target]'s [affected.name] with \the [tool]!", \
"\red Your hand slips, tearing blood vessels and causing massive bleeding in [target]'s [affected.name] with \the [tool]!",)
@@ -186,49 +189,49 @@
min_duration = 30
max_duration = 40
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/generic/retract_skin/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return ..() && affected.open == 1 && !(affected.status & ORGAN_BLEEDING)
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- var/msg = "[user] starts to pry open the incision on [target]'s [affected.name] with \the [tool]."
- var/self_msg = "You start to pry open the incision on [target]'s [affected.name] with \the [tool]."
- if (target_zone == "chest")
- msg = "[user] starts to separate the ribcage and rearrange the organs in [target]'s torso with \the [tool]."
- self_msg = "You start to separate the ribcage and rearrange the organs in [target]'s torso with \the [tool]."
- if (target_zone == "groin")
- msg = "[user] starts to pry open the incision and rearrange the organs in [target]'s lower abdomen with \the [tool]."
- self_msg = "You start to pry open the incision and rearrange the organs in [target]'s lower abdomen with \the [tool]."
- user.visible_message(msg, self_msg)
- target.custom_pain("It feels like the skin on your [affected.name] is on fire!",1)
- ..()
+/datum/surgery_step/generic/retract_skin/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ var/msg = "[user] starts to pry open the incision on [target]'s [affected.name] with \the [tool]."
+ var/self_msg = "You start to pry open the incision on [target]'s [affected.name] with \the [tool]."
+ if (target_zone == "chest")
+ msg = "[user] starts to separate the ribcage and rearrange the organs in [target]'s torso with \the [tool]."
+ self_msg = "You start to separate the ribcage and rearrange the organs in [target]'s torso with \the [tool]."
+ if (target_zone == "groin")
+ msg = "[user] starts to pry open the incision and rearrange the organs in [target]'s lower abdomen with \the [tool]."
+ self_msg = "You start to pry open the incision and rearrange the organs in [target]'s lower abdomen with \the [tool]."
+ user.visible_message(msg, self_msg)
+ target.custom_pain("It feels like the skin on your [affected.name] is on fire!",1)
+ ..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- var/msg = "\blue [user] keeps the incision open on [target]'s [affected.name] with \the [tool]."
- var/self_msg = "\blue You keep the incision open on [target]'s [affected.name] with \the [tool]."
- if (target_zone == "chest")
- msg = "\blue [user] keeps the ribcage open on [target]'s torso with \the [tool]."
- self_msg = "\blue You keep the ribcage open on [target]'s torso with \the [tool]."
- if (target_zone == "groin")
- msg = "\blue [user] keeps the incision open on [target]'s lower abdomen with \the [tool]."
- self_msg = "\blue You keep the incision open on [target]'s lower abdomen with \the [tool]."
- user.visible_message(msg, self_msg)
- affected.open = 2
+/datum/surgery_step/generic/retract_skin/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ var/msg = "\blue [user] keeps the incision open on [target]'s [affected.name] with \the [tool]."
+ var/self_msg = "\blue You keep the incision open on [target]'s [affected.name] with \the [tool]."
+ if (target_zone == "chest")
+ msg = "\blue [user] keeps the ribcage open on [target]'s torso with \the [tool]."
+ self_msg = "\blue You keep the ribcage open on [target]'s torso with \the [tool]."
+ if (target_zone == "groin")
+ msg = "\blue [user] keeps the incision open on [target]'s lower abdomen with \the [tool]."
+ self_msg = "\blue You keep the incision open on [target]'s lower abdomen with \the [tool]."
+ user.visible_message(msg, self_msg)
+ affected.open = 2
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- var/msg = "\red [user]'s hand slips, tearing the edges of incision on [target]'s [affected.name] with \the [tool]!"
- var/self_msg = "\red Your hand slips, tearing the edges of incision on [target]'s [affected.name] with \the [tool]!"
- if (target_zone == "chest")
- msg = "\red [user]'s hand slips, damaging several organs [target]'s torso with \the [tool]!"
- self_msg = "\red Your hand slips, damaging several organs [target]'s torso with \the [tool]!"
- if (target_zone == "groin")
- msg = "\red [user]'s hand slips, damaging several organs [target]'s lower abdomen with \the [tool]"
- self_msg = "\red Your hand slips, damaging several organs [target]'s lower abdomen with \the [tool]!"
- user.visible_message(msg, self_msg)
- target.apply_damage(12, BRUTE, affected, sharp=1)
+/datum/surgery_step/generic/retract_skin/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ var/msg = "\red [user]'s hand slips, tearing the edges of incision on [target]'s [affected.name] with \the [tool]!"
+ var/self_msg = "\red Your hand slips, tearing the edges of incision on [target]'s [affected.name] with \the [tool]!"
+ if (target_zone == "chest")
+ msg = "\red [user]'s hand slips, damaging several organs [target]'s torso with \the [tool]!"
+ self_msg = "\red Your hand slips, damaging several organs [target]'s torso with \the [tool]!"
+ if (target_zone == "groin")
+ msg = "\red [user]'s hand slips, damaging several organs [target]'s lower abdomen with \the [tool]"
+ self_msg = "\red Your hand slips, damaging several organs [target]'s lower abdomen with \the [tool]!"
+ user.visible_message(msg, self_msg)
+ target.apply_damage(12, BRUTE, affected, sharp=1)
/datum/surgery_step/generic/cauterize
allowed_tools = list(
@@ -241,30 +244,30 @@
min_duration = 70
max_duration = 100
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return ..() && affected.open && target_zone != "mouth"
+/datum/surgery_step/generic/cauterize/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return ..() && affected.open && target_zone != "mouth"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("[user] is beginning to cauterize the incision on [target]'s [affected.name] with \the [tool]." , \
- "You are beginning to cauterize the incision on [target]'s [affected.name] with \the [tool].")
- target.custom_pain("Your [affected.name] is being burned!",1)
- ..()
+/datum/surgery_step/generic/cauterize/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("[user] is beginning to cauterize the incision on [target]'s [affected.name] with \the [tool]." , \
+ "You are beginning to cauterize the incision on [target]'s [affected.name] with \the [tool].")
+ target.custom_pain("Your [affected.name] is being burned!",1)
+ ..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("\blue [user] cauterizes the incision on [target]'s [affected.name] with \the [tool].", \
- "\blue You cauterize the incision on [target]'s [affected.name] with \the [tool].")
- affected.open = 0
- affected.germ_level = 0
- affected.status &= ~ORGAN_BLEEDING
+/datum/surgery_step/generic/cauterize/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("\blue [user] cauterizes the incision on [target]'s [affected.name] with \the [tool].", \
+ "\blue You cauterize the incision on [target]'s [affected.name] with \the [tool].")
+ affected.open = 0
+ affected.germ_level = 0
+ affected.status &= ~ORGAN_BLEEDING
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("\red [user]'s hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!", \
- "\red Your hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!")
- target.apply_damage(3, BURN, affected)
+/datum/surgery_step/generic/cauterize/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("\red [user]'s hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!", \
+ "\red Your hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!")
+ target.apply_damage(3, BURN, affected)
/datum/surgery_step/generic/amputate
@@ -278,34 +281,34 @@
min_duration = 110
max_duration = 160
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if (target_zone == "eyes") //there are specific steps for eye surgery
- return 0
- if (!hasorgans(target))
- return 0
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- if (affected == null)
- return 0
- if (affected.status & ORGAN_DESTROYED)
- return 0
- return !affected.cannot_amputate
+/datum/surgery_step/generic/amputate/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if (target_zone == "eyes") //there are specific steps for eye surgery
+ return 0
+ if (!hasorgans(target))
+ return 0
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ if (affected == null)
+ return 0
+ if (affected.status & ORGAN_DESTROYED)
+ return 0
+ return !affected.cannot_amputate
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("[user] is beginning to amputate [target]'s [affected.name] with \the [tool]." , \
- "You are beginning to cut through [target]'s [affected.amputation_point] with \the [tool].")
- target.custom_pain("Your [affected.amputation_point] is being ripped apart!",1)
- ..()
+/datum/surgery_step/generic/amputate/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("[user] is beginning to amputate [target]'s [affected.name] with \the [tool]." , \
+ "You are beginning to cut through [target]'s [affected.amputation_point] with \the [tool].")
+ target.custom_pain("Your [affected.amputation_point] is being ripped apart!",1)
+ ..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("\blue [user] amputates [target]'s [affected.name] at the [affected.amputation_point] with \the [tool].", \
- "\blue You amputate [target]'s [affected.name] with \the [tool].")
- affected.droplimb(1,DROPLIMB_EDGE)
+/datum/surgery_step/generic/amputate/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("\blue [user] amputates [target]'s [affected.name] at the [affected.amputation_point] with \the [tool].", \
+ "\blue You amputate [target]'s [affected.name] with \the [tool].")
+ affected.droplimb(1,DROPLIMB_EDGE)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("\red [user]'s hand slips, sawing through the bone in [target]'s [affected.name] with \the [tool]!", \
- "\red Your hand slips, sawwing through the bone in [target]'s [affected.name] with \the [tool]!")
- affected.createwound(CUT, 30)
- affected.fracture()
\ No newline at end of file
+/datum/surgery_step/generic/amputate/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("\red [user]'s hand slips, sawing through the bone in [target]'s [affected.name] with \the [tool]!", \
+ "\red Your hand slips, sawwing through the bone in [target]'s [affected.name] with \the [tool]!")
+ affected.createwound(CUT, 30)
+ affected.fracture()
\ No newline at end of file
diff --git a/code/modules/surgery/helpers.dm b/code/modules/surgery/helpers.dm
new file mode 100644
index 00000000000..9340099a1bb
--- /dev/null
+++ b/code/modules/surgery/helpers.dm
@@ -0,0 +1,78 @@
+/proc/attempt_initiate_surgery(obj/item/I, mob/living/M, mob/user)
+ if(istype(M))
+ var/mob/living/carbon/human/H
+ var/obj/item/organ/external/affecting
+ var/selected_zone = user.zone_sel.selecting
+
+ if(istype(M, /mob/living/carbon/human))
+ H = M
+ affecting = H.get_organ(check_zone(selected_zone))
+
+ if(can_operate(M)) //if they're prone or a slime
+ var/datum/surgery/current_surgery
+
+ for(var/datum/surgery/S in M.surgeries)
+ if(S.location == selected_zone)
+ current_surgery = S
+
+ if(!current_surgery)
+ var/list/all_surgeries = surgeries_list.Copy()
+ var/list/available_surgeries = list()
+
+ for(var/datum/surgery/S in all_surgeries)
+ if(!S.possible_locs.Find(selected_zone))
+ continue
+ if(affecting && S.requires_organic_bodypart && affecting.status == ORGAN_ROBOT)
+ continue
+ if(!S.can_start(user, M))
+ continue
+
+ for(var/path in S.allowed_species)
+ if(istype(M, path))
+ available_surgeries[S.name] = S
+ break
+
+ var/P = input("Begin which procedure?", "Surgery", null, null) as null|anything in available_surgeries
+ if(P && user && user.Adjacent(M) && (I in user))
+ var/datum/surgery/S = available_surgeries[P]
+ var/datum/surgery/procedure = new S.type
+ if(procedure)
+ procedure.location = selected_zone
+ M.surgeries += procedure
+ procedure.organ_ref = affecting
+ //just use the scalpel cut message
+
+ else if(!current_surgery.step_in_progress)
+ if(current_surgery.status == 1)
+ M.surgeries -= current_surgery
+ //need a new message
+ //user.visible_message("[user] removes the drapes from [M]'s [parse_zone(selected_zone)].", \
+ // "You remove the drapes from [M]'s [parse_zone(selected_zone)].")
+ qdel(current_surgery)
+ else if(istype(user.get_inactive_hand(), /obj/item/weapon/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] .", \
+ "You mend the incision on [M]'s [parse_zone(selected_zone)].")
+ qdel(current_surgery)
+ else if(current_surgery.can_cancel)
+ user << "You need to hold a cautery in inactive hand to stop [M]'s surgery!"
+
+
+ return 1
+ return 0
+
+
+
+proc/get_location_modifier(mob/M)
+ var/turf/T = get_turf(M)
+ if(locate(/obj/machinery/optable, T))
+ return 1
+ else if(locate(/obj/structure/table, T))
+ return 0.8
+ else if(locate(/obj/structure/stool/bed, T))
+ return 0.7
+ else
+ return 0.5
+
+/obj/item/organ/brain/New()
+ new /obj/item/organ/internal/brain(src.loc)
\ No newline at end of file
diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm
index b8a8f072545..0b188380754 100644
--- a/code/modules/surgery/implant.dm
+++ b/code/modules/surgery/implant.dm
@@ -1,42 +1,50 @@
//Procedures in this file: Putting items in body cavity. Implant removal. Items removal.
+
//////////////////////////////////////////////////////////////////
// ITEM PLACEMENT SURGERY //
//////////////////////////////////////////////////////////////////
+/datum/surgery/cavity_implant
+ name = "cavity implant"
+ steps = list(/datum/surgery_step/generic/cut_open, /datum/surgery_step/generic/clamp_bleeders, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/generic/cut_open, /datum/surgery_step/cavity/make_space,/datum/surgery_step/cavity/place_item,/datum/surgery_step/cavity/close_space,/datum/surgery_step/generic/cauterize/)
+
+ possible_locs = list("chest","head","groin")
+
/datum/surgery_step/cavity
priority = 1
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if(!hasorgans(target))
- return 0
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return affected && affected.open == (affected.encased ? 3 : 2) && !(affected.status & ORGAN_BLEEDING)
- proc/get_max_wclass(obj/item/organ/external/affected)
- switch (affected.limb_name)
- if ("head")
- return 1
- if ("chest")
- return 3
- if ("groin")
- return 2
+/datum/surgery_step/cavity/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if(!hasorgans(target))
return 0
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return affected && affected.open == (affected.encased ? 3 : 2) && !(affected.status & ORGAN_BLEEDING)
- proc/get_cavity(obj/item/organ/external/affected)
- switch (affected.limb_name)
- if ("head")
- return "cranial"
- if ("chest")
- return "thoracic"
- if ("groin")
- return "abdominal"
- return ""
+/datum/surgery_step/cavity/proc/get_max_wclass(obj/item/organ/external/affected)
+ switch (affected.limb_name)
+ if ("head")
+ return 1
+ if ("chest")
+ return 3
+ if ("groin")
+ return 2
+ return 0
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
- user.visible_message("\red [user]'s hand slips, scraping around inside [target]'s [affected.name] with \the [tool]!", \
- "\red Your hand slips, scraping around inside [target]'s [affected.name] with \the [tool]!")
- affected.createwound(CUT, 20)
+/datum/surgery_step/cavity/proc/get_cavity(obj/item/organ/external/affected)
+ switch (affected.limb_name)
+ if ("head")
+ return "cranial"
+ if ("chest")
+ return "thoracic"
+ if ("groin")
+ return "abdominal"
+ return ""
+
+/datum/surgery_step/cavity/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
+ user.visible_message("\red [user]'s hand slips, scraping around inside [target]'s [affected.name] with \the [tool]!", \
+ "\red Your hand slips, scraping around inside [target]'s [affected.name] with \the [tool]!")
+ affected.createwound(CUT, 20)
/datum/surgery_step/cavity/make_space
allowed_tools = list(
@@ -48,22 +56,22 @@
min_duration = 60
max_duration = 80
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return ..() && !affected.cavity && !affected.hidden
+/datum/surgery_step/cavity/make_space/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return ..() && !affected.cavity && !affected.hidden
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("[user] starts making some space inside [target]'s [get_cavity(affected)] cavity with \the [tool].", \
- "You start making some space inside [target]'s [get_cavity(affected)] cavity with \the [tool]." )
- target.custom_pain("The pain in your chest is living hell!",1)
- affected.cavity = 1
- ..()
+/datum/surgery_step/cavity/make_space/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("[user] starts making some space inside [target]'s [get_cavity(affected)] cavity with \the [tool].", \
+ "You start making some space inside [target]'s [get_cavity(affected)] cavity with \the [tool]." )
+ target.custom_pain("The pain in your chest is living hell!",1)
+ affected.cavity = 1
+ ..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
- user.visible_message("\blue [user] makes some space inside [target]'s [get_cavity(affected)] cavity with \the [tool].", \
- "\blue You make some space inside [target]'s [get_cavity(affected)] cavity with \the [tool]." )
+/datum/surgery_step/cavity/make_space/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
+ user.visible_message("\blue [user] makes some space inside [target]'s [get_cavity(affected)] cavity with \the [tool].", \
+ "\blue You make some space inside [target]'s [get_cavity(affected)] cavity with \the [tool]." )
/datum/surgery_step/cavity/close_space
priority = 2
@@ -77,22 +85,22 @@
min_duration = 60
max_duration = 80
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return ..() && affected.cavity
+/datum/surgery_step/cavity/close_space/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return ..() && affected.cavity
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("[user] starts mending [target]'s [get_cavity(affected)] cavity wall with \the [tool].", \
- "You start mending [target]'s [get_cavity(affected)] cavity wall with \the [tool]." )
- target.custom_pain("The pain in your chest is living hell!",1)
- affected.cavity = 0
- ..()
+/datum/surgery_step/cavity/close_space/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("[user] starts mending [target]'s [get_cavity(affected)] cavity wall with \the [tool].", \
+ "You start mending [target]'s [get_cavity(affected)] cavity wall with \the [tool]." )
+ target.custom_pain("The pain in your chest is living hell!",1)
+ affected.cavity = 0
+ ..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
- user.visible_message("\blue [user] mends [target]'s [get_cavity(affected)] cavity walls with \the [tool].", \
- "\blue You mend [target]'s [get_cavity(affected)] cavity walls with \the [tool]." )
+/datum/surgery_step/cavity/close_space/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
+ user.visible_message("\blue [user] mends [target]'s [get_cavity(affected)] cavity walls with \the [tool].", \
+ "\blue You mend [target]'s [get_cavity(affected)] cavity walls with \the [tool]." )
/datum/surgery_step/cavity/place_item
priority = 0
@@ -101,43 +109,50 @@
min_duration = 80
max_duration = 100
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if (!ishuman(target))
- return 0
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- var/can_fit = affected && !affected.hidden && affected.cavity && tool.w_class <= get_max_wclass(affected)
- return ..() && can_fit
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("[user] starts putting \the [tool] inside [target]'s [get_cavity(affected)] cavity.", \
- "You start putting \the [tool] inside [target]'s [get_cavity(affected)] cavity." )
- target.custom_pain("The pain in your chest is living hell!",1)
- ..()
+/datum/surgery_step/cavity/place_item/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if (!ishuman(target))
+ return 0
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ var/can_fit = affected && !affected.hidden && affected.cavity && tool.w_class <= get_max_wclass(affected)
+ return ..() && can_fit
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
+/datum/surgery_step/cavity/place_item/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("[user] starts putting \the [tool] inside [target]'s [get_cavity(affected)] cavity.", \
+ "You start putting \the [tool] inside [target]'s [get_cavity(affected)] cavity." )
+ target.custom_pain("The pain in your chest is living hell!",1)
+ ..()
- if(istype(tool, /obj/item/weapon/disk/nuclear))
- user << "Central command would kill you if you implanted the disk into someone."
- else
- user.visible_message("\blue [user] puts \the [tool] inside [target]'s [get_cavity(affected)] cavity.", \
- "\blue You put \the [tool] inside [target]'s [get_cavity(affected)] cavity." )
- if (tool.w_class > get_max_wclass(affected)/2 && prob(50) && !(affected.status & ORGAN_ROBOT))
- user << "\red You tear some vessels trying to fit such big object in this cavity."
- var/datum/wound/internal_bleeding/I = new ()
- affected.wounds += I
- affected.owner.custom_pain("You feel something rip in your [affected.name]!", 1)
- user.drop_item()
- affected.hidden = tool
- target.internal_organs += tool
- tool.loc = target
- affected.cavity = 0
+/datum/surgery_step/cavity/place_item/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
+
+ if(istype(tool, /obj/item/weapon/disk/nuclear))
+ user << "Central command would kill you if you implanted the disk into someone."
+ else
+ user.visible_message("\blue [user] puts \the [tool] inside [target]'s [get_cavity(affected)] cavity.", \
+ "\blue You put \the [tool] inside [target]'s [get_cavity(affected)] cavity." )
+ if (tool.w_class > get_max_wclass(affected)/2 && prob(50) && !(affected.status & ORGAN_ROBOT))
+ user << "\red You tear some vessels trying to fit such big object in this cavity."
+ var/datum/wound/internal_bleeding/I = new ()
+ affected.wounds += I
+ affected.owner.custom_pain("You feel something rip in your [affected.name]!", 1)
+ user.drop_item()
+ affected.hidden = tool
+ target.internal_organs += tool
+ tool.loc = target
+ affected.cavity = 0
//////////////////////////////////////////////////////////////////
// IMPLANT/ITEM REMOVAL SURGERY //
//////////////////////////////////////////////////////////////////
+///Fethas note:I might could condense this down but it would need to take out the part with poking around with a hemostat
+/datum/surgery/cavity_implant_rem
+ name = "implant removal"
+ steps = list(/datum/surgery_step/generic/cut_open, /datum/surgery_step/generic/clamp_bleeders, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/generic/cut_open,/datum/surgery_step/cavity/implant_removal,/datum/surgery_step/cavity/close_space,/datum/surgery_step/generic/cauterize/)
+ possible_locs = list("chest","head","groin")
+
/datum/surgery_step/cavity/implant_removal
allowed_tools = list(
/obj/item/weapon/hemostat = 100, \
@@ -148,78 +163,78 @@
min_duration = 80
max_duration = 100
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("[user] starts poking around inside [target]'s [affected.name] with \the [tool].", \
- "You start poking around inside [target]'s [affected.name] with \the [tool]." )
- target.custom_pain("The pain in your [affected.name] is living hell!",1)
- ..()
+/datum/surgery_step/cavity/implant_removal/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ user.visible_message("[user] starts poking around inside [target]'s [affected.name] with \the [tool].", \
+ "You start poking around inside [target]'s [affected.name] with \the [tool]." )
+ target.custom_pain("The pain in your [affected.name] is living hell!",1)
+ ..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
+/datum/surgery_step/cavity/implant_removal/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
- var/find_prob = 0
+ var/find_prob = 0
- if (affected.implants.len)
+ if (affected.implants.len)
- var/obj/item/obj = affected.implants[1]
+ var/obj/item/obj = affected.implants[1]
+ if(istype(obj,/obj/item/weapon/implant))
+ var/obj/item/weapon/implant/imp = obj
+ if (imp.islegal())
+ find_prob +=60
+ else
+ find_prob +=40
+ else
+ find_prob +=50
+
+ if (prob(find_prob))
+ user.visible_message("\blue [user] takes something out of [target]'s [affected.name] with \the [tool].", \
+ "\blue You take [obj] out of [target]'s [affected.name]s with \the [tool]." )
+ affected.implants -= obj
+
+ target.sec_hud_set_implants()
+
+ //Handle possessive brain borers.
+ if(istype(obj,/mob/living/simple_animal/borer))
+ var/mob/living/simple_animal/borer/worm = obj
+ if(worm.controlling)
+ target.release_control()
+ worm.detatch()
+ worm.leave_host()
+
+ obj.loc = get_turf(target)
if(istype(obj,/obj/item/weapon/implant))
var/obj/item/weapon/implant/imp = obj
- if (imp.islegal())
- find_prob +=60
- else
- find_prob +=40
- else
- find_prob +=50
-
- if (prob(find_prob))
- user.visible_message("\blue [user] takes something out of [target]'s [affected.name] with \the [tool].", \
- "\blue You take [obj] out of [target]'s [affected.name]s with \the [tool]." )
- affected.implants -= obj
-
- target.sec_hud_set_implants()
-
- //Handle possessive brain borers.
- if(istype(obj,/mob/living/simple_animal/borer))
- var/mob/living/simple_animal/borer/worm = obj
- if(worm.controlling)
- target.release_control()
- worm.detatch()
- worm.leave_host()
-
- obj.loc = get_turf(target)
- if(istype(obj,/obj/item/weapon/implant))
- var/obj/item/weapon/implant/imp = obj
- imp.imp_in = null
- imp.implanted = 0
- else
- user.visible_message("\blue [user] removes \the [tool] from [target]'s [affected.name].", \
- "\blue There's something inside [target]'s [affected.name], but you just missed it this time." )
- else if (affected.hidden)
- user.visible_message("\blue [user] takes something out of incision on [target]'s [affected.name] with \the [tool].", \
- "\blue You take something out of incision on [target]'s [affected.name]s with \the [tool]." )
- affected.hidden.loc = get_turf(target)
- if(!affected.hidden.blood_DNA)
- affected.hidden.blood_DNA = list()
- affected.hidden.blood_DNA[target.dna.unique_enzymes] = target.dna.b_type
- affected.hidden.update_icon()
- affected.hidden = null
-
+ imp.imp_in = null
+ imp.implanted = 0
else
- user.visible_message("\blue [user] could not find anything inside [target]'s [affected.name], and pulls \the [tool] out.", \
- "\blue You could not find anything inside [target]'s [affected.name]." )
+ user.visible_message("\blue [user] removes \the [tool] from [target]'s [affected.name].", \
+ "\blue There's something inside [target]'s [affected.name], but you just missed it this time." )
+ else if (affected.hidden)
+ user.visible_message("\blue [user] takes something out of incision on [target]'s [affected.name] with \the [tool].", \
+ "\blue You take something out of incision on [target]'s [affected.name]s with \the [tool]." )
+ affected.hidden.loc = get_turf(target)
+ if(!affected.hidden.blood_DNA)
+ affected.hidden.blood_DNA = list()
+ affected.hidden.blood_DNA[target.dna.unique_enzymes] = target.dna.b_type
+ affected.hidden.update_icon()
+ affected.hidden = null
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- ..()
- var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
- if (affected.implants.len)
- var/fail_prob = 10
- fail_prob += 100 - tool_quality(tool)
- if (prob(fail_prob))
- var/obj/item/weapon/implant/imp = affected.implants[1]
- user.visible_message("\red Something beeps inside [target]'s [affected.name]!")
- playsound(imp.loc, 'sound/items/countdown.ogg', 75, 1, -3)
- spawn(25)
- imp.activate()
+ else
+ user.visible_message("\blue [user] could not find anything inside [target]'s [affected.name], and pulls \the [tool] out.", \
+ "\blue You could not find anything inside [target]'s [affected.name]." )
+
+/datum/surgery_step/cavity/implant_removal/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ ..()
+ var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
+ if (affected.implants.len)
+ var/fail_prob = 10
+ fail_prob += 100 - tool_quality(tool)
+ if (prob(fail_prob))
+ var/obj/item/weapon/implant/imp = affected.implants[1]
+ user.visible_message("\red Something beeps inside [target]'s [affected.name]!")
+ playsound(imp.loc, 'sound/items/countdown.ogg', 75, 1, -3)
+ spawn(25)
+ imp.activate()
diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm
index 4e6e85292c0..d435ed6b87e 100644
--- a/code/modules/surgery/organs/organ_external.dm
+++ b/code/modules/surgery/organs/organ_external.dm
@@ -76,7 +76,7 @@
//qdel(O)
return ..()
-
+/*
/obj/item/organ/external/attackby(obj/item/weapon/W as obj, mob/user as mob)
switch(stage)
if(0)
@@ -110,6 +110,7 @@
user.visible_message("[user] fishes around fruitlessly in [src] with [W].")
return
..()
+ */
/obj/item/organ/external/update_health()
damage = min(max_damage, (brute_dam + burn_dam))
diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm
index 7cfd46aa6a5..0e18d6a357c 100644
--- a/code/modules/surgery/organs_internal.dm
+++ b/code/modules/surgery/organs_internal.dm
@@ -1,10 +1,29 @@
+/datum/surgery/organ_manipulation
+ name = "organ manipulation"
+ steps = list(/datum/surgery_step/generic/cut_open,/datum/surgery_step/generic/clamp_bleeders, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/open_encased/saw,
+ /datum/surgery_step/open_encased/retract, /datum/surgery_step/internal/manipulate_organs)
+ possible_locs = list("chest", "head")
+ requires_organic_bodypart = 0
+
+/datum/surgery/organ_manipulation/soft
+ possible_locs = list("groin", "eyes", "mouth")
+ steps = list(/datum/surgery_step/generic/cut_open,/datum/surgery_step/generic/clamp_bleeders, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/internal/manipulate_organs)
+
+/datum/surgery/organ_manipulation/alien
+ name = "alien organ manipulation"
+ possible_locs = list("chest", "head", "groin", "eyes", "mouth")
+ allowed_species = list(/mob/living/carbon/alien/humanoid)
+ steps = list(/datum/surgery_step/generic/cut_open, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/open_encased/saw, /datum/surgery_step/internal/manipulate_organs)
+
+
+
// Internal surgeries.
/datum/surgery_step/internal
priority = 2
can_infect = 1
blood_level = 1
-/datum/surgery_step/internal/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/internal/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return 0
@@ -15,6 +34,11 @@
//////////////////////////////////////////////////////////////////
// Dethrall Shadowling //
//////////////////////////////////////////////////////////////////
+/datum/surgery/remove_thrall
+ name = "dethralling"
+ steps = list(/datum/surgery_step/generic/cut_open, /datum/surgery_step/generic/clamp_bleeders, /datum/surgery_step/generic/retract_skin, /datum/surgery_step/open_encased/saw,/datum/surgery_step/open_encased/retract, /datum/surgery_step/internal/dethrall)
+ possible_locs = list("head")
+
/datum/surgery_step/internal/dethrall
allowed_tools = list(
/obj/item/weapon/hemostat = 100, \
@@ -25,40 +49,45 @@
min_duration = 120
max_duration = 120
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- if (!hasorgans(target))
- return
- var/obj/item/organ/external/affected = target.get_organ(target_zone)
- return ..() && affected && is_thrall(target) && affected.open_enough_for_surgery() && target_zone == target.named_organ_parent("brain")
+/datum/surgery_step/internal/dethrall/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if (!hasorgans(target))
+ return
+ var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ return ..() && affected && is_thrall(target) && affected.open_enough_for_surgery() && target_zone == target.named_organ_parent("brain")
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/braincase = target.named_organ_parent("brain")
- user.visible_message("[user] begins looking around in [target]'s [braincase].", "You begin looking for foreign influences on [target]'s brain...")
- user << "You locate a small, pulsing black tumor on the side of [target]'s brain and begin to remove it."
- target << "A small part of your [braincase] pulses with agony as the light impacts it."
- user.visible_message("[user] begins removing something from [target]'s [braincase].", \
- "You begin carefully extracting the tumor...")
- ..()
+/datum/surgery_step/internal/dethrall/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/braincase = target.named_organ_parent("brain")
+ user.visible_message("[user] begins looking around in [target]'s [braincase].", "You begin looking for foreign influences on [target]'s brain...")
+ target << "A small part of your [braincase] pulses with agony as the light impacts it."
+ user.visible_message("[user] begins removing something from [target]'s [braincase].", \
+ "You begin carefully extracting the tumor...")
+ ..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/braincase = target.named_organ_parent("brain")
- user.visible_message("[user] carefully extracts the tumor from [target]'s brain!", \
- "You extract the black tumor from [target]'s [braincase]. It quickly shrivels and burns away.")
- ticker.mode.remove_thrall(target.mind,0)
- new /obj/item/organ/internal/shadowtumor(get_turf(target))
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- var/braincase = target.named_organ_parent("brain")
- if(prob(50))
- user.visible_message("[user] slips and rips the tumor out from [target]'s [braincase]!", \
- "You fumble and tear out [target]'s tumor!")
- target.adjustBrainLoss(110) // This is so you can't just defib'n go
- ticker.mode.remove_thrall(target.mind,1)
- else
- user.visible_message("[user]'s hand slips and fumbles! Luckily, they didn't damage anything!")
+/datum/surgery_step/internal/dethrall/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/braincase = target.named_organ_parent("brain")
+ user.visible_message("[user] carefully extracts the tumor from [target]'s brain!", \
+ "You extract the black tumor from [target]'s [braincase]. It quickly shrivels and burns away.")
+ ticker.mode.remove_thrall(target.mind,0)
+ new /obj/item/organ/internal/shadowtumor(get_turf(target))
+
+/datum/surgery_step/internal/dethrall/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ var/braincase = target.named_organ_parent("brain")
+ if(prob(50))
+ user.visible_message("[user] slips and rips the tumor out from [target]'s [braincase]!", \
+ "You fumble and tear out [target]'s tumor!")
+ target.adjustBrainLoss(110) // This is so you can't just defib'n go
+ ticker.mode.remove_thrall(target.mind,1)
+ else
+ user.visible_message("[user]'s hand slips and fumbles! Luckily, they didn't damage anything!")
//////////////////////////////////////////////////////////////////
// ALIEN EMBRYO SURGERY //
//////////////////////////////////////////////////////////////////
+/datum/surgery/remove_xeno_baby
+ steps = list(/datum/surgery_step/generic/cut_open, /datum/surgery_step/generic/clamp_bleeders,/datum/surgery_step/generic/retract_skin, /datum/surgery_step/open_encased/saw,/datum/surgery_step/open_encased/retract, /datum/surgery_step/internal/remove_embryo)
+ possible_locs = list("chest")
+
+
/datum/surgery_step/internal/remove_embryo
allowed_tools = list(
/obj/item/weapon/hemostat = 100, \
@@ -70,7 +99,7 @@
min_duration = 80
max_duration = 100
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/embryo = 0
var/obj/item/organ/internal/body_egg/alien_embryo/A = target.get_int_organ(/obj/item/organ/internal/body_egg/alien_embryo)
if(A)
@@ -82,14 +111,14 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return ..() && affected && embryo && affected.open_enough_for_surgery() && target_zone == "chest"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/msg = "[user] starts to pull something out from [target]'s ribcage with \the [tool]."
var/self_msg = "You start to pull something out from [target]'s ribcage with \the [tool]."
user.visible_message(msg, self_msg)
target.custom_pain("Something hurts horribly in your chest!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\red [user] rips the larva out of [target]'s ribcage!",
"You rip the larva out of [target]'s ribcage!")
@@ -106,7 +135,7 @@
A.remove(target)
A.loc = get_turf(target)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -121,11 +150,144 @@
user.visible_message("[user] accidentally pokes [target] in the lungs!", "You accidentally poke [target] in the lungs!")
+/datum/surgery_step/internal/manipulate_organs
+ allowed_tools = list(/obj/item/organ/internal = 100, /obj/item/weapon/reagent_containers/food/snacks/organ = 0)
+ var/implements_extract = list(/obj/item/weapon/hemostat = 100, /obj/item/weapon/crowbar = 55)
+ var/implements_mend = list(/obj/item/stack/medical/advanced/bruise_pack= 100,/obj/item/stack/medical/bruise_pack = 20
+ )
+ var/current_type
+ var/obj/item/organ/internal/I = null
+ var/obj/item/organ/external/affected = null
+ min_duration = 70
+ max_duration = 90
+
+/datum/surgery_step/internal/manipulate_organs/New()
+ ..()
+ allowed_tools = allowed_tools + implements_extract + implements_mend
+
+
+
+
+/datum/surgery_step/internal/manipulate_organs/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+
+ I = null
+ affected = target.get_organ(target_zone)
+ if(isorgan(tool))
+ current_type = "insert"
+ I = tool
+ if(target_zone != I.parent_organ || target.get_organ_slot(I.slot))
+ user << "There is no room for [I] in [target]'s [parse_zone(target_zone)]!"
+ return -1
+
+ if(I.damage > (I.max_damage * 0.75))
+ user << " \The [I] is in no state to be transplanted."
+ return -1
+
+ if(target.get_int_organ(I))
+ user << "\red \The [target] already has [I]."
+ return -1
+
+ user.visible_message("[user] starts transplanting \the [tool] into [target]'s [affected.name].", \
+ "You start transplanting \the [tool] into [target]'s [affected.name].")
+ target.custom_pain("Someone's rooting around in your [affected.name]!",1)
+
+ else if(tool in implements_extract)
+ current_type = "extract"
+ var/list/organs = target.get_organs_zone(target_zone)
+ if(!organs.len)
+ user << "There is no removeable organs in [target]'s [parse_zone(target_zone)]!"
+ return -1
+ else
+ for(var/obj/item/organ/internal/O in organs)
+ O.on_find(user)
+ organs -= O
+ organs[O.name] = O
+
+ I = input("Remove which organ?", "Surgery", null, null) as null|anything in organs
+ if(I && user && target && user.Adjacent(target) && user.get_active_hand() == tool)
+ I = organs[I]
+ if(!I) return -1
+ user.visible_message("[user] starts to separate [target]'s [I] with \the [tool].", \
+ "You start to separate [target]'s [I] with \the [tool] for removal." )
+ target.custom_pain("The pain in your [affected.name] is living hell!",1)
+ else
+ return -1
+
+ else if(tool in implements_mend)
+ //todo Change message, make it heal the organs...
+ current_type = "mend"
+ var/tool_name = "\the [tool]"
+ if (istype(tool, /obj/item/stack/medical/advanced/bruise_pack))
+ tool_name = "regenerative membrane"
+ else if (istype(tool, /obj/item/stack/medical/bruise_pack))
+ tool_name = "the bandaid"
+
+ if (!hasorgans(target))
+ return
+ for(var/obj/item/organ/internal/I in affected.internal_organs)
+ if(I && I.damage > 0)
+ if(I.robotic < 2)
+ if(!I.sterile)
+ spread_germs_to_organ(I, user)
+ user.visible_message("[user] starts treating damage to [target]'s [I.name] with [tool_name].", \
+ "You start treating damage to [target]'s [I.name] with [tool_name]." )
+ target.custom_pain("The pain in your [affected.name] is living hell!",1)
+
+ else if(istype(tool, /obj/item/weapon/reagent_containers/food/snacks/organ))
+ user << "[tool] was biten by someone! It's too damaged to use!"
+ return -1
+ ..()
+
+/datum/surgery_step/internal/manipulate_organs/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ if(current_type == "mend")
+ var/tool_name = "\the [tool]"
+ if (istype(tool, /obj/item/stack/medical/advanced/bruise_pack))
+ tool_name = "regenerative membrane"
+ if (istype(tool, /obj/item/stack/medical/bruise_pack))
+ tool_name = "the bandaid"
+
+ if (!hasorgans(target))
+ return
+ for(var/obj/item/organ/internal/I in affected.internal_organs)
+ if(I)
+ I.surgeryize()
+ if(I && I.damage > 0)
+ if(I.robotic < 2)
+ user.visible_message("\blue [user] treats damage to [target]'s [I.name] with [tool_name].", \
+ "\blue You treat damage to [target]'s [I.name] with [tool_name]." )
+ I.damage = 0
+ return 1
+ else if(current_type == "insert")
+ I = tool
+ user.drop_item()
+ I.insert(target)
+ spread_germs_to_organ(I, user)
+ user.visible_message("\blue [user] has transplanted \the [tool] into [target]'s [affected.name].", \
+ "\blue You have transplanted \the [tool] into [target]'s [affected.name].")
+
+ I.status &= ~ORGAN_CUT_AWAY
+
+ else if(current_type == "extract")
+ if(I && I.owner == target)
+ user.visible_message("\blue [user] has separated and extracts [target]'s [I] with \the [tool]." , \
+ "\blue You have separated and extracted [target]'s [I] with \the [tool].")
+
+ add_logs(user, target, "surgically removed [I.name] from", addition="INTENT: [uppertext(user.a_intent)]")
+ spread_germs_to_organ(I, user)
+ I.status |= ORGAN_CUT_AWAY
+ I.remove(target)
+ I.loc = get_turf(target)
+ else
+ user.visible_message("[user] can't seem to extract anything from [target]'s [parse_zone(target_zone)]!",
+ "You can't extract anything from [target]'s [parse_zone(target_zone)]!")
+ return 0
+ ..()
//////////////////////////////////////////////////////////////////
// CHEST INTERNAL ORGAN SURGERY //
//////////////////////////////////////////////////////////////////
+/*
/datum/surgery_step/internal/fix_organ
allowed_tools = list(
/obj/item/stack/medical/advanced/bruise_pack= 100, \
@@ -135,7 +297,7 @@
min_duration = 70
max_duration = 90
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -149,7 +311,7 @@
break
return ..() && is_organ_damaged
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/tool_name = "\the [tool]"
if (istype(tool, /obj/item/stack/medical/advanced/bruise_pack))
tool_name = "regenerative membrane"
@@ -171,7 +333,7 @@
target.custom_pain("The pain in your [affected.name] is living hell!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/tool_name = "\the [tool]"
if (istype(tool, /obj/item/stack/medical/advanced/bruise_pack))
tool_name = "regenerative membrane"
@@ -191,7 +353,7 @@
"\blue You treat damage to [target]'s [I.name] with [tool_name]." )
I.damage = 0
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -224,7 +386,7 @@
min_duration = 90
max_duration = 110
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!..())
return 0
@@ -234,8 +396,8 @@
if(!(affected && !(affected.status & ORGAN_ROBOT)))
return 0
- target.op_stage.current_organ = null
- target.op_stage.organ_ref = null
+ surgery.current_organ = null
+ surgery.organ_ref = null
var/list/attached_organs = list()
for(var/organ in affected.internal_organs)
@@ -247,30 +409,30 @@
if(!organ_to_remove)
return 0
- target.op_stage.current_organ = organ_to_remove
- target.op_stage.organ_ref = attached_organs[organ_to_remove]
+ surgery.current_organ = organ_to_remove
+ surgery.organ_ref = attached_organs[organ_to_remove]
return ..() && organ_to_remove
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
- user.visible_message("[user] starts to separate [target]'s [target.op_stage.current_organ] with \the [tool].", \
- "You start to separate [target]'s [target.op_stage.current_organ] with \the [tool]." )
+ user.visible_message("[user] starts to separate [target]'s [surgery.current_organ] with \the [tool].", \
+ "You start to separate [target]'s [surgery.current_organ] with \the [tool]." )
target.custom_pain("The pain in your [affected.name] is living hell!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("\blue [user] has separated [target]'s [target.op_stage.current_organ] with \the [tool]." , \
- "\blue You have separated [target]'s [target.op_stage.current_organ] with \the [tool].")
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("\blue [user] has separated [target]'s [surgery.current_organ] with \the [tool]." , \
+ "\blue You have separated [target]'s [surgery.current_organ] with \the [tool].")
- var/obj/item/organ/internal/I = target.op_stage.organ_ref
+ var/obj/item/organ/internal/I = surgery.organ_ref
if(I && istype(I))
spread_germs_to_organ(I, user)
I.status |= ORGAN_CUT_AWAY
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, slicing an artery inside [target]'s [affected.name] with \the [tool]!", \
"\red Your hand slips, slicing an artery inside [target]'s [affected.name] with \the [tool]!")
@@ -287,7 +449,7 @@
min_duration = 60
max_duration = 80
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!..())
return 0
@@ -296,8 +458,8 @@
if(!istype(affected))
return 0
- target.op_stage.current_organ = null
- target.op_stage.organ_ref = null
+ surgery.current_organ = null
+ surgery.organ_ref = null
var/list/removable_organs = list()
for(var/organ in affected.internal_organs)
@@ -309,30 +471,30 @@
if(!organ_to_remove)
return 0
- target.op_stage.current_organ = organ_to_remove
- target.op_stage.organ_ref = removable_organs[organ_to_remove]
+ surgery.current_organ = organ_to_remove
+ surgery.organ_ref = removable_organs[organ_to_remove]
return ..()
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("[user] starts removing [target]'s [target.op_stage.current_organ] with \the [tool].", \
- "You start removing [target]'s [target.op_stage.current_organ] with \the [tool].")
- target.custom_pain("Someone's ripping out your [target.op_stage.current_organ]!",1)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("[user] starts removing [target]'s [surgery.current_organ] with \the [tool].", \
+ "You start removing [target]'s [surgery.current_organ] with \the [tool].")
+ target.custom_pain("Someone's ripping out your [surgery.current_organ]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("\blue [user] has removed [target]'s [target.op_stage.current_organ] with \the [tool].", \
- "\blue You have removed [target]'s [target.op_stage.current_organ] with \the [tool].")
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("\blue [user] has removed [target]'s [surgery.current_organ] with \the [tool].", \
+ "\blue You have removed [target]'s [surgery.current_organ] with \the [tool].")
// Extract the organ!
- if(target.op_stage.current_organ)
- var/obj/item/organ/internal/O = target.op_stage.organ_ref
+ if(surgery.current_organ)
+ var/obj/item/organ/internal/O = surgery.organ_ref
if(O && istype(O))
spread_germs_to_organ(O, user)
O.remove(target)
O.loc = get_turf(target)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, damaging [target]'s [affected.name] with \the [tool]!", \
"\red Your hand slips, damaging [target]'s [affected.name] with \the [tool]!")
@@ -346,7 +508,7 @@
min_duration = 60
max_duration = 80
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/internal/O = tool
var/obj/item/organ/external/affected = target.get_organ(target_zone)
@@ -394,14 +556,14 @@
return ..() && organ_missing && organ_compatible
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts transplanting \the [tool] into [target]'s [affected.name].", \
"You start transplanting \the [tool] into [target]'s [affected.name].")
target.custom_pain("Someone's rooting around in your [affected.name]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has transplanted \the [tool] into [target]'s [affected.name].", \
"\blue You have transplanted \the [tool] into [target]'s [affected.name].")
@@ -411,7 +573,7 @@
O.insert(target)
spread_germs_to_organ(O, user)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\red [user]'s hand slips, damaging \the [tool]!", \
"\red Your hand slips, damaging \the [tool]!")
var/obj/item/organ/internal/I = tool
@@ -427,7 +589,7 @@
min_duration = 100
max_duration = 120
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!..())
return 0
@@ -437,8 +599,8 @@
if(!istype(affected))
return 0
- target.op_stage.current_organ = null
- target.op_stage.organ_ref = null
+ surgery.current_organ = null
+ surgery.organ_ref = null
var/list/removable_organs = list()
for(var/organ in affected.internal_organs)
@@ -450,31 +612,32 @@
if(!organ_to_replace)
return 0
- target.op_stage.current_organ = organ_to_replace
- target.op_stage.organ_ref = removable_organs[organ_to_replace]
+ surgery.current_organ = organ_to_replace
+ surgery.organ_ref = removable_organs[organ_to_replace]
return ..()
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("[user] begins reattaching [target]'s [target.op_stage.current_organ] with \the [tool].", \
- "You start reattaching [target]'s [target.op_stage.current_organ] with \the [tool].")
- target.custom_pain("Someone's digging needles into your [target.op_stage.current_organ]!",1)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("[user] begins reattaching [target]'s [surgery.current_organ] with \the [tool].", \
+ "You start reattaching [target]'s [surgery.current_organ] with \the [tool].")
+ target.custom_pain("Someone's digging needles into your [surgery.current_organ]!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("\blue [user] has reattached [target]'s [target.op_stage.current_organ] with \the [tool]." , \
- "\blue You have reattached [target]'s [target.op_stage.current_organ] with \the [tool].")
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("\blue [user] has reattached [target]'s [surgery.current_organ] with \the [tool]." , \
+ "\blue You have reattached [target]'s [surgery.current_organ] with \the [tool].")
- var/obj/item/organ/internal/I = target.op_stage.organ_ref
+ var/obj/item/organ/internal/I = surgery.organ_ref
if(I && istype(I))
I.status &= ~ORGAN_CUT_AWAY
spread_germs_to_organ(I, user)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, damaging the flesh in [target]'s [affected.name] with \the [tool]!", \
"\red Your hand slips, damaging the flesh in [target]'s [affected.name] with \the [tool]!")
affected.createwound(BRUISE, 20)
+*/
//////////////////////////////////////////////////////////////////
// HEART SURGERY //
//////////////////////////////////////////////////////////////////
@@ -489,5 +652,5 @@
// min_duration = 30
// max_duration = 40
-// can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+// can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
// return ..() && target.op_stage.ribcage == 2
\ No newline at end of file
diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm
index 99e6a7241d0..7c2d455f319 100644
--- a/code/modules/surgery/other.dm
+++ b/code/modules/surgery/other.dm
@@ -16,7 +16,7 @@
min_duration = 70
max_duration = 90
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if(!affected) return 0
@@ -27,14 +27,14 @@
return affected.open == 2 && internal_bleeding
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts patching the damaged vein in [target]'s [affected.name] with \the [tool]." , \
"You start patching the damaged vein in [target]'s [affected.name] with \the [tool].")
target.custom_pain("The pain in [affected.name] is unbearable!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has patched the damaged vein in [target]'s [affected.name] with \the [tool].", \
"\blue You have patched the damaged vein in [target]'s [affected.name] with \the [tool].")
@@ -44,7 +44,7 @@
affected.update_damages()
if (ishuman(user) && prob(40)) user:bloody_hands(target, 0)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, smearing [tool] in the incision in [target]'s [affected.name]!" , \
"\red Your hand slips, smearing [tool] in the incision in [target]'s [affected.name]!")
@@ -64,7 +64,7 @@
min_duration = 110
max_duration = 160
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if(!hasorgans(target))
return 0
@@ -75,20 +75,20 @@
return affected && affected.open == 2 && (affected.status & ORGAN_DEAD)
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts cutting away necrotic tissue in [target]'s [affected.name] with \the [tool]." , \
"You start cutting away necrotic tissue in [target]'s [affected.name] with \the [tool].")
target.custom_pain("The pain in [affected.name] is unbearable!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has cut away necrotic tissue in [target]'s [affected.name] with \the [tool].", \
"\blue You have cut away necrotic tissue in [target]'s [affected.name] with \the [tool].")
affected.open = 3
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, slicing an artery inside [target]'s [affected.name] with \the [tool]!", \
"\red Your hand slips, slicing an artery inside [target]'s [affected.name] with \the [tool]!")
@@ -110,7 +110,7 @@
min_duration = 50
max_duration = 60
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!istype(tool, /obj/item/weapon/reagent_containers))
return 0
@@ -127,14 +127,14 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected.open == 3 && (affected.status & ORGAN_DEAD)
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts applying medication to the affected tissue in [target]'s [affected.name] with \the [tool]." , \
"You start applying medication to the affected tissue in [target]'s [affected.name] with \the [tool].")
target.custom_pain("Something in your [affected.name] is causing you a lot of pain!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if (!istype(tool, /obj/item/weapon/reagent_containers))
@@ -152,7 +152,7 @@
user.visible_message("\blue [user] applies [trans] units of the solution to affected tissue in [target]'s [affected.name]", \
"\blue You apply [trans] units of the solution to affected tissue in [target]'s [affected.name] with \the [tool].")
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if (!istype(tool, /obj/item/weapon/reagent_containers))
diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm
index b1e2d8323be..c69b026da0a 100644
--- a/code/modules/surgery/robotics.dm
+++ b/code/modules/surgery/robotics.dm
@@ -3,10 +3,17 @@
// COMMON STEPS //
//////////////////////////////////////////////////////////////////
+/datum/surgery/cybernetic_repair
+ name = "Cybernetic Repair"
+ steps = list(/datum/surgery_step/robotics/external/unscrew_hatch,/datum/surgery_step/robotics/external/open_hatch,/datum/surgery_step/robotics/fix_organ_robotic,/datum/surgery_step/robotics/external/close_hatch)
+ possible_locs = list("chest","head","l_arm", "l_hand","r_arm","r_hand","r_leg","r_foot","l_leg","l_foot","groin")
+ requires_organic_bodypart = 0
+
+//to do, moar surgerys or condense down ala mainpulate organs.
/datum/surgery_step/robotics
can_infect = 0
-/datum/surgery_step/robotics/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/robotics/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (isslime(target))
return 0
if (target_zone == "eyes") //there are specific steps for eye surgery
@@ -22,7 +29,7 @@
/datum/surgery_step/robotics/external
-/datum/surgery_step/robotics/external/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/robotics/external/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!..())
return 0
var/obj/item/organ/external/affected = target.get_organ(target_zone)
@@ -40,24 +47,24 @@
min_duration = 90
max_duration = 110
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected && affected.open == 0 && target_zone != "mouth"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts to unscrew the maintenance hatch on [target]'s [affected.name] with \the [tool].", \
"You start to unscrew the maintenance hatch on [target]'s [affected.name] with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has opened the maintenance hatch on [target]'s [affected.name] with \the [tool].", \
"\blue You have opened the maintenance hatch on [target]'s [affected.name] with \the [tool].",)
affected.open = 1
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s [tool.name] slips, failing to unscrew [target]'s [affected.name].", \
"\red Your [tool] slips, failing to unscrew [target]'s [affected.name].")
@@ -72,24 +79,24 @@
min_duration = 30
max_duration = 40
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected && affected.open == 1
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts to pry open the maintenance hatch on [target]'s [affected.name] with \the [tool].",
"You start to pry open the maintenance hatch on [target]'s [affected.name] with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] opens the maintenance hatch on [target]'s [affected.name] with \the [tool].", \
"\blue You open the maintenance hatch on [target]'s [affected.name] with \the [tool]." )
affected.open = 2
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s [tool.name] slips, failing to open the hatch on [target]'s [affected.name].",
"\red Your [tool] slips, failing to open the hatch on [target]'s [affected.name].")
@@ -104,25 +111,25 @@
min_duration = 70
max_duration = 100
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected && affected.open && target_zone != "mouth"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] begins to close and secure the hatch on [target]'s [affected.name] with \the [tool]." , \
"You begin to close and secure the hatch on [target]'s [affected.name] with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] closes and secures the hatch on [target]'s [affected.name] with \the [tool].", \
"\blue You close and secure the hatch on [target]'s [affected.name] with \the [tool].")
affected.open = 0
affected.germ_level = 0
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s [tool.name] slips, failing to close the hatch on [target]'s [affected.name].",
"\red Your [tool.name] slips, failing to close the hatch on [target]'s [affected.name].")
@@ -136,7 +143,7 @@
min_duration = 50
max_duration = 60
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if(istype(tool,/obj/item/weapon/weldingtool))
@@ -145,13 +152,13 @@
return 0
return affected && affected.open == 2 && affected.brute_dam > 0 && target_zone != "mouth"
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] begins to patch damage to [target]'s [affected.name]'s support structure with \the [tool]." , \
"You begin to patch damage to [target]'s [affected.name]'s support structure with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] finishes patching damage to [target]'s [affected.name] with \the [tool].", \
"\blue You finish patching damage to [target]'s [affected.name] with \the [tool].")
@@ -161,7 +168,7 @@
affected.update_icon()
target.regenerate_icons()
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s [tool.name] slips, damaging the internal structure of [target]'s [affected.name].",
"\red Your [tool.name] slips, damaging the internal structure of [target]'s [affected.name].")
@@ -175,7 +182,7 @@
min_duration = 50
max_duration = 60
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if(..())
var/obj/item/stack/cable_coil/C = tool
var/obj/item/organ/external/affected = target.get_organ(target_zone)
@@ -189,19 +196,19 @@
return 1
return 0
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] begins to splice new cabling into [target]'s [affected.name]." , \
"You begin to splice new cabling into [target]'s [affected.name].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] finishes splicing cable into [target]'s [affected.name].", \
"\blue You finishes splicing new cable into [target]'s [affected.name].")
affected.heal_damage(0,rand(30,50),1,1)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user] causes a short circuit in [target]'s [affected.name]!",
"\red You cause a short circuit in [target]'s [affected.name]!")
@@ -217,7 +224,7 @@
min_duration = 70
max_duration = 90
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -230,7 +237,7 @@
break
return affected.open_enough_for_surgery() && is_organ_damaged
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -245,7 +252,7 @@
target.custom_pain("The pain in your [affected.name] is living hell!",1)
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -259,7 +266,7 @@
"\blue You repair [target]'s [I.name] with [tool]." )
I.damage = 0
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if (!hasorgans(target))
return
@@ -284,7 +291,7 @@
min_duration = 90
max_duration = 110
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if(!(affected && (affected.status & ORGAN_ROBOT)))
@@ -292,8 +299,8 @@
if(!affected.open_enough_for_surgery())
return 0
- target.op_stage.current_organ = null
- target.op_stage.organ_ref = null
+ surgery.current_organ = null
+ surgery.organ_ref = null
var/list/attached_organs = list()
for(var/organ in affected.internal_organs)
@@ -305,25 +312,25 @@
if(!organ_to_remove)
return 0
- target.op_stage.current_organ = organ_to_remove
- target.op_stage.organ_ref = attached_organs[organ_to_remove]
+ surgery.current_organ = organ_to_remove
+ surgery.organ_ref = attached_organs[organ_to_remove]
return ..() && organ_to_remove
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("[user] starts to decouple [target]'s [target.op_stage.current_organ] with \the [tool].", \
- "You start to decouple [target]'s [target.op_stage.current_organ] with \the [tool]." )
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("[user] starts to decouple [target]'s [surgery.current_organ] with \the [tool].", \
+ "You start to decouple [target]'s [surgery.current_organ] with \the [tool]." )
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("\blue [user] has decoupled [target]'s [target.op_stage.current_organ] with \the [tool]." , \
- "\blue You have decoupled [target]'s [target.op_stage.current_organ] with \the [tool].")
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("\blue [user] has decoupled [target]'s [surgery.current_organ] with \the [tool]." , \
+ "\blue You have decoupled [target]'s [surgery.current_organ] with \the [tool].")
- var/obj/item/organ/internal/I = target.get_int_organ(target.op_stage.current_organ)
+ var/obj/item/organ/internal/I = target.get_int_organ(surgery.current_organ)
if(I && istype(I))
I.status |= ORGAN_CUT_AWAY
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\red [user]'s hand slips, disconnecting \the [tool].", \
"\red Your hand slips, disconnecting \the [tool].")
@@ -335,7 +342,7 @@
min_duration = 100
max_duration = 120
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if(!(affected && (affected.status & ORGAN_ROBOT)))
@@ -343,8 +350,8 @@
if(!affected.open_enough_for_surgery())
return 0
- target.op_stage.current_organ = null
- target.op_stage.organ_ref = null
+ surgery.current_organ = null
+ surgery.organ_ref = null
var/list/removable_organs = list()
for(var/organ in affected.internal_organs)
@@ -356,24 +363,24 @@
if(!organ_to_replace)
return 0
- target.op_stage.current_organ = organ_to_replace
- target.op_stage.organ_ref = removable_organs[organ_to_replace]
+ surgery.current_organ = organ_to_replace
+ surgery.organ_ref = removable_organs[organ_to_replace]
return ..()
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("[user] begins reattaching [target]'s [target.op_stage.current_organ] with \the [tool].", \
- "You start reattaching [target]'s [target.op_stage.current_organ] with \the [tool].")
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("[user] begins reattaching [target]'s [surgery.current_organ] with \the [tool].", \
+ "You start reattaching [target]'s [surgery.current_organ] with \the [tool].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- user.visible_message("\blue [user] has reattached [target]'s [target.op_stage.current_organ] with \the [tool]." , \
- "\blue You have reattached [target]'s [target.op_stage.current_organ] with \the [tool].")
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
+ user.visible_message("\blue [user] has reattached [target]'s [surgery.current_organ] with \the [tool]." , \
+ "\blue You have reattached [target]'s [surgery.current_organ] with \the [tool].")
- var/obj/item/organ/internal/I = target.get_int_organ(target.op_stage.current_organ)
+ var/obj/item/organ/internal/I = target.get_int_organ(surgery.current_organ)
if(I && istype(I))
I.status &= ~ORGAN_CUT_AWAY
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\red [user]'s hand slips, disconnecting \the [tool].", \
"\red Your hand slips, disconnecting \the [tool].")
@@ -385,7 +392,7 @@
min_duration = 60
max_duration = 80
- can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
if(target_zone != "chest")
return 0
@@ -420,13 +427,13 @@
return 1
- begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts installing \the [tool] into [target]'s [affected.name].", \
"You start installing \the [tool] into [target]'s [affected.name].")
..()
- end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has installed \the [tool] into [target]'s [affected.name].", \
"\blue You have installed \the [tool] into [target]'s [affected.name].")
@@ -445,6 +452,6 @@
if(M.brainmob && M.brainmob.mind)
M.brainmob.mind.transfer_to(target)
- fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
user.visible_message("\red [user]'s hand slips.", \
"\red Your hand slips.")
\ No newline at end of file
diff --git a/code/modules/surgery/slime.dm b/code/modules/surgery/slime.dm
index 02cf0219366..f4e0b999c44 100644
--- a/code/modules/surgery/slime.dm
+++ b/code/modules/surgery/slime.dm
@@ -1,6 +1,11 @@
//////////////////////////////////////////////////////////////////
// SLIME CORE EXTRACTION //
//////////////////////////////////////////////////////////////////
+/datum/surgery/core_removal
+ name = "core removal"
+ steps = list(/datum/surgery_step/slime/cut_flesh, /datum/surgery_step/slime/cut_innards, /datum/surgery_step/slime/saw_core)
+ allowed_species = list( /mob/living/carbon/slime)
+
/datum/surgery_step/slime
is_valid_target(mob/living/carbon/slime/target)
diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm
index 9fd30f31992..f1cb16f138c 100644
--- a/code/modules/surgery/surgery.dm
+++ b/code/modules/surgery/surgery.dm
@@ -1,3 +1,50 @@
+///Datum Surgery Helpers//
+/datum/surgery
+ var/name = "surgery"
+ var/status = 1
+ var/list/steps = list()
+ var/eyes = 0
+ var/face = 0
+ var/appendix = 0
+ var/ribcage = 0
+ var/head_reattach = 0 //Steps in a surgery
+
+ var/can_cancel = 1
+ var/step_in_progress = 0
+ var/list/in_progress = list() //Actively performing a Surgery
+ var/location = "chest" //Surgery location
+ var/requires_organic_bodypart = 1 //Prevents you from performing an operation on robotic limbs
+ var/list/possible_locs = list() //Multiple locations -- c0
+ var/obj/item/organ/organ_ref //Operable body part
+ var/current_organ = "organ"
+ var/list/allowed_species = null
+ var/list/disallowed_species = null
+
+/datum/surgery/proc/can_start(mob/user, mob/living/carbon/target)
+ // if 0 surgery wont show up in list
+ // put special restrictions here
+ return 1
+
+
+/datum/surgery/proc/next_step(mob/user, mob/living/carbon/target)
+ if(step_in_progress) return
+
+ var/datum/surgery_step/S = get_surgery_step()
+ if(S)
+ if(S.begin_step(user, target, user.zone_sel.selecting, user.get_active_hand(), src))
+ return 1
+ return 0
+
+/datum/surgery/proc/get_surgery_step()
+ var/step_type = steps[status]
+ return new step_type
+
+
+/datum/surgery/proc/complete(mob/living/carbon/human/target)
+ target.surgeries -= src
+ src = null
+
+
/* SURGERY STEPS */
/datum/surgery_step
var/priority = 0 //steps with higher priority would be attempted first
@@ -5,18 +52,46 @@
// type path referencing tools that can be used for this step, and how well are they suited for it
var/list/allowed_tools = null
// type paths referencing mutantraces that this step applies to.
- var/list/allowed_species = null
- var/list/disallowed_species = null
// duration of the step
var/min_duration = 0
var/max_duration = 0
+ var/name
+
// evil infection stuff that will make everyone hate me
var/can_infect = 0
//How much blood this step can get on surgeon. 1 - hands, 2 - full body.
var/blood_level = 0
+ var/list/allowed_species = null
+ var/list/disallowed_species = null
+
+/datum/surgery_step/proc/initiate(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ surgery.step_in_progress = 1
+
+ if(do_after(user, max_duration, target = target))
+ var/advance = 0
+ var/prob_chance = 100
+
+ if(tool) //this means it isn't a require nd or any item step.
+ prob_chance = allowed_tools[tool]
+ prob_chance *= get_location_modifier(target)
+
+ if(prob(prob_chance) || isrobot(user))
+ if(end_step(user, target, target_zone, tool, surgery))
+ advance = 1
+ else
+ if(fail_step(user, target, target_zone, tool, surgery))
+ advance = 1
+
+ if(advance)
+ surgery.status++
+ if(surgery.status > surgery.steps.len)
+ surgery.complete(target)
+
+ surgery.step_in_progress = 0
+
//returns how well tool is suited for this step
/datum/surgery_step/proc/tool_quality(obj/item/tool)
for (var/T in allowed_tools)
@@ -42,11 +117,11 @@
return 1
// checks whether this step can be applied with the given user and target
-/datum/surgery_step/proc/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/proc/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
return 0
// does stuff to begin the step, usually just printing messages. Moved germs transfering and bloodying here too
-/datum/surgery_step/proc/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/proc/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if (can_infect && affected)
spread_germs_to_organ(affected, user)
@@ -59,13 +134,14 @@
return
// does stuff to end the step, which is normally print a message + do whatever this step changes
-/datum/surgery_step/proc/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/proc/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
return
// stuff that happens when the step fails
-/datum/surgery_step/proc/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+/datum/surgery_step/proc/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
return null
+
/proc/spread_germs_to_organ(obj/item/organ/E, mob/living/carbon/human/user)
if(!istype(user) || !istype(E)) return
//world << "Germ spread: [E] : [E.owner]"
@@ -75,13 +151,13 @@
if(!(E.status & ORGAN_ROBOT)) //Germs on robotic limbs bad
E.germ_level = max(germ_level,E.germ_level) //as funny as scrubbing microbes out with clean gloves is - no.
-/proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool)
+/proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool,datum/surgery/surgery)
if(!istype(M))
return 0
if (user.a_intent == I_HARM) //check for Hippocratic Oath
return 0
var/zone = user.zone_sel.selecting
- if(zone in M.op_stage.in_progress) //Can't operate on someone repeatedly.
+ if(zone in surgery.step_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)
@@ -91,7 +167,7 @@
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 += zone
+ surgery.step_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)))
@@ -100,7 +176,7 @@
S.fail_step(user, M, zone, tool) //malpractice~
else // This failing silently was a pain.
user << "You must remain close to your patient to conduct surgery."
- M.op_stage.in_progress -= zone // Clear the in-progress flag.
+ surgery.step_in_progress -= zone // Clear the in-progress flag.
return 1 //don't want to do weapony things after surgery
if (user.a_intent == I_HELP)
@@ -123,13 +199,3 @@
if(l.priority < r.priority)
surgery_steps.Swap(i, gap + i)
swapped = 1
-
-/datum/surgery_status/
- var/eyes = 0
- var/face = 0
- var/appendix = 0
- var/ribcage = 0
- var/head_reattach = 0
- var/current_organ = "organ"
- var/obj/item/organ/organ_ref = null
- var/list/in_progress = list()
\ No newline at end of file
diff --git a/code/modules/surgery/tools.dm b/code/modules/surgery/tools.dm
index edc8f6accb4..a53a4d9604e 100644
--- a/code/modules/surgery/tools.dm
+++ b/code/modules/surgery/tools.dm
@@ -133,6 +133,10 @@
attack_verb = list("attacked", "slashed", "sawed", "cut")
+/obj/item/weapon/scalpel/attack(mob/living/M, mob/user)
+ if(!attempt_initiate_surgery(src, M, user))
+ ..()
+
//misc, formerly from code/defines/weapons.dm
/obj/item/weapon/bonegel
name = "bone gel"
diff --git a/paradise.dme b/paradise.dme
index eca2806a045..d43b564f52f 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -1828,6 +1828,7 @@
#include "code\modules\surgery\encased.dm"
#include "code\modules\surgery\face.dm"
#include "code\modules\surgery\generic.dm"
+#include "code\modules\surgery\helpers.dm"
#include "code\modules\surgery\implant.dm"
#include "code\modules\surgery\limb_reattach.dm"
#include "code\modules\surgery\organs_internal.dm"