# Goonstation Pathology Rework Documentation
## Preface
Goon Pathology has been in a state of limbo for over a year. The last rework failed, because the maintainer/developer had lost motivation to continue working. Outright removal is extremely difficult because parts of pathology are used in many different places across the codebase (seriously, why is pathology code called for the *simplemob armadillo??*). I intend to completely redevelop Pathology and free Goondevs of this technical debt.
## I. The Main Pathology Files
I propose the creation/rework of the following files in /code/modules/medical/pathology:
### /_pathogen_constants.dm
This is a DEFINE-centered file.
This file will contain global variables used throughout the pathology code.
### /pathogen.dm
This is a DATUM-centered file.
This file will contain three datums:
One (datum/pathogen) for **initializing variables** for pathogens (l. 776-832)
One (datum/pathogen_generator) for **randomly generating pathogens** (l. 568-757)
One (datum/controller/pathogen) for **handling pathogen creation** (l. 129-332)
### /pathogen_microbodies.dm
This is a DATUM-centered file.
This file will contain datums for each microbody.
An example of a datum in this file:
```
datum/microbody/virus
name = "Virus"
singular = "virus"
plural = "viruses"
var/cure = null
var/symptoms = list()
modifiers = list(25, 0, 0, 0, 0) //Spread chance, AdvancingSpeed, MaxInfections, CreationCost, BountyPrice,
NaturalMaxStages = 4
growth_medium = "egg"
```
### /pathogen_cures.dm
This is a DATUM-centered file.
This file will contain datums for different cure types.
An example of a datum in this file:
```
datum/cure/brutemeds
color = "black"
name = "Brute Medicine"
desc = "The pathogen is cured by brute medicine."
therapy = "chemical"
cure_synthesis = list("styptic_powder", "synthflesh")
suppress_act(var/datum/pathogen/P)
if (P.infected.reagents.has_reagent("styptic_powder", P.suppression_threshold) || P.infected.reagents.has_reagent("synthflesh", P.suppression_threshold))
//proc: pathogen_cure() //Guaranteed cure progression, 10 seconds
return 1
return 0
may_react_to()
return "The DNA repair processes of the pathogen indicate that it might be <b style='font-size:20px;color:red'>cured</b> by certain kinds of medicine."
react_to(var/R)
if (R in cure_synthesis)
return "The pathogens near the [R] appear to be weakened by the brute medicine's presence."
else return null
```
### /pathogen_transmission.dm
This is a DATUM-centered file.
This file will contain datums for different transmission types.
A (poor, nested ifs) example of a datum in this file:
```
proc/infect_direct(var/mob/target as mob, var/datum/pathogen/origin, contact_type = "touch")
if(istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/H = target
if(prob(100-H.get_disease_protection()))
if (target.infected(origin))
logTheThing("pathology", origin.infected, target, "infects [constructTarget(target,"pathology")] with [origin.name] due to symptom [name] through direct contact ([contact_type]).")
return 1
```
### /pathogen_benign.dm
This is a DATUM-centered file.
This file will contain datums for good symptoms.
An example of a datum in this file:
```
datum/pathogeneffects/detoxificaton
name = "Detoxification"
desc = "The pathogen cleans the body of damage caused by toxins."
threat = THREAT_BENETYPE2
react_to(var/R, var/zoom)
return "The pathogen appears to have entirely metabolized... all chemical agents in the dish."
may_react_to()
return "The pathogen seems to be much cleaner than normal."
disease_act(var/mob/M as mob, var/datum/pathogen/origin)
if (M.get_toxin_damage())
M.take_toxin_damage(-origin.stage / 2)
if (prob(12))
M.show_message("<span class='notice'>You feel cleansed.</span>")
```
### /pathogen_malign.dm
This is a DATUM-centered file.
This file will contain datums for bad symptoms.
Identical structure to /pathogen_benign
### /pathogen_ailments.dm
This is a PROC-centered file.
This file will use procs to create preset diseases.
An example of a datum in this file:
```
/proc/generate_cold_pathogen()
var/datum/pathogen/P = new /datum/pathogen
P.name = "Common Cold"
P.microbody = /datum/microbody/virus
P.cure = "antihistamine"
P.add_symptom(pathogen_controller.path_to_symptom[/datum/pathogeneffects/coughing])
P.add_symptom(pathogen_controller.path_to_symptom[/datum/pathogeneffects/indigestion])
return P
```
### /pathogen_machines.dm
This is an OBJECT-centered file.
This file will handle the dense machinery for Pathology.
### /pathogen_research.dm
This is a DATUM-centered file.
This file will create datums to be used by TGUI for the Pathogen Analyzer and Pathogen Creator.
### /pathogen_tools.dm
This is an OBJECT-centered file.
This file will define any unique tools for Pathology.
## II. The Peripheral Files
### Old CSS and HTML
pathoComp.html, pathoui.css, pathology_display.js, and pathoui-script.js need to be salvaged for colors and salvagable text to create a modern TGUI for Pathology.
### Ctrl+F: pathogen
Code needs to be changed to some degree in all of the following files (not exhaustive list):
/goonstation.dme
/mob.dm
/sims.dm
/living.dm
/movement_modifiers.dm
/melee_attack_procs.dm
/human.dm
/emote.dm
/admin.dm
/randomverbs.dm
/Reagents-Diseases.dm
/Reagents-Misc.dm
/syringes.dm
/commodity.dm
/blood_system.dm
/surgery_tools.dm
/appendicitis.dm
/statusEffects.dm
/cleanable.dm
/radio.dm
/QM_supply.dm
/scanprocs.dm
and so on.
## III. 'Contributability' and New Pathology
## IV. Acknowledgements
Games:
- Plague Inc.
- Rimworld
Forums:
- aft2001
- TheMaskedMan2
Discord:
- Devs
-