From ea6754597edc1ca074f501eaf6e532cc5073cefb Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Sat, 28 May 2016 09:12:19 -0400 Subject: [PATCH] Ports Bay's Robolimb Changes (#1779) * Consolidates copypasta for repairing robolimbs Also prevents self-repairing a limb you are using to hold the tool * Fixes robot organs becoming undamagable after reaching cap * Fixes repairing with cable not using any cable, repairing with weldingtool not doing eyecheck * Removes ORGAN_ROBOT and ORGAN_ASSISTED flags, fixes #13123 * Fixes damage to robotic limbs not triggering organ processing At the same time, robotic limbs with damage don't need to process. However, it's much safer to explicitly have robot limbs return 0 from needs_process() instead of not rechecking bad external organs. * Build on HarpyEagle changes to apply to Polaris Had to apply the change from flag to an enumeration. * Removes unneeded file * Fix bruisepacks, remove heart Well, the unused bay version of the heart anyway * Tweaks examine, reverts isSynthetic Reverted that because Bay doesn't use it the same way. Also changed Examine to not list every robo-limb on non-FBPs in red, but left them listed as normal per Spookerton --- code/__defines/damage_organs.dm | 11 +- code/game/antagonist/alien/borer.dm | 2 +- code/game/machinery/adv_med.dm | 7 +- code/game/objects/items.dm | 2 +- code/game/objects/items/devices/scanners.dm | 2 +- code/game/objects/items/stacks/medical.dm | 6 +- code/game/objects/items/stacks/nanopaste.dm | 2 +- .../objects/items/weapons/material/shards.dm | 2 +- .../items/weapons/surgery_limbattachment.dm | 71 ------------ code/game/objects/items/weapons/tools.dm | 24 ++-- code/modules/clothing/masks/monitor.dm | 2 +- .../clothing/under/accessories/accessory.dm | 2 +- .../mob/living/carbon/human/examine.dm | 8 +- code/modules/mob/living/carbon/human/human.dm | 6 +- .../mob/living/carbon/human/human_damage.dm | 12 +- .../mob/living/carbon/human/human_defense.dm | 4 +- .../mob/living/carbon/human/human_organs.dm | 21 +++- code/modules/mob/living/carbon/human/life.dm | 2 +- .../mob/living/carbon/human/update_icons.dm | 2 +- .../mob/living/silicon/robot/analyzer.dm | 4 +- .../simple_animal/hostile/giant_spider.dm | 4 +- code/modules/mob/mob_helpers.dm | 2 +- code/modules/organs/blood.dm | 2 +- code/modules/organs/organ.dm | 30 ++--- code/modules/organs/organ_external.dm | 108 +++++++++++++----- code/modules/organs/organ_icon.dm | 6 +- code/modules/organs/organ_stump.dm | 2 +- code/modules/organs/pain.dm | 4 +- code/modules/organs/subtypes/diona.dm | 4 +- code/modules/power/cable.dm | 20 ++-- .../Chemistry-Reagents-Medicine.dm | 4 +- .../reagents/reagent_containers/borghydro.dm | 2 +- .../reagents/reagent_containers/hypospray.dm | 2 +- .../reagents/reagent_containers/syringes.dm | 2 +- code/modules/surgery/bones.dm | 8 +- code/modules/surgery/encased.dm | 2 +- code/modules/surgery/face.dm | 2 +- code/modules/surgery/generic.dm | 2 +- code/modules/surgery/implant.dm | 2 +- code/modules/surgery/organs_internal.dm | 10 +- code/modules/surgery/robotics.dm | 17 ++- 41 files changed, 204 insertions(+), 223 deletions(-) delete mode 100644 code/game/objects/items/weapons/surgery_limbattachment.dm diff --git a/code/__defines/damage_organs.dm b/code/__defines/damage_organs.dm index 152e22a11a..89b01a699b 100644 --- a/code/__defines/damage_organs.dm +++ b/code/__defines/damage_organs.dm @@ -35,11 +35,9 @@ #define ORGAN_BLEEDING (1<<1) #define ORGAN_BROKEN (1<<2) #define ORGAN_DESTROYED (1<<3) -#define ORGAN_ROBOT (1<<4) -#define ORGAN_SPLINTED (1<<5) -#define ORGAN_DEAD (1<<6) -#define ORGAN_MUTATED (1<<7) -#define ORGAN_ASSISTED (1<<8) +#define ORGAN_SPLINTED (1<<4) +#define ORGAN_DEAD (1<<5) +#define ORGAN_MUTATED (1<<6) #define DROPLIMB_EDGE 0 #define DROPLIMB_BLUNT 1 @@ -48,6 +46,9 @@ // Damage above this value must be repaired with surgery. #define ROBOLIMB_SELF_REPAIR_CAP 30 +#define ORGAN_ASSISTED 1 +#define ORGAN_ROBOT 2 + //Germs and infections. #define GERM_LEVEL_AMBIENT 110 // Maximum germ level you can reach by standing still. #define GERM_LEVEL_MOVE_CAP 200 // Maximum germ level you can reach by running around. diff --git a/code/game/antagonist/alien/borer.dm b/code/game/antagonist/alien/borer.dm index 783055381c..7483fb508b 100644 --- a/code/game/antagonist/alien/borer.dm +++ b/code/game/antagonist/alien/borer.dm @@ -46,7 +46,7 @@ var/datum/antagonist/borer/borers for(var/mob/living/carbon/human/H in mob_list) if(H.stat != DEAD && !H.has_brain_worms()) var/obj/item/organ/external/head = H.get_organ(BP_HEAD) - if(head && !(head.status & ORGAN_ROBOT)) + if(head && !(head.robotic >= ORGAN_ROBOT)) host = H break if(istype(host)) diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 90ff3f0d6b..cd811a2862 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -433,8 +433,9 @@ bled = "Bleeding:" if(e.status & ORGAN_BROKEN) AN = "[e.broken_description]:" - if(e.status & ORGAN_ROBOT) - robot = "Prosthetic:" + switch(e.robotic) + if(ORGAN_ROBOT) robot = "Prosthetic:" + if(ORGAN_ASSISTED) robot = "Augmented:" if(e.open) open = "Open:" @@ -478,7 +479,7 @@ var/mech = "" if(i.status & ORGAN_ASSISTED) mech = "Assisted:" - if(i.status & ORGAN_ROBOT) + if(i.robotic >= ORGAN_ROBOT) mech = "Mechanical:" var/infection = "None" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 2934e5d68d..db08e9e083 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -481,7 +481,7 @@ var/list/global/slot_flags_enumeration = list( eyes.damage += rand(3,4) if(eyes.damage >= eyes.min_bruised_damage) if(M.stat != 2) - if(!(eyes.status & ORGAN_ROBOT)) //robot eyes bleeding might be a bit silly + if(!(eyes.robotic >= ORGAN_ROBOT)) //robot eyes bleeding might be a bit silly M << "Your eyes start to bleed profusely!" if(prob(50)) if(M.stat != 2) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index ef875940ad..a4b159b734 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -75,7 +75,7 @@ REAGENT SCANNER for(var/obj/item/organ/external/org in damaged) user.show_message(text(" [][]: [][] - []", capitalize(org.name), - (org.status & ORGAN_ROBOT) ? "(Cybernetic)" : "", + (org.robotic >= ORGAN_ROBOT) ? "(Cybernetic)" : "", (org.brute_dam > 0) ? "[org.brute_dam]" : 0, (org.status & ORGAN_BLEEDING)?"\[Bleeding\]":"", (org.burn_dam > 0) ? "[org.burn_dam]" : 0),1) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index c55fd587c0..d47df19f19 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -24,6 +24,10 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/affecting = H.get_organ(user.zone_sel.selecting) + if(!affecting) + user << "No body part there to work on!" + return 1 + if(affecting.organ_tag == BP_HEAD) if(H.head && istype(H.head,/obj/item/clothing/head/helmet/space)) user << "You can't apply [src] through [H.head]!" @@ -33,7 +37,7 @@ user << "You can't apply [src] through [H.wear_suit]!" return 1 - if(affecting.status & ORGAN_ROBOT) + if(affecting.robotic >= ORGAN_ROBOT) user << "This isn't useful at all on a robotic limb.." return 1 diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index a9ec052102..5b85763b32 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -28,7 +28,7 @@ var/obj/item/organ/external/S = H.get_organ(user.zone_sel.selecting) if(S.open == 1) - if (S && (S.status & ORGAN_ROBOT)) + if (S && (S.robotic >= ORGAN_ROBOT)) if(S.get_damage()) S.heal_damage(15, 15, robo_repair = 1) H.updatehealth() diff --git a/code/game/objects/items/weapons/material/shards.dm b/code/game/objects/items/weapons/material/shards.dm index e708cc0765..f4b763c5e9 100644 --- a/code/game/objects/items/weapons/material/shards.dm +++ b/code/game/objects/items/weapons/material/shards.dm @@ -85,7 +85,7 @@ var/picked = pick(check) var/obj/item/organ/external/affecting = H.get_organ(picked) if(affecting) - if(affecting.status & ORGAN_ROBOT) + if(affecting.robotic >= ORGAN_ROBOT) return if(affecting.take_damage(5, 0)) H.UpdateDamageIcon() diff --git a/code/game/objects/items/weapons/surgery_limbattachment.dm b/code/game/objects/items/weapons/surgery_limbattachment.dm deleted file mode 100644 index 4ba10524f2..0000000000 --- a/code/game/objects/items/weapons/surgery_limbattachment.dm +++ /dev/null @@ -1,71 +0,0 @@ -/obj/item/robot_parts/attack(mob/living/carbon/human/M as mob, mob/living/carbon/user as mob) - var/limbloc = null - - if(!istype(M)) - return ..() - - if(!((locate(/obj/machinery/optable, M.loc) && M.resting) || (locate(/obj/structure/bed/roller, M.loc) && (M.buckled || M.lying || M.weakened || M.stunned || M.paralysis || M.sleeping || M.stat)) && prob(75) || (locate(/obj/structure/table/, M.loc) && (M.lying || M.weakened || M.stunned || M.paralysis || M.sleeping || M.stat) && prob(66)))) - return ..() - - if(!istype(M, /mob/living/carbon/human)) - return ..() - - if((user.zone_sel.selecting == "l_arm") && (istype(src, /obj/item/robot_parts/l_arm))) - limbloc = "l_hand" - else if((user.zone_sel.selecting == "r_arm") && (istype(src, /obj/item/robot_parts/r_arm))) - limbloc = "r_hand" - else if((user.zone_sel.selecting == "r_leg") && (istype(src, /obj/item/robot_parts/r_leg))) - limbloc = "r_foot" - else if((user.zone_sel.selecting == "l_leg") && (istype(src, /obj/item/robot_parts/l_leg))) - limbloc = "l_foot" - else - user << "That doesn't fit there!" - return ..() - - var/mob/living/carbon/human/H = M - var/datum/organ/external/S = H.organs[user.zone_sel.selecting] - if(S.status & ORGAN_DESTROYED) - if(!(S.status & ORGAN_ATTACHABLE)) - user << "The wound is not ready for a replacement!" - return 0 - if(M != user) - M.visible_message( \ - "\The [user] is beginning to attach \the [src] where [H]'s [S.display_name] used to be.", \ - "\The [user] begins to attach \the [src] where your [S.display_name] used to be.") - else - M.visible_message( \ - "\The [user] begins to attach a robotic limb where \his [S.display_name] used to be with [src].", \ - "You begin to attach \the [src] where your [S.display_name] used to be.") - - if(do_mob(user, H, 100)) - if(M != user) - M.visible_message( \ - "\The [user] finishes attaching [H]'s new [S.display_name].", \ - "\The [user] finishes attaching your new [S.display_name].") - else - M.visible_message( \ - "\The [user] finishes attaching \his new [S.display_name].", \ - "You finish attaching your new [S.display_name].") - - if(H == user && prob(25)) - user << "You mess up!" - S.take_damage(15) - - S.status &= ~ORGAN_BROKEN - S.status &= ~ORGAN_SPLINTED - S.status &= ~ORGAN_ATTACHABLE - S.status &= ~ORGAN_DESTROYED - S.status |= ORGAN_ROBOT - var/datum/organ/external/T = H.organs["[limbloc]"] - T.status &= ~ORGAN_BROKEN - T.status &= ~ORGAN_SPLINTED - T.status &= ~ORGAN_ATTACHABLE - T.status &= ~ORGAN_DESTROYED - T.status |= ORGAN_ROBOT - H.update_body() - M.updatehealth() - M.UpdateDamageIcon() - qdel(src) - - return 1 - return 0 diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index c1922b735e..cf10ae4346 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -428,22 +428,18 @@ var/mob/living/carbon/human/H = A var/obj/item/organ/external/S = H.organs_by_name[user.zone_sel.selecting] - if(!S || !(S.status & ORGAN_ROBOT)) + if(!S || S.robotic < ORGAN_ROBOT || S.open == 3) return ..() - if(S.brute_dam) - if(S.brute_dam < ROBOLIMB_SELF_REPAIR_CAP) - S.heal_damage(15,0,0,1) - user.visible_message("\The [user] patches some dents on \the [H]'s [S.name] with \the [src].") - else if(S.open < 3) - user << "The damage is far too severe to patch over externally." - else - return ..() - else - user << "Nothing to fix!" - S.update_wounds() - return - return ..() + if(!welding) + user << "You'll need to turn [src] on to patch the damage on [H]'s [S.name]!" + return 1 + + if(S.robo_repair(15, BRUTE, "some dents", src, user)) + remove_fuel(1, user) + + else + return ..() /*/obj/item/weapon/combitool name = "combi-tool" diff --git a/code/modules/clothing/masks/monitor.dm b/code/modules/clothing/masks/monitor.dm index b2bfc13876..e8f6340172 100644 --- a/code/modules/clothing/masks/monitor.dm +++ b/code/modules/clothing/masks/monitor.dm @@ -52,7 +52,7 @@ return 0 if(istype(user)) var/obj/item/organ/external/E = user.organs_by_name[BP_HEAD] - if(istype(E) && (E.status & ORGAN_ROBOT)) + if(istype(E) && (E.robotic >= ORGAN_ROBOT)) return 1 user << "You must have a robotic head to install this upgrade." return 0 diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index cde1408536..d4ab2e4d0f 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -124,7 +124,7 @@ var/sound_strength = "cannot hear" var/heartbeat = 0 var/obj/item/organ/internal/heart/heart = M.internal_organs_by_name[O_HEART] - if(heart && !(heart.status & ORGAN_ROBOT)) + if(heart && !(heart.robotic >= ORGAN_ROBOT)) heartbeat = 1 if(M.stat == DEAD || (M.status_flags&FAKEDEATH)) sound_strength = "cannot hear" diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 12ad8359db..de3764e5af 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -276,12 +276,12 @@ if(temp.status & ORGAN_DESTROYED) wound_flavor_text["[temp.name]"] = "[T.He] [T.is] missing [T.his] [temp.name].\n" continue - if(!is_synth && temp.status & ORGAN_ROBOT) + if(!is_synth && temp.robotic >= ORGAN_ROBOT) if(!(temp.brute_dam + temp.burn_dam)) - wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a [temp.name]!\n" - continue + wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a [temp.name].\n" else - wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a [temp.name]. It has[temp.get_wounds_desc()]!\n" + wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a [temp.name]. It has [temp.get_wounds_desc()]!\n" + continue else if(temp.wounds.len > 0 || temp.open) if(temp.is_stump() && temp.parent_organ && organs_by_name[temp.parent_organ]) var/obj/item/organ/external/parent = organs_by_name[temp.parent_organ] diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 47853089cf..b5ea7931c1 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1030,7 +1030,7 @@ src << msg organ.take_damage(rand(1,3), 0, 0) - if(!(organ.status & ORGAN_ROBOT) && !should_have_organ(O_HEART)) //There is no blood in protheses. + if(!(organ.robotic >= ORGAN_ROBOT) && !(should_have_organ(O_HEART))) //There is no blood in protheses. organ.status |= ORGAN_BLEEDING src.adjustToxLoss(rand(1,3)) @@ -1216,7 +1216,7 @@ if(!affecting) . = 0 fail_msg = "They are missing that limb." - else if (affecting.status & ORGAN_ROBOT) + else if (affecting.robotic >= ORGAN_ROBOT) . = 0 fail_msg = "That limb is robotic." else @@ -1444,7 +1444,7 @@ else if(organ_check in list(O_LIVER, O_KIDNEYS)) affecting = organs_by_name[BP_GROIN] - if(affecting && (affecting.status & ORGAN_ROBOT)) + if(affecting && (affecting.robotic >= ORGAN_ROBOT)) return 0 return (species && species.has_organ[organ_check]) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 01351dcf22..994d9dd723 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -9,8 +9,8 @@ var/total_burn = 0 var/total_brute = 0 for(var/obj/item/organ/external/O in organs) //hardcoded to streamline things a bit - if((O.status & ORGAN_ROBOT) && !O.vital) - continue // Non-vital robot limbs don't count towards shock and crit + if((O.robotic >= ORGAN_ROBOT) && !O.vital) + continue //*non-vital* robot limbs don't count towards shock and crit total_brute += O.brute_dam total_burn += O.burn_dam @@ -67,7 +67,7 @@ /mob/living/carbon/human/getBruteLoss() var/amount = 0 for(var/obj/item/organ/external/O in organs) - if((O.status & ORGAN_ROBOT) && !O.vital) + if(O.robotic >= ORGAN_ROBOT) continue //robot limbs don't count towards shock and crit amount += O.brute_dam return amount @@ -75,7 +75,7 @@ /mob/living/carbon/human/getFireLoss() var/amount = 0 for(var/obj/item/organ/external/O in organs) - if((O.status & ORGAN_ROBOT) && !O.vital) + if(O.robotic >= ORGAN_ROBOT) continue //robot limbs don't count towards shock and crit amount += O.burn_dam return amount @@ -106,7 +106,7 @@ O.take_damage(amount, 0, sharp=is_sharp(damage_source), edge=has_edge(damage_source), used_weapon=damage_source) else //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. - O.heal_damage(-amount, 0, internal=0, robo_repair=(O.status & ORGAN_ROBOT)) + O.heal_damage(-amount, 0, internal=0, robo_repair=(O.robotic >= ORGAN_ROBOT)) BITSET(hud_updateflag, HEALTH_HUD) @@ -119,7 +119,7 @@ O.take_damage(0, amount, sharp=is_sharp(damage_source), edge=has_edge(damage_source), used_weapon=damage_source) else //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. - O.heal_damage(0, -amount, internal=0, robo_repair=(O.status & ORGAN_ROBOT)) + O.heal_damage(0, -amount, internal=0, robo_repair=(O.robotic >= ORGAN_ROBOT)) BITSET(hud_updateflag, HEALTH_HUD) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index cfb5058c0a..69b57ed74f 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -57,7 +57,7 @@ emp_act msg_admin_attack("[src.name] ([src.ckey]) was disarmed by a stun effect") drop_from_inventory(c_hand) - if (affected.status & ORGAN_ROBOT) + if (affected.robotic >= ORGAN_ROBOT) emote("me", 1, "drops what they were holding, their [affected.name] malfunctioning!") else var/emote_scream = pick("screams in pain and ", "lets out a sharp cry and ", "cries out and ") @@ -165,7 +165,7 @@ emp_act return 0 if(istype(I,/obj/item/weapon/card/emag)) - if(!(affecting.status & ORGAN_ROBOT)) + if(!(affecting.robotic >= ORGAN_ROBOT)) user << "\red That limb isn't robotic." return if(affecting.sabotaged) diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index e87fd83dd4..f65b9926c8 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -9,15 +9,24 @@ /mob/living/carbon/human/var/list/organs_by_name = list() // map organ names to organs /mob/living/carbon/human/var/list/internal_organs_by_name = list() // so internal organs have less ickiness too +/mob/living/carbon/human/proc/get_bodypart_name(var/zone) + var/obj/item/organ/external/E = get_organ(zone) + if(E) . = E.name + +/mob/living/carbon/human/proc/recheck_bad_external_organs() + var/damage_this_tick = getToxLoss() + for(var/obj/item/organ/external/O in organs) + damage_this_tick += O.burn_dam + O.brute_dam + + if(damage_this_tick > last_dam) + . = TRUE + last_dam = damage_this_tick + // Takes care of organ related updates, such as broken and missing limbs /mob/living/carbon/human/proc/handle_organs() - number_wounds = 0 - var/force_process = 0 - var/damage_this_tick = getBruteLoss() + getFireLoss() + getToxLoss() - if(damage_this_tick > last_dam) - force_process = 1 - last_dam = damage_this_tick + var/force_process = recheck_bad_external_organs() + if(force_process) bad_external_organs.Cut() for(var/obj/item/organ/external/Ex in organs) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 8eb61c5742..13dbd179c0 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1512,7 +1512,7 @@ var/obj/item/organ/internal/heart/H = internal_organs_by_name[O_HEART] - if(!H || (H.status & ORGAN_ROBOT)) + if(!H || (H.robotic >= ORGAN_ROBOT)) return if(pulse >= PULSE_2FAST || shock_stage >= 10 || istype(get_turf(src), /turf/space)) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index ea3a8bf3f0..088c796f28 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -247,7 +247,7 @@ var/global/list/damage_icon_parts = list() var/obj/item/organ/external/part = organs_by_name[organ_tag] if(isnull(part) || part.is_stump()) icon_key += "0" - else if(part.status & ORGAN_ROBOT) + else if(part.robotic >= ORGAN_ROBOT) icon_key += "2[part.model ? "-[part.model]": ""]" else if(part.status & ORGAN_DEAD) icon_key += "3" diff --git a/code/modules/mob/living/silicon/robot/analyzer.dm b/code/modules/mob/living/silicon/robot/analyzer.dm index 22d716aadd..19c44d2e53 100644 --- a/code/modules/mob/living/silicon/robot/analyzer.dm +++ b/code/modules/mob/living/silicon/robot/analyzer.dm @@ -75,7 +75,7 @@ var/organ_found if(H.internal_organs.len) for(var/obj/item/organ/external/E in H.organs) - if(!(E.status & ORGAN_ROBOT)) + if(!(E.robotic >= ORGAN_ROBOT)) continue organ_found = 1 user << "[E.name]: [E.brute_dam] [E.burn_dam]" @@ -86,7 +86,7 @@ organ_found = null if(H.internal_organs.len) for(var/obj/item/organ/O in H.internal_organs) - if(!(O.status & ORGAN_ROBOT)) + if(!(O.robotic >= ORGAN_ROBOT)) continue organ_found = 1 user << "[O.name]: [O.damage]" diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index bf4ea6b572..3ede3e7458 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -83,7 +83,7 @@ var/mob/living/carbon/human/H = target if(prob(poison_per_bite)) var/obj/item/organ/external/O = pick(H.organs) - if(!(O.status & ORGAN_ROBOT)) + if(!(O.robotic >= ORGAN_ROBOT)) var/eggs = PoolOrNew(/obj/effect/spider/eggcluster/, list(O, src)) O.implants += eggs @@ -213,4 +213,4 @@ #undef SPINNING_WEB #undef LAYING_EGGS #undef MOVING_TO_TARGET -#undef SPINNING_COCOON +#undef SPINNING_COCOON diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 51f223295e..612861ed8c 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -25,7 +25,7 @@ if(isnull(full_prosthetic)) robolimb_count = 0 for(var/obj/item/organ/external/E in organs) - if(E.status & ORGAN_ROBOT) + if(E.robotic >= ORGAN_ROBOT) robolimb_count++ if(robolimb_count == organs.len) full_prosthetic = 1 diff --git a/code/modules/organs/blood.dm b/code/modules/organs/blood.dm index 1bae132aed..17219a48d4 100644 --- a/code/modules/organs/blood.dm +++ b/code/modules/organs/blood.dm @@ -126,7 +126,7 @@ var/const/BLOOD_VOLUME_SURVIVE = 40 //Bleeding out var/blood_max = 0 for(var/obj/item/organ/external/temp in organs) - if(!(temp.status & ORGAN_BLEEDING) || (temp.status & ORGAN_ROBOT)) + if(!(temp.status & ORGAN_BLEEDING) || (temp.robotic >= ORGAN_ROBOT)) continue for(var/datum/wound/W in temp.wounds) if(W.bleeding()) blood_max += W.damage / 40 diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 44376e9110..49bb2af1a4 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -10,9 +10,10 @@ var/list/organ_cache = list() var/parent_organ = BP_TORSO // Organ holding this object. // Status tracking. - var/status = 0 // Various status flags (such as robotic) + var/status = 0 // Various status flags var/vital // Lose a vital limb, die immediately. var/damage = 0 // Current damage to the organ + var/robotic = 0 // Reference data. var/mob/living/carbon/human/owner // Current mob owning the organ. @@ -77,7 +78,7 @@ var/list/organ_cache = list() blood_DNA[dna.unique_enzymes] = dna.b_type /obj/item/organ/proc/die() - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return damage = max_damage status |= ORGAN_DEAD @@ -99,7 +100,7 @@ var/list/organ_cache = list() if(istype(loc,/obj/structure/closet/body_bag/cryobag) || istype(loc,/obj/structure/closet/crate/freezer) || istype(loc,/obj/item/weapon/storage/box/freezer)) return //Process infections - if ((status & ORGAN_ROBOT) || (owner && owner.species && (owner.species.flags & IS_PLANT))) + if ((robotic >= ORGAN_ROBOT) || (owner && owner.species && (owner.species.flags & IS_PLANT))) germ_level = 0 return @@ -231,7 +232,7 @@ var/list/organ_cache = list() //Note: external organs have their own version of this proc /obj/item/organ/proc/take_damage(amount, var/silent=0) - if(src.status & ORGAN_ROBOT) + if(src.robotic >= ORGAN_ROBOT) src.damage = between(0, src.damage + (amount * 0.8), max_damage) else src.damage = between(0, src.damage + amount, max_damage) @@ -243,19 +244,20 @@ var/list/organ_cache = list() owner.custom_pain("Something inside your [parent.name] hurts a lot.", 1) /obj/item/organ/proc/robotize() //Being used to make robutt hearts, etc - status = 0 - status |= ORGAN_ASSISTED - status |= ORGAN_ROBOT - + robotic = ORGAN_ROBOT + src.status &= ~ORGAN_BROKEN + src.status &= ~ORGAN_BLEEDING + src.status &= ~ORGAN_SPLINTED + src.status &= ~ORGAN_CUT_AWAY /obj/item/organ/proc/mechassist() //Used to add things like pacemakers, etc - status = 0 - status |= ORGAN_ASSISTED + robotize() + robotic = ORGAN_ASSISTED min_bruised_damage = 15 min_broken_damage = 35 /obj/item/organ/emp_act(severity) - if(!(status & ORGAN_ROBOT)) + if(!(robotic >= ORGAN_ROBOT)) return switch (severity) if (1) @@ -316,7 +318,7 @@ var/list/organ_cache = list() /obj/item/organ/proc/bitten(mob/user) - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return user << "You take an experimental bite out of \the [src]." @@ -342,9 +344,9 @@ var/list/organ_cache = list() /obj/item/organ/attack_self(mob/user as mob) // Convert it to an edible form, yum yum. - if(!(status & ORGAN_ROBOT) && user.a_intent == I_HELP && user.zone_sel.selecting == O_MOUTH) + if(!(robotic >= ORGAN_ROBOT) && user.a_intent == I_HELP && user.zone_sel.selecting == O_MOUTH) bitten(user) return /obj/item/organ/proc/can_feel_pain() - return !(status & (ORGAN_ROBOT|ORGAN_DESTROYED)) && !(species.flags & NO_PAIN) + return !(robotic >= (ORGAN_ROBOT|ORGAN_DESTROYED)) && !(species.flags & NO_PAIN) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 0a08817ef0..cc105e1bbf 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -92,7 +92,7 @@ return ..() /obj/item/organ/external/emp_act(severity) - if(!(status & ORGAN_ROBOT)) + if(!(robotic >= ORGAN_ROBOT)) return switch (severity) if (1) @@ -225,7 +225,8 @@ ****************************************************/ /obj/item/organ/external/proc/is_damageable(var/additional_damage = 0) - return (vital || brute_dam + burn_dam + additional_damage < max_damage) + //Continued damage to vital organs can kill you, and robot organs don't count towards total damage so no need to cap them. + return (vital || (robotic >= ORGAN_ROBOT) || brute_dam + burn_dam + additional_damage < max_damage) /obj/item/organ/external/take_damage(brute, burn, sharp, edge, used_weapon = null, list/forbidden_limbs = list()) if((brute <= 0) && (burn <= 0)) @@ -243,12 +244,12 @@ brute -= brute / 2 if(status & ORGAN_BROKEN && prob(40) && brute) - if(!((species.flags & NO_PAIN) || (status & ORGAN_ROBOT))) + if(!((species.flags & NO_PAIN) || (robotic >= ORGAN_ROBOT))) owner.emote("scream") //getting hit on broken hand hurts if(used_weapon) add_autopsy_data("[used_weapon]", brute + burn) - var/can_cut = (prob(brute*2) || sharp) && !(status & ORGAN_ROBOT) + var/can_cut = (prob(brute*2) || sharp) && (robotic < ORGAN_ROBOT) // If the limbs can break, make sure we don't exceed the maximum damage a limb can take before breaking // Non-vital organs are limited to max_damage. You can't kill someone by bludeonging their arm all the way to 200 -- you can @@ -330,7 +331,7 @@ return update_icon() /obj/item/organ/external/proc/heal_damage(brute, burn, internal = 0, robo_repair = 0) - if(status & ORGAN_ROBOT && !robo_repair) + if(robotic >= ORGAN_ROBOT && !robo_repair) return //Heal damage on the individual wounds @@ -355,12 +356,57 @@ var/result = update_icon() return result +//Helper proc used by various tools for repairing robot limbs +/obj/item/organ/external/proc/robo_repair(var/repair_amount, var/damage_type, var/damage_desc, obj/item/tool, mob/living/user) + if((src.robotic < ORGAN_ROBOT)) + return 0 + + var/damage_amount + switch(damage_type) + if(BRUTE) damage_amount = brute_dam + if(BURN) damage_amount = burn_dam + else return 0 + + if(!damage_amount) + user << "Nothing to fix!" + return 0 + + if(damage_amount >= ROBOLIMB_SELF_REPAIR_CAP) + user << "The damage is far too severe to patch over externally." + return 0 + + if(user == src.owner) + var/grasp + if(user.l_hand == tool && (src.body_part & (ARM_LEFT|HAND_LEFT))) + grasp = "l_hand" + else if(user.r_hand == tool && (src.body_part & (ARM_RIGHT|HAND_RIGHT))) + grasp = "r_hand" + + if(grasp) + user << "You can't reach your [src.name] while holding [tool] in your [owner.get_bodypart_name(grasp)]." + return 0 + + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) + if(!do_mob(user, owner, 10)) + user << "You must stand still to do that." + return 0 + + switch(damage_type) + if(BRUTE) src.heal_damage(repair_amount, 0, 0, 1) + if(BURN) src.heal_damage(0, repair_amount, 0, 1) + if(user == src.owner) + user.visible_message("\The [user] patches [damage_desc] on \his [src.name] with [tool].") + else + user.visible_message("\The [user] patches [damage_desc] on [owner]'s [src.name] with [tool].") + + return 1 + + /* This function completely restores a damaged organ to perfect condition. */ /obj/item/organ/external/rejuvenate(var/ignore_prosthetic_prefs) damage_state = "00" - status = 0 brute_dam = 0 burn_dam = 0 @@ -411,7 +457,7 @@ This function completely restores a damaged organ to perfect condition. //moved this before the open_wound check so that having many small wounds for example doesn't somehow protect you from taking internal damage (because of the return) //Possibly trigger an internal wound, too. var/local_damage = brute_dam + burn_dam + damage - if(damage > 15 && type != BURN && local_damage > 30 && prob(damage) && !(status & ORGAN_ROBOT)) + if(damage > 15 && type != BURN && local_damage > 30 && prob(damage) && (robotic < ORGAN_ROBOT)) var/datum/wound/internal_bleeding/I = new (min(damage - 15, 15)) wounds += I owner.custom_pain("You feel something rip in your [name]!", 1) @@ -429,7 +475,7 @@ This function completely restores a damaged organ to perfect condition. var/datum/wound/W = pick(compatible_wounds) W.open_wound(damage) if(prob(25)) - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) owner.visible_message("The damage to [owner.name]'s [name] worsens.",\ "The damage to your [name] worsens.",\ "You hear the screech of abused metal.") @@ -467,7 +513,7 @@ This function completely restores a damaged organ to perfect condition. /obj/item/organ/external/proc/need_process() if(status & (ORGAN_CUT_AWAY|ORGAN_BLEEDING|ORGAN_BROKEN|ORGAN_DESTROYED|ORGAN_SPLINTED|ORGAN_DEAD|ORGAN_MUTATED)) return 1 - if(brute_dam || burn_dam) + if((brute_dam || burn_dam) && (robotic < ORGAN_ROBOT)) //Robot limbs don't autoheal and thus don't need to process when damaged return 1 if(last_dam != brute_dam + burn_dam) // Process when we are fully healed up. last_dam = brute_dam + burn_dam @@ -523,7 +569,7 @@ Note that amputating the affected organ does in fact remove the infection from t */ /obj/item/organ/external/proc/update_germs() - if(status & (ORGAN_ROBOT) || (owner.species && owner.species.flags & IS_PLANT)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs. + if(robotic >= ORGAN_ROBOT || (owner.species && owner.species.flags & IS_PLANT)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs. germ_level = 0 return @@ -581,12 +627,12 @@ Note that amputating the affected organ does in fact remove the infection from t //spread the infection to child and parent organs if (children) for (var/obj/item/organ/external/child in children) - if (child.germ_level < germ_level && !(child.status & ORGAN_ROBOT)) + if (child.germ_level < germ_level && (child.robotic < ORGAN_ROBOT)) if (child.germ_level < INFECTION_LEVEL_ONE*2 || prob(30)) child.germ_level++ if (parent) - if (parent.germ_level < germ_level && !(parent.status & ORGAN_ROBOT)) + if (parent.germ_level < germ_level && (parent.robotic < ORGAN_ROBOT)) if (parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30)) parent.germ_level++ @@ -602,10 +648,10 @@ Note that amputating the affected organ does in fact remove the infection from t //Updating wounds. Handles wound natural I had some free spachealing, internal bleedings and infections /obj/item/organ/external/proc/update_wounds() - if((status & ORGAN_ROBOT)) //Robotic limbs don't heal or get worse. - for(var/datum/wound/W in wounds) - if(W.damage <= 0) - wounds -= W + if((robotic >= ORGAN_ROBOT)) //Robotic limbs don't heal or get worse. + for(var/datum/wound/W in wounds) //Repaired wounds disappear though + if(W.damage <= 0) //and they disappear right away + wounds -= W //TODO: robot wounds for robot limbs return for(var/datum/wound/W in wounds) @@ -675,7 +721,7 @@ Note that amputating the affected organ does in fact remove the infection from t else brute_dam += W.damage - if(!(status & ORGAN_ROBOT) && W.bleeding() && (H && H.should_have_organ(O_HEART))) + if(!(robotic >= ORGAN_ROBOT) && W.bleeding() && (H && !H.should_have_organ(O_HEART))) W.bleed_timer-- status |= ORGAN_BLEEDING @@ -688,7 +734,7 @@ Note that amputating the affected organ does in fact remove the infection from t status |= ORGAN_BLEEDING //Bone fractures - if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(status & ORGAN_ROBOT)) + if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(robotic >= ORGAN_ROBOT)) src.fracture() // new damage icon system @@ -742,7 +788,7 @@ Note that amputating the affected organ does in fact remove the infection from t switch(disintegrate) if(DROPLIMB_EDGE) if(!clean) - var/gore_sound = "[(status & ORGAN_ROBOT) ? "tortured metal" : "ripping tendons and flesh"]" + var/gore_sound = "[(robotic >= ORGAN_ROBOT) ? "tortured metal" : "ripping tendons and flesh"]" owner.visible_message( "\The [owner]'s [src.name] flies off in an arc!",\ "Your [src.name] goes flying off!",\ @@ -750,7 +796,7 @@ Note that amputating the affected organ does in fact remove the infection from t if(DROPLIMB_BURN) if(cannot_gib) return - var/gore = "[(status & ORGAN_ROBOT) ? "": " of burning flesh"]" + var/gore = "[(robotic >= ORGAN_ROBOT) ? "": " of burning flesh"]" owner.visible_message( "\The [owner]'s [src.name] flashes away into ashes!",\ "Your [src.name] flashes away into ashes!",\ @@ -758,8 +804,8 @@ Note that amputating the affected organ does in fact remove the infection from t if(DROPLIMB_BLUNT) if(cannot_gib) return - var/gore = "[(status & ORGAN_ROBOT) ? "": " in shower of gore"]" - var/gore_sound = "[(status & ORGAN_ROBOT) ? "rending sound of tortured metal" : "sickening splatter of gore"]" + var/gore = "[(robotic >= ORGAN_ROBOT) ? "": " in shower of gore"]" + var/gore_sound = "[(status >= ORGAN_ROBOT) ? "rending sound of tortured metal" : "sickening splatter of gore"]" owner.visible_message( "\The [owner]'s [src.name] explodes[gore]!",\ "Your [src.name] explodes[gore]!",\ @@ -781,7 +827,7 @@ Note that amputating the affected organ does in fact remove the infection from t parent_organ.update_damages() else var/obj/item/organ/external/stump/stump = new (victim, 0, src) - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) stump.robotize() stump.wounds |= W victim.organs |= stump @@ -813,7 +859,7 @@ Note that amputating the affected organ does in fact remove the infection from t qdel(src) if(DROPLIMB_BLUNT) var/obj/effect/decal/cleanable/blood/gibs/gore - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) gore = new /obj/effect/decal/cleanable/blood/gibs/robot(get_turf(victim)) else gore = new /obj/effect/decal/cleanable/blood/gibs(get_turf(victim)) @@ -920,7 +966,7 @@ Note that amputating the affected organ does in fact remove the infection from t return rval /obj/item/organ/external/proc/fracture() - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return //ORGAN_BROKEN doesn't have the same meaning for robot limbs if((status & ORGAN_BROKEN) || cannot_break) return @@ -960,7 +1006,7 @@ Note that amputating the affected organ does in fact remove the infection from t return /obj/item/organ/external/proc/mend_fracture() - if(status & ORGAN_ROBOT) + if(robotic >= 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 @@ -970,7 +1016,7 @@ Note that amputating the affected organ does in fact remove the infection from t /obj/item/organ/external/robotize(var/company, var/skip_prosthetics = 0, var/keep_organs = 0) - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return ..() @@ -1015,7 +1061,7 @@ Note that amputating the affected organ does in fact remove the infection from t return 1 /obj/item/organ/external/proc/mutate() - if(src.status & ORGAN_ROBOT) + if(src.robotic >= ORGAN_ROBOT) return src.status |= ORGAN_MUTATED if(owner) owner.update_body() @@ -1037,7 +1083,7 @@ Note that amputating the affected organ does in fact remove the infection from t return !is_dislocated() && !(status & (ORGAN_MUTATED|ORGAN_DEAD)) /obj/item/organ/external/proc/is_malfunctioning() - return ((status & ORGAN_ROBOT) && (brute_dam + burn_dam) >= 10 && prob(brute_dam + burn_dam)) + return ((robotic >= ORGAN_ROBOT) && (brute_dam + burn_dam) >= 10 && prob(brute_dam + burn_dam)) /obj/item/organ/external/proc/embed(var/obj/item/weapon/W, var/silent = 0) if(!owner || loc != owner) @@ -1057,7 +1103,7 @@ Note that amputating the affected organ does in fact remove the infection from t if(!owner) return - var/is_robotic = status & ORGAN_ROBOT + var/is_robotic = robotic >= ORGAN_ROBOT var/mob/living/carbon/human/victim = owner ..() @@ -1129,7 +1175,7 @@ Note that amputating the affected organ does in fact remove the infection from t if(status & ORGAN_DESTROYED && !is_stump()) . += "tear at [amputation_point] so severe that it hangs by a scrap of flesh" - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) if(brute_dam) switch(brute_dam) if(0 to 20) diff --git a/code/modules/organs/organ_icon.dm b/code/modules/organs/organ_icon.dm index 21e1e337b8..98cce7efd3 100644 --- a/code/modules/organs/organ_icon.dm +++ b/code/modules/organs/organ_icon.dm @@ -16,7 +16,7 @@ var/global/list/limb_icon_cache = list() s_tone = null s_col = null h_col = null - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return if(species && human.species && species.name != human.species.name) return @@ -30,7 +30,7 @@ var/global/list/limb_icon_cache = list() s_tone = null s_col = null h_col = null - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return if(!isnull(dna.GetUIValue(DNA_UI_SKIN_TONE)) && (species.appearance_flags & HAS_SKIN_TONE)) s_tone = dna.GetUIValue(DNA_UI_SKIN_TONE) @@ -110,7 +110,7 @@ var/global/list/limb_icon_cache = list() if(skeletal) mob_icon = new /icon('icons/mob/human_races/r_skeleton.dmi', "[icon_name][gender ? "_[gender]" : ""]") - else if (status & ORGAN_ROBOT) + else if (robotic >= ORGAN_ROBOT) mob_icon = new /icon('icons/mob/human_races/robotic.dmi', "[icon_name][gender ? "_[gender]" : ""]") else mob_icon = new /icon(species.get_icobase(owner, (status & ORGAN_MUTATED)), "[icon_name][gender ? "_[gender]" : ""]") diff --git a/code/modules/organs/organ_stump.dm b/code/modules/organs/organ_stump.dm index ef1fffd01b..3eb2c15e0a 100644 --- a/code/modules/organs/organ_stump.dm +++ b/code/modules/organs/organ_stump.dm @@ -14,7 +14,7 @@ ..(holder, internal) if(istype(limb)) max_damage = limb.max_damage - if((limb.status & ORGAN_ROBOT) && (!parent || (parent.status & ORGAN_ROBOT))) + if((limb.robotic >= ORGAN_ROBOT) && (!parent || (parent.robotic >= ORGAN_ROBOT))) robotize() //if both limb and the parent are robotic, the stump is robotic too /obj/item/organ/external/stump/is_stump() diff --git a/code/modules/organs/pain.dm b/code/modules/organs/pain.dm index 280ea53f49..ea9499fc43 100644 --- a/code/modules/organs/pain.dm +++ b/code/modules/organs/pain.dm @@ -82,7 +82,7 @@ mob/living/carbon/human/proc/handle_pain() var/maxdam = 0 var/obj/item/organ/external/damaged_organ = null for(var/obj/item/organ/external/E in organs) - if(E.status & (ORGAN_DEAD|ORGAN_ROBOT)) continue + if((E.status & ORGAN_DEAD) || E.robotic >= ORGAN_ROBOT) continue var/dam = E.get_damage() // make the choice of the organ depend on damage, // but also sometimes use one of the less damaged ones @@ -94,7 +94,7 @@ mob/living/carbon/human/proc/handle_pain() // Damage to internal organs hurts a lot. for(var/obj/item/organ/I in internal_organs) - if(I.status & (ORGAN_DEAD|ORGAN_ROBOT)) continue + if((I.status & ORGAN_DEAD) || I.robotic >= ORGAN_ROBOT) continue if(I.damage > 2) if(prob(2)) var/obj/item/organ/external/parent = get_organ(I.parent_organ) src.custom_pain("You feel a sharp pain in your [parent.name]", 1) diff --git a/code/modules/organs/subtypes/diona.dm b/code/modules/organs/subtypes/diona.dm index c74f1199e7..344ba2f05a 100644 --- a/code/modules/organs/subtypes/diona.dm +++ b/code/modules/organs/subtypes/diona.dm @@ -126,7 +126,7 @@ //DIONA ORGANS. /obj/item/organ/external/diona/removed() - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return ..() var/mob/living/carbon/human/H = owner ..() @@ -142,7 +142,7 @@ organ_tag = "special" // Turns into a nymph instantly, no transplanting possible. /obj/item/organ/internal/diona/removed(var/mob/living/user, var/skip_nymph) - if(status & ORGAN_ROBOT) + if(robotic >= ORGAN_ROBOT) return ..() var/mob/living/carbon/human/H = owner ..() diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 51ffc6f7b6..e4bbbec5f6 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -522,22 +522,16 @@ obj/structure/cable/proc/cableColor(var/colorC) var/mob/living/carbon/human/H = A var/obj/item/organ/external/S = H.organs_by_name[user.zone_sel.selecting] - if(!S || !(S.status & ORGAN_ROBOT)) + if(!S || S.robotic < ORGAN_ROBOT || S.open == 3) return ..() - if(S.burn_dam) - if(S.burn_dam < ROBOLIMB_SELF_REPAIR_CAP) - S.heal_damage(0,15,0,1) - user.visible_message("\The [user] repairs some burn damage on \the [H]'s [S.name] with \the [src].") - else if(S.open < 3) - user << "The damage is far too severe to patch over externally." - else - return ..() - else - user << "Nothing to fix!" - return - return ..() + var/use_amt = min(src.amount, ceil(S.burn_dam/3), 5) + if(can_use(use_amt)) + if(S.robo_repair(3*use_amt, BURN, "some damaged wiring", src, user)) + src.use(use_amt) + else + return ..() /obj/item/stack/cable_coil/update_icon() if (!color) diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm index 08ec5df6c5..c81a94927c 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm @@ -257,7 +257,7 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/internal/eyes/E = H.internal_organs_by_name[O_EYES] if(istype(E)) - if(E.status & ORGAN_ROBOT) + if(E.robotic >= ORGAN_ROBOT) return if(E.damage > 0) E.damage = max(E.damage - 5 * removed, 0) @@ -277,7 +277,7 @@ if(ishuman(M)) var/mob/living/carbon/human/H = M for(var/obj/item/organ/I in H.internal_organs) - if(I.status & ORGAN_ROBOT) + if(I.robotic >= ORGAN_ROBOT) continue if(I.damage > 0) //Peridaxon heals only non-robotic organs I.damage = max(I.damage - removed, 0) diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 2c8396deee..a9f02811e0 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -65,7 +65,7 @@ if(!affected) user << "\The [H] is missing that limb!" return - else if(affected.status & ORGAN_ROBOT) + else if(affected.robotic >= ORGAN_ROBOT) user << "You cannot inject a robotic limb." return diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index 7632f8456f..355f825db2 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -33,7 +33,7 @@ if(!affected) user << "\The [H] is missing that limb!" return - else if(affected.status & ORGAN_ROBOT) + else if(affected.robotic >= ORGAN_ROBOT) user << "You cannot inject a robotic limb." return diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 3c51df071e..f782b86298 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -149,7 +149,7 @@ if(!affected) user << "\The [H] is missing that limb!" return - else if(affected.status & ORGAN_ROBOT) + else if(affected.robotic >= ORGAN_ROBOT) user << "You cannot inject a robotic limb." return diff --git a/code/modules/surgery/bones.dm b/code/modules/surgery/bones.dm index ff0ea12635..cc4428fcb6 100644 --- a/code/modules/surgery/bones.dm +++ b/code/modules/surgery/bones.dm @@ -18,7 +18,7 @@ if (!hasorgans(target)) return 0 var/obj/item/organ/external/affected = target.get_organ(target_zone) - return affected && !(affected.status & ORGAN_ROBOT) && affected.open >= 2 && affected.stage == 0 + return affected && (affected.robotic < ORGAN_ROBOT) && affected.open >= 2 && affected.stage == 0 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) @@ -52,7 +52,7 @@ if (!hasorgans(target)) return 0 var/obj/item/organ/external/affected = target.get_organ(target_zone) - return affected && affected.organ_tag != BP_HEAD && !(affected.status & ORGAN_ROBOT) && affected.open >= 2 && affected.stage == 1 + return affected && affected.organ_tag != BP_HEAD && !(affected.robotic >= ORGAN_ROBOT) && affected.open >= 2 && affected.stage == 1 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) @@ -91,7 +91,7 @@ if (!hasorgans(target)) return 0 var/obj/item/organ/external/affected = target.get_organ(target_zone) - return affected && affected.organ_tag == BP_HEAD && !(affected.status & ORGAN_ROBOT) && affected.open >= 2 && affected.stage == 1 + return affected && affected.organ_tag == BP_HEAD && (affected.robotic < ORGAN_ROBOT) && affected.open >= 2 && affected.stage == 1 begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) user.visible_message("[user] is beginning to piece together [target]'s skull with \the [tool]." , \ @@ -127,7 +127,7 @@ if (!hasorgans(target)) return 0 var/obj/item/organ/external/affected = target.get_organ(target_zone) - return affected && affected.open >= 2 && !(affected.status & ORGAN_ROBOT) && affected.stage == 2 + return affected && affected.open >= 2 && !(affected.robotic >= ORGAN_ROBOT) && affected.stage == 2 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) diff --git a/code/modules/surgery/encased.dm b/code/modules/surgery/encased.dm index 1744cec3d7..81b11d12db 100644 --- a/code/modules/surgery/encased.dm +++ b/code/modules/surgery/encased.dm @@ -12,7 +12,7 @@ return 0 var/obj/item/organ/external/affected = target.get_organ(target_zone) - return affected && !(affected.status & ORGAN_ROBOT) && affected.encased && affected.open >= 2 + return affected && !(affected.robotic >= ORGAN_ROBOT) && affected.encased && affected.open >= 2 /datum/surgery_step/open_encased/saw diff --git a/code/modules/surgery/face.dm b/code/modules/surgery/face.dm index f4e723d0c6..744b1d56dd 100644 --- a/code/modules/surgery/face.dm +++ b/code/modules/surgery/face.dm @@ -10,7 +10,7 @@ if (!hasorgans(target)) return 0 var/obj/item/organ/external/affected = target.get_organ(target_zone) - if (!affected || (affected.status & ORGAN_ROBOT)) + if (!affected || (affected.robotic >= ORGAN_ROBOT)) return 0 return target_zone == O_MOUTH diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm index 697a5cf191..e6dc9d9860 100644 --- a/code/modules/surgery/generic.dm +++ b/code/modules/surgery/generic.dm @@ -17,7 +17,7 @@ return 0 if (affected.is_stump()) return 0 - if (affected.status & ORGAN_ROBOT) + if (affected.robotic >= ORGAN_ROBOT) return 0 return 1 diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm index 7ea873c8d0..88df711b47 100644 --- a/code/modules/surgery/implant.dm +++ b/code/modules/surgery/implant.dm @@ -128,7 +128,7 @@ 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)) + if (tool.w_class > get_max_wclass(affected)/2 && prob(50) && !(affected.robotic >= ORGAN_ROBOT)) user << "\red You tear some blood vessels trying to fit such a big object in this cavity." var/datum/wound/internal_bleeding/I = new (10) affected.wounds += I diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm index 9b7b006759..ccb90c20d6 100644 --- a/code/modules/surgery/organs_internal.dm +++ b/code/modules/surgery/organs_internal.dm @@ -52,7 +52,7 @@ for(var/obj/item/organ/I in affected.internal_organs) if(I && I.damage > 0) - if(!(I.status & ORGAN_ROBOT)) + if(!(I.robotic >= ORGAN_ROBOT)) 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]." ) @@ -72,7 +72,7 @@ for(var/obj/item/organ/internal/I in affected.internal_organs) if(I && I.damage > 0) - if(!(I.status & ORGAN_ROBOT)) + if(!(I.robotic >= ORGAN_ROBOT)) user.visible_message("[user] treats damage to [target]'s [I.name] with [tool_name].", \ "You treat damage to [target]'s [I.name] with [tool_name]." ) I.damage = 0 @@ -119,7 +119,7 @@ var/obj/item/organ/external/affected = target.get_organ(target_zone) - if(!(affected && !(affected.status & ORGAN_ROBOT))) + if(!(affected && !(affected.robotic >= ORGAN_ROBOT))) return 0 target.op_stage.current_organ = null @@ -234,7 +234,7 @@ if(!istype(O)) return 0 - if((affected.status & ORGAN_ROBOT) && !(O.status & ORGAN_ROBOT)) + if((affected.robotic >= ORGAN_ROBOT) && !(O.robotic >= ORGAN_ROBOT)) user << "You cannot install a naked organ into a robotic body." return SURGERY_FAILURE @@ -307,7 +307,7 @@ var/list/removable_organs = list() for(var/organ in target.internal_organs_by_name) var/obj/item/organ/I = target.internal_organs_by_name[organ] - if(istype(I) && (I.status & ORGAN_CUT_AWAY) && !(I.status & ORGAN_ROBOT) && I.parent_organ == target_zone) + if(istype(I) && (I.status & ORGAN_CUT_AWAY) && !(I.robotic >= ORGAN_ROBOT) && I.parent_organ == target_zone) removable_organs |= organ var/organ_to_replace = input(user, "Which organ do you want to reattach?") as null|anything in removable_organs diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm index 037eb933b2..cc4143658c 100644 --- a/code/modules/surgery/robotics.dm +++ b/code/modules/surgery/robotics.dm @@ -17,7 +17,7 @@ return 0 if (affected.status & ORGAN_DESTROYED) return 0 - if (!(affected.status & ORGAN_ROBOT)) + if (!(affected.robotic >= ORGAN_ROBOT)) return 0 return 1 @@ -213,7 +213,7 @@ if(!affected) return var/is_organ_damaged = 0 for(var/obj/item/organ/I in affected.internal_organs) - if(I.damage > 0 && (I.status & ORGAN_ROBOT)) + if(I.damage > 0 && (I.robotic >= ORGAN_ROBOT)) is_organ_damaged = 1 break return affected.open == 3 && is_organ_damaged @@ -226,7 +226,7 @@ for(var/obj/item/organ/I in affected.internal_organs) if(I && I.damage > 0) - if(I.status & ORGAN_ROBOT) + if(I.robotic >= ORGAN_ROBOT) user.visible_message("[user] starts mending the damage to [target]'s [I.name]'s mechanisms.", \ "You start mending the damage to [target]'s [I.name]'s mechanisms." ) @@ -242,7 +242,7 @@ for(var/obj/item/organ/I in affected.internal_organs) if(I && I.damage > 0) - if(I.status & ORGAN_ROBOT) + if(I.robotic >= ORGAN_ROBOT) user.visible_message("[user] repairs [target]'s [I.name] with [tool].", \ "You repair [target]'s [I.name] with [tool]." ) I.damage = 0 @@ -277,7 +277,7 @@ 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) - if(!(affected && (affected.status & ORGAN_ROBOT))) + if(!(affected && (affected.robotic >= ORGAN_ROBOT))) return 0 if(affected.open < 3) return 0 @@ -326,7 +326,7 @@ 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) - if(!(affected && (affected.status & ORGAN_ROBOT))) + if(!(affected && (affected.robotic >= ORGAN_ROBOT))) return 0 if(affected.open < 3) return 0 @@ -336,7 +336,7 @@ var/list/removable_organs = list() for(var/organ in target.internal_organs_by_name) var/obj/item/organ/I = target.internal_organs_by_name[organ] - if(I && (I.status & ORGAN_CUT_AWAY) && (I.status & ORGAN_ROBOT) && I.parent_organ == target_zone) + if(I && (I.status & ORGAN_CUT_AWAY) && (I.robotic >= ORGAN_ROBOT) && I.parent_organ == target_zone) removable_organs |= organ var/organ_to_replace = input(user, "Which organ do you want to reattach?") as null|anything in removable_organs @@ -388,12 +388,11 @@ user << "That brain is not usable." return SURGERY_FAILURE - if(!(affected.status & ORGAN_ROBOT)) + if(!(affected.robotic >= ORGAN_ROBOT)) user << "You cannot install a computer brain into a meat skull." return SURGERY_FAILURE if(!target.should_have_organ("brain")) - user << "You're pretty sure [target.species.name_plural] don't normally have a brain." return SURGERY_FAILURE