# Health Rework ## Contents [toc] ## Concepts ### Pain Pain is a way to seperate a player's physical damage from their 'health' (Movement slowdown effects). Certain pain medicine such as morphine can be used to reduce the effects of pain, allowing mobs to suffer less effect from slow movement speed due to pain. ### Damage When taking damage, injuries will be applied which cause damage + pain. If damage is applied to existing injuries, the injuries will become more severe. If an injury is healed, but then gets damaged again in quick succession, the injury will become more severe and may require more advanced treatment. When damage is applied, it will always damage the outer limb before potentially hitting stored limbs / internal organs with a chance. (The damage may be reduced depending on the armor of the parent organ) :::danger A system should be in place that prevents instant-death scenarios such as where the brain takes a bullet. Cases of limb damage that would lead to instant death should only occur if the mob is near-death anyway. ::: #### Stamina Damage Stamina damage works slightly different to regular damage in that it doesn't cause physical damage or pain, but will still disable limbs and affect movement. Limbs will contain a stamina damage variable that marks how much damage they have from stamina injuries. #### Armour Armour may reduce sharp attacks to blunt attacks and will protect internal organs. It will also reduce the overall damage of attacks like normal. #### Damage Types Blunt - Won't damage internal organs, causes bruising. More effective against blocking depending on the weight of the blunt weapon. Sharp - Causes bleeding and more likely to penetrate internal wounds. Less effective against shields/blocking. Burn - Causes burns I guess? :::warning **Subject to change** Oxygen - Instead of having oxygen damage, we could have some kind of buffer on the mob that the damage goes to, then we begin dealing brain damage and knocking the mob unconcious / blurry vision. Oxygen damage won't be an actual damage type. **OR** Oxygen damage is an injury applied to the body. ::: :::warning **Subject to change** Toxin - Damage is applied to the liver. ::: Cellular - Genetic damage, not sure what this would entail. ### Healing When a player applies medicine to heal an injury, the pain will decrease quickly over time (to a limit, there may be some minimum pain for certain injuries). This means that the movement slowdown will dissapate quickly, however the player will still have the injury (See below/above). :::warning **Balance:** I'd like to make healing robotic limbs more difficult but be less affected by EMPs. (IE either some form of hard to heal damage, or temporarilly disabled instead of just flying off.) ::: Instant healing injuries will no longer exist, they will persist for some time in some form, even if it doesn't affect your slowdown due to pain. ### Severity :::success The progressive injuries is one of my favourite bits of this, I like this idea a lot to make constant damage difficult to heal, while not overwhelming medical and instantly punishing anyone that doesn't want/can't go to medical. Under the hood we could give antagonists some innate ability to heal injuries a bit faster so they don't have to stay out of combat for long periods of time. ::: Initially, most first injuries will only be a minor injury. Minor injuries can easilly be healed with basic medicine from medkits. When healed, the injury will still persist for some time and if damaged again can become a more severe injury. This means that constantly taking damage over and over will get more punishing over time if some time is not spent to heal in between gaining these injuries and doesn't force all injuries to be reliant on going to medical. Severe injuries are more difficult to tend and require basic surgery (Tend wounds?). Severe injuries are obtained when a minor injury is containually injured further. Critical injuries are the most difficult to heal, at this point the limb has become completely destroyed and is non-functional. A limb will require a full replacement (robotic or otherwise). This system punishes returning to combat after taking injuries. ### Surgery Selecting a part for surgery will require a slightly altered process due to the tree structure-like natrue of limbs. For example selecting the heart to remove would require Chest > Heart (The first layer should display the root bodypart as well as any children of it for simplication.) I can't think of any that should require 3 menus, but it should be possible. Surgery will work on all mobs that have this body system. For simplication, simple animals will still be able to support non-limb based damage systems because if you scroll down and look at the list of things that need to be converted, its huge. :::info We could just have a default body type that only contains a single "body" limb that all damage gets applied to. ::: :::success **UPDATE:** The root component should be 'Body' which shouldn't be able to take damage or be altered under normal means. (But should be able to have injuries applied for things like oxygen damage.) ::: ### Stamina Damage All living mobs should be able to take stamina damage (Assuming their limbs allow it - Construct bodies are just rock and shouldn't be able to be disabled, but dogs should be able to be). ### Mob Stats Mob stats determine how effective a mob is at performing certain actions. These can be affected by pain or damage. #### Manipulation #### Movement The speed at which your character moves. #### Conciousness Conciousness applied a multiplier to manipulation and movement when reduced. ### Limbs / Organs Limbs and organs will all have a stat value they effect. When damage their effectiveness will be reduced. Limbs will work as a tree structure, with a root organ (Body/Chest?) defining what can be attached to it or inside. Mob overlay icons will be applied when limbs are applied or removed. Limbs will contain a health value which will be cached based on the damage from the injuries on it. They will contain a pain value and a stamina damage value. :::info Organs that do not go into a unique slot need to be considered: Multiple brain implants may be able to go into the same slot. Mindshield, explosive implant etc. etc. Either that or we can accept that they should be limited. ::: ### Bodypart Targetting We need to keep an associative list containing the body part and which limb zone that should translate to (On the body?). :::warning If the limb location doesn't exist, damage should be applied to the body instead of that limb. ::: ### Crit Crit will be reached when a mob's conciousness reaches a certain threshold. ### Death Death will occur when a mob's conciousness reaches 0 or a critical limb is destroyed (Destroying the brain will set conciousness to 0, as the brain is responsible for 100% of the conciousness). ### Bleeding Some injuries will cause bleeding. Bleeding will slowly fix overtime, but will need to be bandaged to prevent major blood loss. ## Implementation / Details ### Dynamic Mob Content :::danger **Non-critical** ::: A lot of the stuff won't require specific code for the parts, meaning we can load it from an XML file. This allows us to create and edit the file without restarting the game. We need to create a lot of damn bodies for all the mobs, might as well make it a bit easier. Body: ```yaml= - body: human type: /datum/body pain_crit: 100 pain_hardcrit: 150 blood: - type: /datum/reagent/blood/A+ - type: /datum/reagent/blood/A- - type: /datum/reagent/blood/O ... - maxAmount: 1500 - defaultAmount: 1000 - criticalLimit: 700 slots: - slot: chest_humanoid default: chest_humanoid - slot: head_humanoid default: head_humanoid - slot: arm_left default: left_arm_human - slot: arm_right default: right_arm_human - slot: leg_left default: left_leg_human - slot: leg_right default: right_leg_human ``` Parts: ```yaml= - part: chest_humanoid slot: chest_humanoid max_damage: 60 type: /obj/item/body_part name: Human Chest desc: A human chest icon: /icons/obj/chest.dmi icon_state: human_chest - part: left_arm_human slot: arm_left max_damage: 35 type: /obj/item/body_part name: Left Arm desc: The left arm of someone icon: /icons/obj/chest.dmi icon_state: left_arm stats: - stat: manipulation amount: 50 ``` Objects will reference a shared datum reference, which can be modified to affect all limbs. (Rather than every limb storing its health, every limb stores a reference to a shared limb that tells the limb about its health.) This allows us to reload the content file and update limbs at the same time. ### Body Datum The body datum is a non-modifyable part of all living mobs. It contains information about: - The body parts it can have - Amount of blood in the body - Type of blood (If any) - The root limb of a body #### The agony of life :::danger Might atomize this and do it in a seperate PR. ::: Life() should be removed from the mob and transfered to the body instead. Life Changes: - [ ] Split personality should use signals rather than life hooks - [ ] Blob spore death moved to ZChange rather than life() - [ ] Blob spore zombification? - [ ] Cogscarab home teleportation should be ZChange - [ ] Carbon life loop should have for each organ loops removed - [ ] Damage hud only updates on damage rather than in life() - [ ] Trauma loop removal from life() - [ ] Heartbeet sound channel removal should be done on death rather than life() - [ ] Load component for rotting is done every life loop()??? - [ ] Remove ling chems from life loop - [ ] Optimise breathing - [ ] Remove mutations from human life loop - [ ] Remove cardiac arrest from human life loop and make it a status effect - [ ] Remove updating name from human life loop (really??...) - [ ] Can floating be removed from life()? - [ ] Mutations and radiation may be able to be removed from life() - [ ] Simplify simple mobs handle_breathing - [ ] Gravity updates can be signals probably - [ ] Gravity filters are done every life loop() - [ ] Change confusion to a world.time timer rather than a countdown - [ ] Possibly change eye damage to a world.time timer rather than healing each frame? - [ ] Slime life() :despair: ### Limb Slots / General Parts Note: Stat value, stat factor and the contents of the slot will be stored on the limb itself. This is a general overview. :::success Can be used to clean up life loop? Changeling could be changed to something like this rather than having a life loop hook? ::: :::warning We may be able to simplify other actions for performance reasons. For example, breathing takes air directly out of the atmosphere to process breathing rather than storing it in the lungs. ::: | Limb | Slot | Stat Value | Stat Factor | Slot Contents | Other Actions | | ----- | -------------------- | ------------ | ----------- | --- | --- | | Brain | Brain | Conciousness | +100 | | | | Arm | Left Arm / Right Arm | Manipulation | +50 (Per arm) | | | | Leg | Left Leg / Right Leg | Movement | +50 (Per Leg) | | | | Head (Generic) | Head | Nothing | | Brain, ears, eyes, tongue | | | Head (Robotic) | Head | Nothing | | Optical Sensors, Audiotory Sensors | | | Chest (Critical) (Generic) | Chest | Nothing | | Wings, Stomach, Liver, Lungs, Heart, Tail | | | Chest (Critical) (Robotic) | Chest | Nothing | | Wings, Processing Unit, Tail | | | Eye | Eye | Sight | +50 Per Eye | | | | Ear | Ear | Hearing | +50 Per Ear | | | | Tongue | Tongue | | | | Determines taste | | Stomach | Stomach | | | | Converts nutriment into hunger | | Liver | Liver | | | | Processes toxins | | Lungs | Lungs | | | | Processes atmospheric conditions | | Heart | Heart | | | | Can fail and cause oxyloss + brain damage | | Tail | Tail | | | | | | Wings | Wing | | | | | ### Mob List (Convenience) :::warning We need to consider the optimisations behind giving these bodies. Since the damage will mostly be cached it should be fine, but simpler mobs should avoid more complex processing. ::: :::danger A lot of these will not have a noticeable impact on gameplay. We should focus on making humans have limb based health and only transfer these if necessary. The only real advantage we gain from this is being able to do surgery on /mob/living. ::: #### Abstract ``` /mob/living/split_personality /mob/living/simple_animal/eminence /mob/living/simple_animal/revenant /mob/living/simple_animal/hostile/illusion/doppelganger /mob/living/simple_animal/shade/howling_ghost /mob/living/simple_animal/hostile/eldritch/ash_spirit /mob/living/simple_animal/shade /mob/living/simple_animal/hostile/floor_cluwne /mob/living/simple_animal/hostile/illusion /mob/living/simple_animal/hostile/asteroid/curseblob (purple smoke) /mob/living/simple_animal/hostile/retaliate/ghost /mob/living/passenger ``` #### Humanoid ``` /mob/living/carbon/human /mob/living/simple_animal/hostile/syndicate /mob/living/simple_animal/hostile/zombie /mob/living/carbon/human/abstraction_hologram /mob/living/simple_animal/hostile/retaliate/clown/insane /mob/living/simple_animal/hostile/cat_butcherer /mob/living/simple_animal/hostile/faithless /mob/living/simple_animal/hostile/nanotrasen /mob/living/simple_animal/hostile/pirate /mob/living/simple_animal/hostile/russian /mob/living/simple_animal/hostile/skeleton /mob/living/simple_animal/hostile/wizard /mob/living/simple_animal/hostile/boss/paper_wizard /mob/living/simple_animal/hostile/megafauna/blood_drunk_miner /mob/living/simple_animal/hostile/retaliate/nanotrasenpeace Human Species: Abductor Android Apid Dullahan Ethereal Felinid Fly Golem IPC Jelly Lizard Moth Plasmaman Pod growrth Shadow Skeleton Supermeme Vampire Zombie ``` #### Xenomorph ``` /mob/living/simple_animal/hostile/alien/hugbox /mob/living/carbon/alien /mob/living/carbon/alien/humanoid/royal/queen /mob/living/carbon/alien/larva /mob/living/simple_animal/hostile/alien ``` #### Construct ``` /mob/living/simple_animal/drone/cogscarab /mob/living/simple_animal/hostile/clockwork_marauder /mob/living/simple_animal/hostile/guardian Construct Juggernaught Wraith Artificer Harvester /mob/living/simple_animal/hostile/statue /mob/living/simple_animal/hostile/megafauna/swarmer_swarm_beacon /mob/living/simple_animal/hostile/asteroid/elite/herald/mirror ``` #### Robotic ``` /mob/living/simple_animal/hostile/swarmer /mob/living/simple_animal/hostile/mining_drone /mob/living/silicon/ai /mob/living/silicon/pai (hologram) /mob/living/silicon/robot /mob/living/simple_animal/hostile/eldritch/rust_spirit /mob/living/simple_animal/bot/atmosbot /mob/living/simple_animal/bot/cleanbot /mob/living/simple_animal/bot/firebot /mob/living/simple_animal/bot/floorbot /mob/living/simple_animal/bot/honkbot /mob/living/simple_animal/bot/medbot /mob/living/simple_animal/bot/mulebot /mob/living/simple_animal/bot/secbot /mob/living/simple_animal/drone /mob/living/simple_animal/hostile/hivebot /mob/living/simple_animal/hostile/swarmer /mob/living/circuit_drone ``` #### Animal ``` /mob/living/simple_animal/hostile/blob/blobbernaut /mob/living/simple_animal/imp /mob/living/carbon/true_devil /mob/living/simple_animal/slaughter /mob/living/simple_animal/hostile/morph /mob/living/simple_animal/chicken/rabbit /mob/living/simple_animal/pet/gondola /mob/living/simple_animal/hostile/carp /mob/living/simple_animal/holodeck_monkey /mob/living/carbon/monkey /mob/living/carbon/monkey/tumor /mob/living/simple_animal/cluwne /mob/living/simple_animal/hostile/eldritch/raw_prophet /mob/living/simple_animal/hostile/eldritch/armsy /mob/living/simple_animal/hostile/eldritch/stalker /mob/living/simple_animal/parrot /mob/living/simple_animal/pet/cat /mob/living/simple_animal/cockroach /mob/living/simple_animal/crab /mob/living/simple_animal/pet/dog /mob/living/simple_animal/hostile/retaliate/goat /mob/living/simple_animal/cow /mob/living/simple_animal/chick /mob/living/simple_animal/chicken /mob/living/simple_animal/pet/fox /mob/living/simple_animal/pet/gondola /mob/living/simple_animal/pet/hamster /mob/living/simple_animal/hostile/lizard /mob/living/simple_animal/pet/penguin /mob/living/simple_animal/sloth /mob/living/simple_animal/hostile/retaliate/poison/snake /mob/living/simple_animal/turtle /mob/living/simple_animal/hostile/bear /mob/living/simple_animal/hostile/poison/giant_spider /mob/living/simple_animal/hostile/retaliate/goose /mob/living/simple_animal/hostile/netherworld/migo /mob/living/simple_animal/hostile/netherworld/blankbody /mob/living/simple_animal/hostile/asteroid/fugu /mob/living/simple_animal/hostile/gorilla /mob/living/simple_animal/hostile/jungle/leaper /mob/living/simple_animal/hostile/jungle/mega_arachnid /mob/living/simple_animal/hostile/jungle/mook /mob/living/simple_animal/hostile/jungle/seedling /mob/living/simple_animal/hostile/megafauna/bubblegum /mob/living/simple_animal/hostile/megafauna/colossus /mob/living/simple_animal/hostile/megafauna/dragon /mob/living/simple_animal/hostile/megafauna/hierophant (Hiero my beloved) /mob/living/simple_animal/hostile/megafauna/legion /mob/living/simple_animal/hostile/asteroid/basilisk /mob/living/simple_animal/hostile/asteroid/goldgrub /mob/living/simple_animal/hostile/asteroid/goliath /mob/living/simple_animal/hostile/asteroid/gutlunch /mob/living/simple_animal/hostile/asteroid/hivelord /mob/living/simple_animal/hostile/asteroid/elite/broodmother /mob/living/simple_animal/hostile/asteroid/elite/herald /mob/living/simple_animal/hostile/asteroid/elite/legionnaire /mob/living/simple_animal/hostile/asteroid/elite/pandora /mob/living/simple_animal/hostile/retaliate/bat /mob/living/simple_animal/hostile/retaliate/clown /mob/living/simple_animal/hostile/retaliate/dolphin ``` #### Simple Simple mobs are mobs that are so small or weak that they don't require complex bodies outside of just a simple body that can take damage and death upon that parts destruction. ``` /mob/living/simple_animal/hostile/headcrab /mob/living/simple_animal/hostile/poison/bees /mob/living/simple_animal/mouse /mob/living/simple_animal/butterfly /mob/living/simple_animal/hostile/poison/limbsnake /mob/living/simple_animal/hostile/blob/blobspore /mob/living/simple_animal/hostile/macrophage /mob/living/simple_animal/hostile/asteroid/hivelordbrood/slaughter /mob/living/simple_animal/hostile/lightgeist /mob/living/simple_animal/hostile/asteroid/hivelordbrood /mob/living/simple_animal/hostile/asteroid/elite/legionnairehead /mob/living/simple_animal/hostile/retaliate/frog /mob/living/simple_animal/slime ``` #### Unknown ``` /mob/living/simple_animal/hostile/carp/eyeball (It is a giant floating eyeball) /mob/living/simple_animal/hostile/breadloaf (Its body is bread?) /mob/living/simple_animal/hostile/killertomato (A giant tomato) /mob/living/simple_animal/hostile/mimic /mob/living/simple_animal/hostile/mushroom /mob/living/simple_animal/hostile/stickman /mob/living/simple_animal/hostile/tree /mob/living/simple_animal/hostile/venus_human_trap /mob/living/simple_animal/hostile/retaliate/spaceman ``` ### Injuries Some injury types to consider for when making the variables for injuries: - Bullets - Lasers - Explosions - Stabbing / Sharp - Bashing / Blunt - Burning (Welders) - Pressure Damage (Applied to full body) ## Implementation Requirements A finite list of things that should be implemented in order to complete this document. ### Pain - [ ] Pain affects conciousness (Capped to 20%) - [ ] Pain is shown by the health bar - [ ] IPCs health bar displays power distribution rather than pain, however it is functionally the same thing. ### Damage / Injuries - [ ] Conciousness affects movement and manipulation. - [ ] Movement stat affects a mobs move speed. - [ ] When movement is below a certain amount (50%?) the mob is forced to crawl. - [ ] When conciousness is below a certain amount the mob is sent to soft-crit. - [ ] When conciousness hits 0 a mob dies. - [ ] Damage is shown by the health doll. - [ ] Sight defines how poorly a mob can see. - [ ] Conciousness affects sight, as a mob loses conciousness they will slowly fade to black. - [ ] Minor injuries can be tended with simple medicine (Brute packs, chemicals etc.) - [ ] Major injuries can be tended with surgery (Tend wounds?) - [ ] Critical injuries require limb replacement - [ ] Obtaining a lot of minor injuries while a limb already has minor injuries healing will progress to a major injury. - [ ] A limb taking damage while already having major injuries will progress to critical injuries. - [ ] Tending an injury on a limb will quickly reduce pain and damage, however the injury will exist on the limb for some time. If that limb takes damage again, the next damage will be sigificantly worse. - [ ] Injuries can cause bleeding. - [ ] Hitting a destroyed limb will decapitate it. - [ ] Injuries that do less than 5 damage will stack with other similar injuries that haven't been healed. ### Surgery - [ ] Surgery can be peformed on /mob/living - [ ] Organ manipulation will first display a list of all non organs, then all organs inside that selected part. ### Body - [x] Body datum on /mob/living - [ ] Body datum defines the mobs blood type - [x] Body datum defines the root component of a body (Body) - [ ] Body datum specifies if a mob supports bodypart overlays. - [ ] Certain mobs like robots don't feel pain, so their health hud should display damage instead. - [ ] Body slots can contain multiple possibilities. ### Bodyparts - [x] Bodyparts contain other bodyparts/Organs (Considered the same) - [x] Bodyparts contain a list of injuries - [ ] Injury healing is based on timers - [ ] Bodyparts have a cached damage based on the injuries - [ ] Stamina Damage on bodyparts - [ ] Bodyparts contain a probability flag for internal penetration. (Applying penetrative damage to a bodypart will recursively pick and check parts inside to damage (bullets)) - [ ] Bodyparts update the overlays of their parent mob when added/removed if the body supports overlays. - [ ] Bodyparts affect mob stats depending on damage. (+50 sight at 50% becomes +25 sight). - [ ] BODYPART_REMOVABLE flag defines if a bodypart can be removed - [ ] BODYPART_ORGAN flag defines if a bodypart is an organ (used for surgery list) - [ ] BODYPART_INTERNAL flag defines if a bodypart is internal. (Damage may be reduced to blunt attacks if penetrating internal organs) - [ ] Bodyparts contain an armour flag that define how much they protect internal organs. - [ ] Instant kill / extremely strong damage should be avoided unless the mob is already injured. (Rig the randomness to make it fair) - [ ] Bodyparts have a pain multiplier. Constructs shouldn't feel pain and be slowed by it. - [ ] Robotic limbs do not feel pain. - [ ] Limbs like the lungs will be disabled and simpler atmospheric processing will be done for simple mobs. - [ ] Limbs that require blood shouldn't work when attached to mobs with no blood (Robots) ### Species - [ ] Create basic human limbs - [ ] Felinid tail - [ ] Felinid ears (Increased sensitivity) - [ ] Lizard limbs (Increased internal organ protection due to armour?) - [ ] Golem limbs (No pain, high armour, no blood) - [ ] Wings - Flight ### Specifics - [ ] Changelings can heal minor/major injuries with their fleshmend ability. - [ ] Changelings can heal critical injuries with regenerate. - [ ] Changelings will have a unique body datum for their mob. (Essentially their own species) - [ ] Species will work by having different body datums to their respective mobs. ## Interface ### Defines `#define INJURY_SEVERITY_MINOR` `#define INJURY_SEVERITY_MAJOR` `#define INJURY_SEVERITY_CRITICAL` ### Blood ```dm /datum/blood var/blood_type var/blood_colour ``` ### Body `/proc/update_health()` `/proc/get_bodypart(part_slot)` `/proc/get_body_slots()` `/proc/get_valid_slots(datum/bodypart/part)` `/proc/get_species_name()` ### Bodypart `/proc/generate_injury(damage_type, damage_amount, severity)` `/proc/apply_injury(datum/injury/injury, update_health = FALSE)` `/proc/try_tend(datum/tending_item/tender)` `/proc/insert(part_slot, datum/bodypart/part)` `/proc/remove_self()` `/proc/get_damage()` ### Injury ```dm /datum/injury //The amount of damage the injury provides var/damage_amount //The severity level of the injury var/severity //Amount of blood lost per second var/bleed_rate = 0 //Chance to penetrate into sub limbs or organs var/penetration_chance = 0 ``` ## Balance Notes This will be a very big change to IPCs, since they do not feel pain. They should enter a low power mode when they take sufficient damage (Soft-crit). Nukies have pretty good armour, so getting shot at should reduce almost all their injuries from major to minor. ## Documentation ### Body :::info The body is an abstract datum that represents a the body details of a mob. ::: `var/mob` - The mob that the body is associated with. `var/manipulation (private)` - The actionspeed modifier for the body. Used when the manipulation stat is changed. `var/accepted_blood_type` - The type of blood that the body can accept. Includes any subtypes.