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/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/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