From 31b336da6447bc65278063d1e2d829941bf543a8 Mon Sep 17 00:00:00 2001 From: Charlie <69320440+hal9000PR@users.noreply.github.com> Date: Wed, 1 Dec 2021 21:17:44 +0000 Subject: [PATCH] minor external organ refactor (#16183) Co-authored-by: SabreML <57483089+SabreML@users.noreply.github.com> Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com> --- code/__DEFINES/mobs.dm | 16 ++-- code/__HELPERS/traits.dm | 3 + code/_globalvars/traits.dm | 3 + code/datums/status_effects/buffs.dm | 4 +- code/game/gamemodes/cult/runes.dm | 2 +- .../vampire/vampire_powers/vampire_powers.dm | 2 +- code/game/machinery/adv_med.dm | 4 +- code/game/objects/items/devices/scanners.dm | 4 +- code/modules/mob/living/carbon/human/death.dm | 6 +- .../mob/living/carbon/human/examine.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 23 +++--- .../mob/living/carbon/human/human_damage.dm | 1 + .../mob/living/carbon/human/human_defense.dm | 2 +- .../living/carbon/human/species/_species.dm | 5 +- .../mob/living/carbon/human/species/golem.dm | 20 +---- .../mob/living/carbon/human/species/slime.dm | 16 +--- .../reagents/chemistry/reagents/admin.dm | 2 +- .../reagents/chemistry/reagents/medicine.dm | 4 +- code/modules/surgery/bones.dm | 6 +- code/modules/surgery/cavity_implant.dm | 3 +- code/modules/surgery/generic.dm | 4 +- code/modules/surgery/limb_reattach.dm | 4 +- code/modules/surgery/organs/blood.dm | 2 +- code/modules/surgery/organs/organ_external.dm | 54 ++++++++----- .../surgery/organs/subtypes/standard.dm | 5 +- .../surgery/organs/subtypes/unbreakable.dm | 78 ------------------- code/modules/surgery/other.dm | 15 ++-- code/modules/surgery/plastic_surgery.dm | 4 +- code/modules/surgery/robotics.dm | 8 +- paradise.dme | 1 - 30 files changed, 116 insertions(+), 187 deletions(-) delete mode 100644 code/modules/surgery/organs/subtypes/unbreakable.dm diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 561c8720750..c3ce1dcd0f2 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -1,11 +1,17 @@ ///////////////////ORGAN DEFINES/////////////////// // Organ defines. -#define ORGAN_BROKEN 1 -#define ORGAN_ROBOT 2 -#define ORGAN_SPLINTED 4 -#define ORGAN_DEAD 8 -#define ORGAN_MUTATED 16 +#define ORGAN_BROKEN (1 << 0) +#define ORGAN_ROBOT (1 << 1) +#define ORGAN_SPLINTED (1 << 2) +#define ORGAN_DEAD (1 << 3) +#define ORGAN_MUTATED (1 << 4) +#define ORGAN_INT_BLEEDING (1 << 5) +#define ORGAN_DISFIGURED (1 << 6) + +// For limb resistance flags +#define CANNOT_BREAK (1 << 0) +#define CANNOT_DISMEMBER (1 << 1) #define PROCESS_ACCURACY 10 diff --git a/code/__HELPERS/traits.dm b/code/__HELPERS/traits.dm index b74d8a154dd..9e9ba078cc5 100644 --- a/code/__HELPERS/traits.dm +++ b/code/__HELPERS/traits.dm @@ -168,6 +168,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_FLASH_PROTECTION "flash_protection" #define TRAIT_NIGHT_VISION "night_vision" +#define TRAIT_NO_BONES "no_bones" +#define TRAIT_STURDY_LIMBS "sturdy_limbs" + #define TRAIT_COMIC_SANS "comic_sans" #define TRAIT_NOFINGERPRINTS "no_fingerprints" #define TRAIT_SLOWDIGESTION "slow_digestion" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 3a5e3c73130..8f20a290658 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -50,6 +50,9 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_FLASH_PROTECTION" = TRAIT_FLASH_PROTECTION, "TRAIT_NIGHT_VISION" = TRAIT_NIGHT_VISION, + "TRAIT_NO_BONES" = TRAIT_NO_BONES, + "TRAIT_STURDY_LIMBS" = TRAIT_STURDY_LIMBS, + "TRAIT_COMIC_SANS" = TRAIT_COMIC_SANS, "TRAIT_NOFINGERPRINTS" = TRAIT_NOFINGERPRINTS, "TRAIT_SLOWDIGESTION" = TRAIT_SLOWDIGESTION, diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index c71e2379c24..249f0510a0f 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -305,7 +305,7 @@ for(var/obj/item/organ/external/E in H.bodyparts) if(prob(10)) E.mend_fracture() - E.internal_bleeding = FALSE + E.fix_internal_bleeding() heal_points-- else if(issilicon(L)) L.adjustBruteLoss(-3.5) @@ -339,7 +339,7 @@ H.bodytemperature = H.dna.species.body_temperature for(var/thing in H.bodyparts) var/obj/item/organ/external/E = thing - E.internal_bleeding = FALSE + E.fix_internal_bleeding() E.mend_fracture() else owner.bodytemperature = BODYTEMP_NORMAL diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 9129f928888..ecca69e9743 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -346,7 +346,7 @@ structure_check() searches for nearby cultist structures required for the invoca "Your wounds have been healed. Now spread the blood to others.") for(var/obj/item/organ/external/E in H.bodyparts) E.mend_fracture() - E.internal_bleeding = FALSE + E.fix_internal_bleeding() for(var/datum/disease/critical/crit in H.viruses) // cure all crit conditions crit.cure() diff --git a/code/game/gamemodes/vampire/vampire_powers/vampire_powers.dm b/code/game/gamemodes/vampire/vampire_powers/vampire_powers.dm index 45fe711aeb2..ea89c3c91cd 100644 --- a/code/game/gamemodes/vampire/vampire_powers/vampire_powers.dm +++ b/code/game/gamemodes/vampire/vampire_powers/vampire_powers.dm @@ -314,7 +314,7 @@ for(var/obj/item/organ/external/E in H.bodyparts) if(prob(25)) E.mend_fracture() - E.internal_bleeding = FALSE + E.fix_internal_bleeding() return if(H.stat != DEAD) diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 52857a071dc..1e046b4b268 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -306,7 +306,7 @@ if(istype(E, /obj/item/organ/external/chest) && occupant.is_lung_ruptured()) organData["lungRuptured"] = TRUE - if(E.internal_bleeding) + if(E.status & ORGAN_INT_BLEEDING) organData["internalBleeding"] = TRUE extOrganData.Add(list(organData)) @@ -454,7 +454,7 @@ var/splint = "" var/internal_bleeding = "" var/lung_ruptured = "" - if(e.internal_bleeding) + if(e.status & ORGAN_INT_BLEEDING) internal_bleeding = "
Internal bleeding" if(istype(e, /obj/item/organ/external/chest) && occupant.is_lung_ruptured()) lung_ruptured = "Lung ruptured:" diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index f2cf6f158c3..5862cf0f57c 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -225,7 +225,7 @@ REAGENT SCANNER to_chat(user, "Bone fractures detected. Advanced scanner required for location.") break for(var/obj/item/organ/external/e in H.bodyparts) - if(e.internal_bleeding) + if(e.status & ORGAN_INT_BLEEDING) to_chat(user, "Internal bleeding detected. Advanced scanner required for location.") break var/blood_id = H.get_blood_id() @@ -794,7 +794,7 @@ REAGENT SCANNER var/splint = "" var/internal_bleeding = "" var/lung_ruptured = "" - if(e.internal_bleeding) + if(e.status & ORGAN_INT_BLEEDING) internal_bleeding = "
Internal bleeding" if(istype(e, /obj/item/organ/external/chest) && target.is_lung_ruptured()) lung_ruptured = "Lung ruptured:" diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index fd2f8bcb1b2..8c2fa14dc78 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -124,7 +124,7 @@ var/obj/item/organ/external/head/H = get_organ("head") if(istype(H)) - H.disfigured = TRUE + H.status |= ORGAN_DISFIGURED if(H.f_style) H.f_style = initial(H.f_style) if(H.h_style) @@ -150,7 +150,7 @@ ADD_TRAIT(src, TRAIT_HUSK, source) var/obj/item/organ/external/head/H = bodyparts_by_name["head"] if(istype(H)) - H.disfigured = TRUE //makes them unknown without fucking up other stuff like admintools + H.status |= ORGAN_DISFIGURED //makes them unknown without fucking up other stuff like admintools if(H.f_style) H.f_style = "Shaved" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE if(H.h_style) @@ -172,7 +172,7 @@ if(!HAS_TRAIT(src, TRAIT_HUSK)) var/obj/item/organ/external/head/H = bodyparts_by_name["head"] if(istype(H)) - H.disfigured = FALSE + H.status &= ~ORGAN_DISFIGURED update_body() update_mutantrace() UpdateAppearance() // reset hair from DNA diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index cc85d785a86..2a7ac81935b 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -398,7 +398,7 @@ if(print_flavor_text() && !skipface) if(get_organ("head")) var/obj/item/organ/external/head/H = get_organ("head") - if(!H.disfigured) + if(!(H.status & ORGAN_DISFIGURED)) msg += "[print_flavor_text()]\n" msg += "*---------*" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index d8318d859da..68e29086ce1 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -484,7 +484,7 @@ //Returns "Unknown" if facially disfigured and real_name if not. Useful for setting name when polyacided or when updating a human's name variable /mob/living/carbon/human/proc/get_face_name() var/obj/item/organ/external/head = get_organ("head") - if(!head || head.disfigured || cloneloss > 50 || !real_name || HAS_TRAIT(src, TRAIT_HUSK)) //disfigured. use id-name if possible + if(!head || (head.status & ORGAN_DISFIGURED) || cloneloss > 50 || !real_name || HAS_TRAIT(src, TRAIT_HUSK)) //disfigured. use id-name if possible return "Unknown" return real_name @@ -1269,16 +1269,19 @@ item_flags[I] = I.flags I.flags = 0 // Temporary set the flags to 0 + if(!transformation) //Distinguish between creating a mob and switching species + dna.species.on_species_gain(src) + if(retain_damage) //Create a list of body parts which are damaged by burn or brute and save them to apply after new organs are generated. First we just handle external organs. var/bodypart_damages = list() //Loop through all external organs and save the damage states for brute and burn - for(var/obj/item/organ/external/E in bodyparts) - if(E.brute_dam == 0 && E.burn_dam == 0 && E.internal_bleeding == FALSE) //If there's no damage we don't bother remembering it. + for(var/obj/item/organ/external/E as anything in bodyparts) + if(E.brute_dam == 0 && E.burn_dam == 0 && !(E.status & ORGAN_INT_BLEEDING)) //If there's no damage we don't bother remembering it. continue var/brute = E.brute_dam var/burn = E.burn_dam - var/IB = E.internal_bleeding + var/IB = (E.status & ORGAN_INT_BLEEDING) var/obj/item/organ/external/OE = new E.type() var/stats = list(OE, brute, burn, IB) bodypart_damages += list(stats) @@ -1298,17 +1301,16 @@ dna.species.create_organs(src) //Apply relevant damages and variables to the new organs. - for(var/B in bodyparts) - var/obj/item/organ/external/E = B + for(var/obj/item/organ/external/E as anything in bodyparts) for(var/list/part in bodypart_damages) var/obj/item/organ/external/OE = part[1] if((E.type == OE.type)) // Type has to be explicit, as right limbs are a child of left ones etc. var/brute = part[2] var/burn = part[3] - var/IB = part[4] - //Deal the damage to the new organ and then delete the entry to prevent duplicate checks + var/IB = part[4] //Deal the damage to the new organ and then delete the entry to prevent duplicate checks + if(IB) + E.status |= ORGAN_INT_BLEEDING E.receive_damage(brute, burn, ignore_resists = TRUE) - E.internal_bleeding = IB qdel(part) for(var/O in internal_organs) @@ -1372,9 +1374,6 @@ dna.real_name = real_name - if (!transformation) //Distinguish between creating a mob and switching species - dna.species.on_species_gain(src) - update_sight() dna.species.handle_dna(src) //Give them whatever special dna business they got. diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 855c7bc7d19..c6741365b0e 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -304,6 +304,7 @@ This function restores all organs. /mob/living/carbon/human/restore_all_organs() for(var/obj/item/organ/external/current_organ in bodyparts) current_organ.rejuvenate() + current_organ.add_limb_flags() /mob/living/carbon/human/proc/HealDamage(zone, brute, burn) var/obj/item/organ/external/E = get_organ(zone) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 36f2580aede..29708f16c78 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -125,7 +125,7 @@ emp_act /mob/living/carbon/human/check_projectile_dismemberment(obj/item/projectile/P, def_zone) var/obj/item/organ/external/affecting = get_organ(check_zone(def_zone)) - if(affecting && !affecting.cannot_amputate && affecting.get_damage() >= (affecting.max_damage - P.dismemberment)) + if(affecting && !(affecting.limb_flags & CANNOT_DISMEMBER) && affecting.get_damage() >= (affecting.max_damage - P.dismemberment)) var/damtype = DROPLIMB_SHARP if(!P.sharp) switch(P.damage_type) diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index 5be9db1f14e..fc0335976e6 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -202,8 +202,9 @@ for(var/name in H.bodyparts_by_name) H.bodyparts |= H.bodyparts_by_name[name] - for(var/obj/item/organ/external/O in H.bodyparts) - O.owner = H + for(var/obj/item/organ/external/E as anything in H.bodyparts) + E.owner = H + E.add_limb_flags() /datum/species/proc/create_mutant_organs(mob/living/carbon/human/H) var/obj/item/organ/internal/ears/ears = H.get_int_organ(/obj/item/organ/internal/ears) diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm index d3bf2007322..6cb2dc54bd2 100644 --- a/code/modules/mob/living/carbon/human/species/golem.dm +++ b/code/modules/mob/living/carbon/human/species/golem.dm @@ -5,7 +5,7 @@ icobase = 'icons/mob/human_races/r_golem.dmi' species_traits = list(NO_BLOOD, NO_HAIR) - inherent_traits = list(TRAIT_RESISTHEAT, TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_NOFIRE, TRAIT_CHUNKYFINGERS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN) + inherent_traits = list(TRAIT_RESISTHEAT, TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_NOFIRE, TRAIT_CHUNKYFINGERS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN, TRAIT_NO_BONES, TRAIT_STURDY_LIMBS) inherent_biotypes = MOB_HUMANOID | MOB_MINERAL dies_at_threshold = TRUE speed_mod = 2 @@ -33,18 +33,6 @@ "adamantine_resonator" = /obj/item/organ/internal/adamantine_resonator ) //Has standard darksight of 2. - has_limbs = list( - "chest" = list("path" = /obj/item/organ/external/chest/unbreakable/sturdy), - "groin" = list("path" = /obj/item/organ/external/groin/unbreakable/sturdy), - "head" = list("path" = /obj/item/organ/external/head/unbreakable/sturdy), - "l_arm" = list("path" = /obj/item/organ/external/arm/unbreakable/sturdy), - "r_arm" = list("path" = /obj/item/organ/external/arm/right/unbreakable/sturdy), - "l_leg" = list("path" = /obj/item/organ/external/leg/unbreakable/sturdy), - "r_leg" = list("path" = /obj/item/organ/external/leg/right/unbreakable/sturdy), - "l_hand" = list("path" = /obj/item/organ/external/hand/unbreakable/sturdy), - "r_hand" = list("path" = /obj/item/organ/external/hand/right/unbreakable/sturdy), - "l_foot" = list("path" = /obj/item/organ/external/foot/unbreakable/sturdy), - "r_foot" = list("path" = /obj/item/organ/external/foot/right/unbreakable/sturdy)) suicide_messages = list( "is crumbling into dust!", @@ -123,7 +111,7 @@ name = "Plasma Golem" skinned_type = /obj/item/stack/ore/plasma //Can burn and takes damage from heat - inherent_traits = list(TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_CHUNKYFINGERS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN) //no RESISTHEAT, NOFIRE + inherent_traits = list(TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_CHUNKYFINGERS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN, TRAIT_NO_BONES, TRAIT_STURDY_LIMBS) //no RESISTHEAT, NOFIRE golem_colour = rgb(170, 51, 221) info_text = "As a Plasma Golem, you burn easily. Be careful, if you get hot enough while burning, you'll blow up!" heatmod = 0 //fine until they blow up @@ -301,7 +289,7 @@ golem_colour = rgb(158, 112, 75) skinned_type = /obj/item/stack/sheet/wood //Can burn and take damage from heat - inherent_traits = list(TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_CHUNKYFINGERS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN) + inherent_traits = list(TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_CHUNKYFINGERS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN, TRAIT_NO_BONES, TRAIT_STURDY_LIMBS) inherent_biotypes = MOB_ORGANIC | MOB_HUMANOID | MOB_PLANT armor = 30 burn_mod = 1.25 @@ -575,7 +563,7 @@ prefix = "Bananium" special_names = null unarmed_type = /datum/unarmed_attack/golem/bananium - inherent_traits = list(TRAIT_RESISTHEAT, TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_NOFIRE, TRAIT_CHUNKYFINGERS, TRAIT_CLUMSY, TRAIT_COMIC_SANS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN) + inherent_traits = list(TRAIT_RESISTHEAT, TRAIT_NOBREATH, TRAIT_RESISTCOLD, TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_NOFIRE, TRAIT_CHUNKYFINGERS, TRAIT_CLUMSY, TRAIT_COMIC_SANS, TRAIT_RADIMMUNE, TRAIT_PIERCEIMMUNE, TRAIT_NOPAIN, TRAIT_NO_BONES, TRAIT_STURDY_LIMBS) var/last_honk = 0 var/honkooldown = 0 var/last_banana = 0 diff --git a/code/modules/mob/living/carbon/human/species/slime.dm b/code/modules/mob/living/carbon/human/species/slime.dm index 59dc44026ee..f861897d433 100644 --- a/code/modules/mob/living/carbon/human/species/slime.dm +++ b/code/modules/mob/living/carbon/human/species/slime.dm @@ -26,7 +26,7 @@ female_cough_sounds = list('sound/effects/slime_squish.ogg') species_traits = list(LIPS, IS_WHITELISTED, NO_CLONESCAN, EXOTIC_COLOR) - inherent_traits = list(TRAIT_WATERBREATH) + inherent_traits = list(TRAIT_WATERBREATH, TRAIT_NO_BONES) clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS bodyflags = HAS_SKIN_COLOR | NO_EYES dietflags = DIET_CARN @@ -46,19 +46,6 @@ "lungs" = /obj/item/organ/internal/lungs/slime ) mutantears = null - has_limbs = list( - "chest" = list("path" = /obj/item/organ/external/chest/unbreakable), - "groin" = list("path" = /obj/item/organ/external/groin/unbreakable), - "head" = list("path" = /obj/item/organ/external/head/unbreakable), - "l_arm" = list("path" = /obj/item/organ/external/arm/unbreakable), - "r_arm" = list("path" = /obj/item/organ/external/arm/right/unbreakable), - "l_leg" = list("path" = /obj/item/organ/external/leg/unbreakable), - "r_leg" = list("path" = /obj/item/organ/external/leg/right/unbreakable), - "l_hand" = list("path" = /obj/item/organ/external/hand/unbreakable), - "r_hand" = list("path" = /obj/item/organ/external/hand/right/unbreakable), - "l_foot" = list("path" = /obj/item/organ/external/foot/unbreakable), - "r_foot" = list("path" = /obj/item/organ/external/foot/right/unbreakable) - ) suicide_messages = list( "is melting into a puddle!", "is ripping out their own core!", @@ -203,6 +190,7 @@ H.UpdateDamageIcon() H.adjust_nutrition(-SLIMEPERSON_HUNGERCOST) H.visible_message("[H] finishes regrowing [H.p_their()] missing [new_limb]!", "You finish regrowing your [limb_select]") + new_limb.add_limb_flags() else to_chat(H, "You need to hold still in order to regrow a limb!") diff --git a/code/modules/reagents/chemistry/reagents/admin.dm b/code/modules/reagents/chemistry/reagents/admin.dm index c4faf9e86a7..af2926e0779 100644 --- a/code/modules/reagents/chemistry/reagents/admin.dm +++ b/code/modules/reagents/chemistry/reagents/admin.dm @@ -23,7 +23,7 @@ I.receive_damage(-5, FALSE) for(var/obj/item/organ/external/E in H.bodyparts) E.mend_fracture() - E.internal_bleeding = FALSE + E.fix_internal_bleeding() M.SetEyeBlind(0, FALSE) M.cure_nearsighted(null, FALSE) M.cure_blind(null, FALSE) diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index e5cbdbd3f08..78862b99425 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -138,7 +138,7 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/head/head = H.get_organ("head") if(head) - head.disfigured = FALSE + head.status &= ~ORGAN_DISFIGURED return ..() | update_flags /datum/reagent/medicine/rezadone @@ -161,7 +161,7 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/head/head = H.get_organ("head") if(head) - head.disfigured = FALSE + head.status &= ~ORGAN_DISFIGURED return ..() | update_flags /datum/reagent/medicine/rezadone/overdose_process(mob/living/M, severity) diff --git a/code/modules/surgery/bones.dm b/code/modules/surgery/bones.dm index 533314d715f..16d69b6da49 100644 --- a/code/modules/surgery/bones.dm +++ b/code/modules/surgery/bones.dm @@ -21,8 +21,8 @@ return 0 if(affected.is_robotic()) return 0 - if(affected.cannot_break) - return 0 + if(affected.limb_flags & CANNOT_BREAK) + return FALSE if(affected.status & ORGAN_BROKEN) return 1 return 1 @@ -43,7 +43,7 @@ /datum/surgery_step/glue_bone/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/obj/item/organ/external/affected = target.get_organ(target_zone) - return affected && !affected.is_robotic() && !(affected.cannot_break) + return affected && !affected.is_robotic() && !(affected.limb_flags & CANNOT_BREAK) /datum/surgery_step/glue_bone/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/cavity_implant.dm b/code/modules/surgery/cavity_implant.dm index d7b7621e9c0..dd705b54c0c 100644 --- a/code/modules/surgery/cavity_implant.dm +++ b/code/modules/surgery/cavity_implant.dm @@ -189,8 +189,7 @@ " You put \the [tool] inside [target]'s [get_cavity(affected)] cavity." ) if((tool.w_class > get_max_wclass(affected) / 2 && prob(50) && !affected.is_robotic())) to_chat(user, " You tear some vessels trying to fit the object in the cavity.") - affected.internal_bleeding = TRUE - affected.owner.custom_pain("You feel something rip in your [affected.name]!") + affected.cause_internal_bleeding() user.drop_item() affected.hidden = tool tool.forceMove(affected) diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm index 39c21bf1ee1..3d84525e5c4 100644 --- a/code/modules/surgery/generic.dm +++ b/code/modules/surgery/generic.dm @@ -213,7 +213,9 @@ var/obj/item/organ/external/affected = target.get_organ(target_zone) if(affected == null) return 0 - return !affected.cannot_amputate + if(affected.limb_flags & CANNOT_DISMEMBER) + return FALSE + return TRUE /datum/surgery_step/generic/amputate/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery) var/obj/item/organ/external/affected = target.get_organ(target_zone) diff --git a/code/modules/surgery/limb_reattach.dm b/code/modules/surgery/limb_reattach.dm index c43c3f373d5..8913220803c 100644 --- a/code/modules/surgery/limb_reattach.dm +++ b/code/modules/surgery/limb_reattach.dm @@ -17,8 +17,8 @@ return 0 if(affected.is_robotic()) return 0 - if(affected.cannot_amputate) - return 0 + if(affected.limb_flags & CANNOT_DISMEMBER) + return FALSE return 1 diff --git a/code/modules/surgery/organs/blood.dm b/code/modules/surgery/organs/blood.dm index 2fd179caad9..d01a1fb8392 100644 --- a/code/modules/surgery/organs/blood.dm +++ b/code/modules/surgery/organs/blood.dm @@ -67,7 +67,7 @@ if(BP.open) temp_bleed += 0.5 - if(BP.internal_bleeding) + if(BP.status & ORGAN_INT_BLEEDING) internal_bleeding_rate += 0.5 bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects naturally decreases diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 1f6dde3146a..f84219fc898 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -26,9 +26,7 @@ var/icon/mob_icon var/gendered_icon = 0 var/limb_name - var/disfigured = 0 - var/cannot_amputate - var/cannot_break + var/limb_flags var/s_tone = null var/s_col = null // If this is instantiated, it should be a hex value. var/list/child_icons = list() @@ -54,7 +52,6 @@ var/obj/item/hidden = null var/list/embedded_objects = list() - var/internal_bleeding = FALSE var/amputation_point // Descriptive string used in amputation. var/can_grasp var/can_stand @@ -105,13 +102,22 @@ /obj/item/organ/external/New(mob/living/carbon/holder) ..() - var/mob/living/carbon/human/H = holder - icobase = dna.species.icobase - if(istype(H)) + if(ishuman(holder)) + var/mob/living/carbon/human/H = holder + icobase = H.dna.species.icobase replaced(H) sync_colour_to_human(H) get_icon() + +/obj/item/organ/external/proc/add_limb_flags() + if(HAS_TRAIT(owner, TRAIT_NO_BONES)) + limb_flags |= CANNOT_BREAK + + if(HAS_TRAIT(owner, TRAIT_STURDY_LIMBS)) + limb_flags |= CANNOT_DISMEMBER + + /obj/item/organ/external/replaced(mob/living/carbon/human/target) owner = target loc = null @@ -227,7 +233,7 @@ var/mob/living/carbon/owner_old = owner //Need to update health, but need a reference in case the below check cuts off a limb. //If limb took enough damage, try to cut or tear it off if(owner) - if(!cannot_amputate && (brute_dam) >= (max_damage)) + if(!(limb_flags & CANNOT_DISMEMBER) && brute_dam >= max_damage) if(prob(brute / 2)) if(sharp) droplimb(0, DROPLIMB_SHARP) @@ -297,8 +303,6 @@ This function completely restores a damaged organ to perfect condition. brute_dam = 0 burn_dam = 0 open = 0 //Closing all wounds. - internal_bleeding = FALSE - disfigured = FALSE // handle internal organs for(var/obj/item/organ/internal/current_organ in internal_organs) @@ -408,9 +412,8 @@ Note that amputating the affected organ does in fact remove the infection from t if(owner && (NO_BLOOD in owner.dna.species.species_traits)) return var/local_damage = brute_dam + damage - if(damage > 15 && local_damage > 30 && prob(damage) && !is_robotic()) - internal_bleeding = TRUE - owner.custom_pain("You feel something rip in your [name]!") + if(damage > 15 && local_damage > 30 && prob(damage)) + cause_internal_bleeding() // new damage icon system // returns just the brute/burn damage code @@ -456,7 +459,7 @@ Note that amputating the affected organ does in fact remove the infection from t //Handles dismemberment /obj/item/organ/external/proc/droplimb(clean, disintegrate, ignore_children, nodamage) - if(cannot_amputate || !owner) + if(limb_flags & CANNOT_DISMEMBER || !owner) return if(!disintegrate) @@ -605,7 +608,7 @@ Note that amputating the affected organ does in fact remove the infection from t if(is_robotic()) return //ORGAN_BROKEN doesn't have the same meaning for robot limbs - if((status & ORGAN_BROKEN) || cannot_break) + if((status & ORGAN_BROKEN) || (limb_flags & CANNOT_BREAK)) return if(owner) owner.visible_message(\ @@ -638,6 +641,20 @@ Note that amputating the affected organ does in fact remove the infection from t owner.handle_splints() return TRUE +/obj/item/organ/external/proc/cause_internal_bleeding() + if(is_robotic()) + return + if(HAS_TRAIT(owner, NO_BLOOD)) + return + status |= ORGAN_INT_BLEEDING + owner.custom_pain("You feel something rip in your [name]!") + +/obj/item/organ/external/proc/fix_internal_bleeding() + if(is_robotic()) + return + status &= ~ORGAN_INT_BLEEDING + perma_injury = 0 + /obj/item/organ/external/robotize(company, make_tough = 0, convert_all = 1) ..() //robot limbs take reduced damage @@ -654,7 +671,7 @@ Note that amputating the affected organ does in fact remove the infection from t if(company && istext(company)) set_company(company) - cannot_break = 1 + limb_flags |= CANNOT_BREAK get_icon() for(var/obj/item/organ/external/T in children) if((convert_all) || (T.type in convertable_children)) @@ -738,13 +755,14 @@ Note that amputating the affected organ does in fact remove the infection from t qdel(src) /obj/item/organ/external/proc/disfigure() - if(disfigured) + if(status & ORGAN_DISFIGURED) return if(owner) owner.visible_message("You hear a sickening sound coming from \the [owner]'s [name] as it turns into a mangled mess!", \ "Your [name] becomes a mangled mess!", \ "You hear a sickening sound.") - disfigured = TRUE + + status |= ORGAN_DISFIGURED /obj/item/organ/external/is_primary_organ(mob/living/carbon/human/O = null) if(isnull(O)) diff --git a/code/modules/surgery/organs/subtypes/standard.dm b/code/modules/surgery/organs/subtypes/standard.dm index f992c31fd77..0f5f306d075 100644 --- a/code/modules/surgery/organs/subtypes/standard.dm +++ b/code/modules/surgery/organs/subtypes/standard.dm @@ -255,9 +255,8 @@ /obj/item/organ/external/head/receive_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list(), ignore_resists = FALSE, updating_health = TRUE) ..() - if(!disfigured) - if(brute_dam + burn_dam > 50) - disfigure() + if(brute_dam + burn_dam > 50 && !(status & ORGAN_DISFIGURED)) + disfigure() /obj/item/organ/external/head/proc/handle_alt_icon() if(alt_head && GLOB.alt_heads_list[alt_head]) diff --git a/code/modules/surgery/organs/subtypes/unbreakable.dm b/code/modules/surgery/organs/subtypes/unbreakable.dm deleted file mode 100644 index 6e1c484e586..00000000000 --- a/code/modules/surgery/organs/subtypes/unbreakable.dm +++ /dev/null @@ -1,78 +0,0 @@ -/obj/item/organ/external/chest/unbreakable - cannot_break = TRUE - encased = null - convertable_children = list(/obj/item/organ/external/groin/unbreakable) - -/obj/item/organ/external/groin/unbreakable - cannot_break = TRUE - -/obj/item/organ/external/arm/unbreakable - cannot_break = TRUE - convertable_children = list(/obj/item/organ/external/hand/unbreakable) - -/obj/item/organ/external/arm/right/unbreakable - cannot_break = TRUE - convertable_children = list(/obj/item/organ/external/hand/right/unbreakable) - -/obj/item/organ/external/leg/unbreakable - cannot_break = TRUE - convertable_children = list(/obj/item/organ/external/foot/unbreakable) - -/obj/item/organ/external/leg/right/unbreakable - cannot_break = TRUE - convertable_children = list(/obj/item/organ/external/foot/right/unbreakable) - -/obj/item/organ/external/foot/unbreakable - cannot_break = TRUE - -/obj/item/organ/external/foot/right/unbreakable - cannot_break = TRUE - -/obj/item/organ/external/hand/unbreakable - cannot_break = TRUE - -/obj/item/organ/external/hand/right/unbreakable - cannot_break = TRUE - -/obj/item/organ/external/head/unbreakable - cannot_break = TRUE - encased = null - -// Cannot dismember or break -/obj/item/organ/external/chest/unbreakable/sturdy - cannot_amputate = TRUE - convertable_children = list(/obj/item/organ/external/groin/unbreakable/sturdy) - -/obj/item/organ/external/groin/unbreakable/sturdy - cannot_amputate = TRUE - -/obj/item/organ/external/arm/unbreakable/sturdy - cannot_amputate = TRUE - convertable_children = list(/obj/item/organ/external/hand/unbreakable/sturdy) - -/obj/item/organ/external/arm/right/unbreakable/sturdy - cannot_amputate = TRUE - convertable_children = list(/obj/item/organ/external/hand/right/unbreakable/sturdy) - -/obj/item/organ/external/leg/unbreakable/sturdy - cannot_amputate = TRUE - convertable_children = list(/obj/item/organ/external/foot/unbreakable/sturdy) - -/obj/item/organ/external/leg/right/unbreakable/sturdy - cannot_amputate = TRUE - convertable_children = list(/obj/item/organ/external/foot/right/unbreakable/sturdy) - -/obj/item/organ/external/foot/unbreakable/sturdy - cannot_amputate = TRUE - -/obj/item/organ/external/foot/right/unbreakable/sturdy - cannot_amputate = TRUE - -/obj/item/organ/external/hand/unbreakable/sturdy - cannot_amputate = TRUE - -/obj/item/organ/external/hand/right/unbreakable/sturdy - cannot_amputate = TRUE - -/obj/item/organ/external/head/unbreakable/sturdy - cannot_amputate = TRUE diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm index 59274fb0c19..8e49fc94ba6 100644 --- a/code/modules/surgery/other.dm +++ b/code/modules/surgery/other.dm @@ -34,11 +34,11 @@ var/mob/living/carbon/human/H = target var/obj/item/organ/external/affected = H.get_organ(user.zone_selected) if(!affected) - return 0 + return FALSE - if(affected.internal_bleeding) - return 1 - return 0 + if(affected.status & ORGAN_INT_BLEEDING) + return TRUE + return FALSE /datum/surgery/debridement/can_start(mob/user, mob/living/carbon/target) if(ishuman(target)) @@ -72,9 +72,10 @@ /datum/surgery_step/fix_vein/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery) var/obj/item/organ/external/affected = target.get_organ(target_zone) if(!affected) - return 0 + return FALSE - return affected.internal_bleeding + if(affected.status & ORGAN_INT_BLEEDING) + return TRUE /datum/surgery_step/fix_vein/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery) var/obj/item/organ/external/affected = target.get_organ(target_zone) @@ -88,7 +89,7 @@ user.visible_message(" [user] has patched the damaged vein in [target]'s [affected.name] with \the [tool].", \ " You have patched the damaged vein in [target]'s [affected.name] with \the [tool].") - affected.internal_bleeding = FALSE + affected.fix_internal_bleeding() if(ishuman(user) && prob(40)) var/mob/living/carbon/human/U = user U.bloody_hands(target, 0) diff --git a/code/modules/surgery/plastic_surgery.dm b/code/modules/surgery/plastic_surgery.dm index d3a47157ffb..a75f35f7de3 100644 --- a/code/modules/surgery/plastic_surgery.dm +++ b/code/modules/surgery/plastic_surgery.dm @@ -25,8 +25,8 @@ /datum/surgery_step/reshape_face/end_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery) var/obj/item/organ/external/head/head = target.get_organ(target_zone) var/species_names = target.dna.species.name - if(head.disfigured) - head.disfigured = FALSE + if(head.status & ORGAN_DISFIGURED) + head.status &= ~ORGAN_DISFIGURED user.visible_message("[user] successfully restores [target]'s appearance!", "You successfully restore [target]'s appearance.") else var/list/names = list() diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm index 797a3b7c11a..d5e08e049fa 100644 --- a/code/modules/surgery/robotics.dm +++ b/code/modules/surgery/robotics.dm @@ -40,8 +40,8 @@ return 0 if(!affected.is_robotic()) return 0 - if(affected.cannot_amputate) - return 0 + if(affected.limb_flags & CANNOT_DISMEMBER) + return FALSE return 1 //to do, moar surgerys or condense down ala manipulate organs. @@ -222,7 +222,7 @@ else if(implement_type in implements_heal_brute) current_type = "brute" - if(!(affected.brute_dam > 0 || affected.disfigured)) + if(!(affected.brute_dam > 0 || (affected.status & ORGAN_DISFIGURED))) to_chat(user, "\The [affected] does not require welding repair!") return -1 if(tool.tool_behaviour == TOOL_WELDER) @@ -247,7 +247,7 @@ user.visible_message(" [user] finishes patching damage to [target]'s [affected.name] with \the [tool].", \ " You finish patching damage to [target]'s [affected.name] with \the [tool].") affected.heal_damage(rand(30,50),0,1,1) - affected.disfigured = FALSE + affected.status &= ~ORGAN_DISFIGURED if("burn") user.visible_message(" [user] finishes splicing cable into [target]'s [affected.name].", \ " You finishes splicing new cable into [target]'s [affected.name].") diff --git a/paradise.dme b/paradise.dme index 456ab1bf3d5..76d347ae2f2 100644 --- a/paradise.dme +++ b/paradise.dme @@ -2480,7 +2480,6 @@ #include "code\modules\surgery\organs\subtypes\standard.dm" #include "code\modules\surgery\organs\subtypes\tajaran.dm" #include "code\modules\surgery\organs\subtypes\unathi.dm" -#include "code\modules\surgery\organs\subtypes\unbreakable.dm" #include "code\modules\surgery\organs\subtypes\vox.dm" #include "code\modules\surgery\organs\subtypes\vulpkanin.dm" #include "code\modules\surgery\organs\subtypes\wryn.dm"