diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 85fcccd10af..a501cd939b5 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -27,23 +27,41 @@ //Damage variables. var/brute_mod = 1 - var/brute_dam = 0 // Actual current brute damage. - var/brute_ratio = 0 // Ratio of current brute damage to max damage. + + ///Actual current brute damage + var/brute_dam = 0 + + ///Ratio of current brute damage to max damage + var/brute_ratio = 0 + var/burn_mod = 1 - var/burn_dam = 0 // Actual current burn damage. - var/burn_ratio = 0 // Ratio of current burn damage to max damage. + + ///Actual current burn damage + var/burn_dam = 0 + + ///Ratio of current burn damage to max damage + var/burn_ratio = 0 var/last_dam = -1 - var/genetic_degradation = 0 // Amount of current genetic damage. - var/pain = 0 // How much the limb hurts. - var/pain_disability_threshold // Point at which a limb becomes unusable due to pain. - //Organ behaviour. + ///Amount of current genetic damage + var/genetic_degradation = 0 + + ///How much the limb hurts + var/pain = 0 + + ///The amount of `pain` at which a limb becomes unusable + var/pain_disability_threshold + + ///Organ behaviour flags, see `ORGAN_CAN_*` and `ORGAN_HAS_*` in `code\__defines\damage_organs.dm` var/limb_flags = ORGAN_CAN_AMPUTATE | ORGAN_CAN_BREAK | ORGAN_CAN_MAIM var/max_size = 0 + + ///The `/icon` of the mob that has this organ var/icon/mob_icon + var/gendered_icon = 0 var/force_icon @@ -54,20 +72,41 @@ var/skin_color var/hair_color - var/list/wounds = list() + ///A `/list` of wounds + var/list/datum/wound/wounds = list() + + ///A list of implants present in this organ var/list/implants = list() - var/number_wounds = 0 // cache the number of wounds, which is NOT wounds.len! + + ///Cache the number of wounds, which is NOT wounds.len! + var/number_wounds = 0 + var/perma_injury = 0 + ///The parent organ var/obj/item/organ/external/parent - var/list/obj/item/organ/external/children - var/supports_children = TRUE - var/list/internal_organs = list() // Internal organs of this body part + ///A `/list` of organs that have this organ as a parent + var/list/obj/item/organ/external/children + + ///Boolean, if this organ supports childrens, which will be added in `children` + var/supports_children = TRUE + + ///Internal organs of this body part + var/list/obj/item/organ/internal/internal_organs = list() + + ///The tendon var/datum/tendon/tendon + + ///A path of the type of tendon to create when this organ is created var/tendon_path = /datum/tendon - var/tendon_name = "tendon" // Name of the limb's tendon. Achilles heel, etc. - var/tendon_health = 30 // HP value of the limb's tendon + + ///Name of the limb's tendon. Achilles heel, etc. + var/tendon_name = "tendon" + + ///HP value of the limb's tendon + var/tendon_health = 30 + var/list/tendon_msgs = list("tore apart", "ripped away") var/damage_msg = "You feel an intense pain!" @@ -75,51 +114,92 @@ var/open = 0 var/stage = 0 var/cavity = 0 - var/sabotaged = 0 // If a prosthetic limb is emagged, it will detonate when it fails. - var/encased // Needs to be opened with a saw to access the organs. - var/joint = "joint" // Descriptive string used in dislocation. - var/artery_name = "artery" //Name of the artery. Cartoid, etc. - var/arterial_bleed_severity = 1 // Multiplier for bleeding in a limb. - var/amputation_point // Descriptive string used in amputation. - var/dislocated = 0 // If you target a joint, you can dislocate the limb, causing temporary damage to the organ. - var/wound_update_accuracy = 1 // how often wounds should be updated, a higher number means less often + ///Boolean, if it was sabotaged (emagged), make it detonate when it fails + var/sabotaged = FALSE + + ///Needs to be opened with a saw to access the organs + var/encased + + ///Descriptive string used in dislocation + var/joint = "joint" + + ///Name of the artery. Cartoid, etc. + var/artery_name = "artery" + + ///Multiplier for bleeding in a limb + var/arterial_bleed_severity = 1 + + ///Descriptive string used in amputation + var/amputation_point + + ///If the joint is dislocated + var/dislocated = FALSE + + ///How often wounds should be updated, a higher number means less often + var/wound_update_accuracy = 1 var/body_hair var/painted = 0 - var/maim_bonus = 0 //For special projectile gibbing calculation, dubbed "maiming" + ///For special projectile gibbing calculation, dubbed "maiming" + var/maim_bonus = 0 - var/list/genetic_markings // Markings (body_markings) to apply to the icon - var/list/temporary_markings // Same as above, but not preserved when cloning - var/list/cached_markings // The two above lists cached for perf. reasons. - var/list/additional_images + ///Markings (body_markings) to apply to the icon + var/list/genetic_markings - var/atom/movable/applied_pressure //Pressure applied to wounds. It'll make them bleed less, generally. + ///Same as `genetic_markings`, but not preserved when cloning + var/list/temporary_markings + + ///The `genetic_markings` and `temporary_markings` cached for perf. reasons + var/list/cached_markings + + var/list/image/additional_images + + ///Pressure applied to wounds. It'll make them bleed less, generally. + var/atom/movable/applied_pressure var/image/hud_damage_image - var/augment_limit //how many augments you can fit inside this limb + ///How many augments you can fit inside this limb + var/augment_limit - var/obj/item/organ/infect_target_internal //make internal organs become infected one at a time instead of all at once - var/obj/item/organ/infect_target_external //make child and parent organs become infected one at a time instead of all at once + var/obj/item/organ/internal/infect_target_internal //make internal organs become infected one at a time instead of all at once + var/obj/item/organ/external/infect_target_external //make child and parent organs become infected one at a time instead of all at once + + ///Dionae limb + var/mob/living/carbon/alien/diona/nymph - var/mob/living/carbon/alien/diona/nymph //used by dionae limbs var/nymph_child /obj/item/organ/external/proc/invalidate_marking_cache() cached_markings = null /obj/item/organ/external/Destroy() - if(parent && parent.children) + if(parent?.children) parent.children -= src - if(children) - for(var/obj/item/organ/external/C in children) - qdel(C) + if(istype(owner) && owner.bad_external_organs) + owner.bad_external_organs -= src - if(internal_organs) - for(var/obj/item/organ/O in internal_organs) - qdel(O) + if(limb_name && istype(owner, /mob/living/carbon) && owner.organs_by_name) + owner.organs_by_name[limb_name] = null + owner.organs_by_name -= limb_name + + parent = null + + //Remove the images from the owner and clear them + if(istype(owner)) + cut_additional_images(owner) + additional_images = null + + genetic_markings = null + temporary_markings = null + cached_markings = null + mob_icon = null + + QDEL_NULL_LIST(children) + QDEL_NULL_LIST(internal_organs) + QDEL_NULL_LIST(wounds) QDEL_NULL_LIST(implants) infect_target_internal = null @@ -131,7 +211,8 @@ QDEL_NULL(tendon) - return ..() + . = ..() + /obj/item/organ/external/attack_self(var/mob/user) if(!contents.len) diff --git a/html/changelogs/FluffyGhost-refdrop_dmdoc_external_organs.yml b/html/changelogs/FluffyGhost-refdrop_dmdoc_external_organs.yml new file mode 100644 index 00000000000..f155ac5595b --- /dev/null +++ b/html/changelogs/FluffyGhost-refdrop_dmdoc_external_organs.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "External organs now clear more references when they are deleted." + - backend: "DMDoc'd most external organs vars."