diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index bd3ee6f3..e4db2e6b 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -56,7 +56,10 @@ if(species && species.has_organ["brain"]) var/datum/organ/internal/brain/sponge = internal_organs_by_name["brain"] - brainloss = min(sponge.damage,maxHealth*2) + if(sponge) + brainloss = min(sponge.damage,maxHealth*2) + else + brainloss = 200 else brainloss = 0 return brainloss diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index b6758551..d69b6e61 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -54,6 +54,8 @@ if (bodytemperature < 283.222) tally += (283.222 - bodytemperature) / 10 * 1.75 + tally += max(2 * stance_damage, 0) + if(mRun in mutations) tally = -1 diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index db65ebe9..8c52146b 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -108,28 +108,29 @@ Please contact me on #coderbus IRC. ~Carn x #define MUTANTRACE_LAYER 1 #define MUTATIONS_LAYER 2 #define DAMAGE_LAYER 3 -#define UNIFORM_LAYER 4 -#define TAIL_LAYER 5 //bs12 specific. this hack is probably gonna come back to haunt me -#define ID_LAYER 6 -#define SHOES_LAYER 7 -#define GLOVES_LAYER 8 -#define SUIT_LAYER 9 -#define GLASSES_LAYER 10 -#define BELT_LAYER 11 //Possible make this an overlay of somethign required to wear a belt? -#define SUIT_STORE_LAYER 12 -#define BACK_LAYER 13 -#define HAIR_LAYER 14 //TODO: make part of head layer? -#define EARS_LAYER 15 -#define FACEMASK_LAYER 16 -#define HEAD_LAYER 17 -#define COLLAR_LAYER 18 -#define HANDCUFF_LAYER 19 -#define LEGCUFF_LAYER 20 -#define L_HAND_LAYER 21 -#define R_HAND_LAYER 22 -#define TARGETED_LAYER 23 //BS12: Layer for the target overlay from weapon targeting system -#define FIRE_LAYER 24 //If you're on fire -#define TOTAL_LAYERS 24 +#define SURGERY_LEVEL 4 +#define UNIFORM_LAYER 5 +#define TAIL_LAYER 6 //bs12 specific. this hack is probably gonna come back to haunt me +#define ID_LAYER 7 +#define SHOES_LAYER 8 +#define GLOVES_LAYER 9 +#define SUIT_LAYER 10 +#define GLASSES_LAYER 11 +#define BELT_LAYER 12 //Possible make this an overlay of somethign required to wear a belt? +#define SUIT_STORE_LAYER 13 +#define BACK_LAYER 14 +#define HAIR_LAYER 15 //TODO: make part of head layer? +#define EARS_LAYER 16 +#define FACEMASK_LAYER 17 +#define HEAD_LAYER 18 +#define COLLAR_LAYER 19 +#define HANDCUFF_LAYER 20 +#define LEGCUFF_LAYER 21 +#define L_HAND_LAYER 22 +#define R_HAND_LAYER 23 +#define TARGETED_LAYER 24 //BS12: Layer for the target overlay from weapon targeting system +#define FIRE_LAYER 25 //If you're on fire +#define TOTAL_LAYERS 25 ////////////////////////////////// /mob/living/carbon/human @@ -1051,10 +1052,21 @@ proc/get_damage_icon_part(damage_state, body_part) var/image/face_lying_image = new /image(icon = face_lying) return face_lying_image +/mob/living/carbon/human/proc/update_surgery(var/update_icons=1) + overlays_standing[SURGERY_LEVEL] = null + var/image/total = new + for(var/datum/organ/external/E in organs) + if(E.open) + var/image/I = image("icon"='icons/mob/surgery.dmi', "icon_state"="[E.name][round(E.open)]", "layer"=-SURGERY_LEVEL) + total.overlays += I + overlays_standing[SURGERY_LEVEL] = total + if(update_icons) update_icons() + //Human Overlays Indexes///////// #undef MUTANTRACE_LAYER #undef MUTATIONS_LAYER #undef DAMAGE_LAYER +#undef SURGERY_LEVEL #undef UNIFORM_LAYER #undef TAIL_LAYER #undef ID_LAYER diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 77a97e71..b0e0f0b9 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -222,3 +222,5 @@ var/list/active_genes=list() var/floating = 0 //living + + var/stance_damage = 0 \ No newline at end of file diff --git a/code/modules/organs/blood.dm b/code/modules/organs/blood.dm index 8d4144a5..7c010844 100644 --- a/code/modules/organs/blood.dm +++ b/code/modules/organs/blood.dm @@ -330,12 +330,8 @@ proc/blood_splatter(var/target,var/datum/reagent/blood/source,var/large) else B.blood_DNA[source.data["blood_DNA"]] = "O+" - // Update virus information. //Looks like this is out of date. - //for(var/datum/disease/D in source.data["viruses"]) - // var/datum/disease/new_virus = D.Copy(1) - // source.viruses += new_virus - // new_virus.holder = B + // Update virus information. if(source.data["virus2"]) B.virus2 = virus_copylist(source.data["virus2"]) - return B \ No newline at end of file + return B diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 8d9cf177..17f178ad 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -58,8 +58,8 @@ // Takes care of organ related updates, such as broken and missing limbs /mob/living/carbon/human/proc/handle_organs() + number_wounds = 0 - var/leg_tally = 2 var/force_process = 0 var/damage_this_tick = getBruteLoss() + getFireLoss() + getToxLoss() if(damage_this_tick > last_dam) @@ -74,6 +74,9 @@ for(var/datum/organ/internal/I in internal_organs) I.process() + //losing a limb stops it from processing, so this has to be done separately + handle_stance() + if(!force_process && !bad_external_organs.len) return @@ -100,23 +103,37 @@ if (W.infection_check()) W.germ_level += 1 - if(E.name in list("l_leg","l_foot","r_leg","r_foot") && !lying) - if (!E.is_usable() || E.is_malfunctioning() || (E.is_broken() && !(E.status & ORGAN_SPLINTED))) - leg_tally-- // let it fail even if just foot&leg +/mob/living/carbon/human/proc/handle_stance() + // Don't need to process any of this if they aren't standing anyways + // unless their stance is damaged, and we want to check if they should stay down + if (!stance_damage && (lying || resting) && (life_tick % 4) == 0) + return + + stance_damage = 0 + + // Buckled to a bed/chair. Stance damage is forced to 0 since they're sitting on something solid + if (istype(buckled, /obj/structure/stool/bed)) + return + + for (var/organ in list("l_leg","l_foot","r_leg","r_foot")) + var/datum/organ/external/E = organs_by_name[organ] + if (E.status & ORGAN_DESTROYED) + stance_damage += 2 // let it fail even if just foot&leg + else if (E.is_malfunctioning() || (E.is_broken() && !(E.status & ORGAN_SPLINTED)) || !E.is_usable()) + stance_damage += 1 + + // Canes and crutches help you stand (if the latter is ever added) + // One cane mitigates a broken leg+foot, or a missing foot. + // Two canes are needed for a lost leg. If you are missing both legs, canes aren't gonna help you. + if (istype(l_hand, /obj/item/weapon/cane)) + stance_damage -= 2 + if (istype(l_hand, /obj/item/weapon/cane)) + stance_damage -= 2 // standing is poor - if(leg_tally <= 0 && !paralysis && !(lying || resting) && prob(5)) - if(species && species.flags & NO_PAIN) - emote("scream") - emote("collapse") - paralysis = 10 - - //Check arms and legs for existence - can_stand = 2 //can stand on both legs - var/datum/organ/external/E = organs_by_name["l_foot"] - if(E.status & ORGAN_DESTROYED) - can_stand-- - - E = organs_by_name["r_foot"] - if(E.status & ORGAN_DESTROYED) - can_stand-- + if(stance_damage >= 4 || (stance_damage >= 2 && prob(5))) + if(!(lying || resting)) + if(species && !(species.flags & NO_PAIN)) + emote("scream") + custom_emote(1, "collapses!") + Weaken(5) //can't emote while weakened, apparently. \ No newline at end of file diff --git a/code/modules/organs/organ_alien.dm b/code/modules/organs/organ_alien.dm index ae70f485..3f17df0d 100644 --- a/code/modules/organs/organ_alien.dm +++ b/code/modules/organs/organ_alien.dm @@ -39,6 +39,7 @@ /obj/item/organ/diona/removed(var/mob/living/target,var/mob/living/user) + ..() var/mob/living/carbon/human/H = target if(!istype(target)) del(src) @@ -51,10 +52,10 @@ if(!diona) del(src) - var/mob/living/carbon/alien/diona/D = new(get_turf(src)) - diona.request_player(D) - - del(src) + spawn(1) // So it has time to be thrown about by the gib() proc. + var/mob/living/carbon/alien/diona/D = new(get_turf(src)) + diona.request_player(D) + del(src) // These are different to the standard diona organs as they have a purpose in other // species (absorbing radiation and light respectively) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 0c987b72..fe20acd3 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -32,8 +32,6 @@ var/damage_msg = "\red You feel an intense pain" var/broken_description -// var/vital //Lose a vital limb, die immediately. -// var/status = 0 var/open = 0 var/stage = 0 var/cavity = 0 @@ -100,7 +98,8 @@ brute -= brute / 2 if(status & ORGAN_BROKEN && prob(40) && brute) - owner.emote("scream") //getting hit on broken hand hurts + if (!(owner.species && (owner.species.flags & NO_PAIN))) + owner.emote("scream") //getting hit on broken hand hurts if(used_weapon) add_autopsy_data("[used_weapon]", brute + burn) @@ -138,9 +137,9 @@ burn = max(0, burn - can_inflict) //If there are still hurties to dispense if (burn || brute) -// if (status & ORGAN_ROBOT) -// droplimb(1) //Robot limbs just kinda fail at full damage. //this is breaking things okay - if (burn || brute)//else this was formerly an else. double iffing because nobody wants to fix that much spacing + if (status & ORGAN_ROBOT) + droplimb(1) //Robot limbs just kinda fail at full damage. + else //List organs we can pass it to var/list/datum/organ/external/possible_points = list() if(parent) @@ -160,7 +159,7 @@ //If limb took enough damage, try to cut or tear it off if(body_part != UPPER_TORSO && body_part != LOWER_TORSO) //as hilarious as it is, getting hit on the chest too much shouldn't effectively gib you. if(config.limbs_can_break && brute_dam >= max_damage * config.organ_health_multiplier) - if( (edge && prob(5 * brute)) || (brute > 20 && prob(2 * brute)) ) + if( (edge && prob(5 * brute)) || (brute > 20 && prob(brute)) ) droplimb(1) return @@ -498,10 +497,11 @@ Note that amputating the affected organ does in fact remove the infection from t H = owner for(var/datum/wound/W in wounds) - if(W.damage_type == CUT || W.damage_type == BRUISE) - brute_dam += W.damage - else if(W.damage_type == BURN) - burn_dam += W.damage + if(!W.internal) //so IB doesn't count towards crit/paincrit + if(W.damage_type == CUT || W.damage_type == BRUISE) + brute_dam += W.damage + else if(W.damage_type == BURN) + burn_dam += W.damage if(!(status & ORGAN_ROBOT) && W.bleeding() && (H && !(H.species.flags & NO_BLOOD))) W.bleed_timer-- @@ -563,7 +563,7 @@ Note that amputating the affected organ does in fact remove the infection from t O.setAmputatedTree() //Handles dismemberment -/datum/organ/external/proc/droplimb(var/override = 0,var/no_explode = 0) +/datum/organ/external/proc/droplimb(var/override = 0,var/no_explode = 0,var/amputation=0) if(destspawn) return if(override) status |= ORGAN_DESTROYED @@ -580,9 +580,13 @@ Note that amputating the affected organ does in fact remove the infection from t germ_level = 0 + // If any organs are attached to this, destroy them + for(var/datum/organ/external/O in children) + O.droplimb(1, no_explode, amputation) + //Replace all wounds on that arm with one wound on parent organ. wounds.Cut() - if (parent) + if (parent && !amputation) var/datum/wound/W if(max_damage < 50) W = new/datum/wound/lost_limb/small(max_damage) @@ -592,22 +596,12 @@ Note that amputating the affected organ does in fact remove the infection from t parent.update_damages() update_damages() - // If any organs are attached to this, destroy them - for(var/datum/organ/external/O in children) - O.droplimb(1) - var/obj/organ //Dropped limb object + var/list/dropped_items switch(body_part) if(HEAD) - if(owner.species.flags & IS_SYNTHETIC) - organ= new /obj/item/weapon/organ/head/posi(owner.loc, owner) - else - organ= new /obj/item/weapon/organ/head(owner.loc, owner) - owner.u_equip(owner.glasses) - owner.u_equip(owner.head) - owner.u_equip(owner.l_ear) - owner.u_equip(owner.r_ear) - owner.u_equip(owner.wear_mask) + organ = new /obj/item/weapon/organ/head(owner.loc, owner) + dropped_items = list(owner.glasses, owner.head, owner.l_ear, owner.r_ear, owner.wear_mask) if(ARM_RIGHT) if(status & ORGAN_ROBOT) organ = new /obj/item/robot_parts/r_arm(owner.loc) @@ -631,26 +625,29 @@ Note that amputating the affected organ does in fact remove the infection from t if(HAND_RIGHT) if(!(status & ORGAN_ROBOT)) organ= new /obj/item/weapon/organ/r_hand(owner.loc, owner) - owner.u_equip(owner.gloves) + dropped_items = list(owner.gloves) //should probably make it so that you can still wear gloves if you have one hand if(HAND_LEFT) if(!(status & ORGAN_ROBOT)) organ= new /obj/item/weapon/organ/l_hand(owner.loc, owner) - owner.u_equip(owner.gloves) + dropped_items = list(owner.gloves) if(FOOT_RIGHT) if(!(status & ORGAN_ROBOT)) organ= new /obj/item/weapon/organ/r_foot/(owner.loc, owner) - owner.u_equip(owner.shoes) + dropped_items = list(owner.shoes) if(FOOT_LEFT) if(!(status & ORGAN_ROBOT)) organ = new /obj/item/weapon/organ/l_foot(owner.loc, owner) - owner.u_equip(owner.shoes) + dropped_items = list(owner.shoes) + if(dropped_items) + for(var/obj/O in dropped_items) + owner.remove_from_mob(O) destspawn = 1 //Robotic limbs explode if sabotaged. if(status & ORGAN_ROBOT && !no_explode && sabotaged) owner.visible_message("\red \The [owner]'s [display_name] explodes violently!",\ "\red Your [display_name] explodes!",\ - "You hear an explosion followed by a scream!") + "You hear an explosion!") explosion(get_turf(owner),-1,-1,2,3) var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread() spark_system.set_up(5, 0, owner) @@ -663,10 +660,9 @@ Note that amputating the affected organ does in fact remove the infection from t "Your [display_name] goes flying off!",\ "You hear a terrible sound of ripping tendons and flesh.") - if(organ) - //Throw organs around - var/lol = pick(cardinal) - step(organ,lol) + //Throw organs around + if(istype(owner.loc,/turf) && organ) + step(organ,pick(cardinal)) owner.update_body(1) @@ -769,6 +765,15 @@ Note that amputating the affected organ does in fact remove the infection from t suit.supporting_limbs |= src return +/datum/organ/external/proc/mend_fracture() + if(status & ORGAN_ROBOT) + return 0 //ORGAN_BROKEN doesn't have the same meaning for robot limbs + if(brute_dam > min_broken_damage * config.organ_health_multiplier) + return 0 //will just immediately fracture again + + status &= ~ORGAN_BROKEN + return 1 + /datum/organ/external/proc/robotize() src.status &= ~ORGAN_BROKEN src.status &= ~ORGAN_BLEEDING @@ -816,7 +821,7 @@ Note that amputating the affected organ does in fact remove the infection from t return ((status & ORGAN_BROKEN) && !(status & ORGAN_SPLINTED)) /datum/organ/external/proc/is_malfunctioning() - return ((status & ORGAN_ROBOT) && prob(brute_dam + burn_dam - 11)) + return ((status & ORGAN_ROBOT) && prob(brute_dam + burn_dam)) //for arms and hands /datum/organ/external/proc/process_grasp(var/obj/item/c_hand, var/hand_name) @@ -825,8 +830,8 @@ Note that amputating the affected organ does in fact remove the infection from t if(is_broken()) owner.u_equip(c_hand) - var/emote_scream = pick("screams in pain and", "lets out a sharp cry and", "cries out and") - owner.emote("me", 1, "[(owner.species && owner.species.flags & NO_PAIN) ? "" : emote_scream ] drops what they were holding in their [hand_name]!") + var/emote_scream = pick("screams in pain and ", "lets out a sharp cry and ", "cries out and ") + owner.emote("me", 1, "[(owner.species && owner.species.flags & NO_PAIN) ? "" : emote_scream ]drops what they were holding in their [hand_name]!") if(is_malfunctioning()) owner.u_equip(c_hand) owner.emote("me", 1, "drops what they were holding, their [hand_name] malfunctioning!") @@ -1005,6 +1010,8 @@ Note that amputating the affected organ does in fact remove the infection from t obj/item/weapon/organ icon = 'icons/mob/human_races/r_human.dmi' + var/op_stage = 0 + var/list/organs_internal = list() obj/item/weapon/organ/New(loc, mob/living/carbon/human/H) ..(loc) @@ -1015,9 +1022,18 @@ obj/item/weapon/organ/New(loc, mob/living/carbon/human/H) blood_DNA = list() blood_DNA[H.dna.unique_enzymes] = H.dna.b_type - //Forming icon for the limb + // Transferring over organs from the host. + for(var/datum/organ/internal/I in H.internal_organs) + if(I.parent_organ != name) + continue + var/obj/item/organ/current_organ = I.remove() + current_organ.removed(H) + current_organ.loc = src + if(current_organ.organ_data) + organs_internal |= current_organ.organ_data - //Setting base icon for this mob's race + // Forming icon for the limb + // Setting base icon for this mob's race var/icon/base if(H.species && H.species.icobase) base = icon(H.species.icobase) @@ -1038,7 +1054,7 @@ obj/item/weapon/organ/New(loc, mob/living/carbon/human/H) base.Blend(rgb(H.r_skin, H.g_skin, H.b_skin), ICON_ADD) icon = base - dir = SOUTH + set_dir(SOUTH) src.transform = turn(src.transform, rand(70,130)) @@ -1101,81 +1117,34 @@ obj/item/weapon/organ/head/New(loc, mob/living/carbon/human/H) hair.Blend(rgb(H.r_hair, H.g_hair, H.b_hair), ICON_ADD) overlays.Add(hair) //icon.Blend(hair, ICON_OVERLAY) - spawn(5) - if(brainmob && brainmob.client) - brainmob.client.screen.len = null //clear the hud - - //if(ishuman(H)) - // if(H.gender == FEMALE) - // H.icon_state = "head_f" - // H.overlays += H.generate_head_icon() - transfer_identity(H) name = "[H.real_name]'s head" - H.regenerate_icons() - brainmob.stat = 2 - brainmob.death() - -obj/item/weapon/organ/head/proc/transfer_identity(var/mob/living/carbon/human/H)//Same deal as the regular brain proc. Used for human-->head - brainmob = new(src) - brainmob.name = H.real_name - brainmob.real_name = H.real_name - brainmob.dna = H.dna.Clone() - if(H.mind) - H.mind.transfer_to(brainmob) - brainmob.container = src - -obj/item/weapon/organ/head/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(istype(W,/obj/item/weapon/scalpel)) - switch(brain_op_stage) - if(0) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] is beginning to have \his head cut open with [W] by [user].", 1) - brainmob << "\red [user] begins to cut open your head with [W]!" - user << "\red You cut [brainmob]'s head open with [W]!" - - brain_op_stage = 1 - - if(2) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] is having \his connections to the brain delicately severed with [W] by [user].", 1) - brainmob << "\red [user] begins to cut open your head with [W]!" - user << "\red You cut [brainmob]'s head open with [W]!" - - brain_op_stage = 3.0 - else - ..() - else if(istype(W,/obj/item/weapon/circular_saw)) - switch(brain_op_stage) - if(1) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] has \his head sawed open with [W] by [user].", 1) - brainmob << "\red [user] begins to saw open your head with [W]!" - user << "\red You saw [brainmob]'s head open with [W]!" - - brain_op_stage = 2 - if(3) - for(var/mob/O in (oviewers(brainmob) - user)) - O.show_message("\red [brainmob] has \his spine's connection to the brain severed with [W] by [user].", 1) - brainmob << "\red [user] severs your brain's connection to the spine with [W]!" - user << "\red You sever [brainmob]'s brain's connection to the spine with [W]!" - - user.attack_log += "\[[time_stamp()]\] Debrained [brainmob.name] ([brainmob.ckey]) with [W.name] (INTENT: [uppertext(user.a_intent)])" - brainmob.attack_log += "\[[time_stamp()]\] Debrained by [user.name] ([user.ckey]) with [W.name] (INTENT: [uppertext(user.a_intent)])" - msg_admin_attack("[key_name_admin(user)] debrained [key_name_admin(brainmob)] (INTENT: [uppertext(user.a_intent)]) (JMP)") - - //TODO: ORGAN REMOVAL UPDATE. - if(istype(src,/obj/item/weapon/organ/head/posi)) - var/obj/item/device/mmi/posibrain/B = new(loc) - B.transfer_identity(brainmob) +obj/item/weapon/organ/attackby(obj/item/weapon/W as obj, mob/user as mob) + switch(op_stage) + if(0) + if(istype(W,/obj/item/weapon/scalpel)) + user.visible_message("[user] cuts [src] open with [W]!") + op_stage++ + return + if(1) + if(istype(W,/obj/item/weapon/retractor)) + user.visible_message("[user] cracks [src] open like an egg with [W]!") + op_stage++ + return + if(2) + if(istype(W,/obj/item/weapon/hemostat)) + if(contents.len) + var/obj/item/removing = pick(contents) + removing.loc = get_turf(user.loc) + if(!(user.l_hand && user.r_hand)) + user.put_in_hands(removing) + if(istype(removing,/obj/item/organ)) + var/obj/item/organ/removed_organ = removing + organs_internal -= removed_organ.organ_data + user.visible_message("[user] extracts [removing] from [src] with [W]!") else - var/obj/item/organ/brain/B = new(loc) - B.transfer_identity(brainmob) - - brain_op_stage = 4.0 - else - ..() - else - ..() + user.visible_message("[user] fishes around fruitlessly in [src] with [W].") + return + ..() \ No newline at end of file diff --git a/code/modules/organs/organ_internal.dm b/code/modules/organs/organ_internal.dm index 494e375e..6b9595d9 100644 --- a/code/modules/organs/organ_internal.dm +++ b/code/modules/organs/organ_internal.dm @@ -16,6 +16,7 @@ var/rejecting // Is this organ already being rejected? var/obj/item/organ/organ_holder // If not in a body, held in this item. var/list/transplant_data + /datum/organ/internal/proc/rejuvenate() damage=0 @@ -40,8 +41,8 @@ E.internal_organs |= src /datum/organ/internal/process() - //Process infections + //Process infections if (robotic >= 2 || (owner.species && owner.species.flags & IS_PLANT)) //TODO make robotic internal and external organs separate types of organ instead of a flag germ_level = 0 return @@ -172,7 +173,9 @@ removed_type = /obj/item/organ/liver process() + ..() + if (germ_level > INFECTION_LEVEL_ONE) if(prob(1)) owner << "\red Your skin itches." @@ -271,7 +274,13 @@ if(!removed_type) return 0 - var/obj/item/organ/removed_organ = new removed_type(get_turf(user)) + var/turf/target_loc + if(user) + target_loc = get_turf(user) + else + target_loc = get_turf(owner) + + var/obj/item/organ/removed_organ = new removed_type(target_loc) if(istype(removed_organ)) removed_organ.organ_data = src diff --git a/code/modules/organs/organ_objects.dm b/code/modules/organs/organ_objects.dm index 8e4faaab..a97f1f28 100644 --- a/code/modules/organs/organ_objects.dm +++ b/code/modules/organs/organ_objects.dm @@ -76,7 +76,7 @@ /obj/item/organ/proc/update() if(!organ_data) - organ_data = new /datum/organ/internal() + organ_data = new organ_type() if(robotic) organ_data.robotic = robotic @@ -93,6 +93,7 @@ organ_tag = "heart" fresh = 6 // Juicy. dead_icon = "heart-off" + organ_type = /datum/organ/internal/heart /obj/item/organ/lungs name = "lungs" @@ -101,6 +102,7 @@ prosthetic_name = "gas exchange system" prosthetic_icon = "lungs-prosthetic" organ_tag = "lungs" + organ_type = /datum/organ/internal/lungs /obj/item/organ/kidneys name = "kidneys" @@ -109,6 +111,7 @@ prosthetic_name = "prosthetic kidneys" prosthetic_icon = "kidneys-prosthetic" organ_tag = "kidneys" + organ_type = /datum/organ/internal/kidney /obj/item/organ/eyes name = "eyeballs" @@ -117,7 +120,7 @@ prosthetic_name = "visual prosthesis" prosthetic_icon = "eyes-prosthetic" organ_tag = "eyes" - + organ_type = /datum/organ/internal/eyes var/eye_colour /obj/item/organ/liver @@ -126,11 +129,13 @@ prosthetic_name = "toxin filter" prosthetic_icon = "liver-prosthetic" organ_tag = "liver" + organ_type = /datum/organ/internal/liver /obj/item/organ/appendix name = "appendix" icon_state = "appendix" organ_tag = "appendix" + organ_type = /datum/organ/internal/appendix //These are here so they can be printed out via the fabricator. /obj/item/organ/heart/prosthetic @@ -151,15 +156,28 @@ /obj/item/organ/appendix name = "appendix" -/obj/item/organ/proc/removed(var/mob/living/target,var/mob/living/user) +/obj/item/organ/proc/removed(var/mob/living/carbon/human/target,var/mob/living/user) - if(!target || !user) + if(!istype(target) || !organ_data) return - if(organ_data.vital) + target.internal_organs_by_name[organ_tag] = null + target.internal_organs_by_name -= organ_tag + target.internal_organs -= organ_data + + var/datum/organ/external/affected = target.get_organ(organ_data.parent_organ) + affected.internal_organs -= organ_data + + loc = target.loc + organ_data.rejecting = null + var/datum/reagent/blood/organ_blood = locate(/datum/reagent/blood) in reagents.reagent_list + if(!organ_blood || !organ_blood.data["blood_DNA"]) + target.vessel.trans_to(src, 5, 1, 1) + + if(target && user && organ_data.vital) user.attack_log += "\[[time_stamp()]\] removed a vital organ ([src]) from [target.name] ([target.ckey]) (INTENT: [uppertext(user.a_intent)])" target.attack_log += "\[[time_stamp()]\] had a vital organ ([src]) removed by [user.name] ([user.ckey]) (INTENT: [uppertext(user.a_intent)])" - msg_admin_attack("[key_name_admin(user)] removed a vital organ ([src]) from [key_name_admin(target)] (INTENT: [uppertext(user.a_intent)]) (JMP)") + msg_admin_attack("[user.name] ([user.ckey]) removed a vital organ ([src]) from [target.name] ([target.ckey]) (INTENT: [uppertext(user.a_intent)]) (JMP)") target.death() /obj/item/organ/appendix/removed(var/mob/living/target,var/mob/living/user) @@ -196,18 +214,40 @@ H.b_eyes = 0 H.update_body() -/obj/item/organ/proc/replaced(var/mob/living/target) - return +/obj/item/organ/proc/replaced(var/mob/living/carbon/human/target,var/datum/organ/external/affected) -/obj/item/organ/eyes/replaced(var/mob/living/target) + if(!istype(target)) return + + var/datum/reagent/blood/transplant_blood = locate(/datum/reagent/blood) in reagents.reagent_list + if(!transplant_blood) + organ_data.transplant_data = list() + organ_data.transplant_data["species"] = target.species.name + organ_data.transplant_data["blood_type"] = target.dna.b_type + organ_data.transplant_data["blood_DNA"] = target.dna.unique_enzymes + else + organ_data.transplant_data = list() + organ_data.transplant_data["species"] = transplant_blood.data["species"] + organ_data.transplant_data["blood_type"] = transplant_blood.data["blood_type"] + organ_data.transplant_data["blood_DNA"] = transplant_blood.data["blood_DNA"] + + organ_data.organ_holder = null + organ_data.owner = target + target.internal_organs |= organ_data + affected.internal_organs |= organ_data + target.internal_organs_by_name[organ_tag] = organ_data + organ_data.status |= ORGAN_CUT_AWAY + + del(src) + +/obj/item/organ/eyes/replaced(var/mob/living/carbon/human/target) // Apply our eye colour to the target. - var/mob/living/carbon/human/H = target - if(istype(H) && eye_colour) - H.r_eyes = eye_colour[1] - H.g_eyes = eye_colour[2] - H.b_eyes = eye_colour[3] - H.update_body() + if(istype(target) && eye_colour) + target.r_eyes = eye_colour[1] + target.g_eyes = eye_colour[2] + target.b_eyes = eye_colour[3] + target.update_body() + ..() /obj/item/organ/proc/bitten(mob/user) diff --git a/code/modules/surgery/appendix.dm b/code/modules/surgery/appendix.dm deleted file mode 100644 index 91332eab..00000000 --- a/code/modules/surgery/appendix.dm +++ /dev/null @@ -1,89 +0,0 @@ -//Procedures in this file: Appendectomy -////////////////////////////////////////////////////////////////// -// APPENDECTOMY // -////////////////////////////////////////////////////////////////// - -/datum/surgery_step/appendectomy/ - priority = 2 - can_infect = 1 - blood_level = 1 - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - if (!hasorgans(target)) - return 0 - if (target_zone != "groin") - return 0 - var/datum/organ/external/groin = target.get_organ("groin") - if (!groin) - return 0 - if (groin.open < 2) - return 0 - return 1 - -/datum/surgery_step/appendectomy/cut_appendix - allowed_tools = list( - /obj/item/weapon/scalpel = 100, \ - /obj/item/weapon/kitchenknife = 75, \ - /obj/item/weapon/shard = 50, \ - ) - - 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.appendix == 0 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] starts to separate [target]'s appendix from the abdominal wall with \the [tool].", \ - "You start to separate [target]'s appendix from the abdominal wall with \the [tool]." ) - target.custom_pain("The pain in your abdomen 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 appendix with \the [tool]." , \ - "\blue You have separated [target]'s appendix with \the [tool].") - target.op_stage.appendix = 1 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/datum/organ/external/groin = target.get_organ("groin") - user.visible_message("\red [user]'s hand slips, slicing an artery inside [target]'s abdomen with \the [tool]!", \ - "\red Your hand slips, slicing an artery inside [target]'s abdomen with \the [tool]!") - groin.createwound(CUT, 50, 1) - -/datum/surgery_step/appendectomy/remove_appendix - allowed_tools = list( - /obj/item/weapon/hemostat = 100, \ - /obj/item/weapon/wirecutters = 75, \ - /obj/item/weapon/kitchen/utensil/fork = 20 - ) - - min_duration = 60 - max_duration = 80 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.op_stage.appendix == 1 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] starts removing [target]'s appendix with \the [tool].", \ - "You start removing [target]'s appendix with \the [tool].") - target.custom_pain("Someone's ripping out your bowels!",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 appendix with \the [tool].", \ - "\blue You have removed [target]'s appendix with \the [tool].") - var/app = 0 - for(var/datum/disease/appendicitis/appendicitis in target.viruses) - app = 1 - appendicitis.cure() - target.resistances += appendicitis - if (app) - new /obj/item/weapon/reagent_containers/food/snacks/appendix/inflamed(get_turf(target)) - else - new /obj/item/weapon/reagent_containers/food/snacks/appendix(get_turf(target)) - target.op_stage.appendix = 2 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/datum/organ/external/affected = target.get_organ(target_zone) - user.visible_message("\red [user]'s hand slips, nicking internal organs in [target]'s abdomen with \the [tool]!", \ - "\red Your hand slips, nicking internal organs in [target]'s abdomen with \the [tool]!") - affected.createwound(BRUISE, 20) diff --git a/code/modules/surgery/braincore.dm b/code/modules/surgery/braincore.dm deleted file mode 100644 index c3793ccc..00000000 --- a/code/modules/surgery/braincore.dm +++ /dev/null @@ -1,279 +0,0 @@ -//Procedures in this file: Brain extraction. Brain fixing. Slime Core extraction. -////////////////////////////////////////////////////////////////// -// BRAIN SURGERY // -////////////////////////////////////////////////////////////////// - -/datum/surgery_step/brain/ - priority = 2 - blood_level = 1 - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return target_zone == "head" && hasorgans(target) - -/datum/surgery_step/brain/saw_skull - allowed_tools = list( - /obj/item/weapon/circular_saw = 100, \ - /obj/item/weapon/hatchet = 75 - ) - - min_duration = 50 - max_duration = 70 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target_zone == "head" && target.brain_op_stage == 1 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] begins to cut through [target]'s skull with \the [tool].", \ - "You begin to cut through [target]'s skull with \the [tool].") - ..() - - end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\blue [user] has cut [target]'s skull open with \the [tool].", \ - "\blue You have cut [target]'s skull open with \the [tool].") - target.brain_op_stage = 2 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, cracking [target]'s skull with \the [tool]!" , \ - "\red Your hand slips, cracking [target]'s skull with \the [tool]!" ) - target.apply_damage(max(10, tool.force), BRUTE, "head") - -/datum/surgery_step/brain/cut_brain - allowed_tools = list( - /obj/item/weapon/scalpel = 100, \ - /obj/item/weapon/kitchenknife = 75, \ - /obj/item/weapon/shard = 50, \ - ) - - min_duration = 80 - max_duration = 100 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.brain_op_stage == 2 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] starts separating connections to [target]'s brain with \the [tool].", \ - "You start separating connections to [target]'s brain with \the [tool].") - ..() - - end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\blue [user] separates connections to [target]'s brain with \the [tool].", \ - "\blue You separate connections to [target]'s brain with \the [tool].") - target.brain_op_stage = 3 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, cutting a vein in [target]'s brain with \the [tool]!", \ - "\red Your hand slips, cutting a vein in [target]'s brain with \the [tool]!") - target.apply_damage(50, BRUTE, "head", 1, sharp=1) - -/datum/surgery_step/brain/saw_spine - allowed_tools = list( - /obj/item/weapon/circular_saw = 100, \ - /obj/item/weapon/hatchet = 75 - ) - - min_duration = 50 - max_duration = 70 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.brain_op_stage == 3 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] starts separating [target]'s brain from \his spine with \the [tool].", \ - "You start separating [target]'s brain from spine with \the [tool].") - ..() - - end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\blue [user] separates [target]'s brain from \his spine with \the [tool].", \ - "\blue You separate [target]'s brain from spine with \the [tool].") - - var/mob/living/simple_animal/borer/borer = target.has_brain_worms() - - if(borer) - borer.detatch() //Should remove borer if the brain is removed - RR - - user.attack_log += "\[[time_stamp()]\] Debrained [target.name] ([target.ckey]) with [tool.name] (INTENT: [uppertext(user.a_intent)])" - target.attack_log += "\[[time_stamp()]\] Debrained by [user.name] ([user.ckey]) with [tool.name] (INTENT: [uppertext(user.a_intent)])" - msg_admin_attack("[key_name_admin(user)] debrained [key_name_admin(target)] with [tool.name] (INTENT: [uppertext(user.a_intent)]) (JMP)") - - var/mob/living/carbon/human/H - if(istype(target,/mob/living/carbon/human)) - H = target - - var/obj/item/brain/B - if(H && H.species && H.species.flags & IS_SYNTHETIC) - var/obj/item/device/mmi/posibrain/P = new(target.loc) - P.transfer_identity(target) - else - B = new(target.loc) - B.transfer_identity(target) - - target.internal_organs -= B - target.internal_organs_by_name -= "brain" - - target:brain_op_stage = 4.0 - target.death()//You want them to die after the brain was transferred, so not to trigger client death() twice. - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, cutting a vein in [target]'s brain with \the [tool]!", \ - "\red Your hand slips, cutting a vein in [target]'s brain with \the [tool]!") - target.apply_damage(30, BRUTE, "head", 1, sharp=1) - if (ishuman(user)) - user:bloody_body(target) - user:bloody_hands(target, 0) - - -////////////////////////////////////////////////////////////////// -// BRAIN DAMAGE FIXING // -////////////////////////////////////////////////////////////////// - -/datum/surgery_step/brain/bone_chips - allowed_tools = list( - /obj/item/weapon/hemostat = 100, \ - /obj/item/weapon/wirecutters = 75, \ - /obj/item/weapon/kitchen/utensil/fork = 20 - ) - - min_duration = 80 - max_duration = 100 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.brain_op_stage == 2 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] starts taking bone chips out of [target]'s brain with \the [tool].", \ - "You start taking bone chips out of [target]'s brain with \the [tool].") - ..() - - end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\blue [user] takes out all the bone chips in [target]'s brain with \the [tool].", \ - "\blue You take out all the bone chips in [target]'s brain with \the [tool].") - target.brain_op_stage = 3 - - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, jabbing \the [tool] in [target]'s brain!", \ - "\red Your hand slips, jabbing \the [tool] in [target]'s brain!") - target.apply_damage(30, BRUTE, "head", 1, sharp=1) - -/datum/surgery_step/brain/hematoma - allowed_tools = list( - /obj/item/weapon/FixOVein = 100, \ - /obj/item/weapon/cable_coil = 75 - ) - - min_duration = 90 - max_duration = 110 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.brain_op_stage == 3 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] starts mending hematoma in [target]'s brain with \the [tool].", \ - "You start mending hematoma in [target]'s brain with \the [tool].") - ..() - - end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\blue [user] mends hematoma in [target]'s brain with \the [tool].", \ - "\blue You mend hematoma in [target]'s brain with \the [tool].") - var/datum/organ/internal/brain/sponge = target.internal_organs_by_name["brain"] - if (sponge) - sponge.damage = 0 - - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, bruising [target]'s brain with \the [tool]!", \ - "\red Your hand slips, bruising [target]'s brain with \the [tool]!") - target.apply_damage(20, BRUTE, "head", 1, sharp=1) - -////////////////////////////////////////////////////////////////// -// SLIME CORE EXTRACTION // -////////////////////////////////////////////////////////////////// - -/datum/surgery_step/slime - is_valid_target(mob/living/carbon/slime/target) - return istype(target, /mob/living/carbon/slime/) - - can_use(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - return target.stat == 2 - -/datum/surgery_step/slime/cut_flesh - allowed_tools = list( - /obj/item/weapon/scalpel = 100, \ - /obj/item/weapon/kitchenknife = 75, \ - /obj/item/weapon/shard = 50, \ - ) - - min_duration = 30 - max_duration = 50 - - can_use(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - return ..() && target.brain_op_stage == 0 - - begin_step(mob/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("[user] starts cutting through [target]'s flesh with \the [tool].", \ - "You start cutting through [target]'s flesh with \the [tool].") - - end_step(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("\blue [user] cuts through [target]'s flesh with \the [tool].", \ - "\blue You cut through [target]'s flesh with \the [tool], revealing its silky innards.") - target.brain_op_stage = 1 - - fail_step(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, tearing [target]'s flesh with \the [tool]!", \ - "\red Your hand slips, tearing [target]'s flesh with \the [tool]!") - -/datum/surgery_step/slime/cut_innards - allowed_tools = list( - /obj/item/weapon/scalpel = 100, \ - /obj/item/weapon/kitchenknife = 75, \ - /obj/item/weapon/shard = 50, \ - ) - - min_duration = 30 - max_duration = 50 - - can_use(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - return ..() && target.brain_op_stage == 1 - - begin_step(mob/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("[user] starts cutting [target]'s silky innards apart with \the [tool].", \ - "You start cutting [target]'s silky innards apart with \the [tool].") - - end_step(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("\blue [user] cuts [target]'s innards apart with \the [tool], exposing the cores.", \ - "\blue You cut [target]'s innards apart with \the [tool], exposing the cores.") - target.brain_op_stage = 2 - - fail_step(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, tearing [target]'s innards with \the [tool]!", \ - "\red Your hand slips, tearing [target]'s innards with \the [tool]!") - -/datum/surgery_step/slime/saw_core - allowed_tools = list( - /obj/item/weapon/circular_saw = 100, \ - /obj/item/weapon/hatchet = 75 - ) - - min_duration = 50 - max_duration = 70 - - can_use(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - return ..() && target.brain_op_stage == 2 && target.cores > 0 - - begin_step(mob/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("[user] starts cutting out one of [target]'s cores with \the [tool].", \ - "You start cutting out one of [target]'s cores with \the [tool].") - - end_step(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - target.cores-- - user.visible_message("\blue [user] cuts out one of [target]'s cores with \the [tool].",, \ - "\blue You cut out one of [target]'s cores with \the [tool]. [target.cores] cores left.") - - if(target.cores >= 0) - new target.coretype(target.loc) - if(target.cores <= 0) - target.icon_state = "[target.colour] baby slime dead-nocore" - - - fail_step(mob/living/user, mob/living/carbon/slime/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, causing \him to miss the core!", \ - "\red Your hand slips, causing you to miss the core!") \ No newline at end of file diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm index 0f1ea7c5..0cf7dfef 100644 --- a/code/modules/surgery/generic.dm +++ b/code/modules/surgery/generic.dm @@ -59,8 +59,6 @@ affected.createwound(CUT, 1) affected.clamp() spread_germs_to_organ(affected, user) -// if (target_zone == "head") -// target.brain_op_stage = 1 fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) @@ -101,8 +99,6 @@ affected.createwound(CUT, 1) affected.clamp() affected.open = 2 -// if (target_zone == "head") -// target.brain_op_stage = 1 fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) @@ -143,8 +139,6 @@ affected.status |= ORGAN_BLEEDING affected.createwound(CUT, 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) var/datum/organ/external/affected = target.get_organ(target_zone) @@ -311,7 +305,7 @@ var/datum/organ/external/affected = target.get_organ(target_zone) user.visible_message("\blue [user] cuts off [target]'s [affected.display_name] with \the [tool].", \ "\blue You cut off [target]'s [affected.display_name] with \the [tool].") - affected.droplimb(1,0) + affected.droplimb(1,1,1) fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) diff --git a/code/modules/surgery/headreattach.dm b/code/modules/surgery/headreattach.dm index 72da44cc..4960e406 100644 --- a/code/modules/surgery/headreattach.dm +++ b/code/modules/surgery/headreattach.dm @@ -181,11 +181,11 @@ target.update_body() target.updatehealth() target.UpdateDamageIcon() - var/obj/item/weapon/organ/head/B = tool - if (B.brainmob.mind) - B.brainmob.mind.transfer_to(target) - del(B) - + for(var/obj/item/organ/replacing_organ in tool) + replacing_organ.loc = get_turf(tool) + replacing_organ.replaced(target,affected) + del(replacing_organ) //Just in case. + del(tool) fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm index 54cbcae4..a795dd10 100644 --- a/code/modules/surgery/implant.dm +++ b/code/modules/surgery/implant.dm @@ -112,7 +112,7 @@ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) if(..()) var/datum/organ/external/affected = target.get_organ(target_zone) - return !affected.hidden && affected.cavity && tool.w_class <= get_max_wclass(affected) + return !istype(user,/mob/living/silicon/robot) && !affected.hidden && affected.cavity && tool.w_class <= get_max_wclass(affected) begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) @@ -198,12 +198,13 @@ if(worm.controlling) target.release_control() worm.detatch() - - 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 + worm.leave_host() + else + 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.display_name].", \ "\blue There's something inside [target]'s [affected.display_name], but you just missed it this time." ) diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm index ee7d5606..19f64c5d 100644 --- a/code/modules/surgery/organs_internal.dm +++ b/code/modules/surgery/organs_internal.dm @@ -58,8 +58,7 @@ /datum/surgery_step/internal/fix_organ allowed_tools = list( /obj/item/stack/medical/advanced/bruise_pack= 100, \ - /obj/item/stack/medical/bruise_pack = 20, \ - /obj/item/stack/medical/bruise_pack/tajaran = 70, \ + /obj/item/stack/medical/bruise_pack = 20 ) min_duration = 70 @@ -82,11 +81,8 @@ 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)) - if (istype(tool, /obj/item/stack/medical/bruise_pack/tajaran)) - tool_name = "the poultice" - else - tool_name = "the bandaid" + else if (istype(tool, /obj/item/stack/medical/bruise_pack)) + tool_name = "the bandaid" if (!hasorgans(target)) return @@ -106,10 +102,7 @@ if (istype(tool, /obj/item/stack/medical/advanced/bruise_pack)) tool_name = "regenerative membrane" if (istype(tool, /obj/item/stack/medical/bruise_pack)) - if (istype(tool, /obj/item/stack/medical/bruise_pack/tajaran)) - tool_name = "the poultice" - else - tool_name = "the bandaid" + tool_name = "the bandaid" if (!hasorgans(target)) return @@ -136,12 +129,9 @@ target.adjustToxLoss(5) else if (istype(tool, /obj/item/stack/medical/bruise_pack)) - if (istype(tool, /obj/item/stack/medical/bruise_pack/tajaran)) - target.adjustToxLoss(7) - else - dam_amt = 5 - target.adjustToxLoss(10) - affected.createwound(CUT, 5) + dam_amt = 5 + target.adjustToxLoss(10) + affected.createwound(CUT, 5) for(var/datum/organ/internal/I in affected.internal_organs) if(I && I.damage > 0) @@ -314,30 +304,12 @@ // Extract the organ! if(target.op_stage.current_organ) - - var/datum/organ/external/affected = target.get_organ(target_zone) var/datum/organ/internal/I = target.internal_organs_by_name[target.op_stage.current_organ] - var/obj/item/organ/O if(I && istype(I)) O = I.remove(user) if(O && istype(O)) - - // Stop the organ from continuing to reject. - O.organ_data.rejecting = null - - // Transfer over some blood data, if the organ doesn't have data. - var/datum/reagent/blood/organ_blood = locate(/datum/reagent/blood) in O.reagents.reagent_list - if(!organ_blood || !organ_blood.data["blood_DNA"]) - target.vessel.trans_to(O, 5, 1, 1) - - // Kinda redundant, but I'm getting some buggy behavior. - target.internal_organs_by_name[target.op_stage.current_organ] = null - target.internal_organs_by_name -= target.op_stage.current_organ - target.internal_organs -= O.organ_data - affected.internal_organs -= O.organ_data O.removed(target,user) - target.op_stage.current_organ = null fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) @@ -409,30 +381,8 @@ "\blue You have transplanted \the [tool] into [target]'s [affected.display_name].") user.drop_item(tool) var/obj/item/organ/O = tool - if(istype(O)) - - var/datum/reagent/blood/transplant_blood = locate(/datum/reagent/blood) in O.reagents.reagent_list - if(!transplant_blood) - O.organ_data.transplant_data = list() - O.organ_data.transplant_data["species"] = target.species.name - O.organ_data.transplant_data["blood_type"] = target.dna.b_type - O.organ_data.transplant_data["blood_DNA"] = target.dna.unique_enzymes - else - O.organ_data.transplant_data = list() - O.organ_data.transplant_data["species"] = transplant_blood.data["species"] - O.organ_data.transplant_data["blood_type"] = transplant_blood.data["blood_type"] - O.organ_data.transplant_data["blood_DNA"] = transplant_blood.data["blood_DNA"] - - O.organ_data.organ_holder = null - O.organ_data.owner = target - target.internal_organs |= O.organ_data - affected.internal_organs |= O.organ_data - target.internal_organs_by_name[O.organ_tag] = O.organ_data - O.organ_data.status |= ORGAN_CUT_AWAY - O.replaced(target) - - del(O) + O.replaced(target,affected) fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) user.visible_message("\red [user]'s hand slips, damaging \the [tool]!", \ diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm index 6ac5da27..38ca2903 100644 --- a/code/modules/surgery/other.dm +++ b/code/modules/surgery/other.dm @@ -59,7 +59,7 @@ /obj/item/weapon/kitchenknife = 75, \ /obj/item/weapon/shard = 50, \ ) - + can_infect = 1 blood_level = 1 @@ -72,7 +72,7 @@ if (target_zone == "mouth" || target_zone == "eyes") return 0 - + var/datum/organ/external/affected = target.get_organ(target_zone) return affected.open >= 2 && (affected.status & ORGAN_DEAD) @@ -105,7 +105,7 @@ /obj/item/weapon/reagent_containers/spray = 50, /obj/item/weapon/reagent_containers/glass/bucket = 50, ) - + can_infect = 0 blood_level = 0 @@ -115,7 +115,7 @@ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) if (!istype(tool, /obj/item/weapon/reagent_containers)) return 0 - + var/obj/item/weapon/reagent_containers/container = tool if(!container.reagents.has_reagent("peridaxon")) return 0 @@ -125,7 +125,7 @@ if (target_zone == "mouth" || target_zone == "eyes") return 0 - + var/datum/organ/external/affected = target.get_organ(target_zone) return affected.open == 3 && (affected.status & ORGAN_DEAD) @@ -138,34 +138,34 @@ end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) - + if (!istype(tool, /obj/item/weapon/reagent_containers)) return - + var/obj/item/weapon/reagent_containers/container = tool - + var/trans = container.reagents.trans_to(target, container.amount_per_transfer_from_this) if (trans > 0) container.reagents.reaction(target, INGEST) //technically it's contact, but the reagents are being applied to internal tissue - + if(container.reagents.has_reagent("peridaxon")) affected.status &= ~ORGAN_DEAD - + user.visible_message("\blue [user] applies [trans] units of the solution to affected tissue in [target]'s [affected.display_name]", \ "\blue You apply [trans] units of the solution to affected tissue in [target]'s [affected.display_name] with \the [tool].") fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) - + if (!istype(tool, /obj/item/weapon/reagent_containers)) return - + var/obj/item/weapon/reagent_containers/container = tool - + var/trans = container.reagents.trans_to(target, container.amount_per_transfer_from_this) container.reagents.reaction(target, INGEST) //technically it's contact, but the reagents are being applied to internal tissue - + user.visible_message("\red [user]'s hand slips, applying [trans] units of the solution to the wrong place in [target]'s [affected.display_name] with the [tool]!" , \ "\red Your hand slips, applying [trans] units of the solution to the wrong place in [target]'s [affected.display_name] with the [tool]!") - + //no damage or anything, just wastes medicine diff --git a/code/modules/surgery/ribcage.dm b/code/modules/surgery/ribcage.dm deleted file mode 100644 index c14d065c..00000000 --- a/code/modules/surgery/ribcage.dm +++ /dev/null @@ -1,335 +0,0 @@ -//Procedures in this file: Generic ribcage opening steps, Removing alien embryo, Fixing internal organs. -////////////////////////////////////////////////////////////////// -// GENERIC RIBCAGE SURGERY // -////////////////////////////////////////////////////////////////// -/datum/surgery_step/ribcage - priority = 2 - can_infect = 1 - blood_level = 1 - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return target_zone == "chest" - -/datum/surgery_step/ribcage/saw_ribcage - allowed_tools = list( - /obj/item/weapon/circular_saw = 100, \ - /obj/item/weapon/hatchet = 75 - ) - - min_duration = 50 - max_duration = 70 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - if (!hasorgans(target)) - return - var/datum/organ/external/affected = target.get_organ(target_zone) - return ..() && target.op_stage.ribcage == 0 && affected.open >= 2 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("[user] begins to cut through [target]'s ribcage with \the [tool].", \ - "You begin to cut through [target]'s ribcage with \the [tool].") - 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) - user.visible_message("\blue [user] has cut [target]'s ribcage open with \the [tool].", \ - "\blue You have cut [target]'s ribcage open with \the [tool].") - target.op_stage.ribcage = 1 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - user.visible_message("\red [user]'s hand slips, cracking [target]'s ribcage with \the [tool]!" , \ - "\red Your hand slips, cracking [target]'s ribcage with \the [tool]!" ) - var/datum/organ/external/affected = target.get_organ(target_zone) - affected.createwound(CUT, 20) - affected.fracture() - - -/datum/surgery_step/ribcage/retract_ribcage - allowed_tools = list( - /obj/item/weapon/retractor = 100, \ - /obj/item/weapon/crowbar = 75, \ - /obj/item/weapon/kitchen/utensil/fork = 20 - ) - - min_duration = 30 - max_duration = 40 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.op_stage.ribcage == 1 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/msg = "[user] starts to force open the ribcage in [target]'s torso with \the [tool]." - var/self_msg = "You start to force open the ribcage in [target]'s torso 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) - var/msg = "\blue [user] forces open [target]'s ribcage with \the [tool]." - var/self_msg = "\blue You force open [target]'s ribcage with \the [tool]." - user.visible_message(msg, self_msg) - target.op_stage.ribcage = 2 - - // Whoops! - if(prob(10)) - var/datum/organ/external/affected = target.get_organ(target_zone) - affected.fracture() - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/msg = "\red [user]'s hand slips, breaking [target]'s ribcage!" - var/self_msg = "\red Your hand slips, breaking [target]'s ribcage!" - user.visible_message(msg, self_msg) - var/datum/organ/external/affected = target.get_organ(target_zone) - affected.createwound(BRUISE, 20) - affected.fracture() - -/datum/surgery_step/ribcage/close_ribcage - allowed_tools = list( - /obj/item/weapon/retractor = 100, \ - /obj/item/weapon/crowbar = 75, \ - /obj/item/weapon/kitchen/utensil/fork = 20 - ) - - - min_duration = 20 - max_duration = 40 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.op_stage.ribcage == 2 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/msg = "[user] starts bending [target]'s ribcage back into place with \the [tool]." - var/self_msg = "You start bending [target]'s ribcage back into place 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) - var/msg = "\blue [user] bends [target]'s ribcage back into place with \the [tool]." - var/self_msg = "\blue You bend [target]'s ribcage back into place with \the [tool]." - user.visible_message(msg, self_msg) - - target.op_stage.ribcage = 1 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/msg = "\red [user]'s hand slips, bending [target]'s ribs the wrong way!" - var/self_msg = "\red Your hand slips, bending [target]'s ribs the wrong way!" - user.visible_message(msg, self_msg) - var/datum/organ/external/chest/affected = target.get_organ("chest") - affected.createwound(BRUISE, 20) - affected.fracture() - if (prob(40)) - user.visible_message("\red A rib pierces the lung!") - target.rupture_lung() - -/datum/surgery_step/ribcage/mend_ribcage - allowed_tools = list( - /obj/item/weapon/bonegel = 100, \ - /obj/item/weapon/screwdriver = 75 - ) - - min_duration = 20 - max_duration = 40 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - return ..() && target.op_stage.ribcage == 1 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/msg = "[user] starts applying \the [tool] to [target]'s ribcage." - var/self_msg = "You start applying \the [tool] to [target]'s ribcage." - 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) - var/msg = "\blue [user] applied \the [tool] to [target]'s ribcage." - var/self_msg = "\blue You applied \the [tool] to [target]'s ribcage." - user.visible_message(msg, self_msg) - - target.op_stage.ribcage = 0 - -////////////////////////////////////////////////////////////////// -// ALIEN EMBRYO SURGERY // -////////////////////////////////////////////////////////////////// -/datum/surgery_step/ribcage/remove_embryo - allowed_tools = list( - /obj/item/weapon/hemostat = 100, \ - /obj/item/weapon/wirecutters = 75, \ - /obj/item/weapon/kitchen/utensil/fork = 20 - ) - blood_level = 2 - - min_duration = 80 - max_duration = 100 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/embryo = 0 - for(var/obj/item/alien_embryo/A in target) - embryo = 1 - break - return ..() && embryo && target.op_stage.ribcage == 2 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - 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) - user.visible_message("\red [user] rips the larva out of [target]'s ribcage!", - "You rip the larva out of [target]'s ribcage!") - - for(var/obj/item/alien_embryo/A in target) - A.loc = A.loc.loc - - -////////////////////////////////////////////////////////////////// -// CHEST INTERNAL ORGAN SURGERY // -////////////////////////////////////////////////////////////////// -/datum/surgery_step/ribcage/fix_chest_internal - allowed_tools = list( - /obj/item/stack/medical/advanced/bruise_pack= 100, \ - /obj/item/stack/medical/bruise_pack = 20, \ - /obj/item/stack/medical/bruise_pack/tajaran = 70, \ - ) - - min_duration = 70 - max_duration = 90 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - if(!hasorgans(target)) - return 0 - - var/is_chest_organ_damaged = 0 - var/datum/organ/external/chest/chest = target.get_organ("chest") - for(var/datum/organ/internal/I in chest.internal_organs) - if(I.damage > 0) - is_chest_organ_damaged = 1 - break - return ..() && is_chest_organ_damaged && target.op_stage.ribcage == 2 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - 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)) - if (istype(tool, /obj/item/stack/medical/bruise_pack/tajaran)) - tool_name = "the poultice" - else - tool_name = "the bandaid" - var/datum/organ/external/chest/chest = target.get_organ("chest") - for(var/datum/organ/internal/I in chest.internal_organs) - if(I && I.damage > 0) - if(I.robotic < 2) - 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]." ) - else - user.visible_message("[user] attempts to repair [target]'s mechanical [I.name] with [tool_name]...", \ - "\blue You attempt to repair [target]'s mechanical [I.name] with [tool_name]...") - - target.custom_pain("The pain in your chest is living hell!",1) - ..() - - end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - 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)) - if (istype(tool, /obj/item/stack/medical/bruise_pack/tajaran)) - tool_name = "the poultice" - else - tool_name = "the bandaid" - var/datum/organ/external/chest/chest = target.get_organ("chest") - for(var/datum/organ/internal/I in chest.internal_organs) - 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]." ) - else - user.visible_message("\blue [user] pokes [target]'s mechanical [I.name] with [tool_name]...", \ - "\blue You poke [target]'s mechanical [I.name] with [tool_name]... \red For no effect, since it's robotic.") - I.damage = 0 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/datum/organ/external/chest/affected = target.get_organ("chest") - user.visible_message("\red [user]'s hand slips, getting mess and tearing the inside of [target]'s chest with \the [tool]!", \ - "\red Your hand slips, getting mess and tearing the inside of [target]'s chest with \the [tool]!") - var/dam_amt = 2 - - if (istype(tool, /obj/item/stack/medical/advanced/bruise_pack)) - target.adjustToxLoss(5) - - else if (istype(tool, /obj/item/stack/medical/bruise_pack)) - if (istype(tool, /obj/item/stack/medical/bruise_pack/tajaran)) - target.adjustToxLoss(7) - else - dam_amt = 5 - target.adjustToxLoss(10) - affected.createwound(CUT, 5) - - for(var/datum/organ/internal/I in affected.internal_organs) - if(I && I.damage > 0) - I.take_damage(dam_amt,0) - -/datum/surgery_step/ribcage/fix_chest_internal_robot //For artificial organs - allowed_tools = list( - /obj/item/stack/nanopaste = 100, \ - /obj/item/weapon/bonegel = 30, \ - /obj/item/weapon/screwdriver = 70, \ - ) - - min_duration = 70 - max_duration = 90 - - can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - if(!hasorgans(target)) - return 0 - - var/is_chest_organ_damaged = 0 - var/datum/organ/internal/heart/heart = target.internal_organs_by_name["heart"] - var/datum/organ/external/chest/chest = target.get_organ("chest") - for(var/datum/organ/internal/I in chest.internal_organs) if(I.damage > 0) - is_chest_organ_damaged = 1 - break - return ..() && is_chest_organ_damaged && heart.robotic == 2 && target.op_stage.ribcage == 2 - - begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/datum/organ/internal/heart/heart = target.internal_organs_by_name["heart"] - - if(heart.damage > 0) - user.visible_message("[user] starts mending the mechanisms on [target]'s heart with \the [tool].", \ - "You start mending the mechanisms on [target]'s heart with \the [tool]." ) - target.custom_pain("The pain in your chest is living hell!",1) - ..() - - end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/datum/organ/internal/heart/heart = target.internal_organs_by_name["heart"] - if(heart.damage > 0) - user.visible_message("\blue [user] repairs [target]'s heart with \the [tool].", \ - "\blue You repair [target]'s heart with \the [tool]." ) - heart.damage = 0 - - fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) - var/datum/organ/internal/heart/heart = target.internal_organs_by_name["heart"] - user.visible_message("\red [user]'s hand slips, smearing [tool] in the incision in [target]'s heart, gumming it up!!" , \ - "\red Your hand slips, smearing [tool] in the incision in [target]'s heart, gumming it up!") - heart.take_damage(5, 0) - target.adjustToxLoss(5) - -////////////////////////////////////////////////////////////////// -// HEART SURGERY // -////////////////////////////////////////////////////////////////// -// To be finished after some tests. -// /datum/surgery_step/ribcage/heart/cut -// allowed_tools = list( -// /obj/item/weapon/scalpel = 100, \ -// /obj/item/weapon/kitchenknife = 75, \ -// /obj/item/weapon/shard = 50, \ -// ) - -// min_duration = 30 -// max_duration = 40 - -// can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) -// return ..() && target.op_stage.ribcage == 2 - diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 6822e0c1..a4e6cfdc 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -5,7 +5,7 @@ // 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. + // type paths referencing races that this step applies to. var/list/allowed_species = null var/list/disallowed_species = null @@ -82,27 +82,30 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) return 0 if (user.a_intent == "harm") //check for Hippocratic Oath return 0 - if(M.op_stage.in_progress) //Can't operate on someone repeatedly. - user << "\red You can't operate on the patient while surgery is already in progress." + var/zone = user.zone_sel.selecting + if(zone in M.op_stage.in_progress) //Can't operate on someone repeatedly. + user << "\red You can't operate on this area while surgery is already in progress." return 1 - for(var/datum/surgery_step/S in surgery_steps) //check if tool is right or close enough and if this step is possible if(S.tool_quality(tool)) - var/step_is_valid = S.can_use(user, M, user.zone_sel.selecting, tool) + var/step_is_valid = S.can_use(user, M, zone, tool) if(step_is_valid && S.is_valid_target(M)) if(step_is_valid == 2) // This is a failure that already has a message for failing. return 1 - M.op_stage.in_progress = 1 - S.begin_step(user, M, user.zone_sel.selecting, tool) //start on it + M.op_stage.in_progress += zone + S.begin_step(user, M, zone, tool) //start on it //We had proper tools! (or RNG smiled.) and user did not move or change hands. if(prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration))) - S.end_step(user, M, user.zone_sel.selecting, tool) //finish successfully - else if (tool in user.contents && user.Adjacent(M)) //or - S.fail_step(user, M, user.zone_sel.selecting, tool) //malpractice~ + S.end_step(user, M, zone, tool) //finish successfully + else if ((tool in user.contents) && user.Adjacent(M)) //or + S.fail_step(user, M, zone, tool) //malpractice~ else // This failing silently was a pain. user << "\red You must remain close to your patient to conduct surgery." - M.op_stage.in_progress = 0 // Clear the in-progress flag. + M.op_stage.in_progress -= zone // Clear the in-progress flag. + if (ishuman(M)) + var/mob/living/carbon/human/H = M + H.update_surgery() return 1 //don't want to do weapony things after surgery if (user.a_intent == "help") @@ -129,8 +132,6 @@ proc/sort_surgeries() /datum/surgery_status/ var/eyes = 0 var/face = 0 -// var/appendix = 0 -// var/ribcage = 0 var/head_reattach = 0 var/current_organ = "organ" - var/in_progress = 0 \ No newline at end of file + var/list/in_progress = list() \ No newline at end of file diff --git a/icons/mob/surgery.dmi b/icons/mob/surgery.dmi new file mode 100644 index 00000000..20381e09 Binary files /dev/null and b/icons/mob/surgery.dmi differ