Files
Paradise/code/datums/diseases/_disease.dm
Migratingcocofruit a5260456ae Advanced Disease Rework (#28451)
* Reworks cures, adds strains, adds treatment chems to symptoms

* Enables coexistence of different samples of the same strain at different stages within the same container

* Adds symptom guessing. Correct guesses reduce analysis time and wrong ones increase it.

* Adds a chance for a virus to evolve into a new strain. changing the cure and adding/subtracting symptoms

* Revert "Adds a chance for a virus to evolve into a new strain. changing the cure and adding/subtracting symptoms"

This reverts commit 124dd485c7.

* Adds spontaneous virus mutations, strain tracking. Removes antibody metabolism

* change the amount of time added/reduced by each factor

* Creates a disease outbreak event that allows admins to cause an outbreak of a virus of their choosing. Allows virus creation when choosing virus to give someone or for an outbreak.

* The normal base property values are now the defaults for disease creation

* Rebuild TGUI

* Rebuild TGUI

* Rebuild TGUI

* Update tgui.bundle.js

* remove redundant lines

* improves ui some and moves to using world time for analysis time

* fixes a bug with the analysis time and updates the initial known advanced disease list

* Buffs the disease outbreak event and adds a base stat row to the PANDEMIC

* Update tgui.bundle.js

* Implements calibration

* Adds a remove from database button

* Moves the known disease global list to work per z level

* Removes treatments from most chems and makes each instance of a symptom not acting purge some of the reagent that treated it

* Update symptoms.dm

* Adds stage to unknown diseases

* Moves accumulated error to work per z level and change the location of the delete strain data button

* Adds confirmation to the delete data button and moves the disease text out of the loop in the copy constructor

* fix indentation

* Replaces pent with hydrocodone in the advanced cure list

* gives more buffs to event disease based on severity. removes longevity from possible symptoms an event disease can get.  Fixes a bug with determining analysis time

* Update tgui.bundle.js

* Update pandemic.dm

* Update pandemic.dm

* Update tgui.bundle.js

* review changes

* Update tgui.bundle.js

* Update tgui.bundle.js

* Update tgui.bundle.js

* Update tgui.bundle.js

* Update tgui.bundle.js

* Update tgui.bundle.js

* Update tgui.bundle.js

* Update tgui.bundle.js

* review changes

* Update tgui.bundle.js

* Makes vaccines only add resistances and no longer cure

* improves pandemic ui and fixes calibration button not being properly disabled

* Update tgui.bundle.js

* Add the new agars to the virologist's fridge

* lowered evolution chance of viruses a bit

* further lowers evolution chance

* Update advance.dm

* Changes the scaling of analysis time and fixes stage speed presentation in the pandemic

* Scanners can now see virus strains that have been inserted in the pandemic

* Allows a mob to be infected by both an event and non event disease

* Fixes the +1 syringe of translocation stabbing your feet

* Update tgui.bundle.js

* Changes spontanous mutation to be per spread and makes disease events less likely.

* Diseases less common, mutations happen only on spread now, symptom list ordered alphabetically in the dropdown, fixed some bugs

* Update tgui.bundle.js

* changes virus alerts

* Removes numbers from the virus alert text and fixes a bug that caused excessive virus mutations

* Update tgui.bundle.js

* refactor disease spread

* Changes disease spread logic to give players options to protect themselves and others

* Blackbox things

* Increases announcement timer and fixes the infection talley

* Update disease_outbreak.dm

* Adds an incubation period to advanced viruses. bumps sneeze back to 5 range

* Adds failsafe to disease outbreaks that will infect a random crew member if none have arrived in 10 minutes

* Only record advanced disease infections

* Properly handle recording of disease infection events

* Changed resistance effect on cure

* another adjustment to res effect on cure

* Small resist buff, spontanous combustion buff and some calculation fixes

* changes spontanous combustion stat bonuses and maluses

* Update flesh_eating.dm

* Update flesh_eating.dm

* Update flesh_eating.dm

* Big trait changes and rebalance

* adds treatments to fire and necro

* Introduces viral contamination of food and reagent containers, as well as disinfection

* Fix runtime in reagent transfers

* Revert the prefs and config changes

* Slowed down diseases and made symptoms more gradual, improved disease alerts to both crew and dchat

* Sterilizine now sterilizes things contaminated with viruses. Heat reactions now take place alongside chemical reactions when adding reagents to a beaker

* Adds option to order sterile masks, goggles and biosuits in packs of 4. Makes sterile masks as good as internals for viruses

* adds logging to pandemic

* Changes symptom stats and increased disease varaiety

* Fixes some disease bugs

* Fixes some bugs and makes it behave better

* Adds shiver emote to shiver symptom

* Adds admin message/log to contracting an event disease and fixes copy behaviour when infecting

* Prefix spread defines

* Change the rest of the macros

* correct the disinfection temp macro

* Moves disease signals to their own file

* move disnifection temp back

* fix a type

* viral contaminations component review changes

* var name changes

* more style fixes

* Update tgui.bundle.js

* fixes pandemic

* Fixes disease outbreak having two carriers sometimes and changes the virus alert to the new one

* Update disease_defines.dm

* fixes samples not passing stages on properly

* actually fixes the bug

* Fixes stabilization being lost on cloning

* Finally completely and absolutely fixes the sample stages bug(please)

* Makes the pandemic a machine

* Update pandemic.dm

* removed drinks from cure requirements

* lowers chance of major viral outbreak

* fixes pandemic not processing properly

* Changes the cure system to have more options

* Makes mixing event viruses more random

* Fixes hardsuits having a 1% chance to be infected

* Increases virus protection of most clothing. medical scrubs and surgical hat buffed sunstantially

* Slow down progress of diseases

* makes spread less likely

* envirosuit is now slightly more protective from viruses, while the medical one is as good as scrubs

* Adds further protection to helmets

* Increases the number of possible cures and the scaling of required cures

* Pandemic ui improvements

* Update _disease.dm

* fix a bug with spread target in the disease outbreak event

* changes some clothing permeability

* Adds the ability to make viral DNA extracts by injecting a sample into a black slime core. It's equivalent to 2 stages

* Adds age to health analyzer, makes viral evolution toggle minor disabilities, confusion symptom now confuses more often

* Update pandemic.dm

* replace lazarus with acetic acid in the cures

* Changes the relation of the amount of cure options to required cures and the scaling of required cures with resistance

* Fixes virus renaming

* changes description and permeability of some medical jumpsuits

* Adds a list of all diseases infecting client mobs to the disease outbreak event

* uses event UID instead of ref in the disease

* Adds advanced disease carriers to admin antag menu

* Adds viral eraser which removes tracking and stabilizing. Admin spawn only for now

* Update tgui.bundle.js

* Adds the ability to create viral genetic material using radiation. it can be used in addition to that produced in xenobio

* changes alert logic, disease generation logic, adds treatments to weakness, cough and sneeze now more gradual and cough spreads at range 3

* makes disease advance a bit faster

* reduce time to announcement to 6 minutes after 3 people are infected

* Changes medibot disease detection to be the same as analyzers. Treatment chems now put the symptom on a cooldown that persists after they leave the body.

* Make sure the disease outbreak event only selects crew

* Fix abductor virus gland virus generation

* Adds sterilizine to viro locker

* Fixes null viruses appearing when merging virusless blood

* Adds oculine to hyphema treatments

* Rebalances weight loss and flesh eating

* Improvements to advanced disease carrier tab on the TGUI antag menu

* change the flag on away missions

* Update mob_spawn.dm

* Update tgui.bundle.js

* adds sterilizine recipe back

* Adds viral contamination to surgery tools and surgery steps

* small changes

* fixes pandemic ui. should work properly now(I hope)

* CI compliance

* Update flesh_eating.dm

* Update vomit.dm

* Update tgui.bundle.js

* Initial revision of analysis and fixes the UI issue with multiple stage samples

* refactors treatment and makes treatment chems more adjustable

* var correction

* symptoms and their contribution now show up on the pandemic

* Update tgui.bundle.js

* Update code/datums/diseases/advance/symptoms/cough.dm

Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

* change wizard disease and zombie disease macros to new ones

* Update tgui.bundle.js

* changes the part requirements on the pandemic boards to fit the actual parts

* fix misbehaviour when inserting samples without symptoms

* Some changes to difficulty scaling, reverts the level of projectile vomiting back to 4, and disallows germaphobes to avoid infection by injection

* Adds viral contamination to IV bags

---------

Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
2025-08-08 01:54:36 +00:00

243 lines
7.4 KiB
Plaintext

GLOBAL_LIST_INIT(diseases, subtypesof(/datum/disease))
/datum/disease
//Flags
var/visibility_flags = 0
var/disease_flags = VIRUS_CURABLE|VIRUS_CAN_CARRY|VIRUS_CAN_RESIST
var/spread_flags = SPREAD_AIRBORNE
//Fluff
/// Used for identification of viruses in the Medical Records Virus Database
var/medical_name
var/form = "Virus"
var/name = "No disease"
var/desc = ""
var/agent = "some microbes"
var/spread_text = ""
var/cure_text = ""
//Stages
var/stage = 1
var/max_stages = 0
var/stage_prob = 4
/// The fraction of stages the virus must at least be at to show up on medical HUDs. Rounded up.
var/discovery_threshold = 0.5
/// If TRUE, this virus will show up on medical HUDs. Automatically set when it reaches mid-stage.
var/discovered = FALSE
//Other
var/list/viable_mobtypes = list() //typepaths of viable mobs
var/mob/living/carbon/affected_mob
var/list/cures = list() //list of cures if the disease has the VIRUS_CURABLE flag, these are reagent ids
var/infectivity = 65
var/cure_chance = 8
var/carrier = FALSE //If our host is only a carrier
var/bypasses_immunity = FALSE //Does it skip species virus immunity check? Some things may diseases and not viruses
var/virus_heal_resistant = FALSE // Some things aren't technically viruses/traditional diseases and should be immune to edge case cure methods, like healing viruses.
var/permeability_mod = 1
var/severity = VIRUS_NONTHREAT
var/list/required_organs = list()
var/needs_all_cures = TRUE
var/list/strain_data = list() //dna_spread special bullshit
/// Allow the virus to infect and process while the affected_mob is dead
var/allow_dead = FALSE
/// How many cycles we should incubate
var/incubation = 0
/datum/disease/Destroy()
affected_mob = null
GLOB.active_diseases.Remove(src)
return ..()
/datum/disease/proc/stage_act()
// Still incubating, do nothing
if(incubation)
if(is_species(affected_mob, /datum/species/monkey))
incubation = 0
else
incubation--
return FALSE
// We have no host
if(!affected_mob)
return FALSE
var/cure = has_cure()
// This is patient 0 and we aren't curing them. Do nothing
if(carrier && !cure)
return FALSE
stage = min(stage, max_stages)
handle_stage_advance(cure)
return handle_cure_testing(cure)
/datum/disease/proc/handle_stage_advance(has_cure = FALSE)
if(!has_cure && prob(stage_prob))
stage = min(stage + 1, max_stages)
if(!discovered && stage >= CEILING(max_stages * discovery_threshold, 1)) // Once we reach a late enough stage, medical HUDs can pick us up even if we regress
discovered = TRUE
affected_mob.med_hud_set_status()
/datum/disease/proc/handle_cure_testing(has_cure = FALSE)
if(has_cure && prob(cure_chance))
stage = max(stage - 1, 1)
if(disease_flags & VIRUS_CURABLE)
if(has_cure && prob(cure_chance))
cure()
return FALSE
return TRUE
/datum/disease/proc/has_cure()
if(!(disease_flags & VIRUS_CURABLE))
return 0
var/cures_found = 0
for(var/C_id in cures)
if(C_id == "ethanol")
for(var/datum/reagent/consumable/ethanol/booze in affected_mob.reagents.reagent_list)
cures_found++
break
else if(affected_mob.reagents.has_reagent(C_id))
cures_found++
if(needs_all_cures && cures_found < length(cures))
return FALSE
return cures_found
/datum/disease/proc/spread(force_spread = 0)
if(!affected_mob)
return
if((spread_flags & SPREAD_SPECIAL || spread_flags & SPREAD_NON_CONTAGIOUS || spread_flags & SPREAD_BLOOD) && !force_spread)
return
if(affected_mob.reagents.has_reagent("spaceacillin") || (affected_mob.satiety > 0 && prob(affected_mob.satiety/10)))
return
var/spread_range = 1
if(force_spread)
spread_range = force_spread
if(spread_flags & SPREAD_AIRBORNE)
spread_range++
var/spread_method = NONE
// If we do an airborne spread we will do that as well as other spreads
if((spread_flags & SPREAD_AIRBORNE) || spread_range > 1)
spread_method |= SPREAD_AIRBORNE
var/turf/target = affected_mob.loc
if(istype(target))
for(var/mob/living/carbon/C in oview(spread_range, affected_mob))
// Assume we are touching
spread_method |= (SPREAD_CONTACT_GENERAL | SPREAD_CONTACT_FEET | SPREAD_CONTACT_HANDS)
var/turf/current = get_turf(C)
if(current)
while(TRUE)
// Found a path from target to source that isn't atmos blocked. Try to give them the disease
if(current == target)
// If we are further than 1 tile we aren't touching
if(get_dist(target, C) > 1)
spread_method &= ~(SPREAD_CONTACT_GENERAL | SPREAD_CONTACT_FEET | SPREAD_CONTACT_HANDS)
// We also want to test our own mob's permeability so people in hardsuits with internals won't just infect others with sneezes or touch
affected_mob.can_spread_disease(src, spread_method) && C.ContractDisease(src, spread_method)
break
var/direction = get_dir(current, target)
var/turf/next = get_step(current, direction)
if(!current.CanAtmosPass(direction) || !next.CanAtmosPass(turn(direction, 180)))
break
current = next
/datum/disease/proc/after_infect()
return
/datum/disease/proc/cure()
if(affected_mob)
if(disease_flags & VIRUS_CAN_RESIST)
if(!(type in affected_mob.resistances))
affected_mob.resistances += type
remove_virus()
affected_mob.create_log(MISC_LOG, "has been cured from the virus \"[src]\"")
qdel(src)
// Gives the received mob a resistance to this disease. Does not cure it if they are already infected
/datum/disease/proc/make_resistant(mob/living/target)
if(target && disease_flags & VIRUS_CAN_RESIST && !(type in target.resistances))
target.resistances += type
/datum/disease/proc/IsSame(datum/disease/D)
if(ispath(D))
return istype(src, D)
return istype(src, D.type)
/datum/disease/proc/Copy()
var/datum/disease/D = new type()
D.spread_flags = spread_flags //In case an admin (or other factor) has made a virus non spreading, you should *not* get a new spreading virus from blood
D.visibility_flags = visibility_flags // See above.
D.strain_data = strain_data.Copy()
return D
/datum/disease/proc/get_required_cures()
return needs_all_cures ? length(cures) : 1
/datum/disease/proc/is_stabilized()
return TRUE
/datum/disease/proc/get_tracker()
return ""
/datum/disease/proc/get_stage()
return stage
/datum/disease/proc/GetDiseaseID()
return type
// Id for the pandemic
/datum/disease/proc/get_ui_id()
return name
// Another Id for the pandemic. We need multiple procs so we can override them in different ways
/datum/disease/proc/get_strain_id()
return name
// Another Id for the pandemic.
/datum/disease/proc/get_full_strain_id()
return name
/datum/disease/proc/IsSpreadByTouch()
if(spread_flags & SPREAD_CONTACT_FEET || spread_flags & SPREAD_CONTACT_HANDS || spread_flags & SPREAD_CONTACT_GENERAL)
return 1
return 0
//don't use this proc directly. this should only ever be called by cure()
/datum/disease/proc/remove_virus()
affected_mob.viruses -= src //remove the datum from the list
affected_mob.med_hud_set_status()
/// Not interested in normal diseases right now
/datum/disease/proc/record_infection()
return
/// Returns whether or not the disease is known
/datum/disease/proc/is_known(z)
return TRUE
/// Returns an Asoc list of disease's symptoms and their properties in a format usable by the PANDEMIC
/datum/disease/proc/get_pandemic_symptoms()
return list()
/// Returns the Disease's base stats
/datum/disease/proc/get_pandemic_base_stats()
return list(
"resistance" = 0,
"stealth" = 0,
"stageSpeed" = 0,
"transmissibility" = 0,
)