# Dev Diary #1: What is a Pathogen? What are the associated basic functions? ### Code in Focus: /pathogen.dm Specifically, the datum defining all pathogens. ## Name (name,name_base,replica) Naming is split into two variables: one for the original 'proper' name, and one to store customized names. Things to consider: - How will word filters check these variables? - What is the nomenclature for replicated strains? Currently, I am thinking about appending names with a dash+captial letter (-A,-D,-G) to signify different replica strains. A new var is needed to differentiate each strain's infection capacity. Let's call it "var/replica". ## Description (desc) The original function of this var is maintained. ## The Infected Mob (var/mob/infected) The original function of this var is maintained. ## Staging + Advancement (stage,stages,advance_speed,cooldown,ticked) All variables are functionally identical from before. ## Microbody Type (/datum/microbody/body_type) The original function of this var is maintained. This var will be critical in assembling pathogens. ## Cure (cure_catagory,cure_threshold,in_remission = 0) Cures are simplified such that meeting the cure requirement puts the infected user in permanent remission until cleared and immunized. ## Symptoms (symptom_data = list() effects = list(), mutex = list()) All original var definitions and functions will remain. This section will definitely be revisited for implementation of complex symptom hierarchy and multipathogen rule enforcement. ## Transmission (transmissions = list(), spread) A transmissions list will store flags for what mode of spread a pathogen can take. Spread is a modifier used by the microbody (and perhaps symptoms) to affect the probabilities concerning contagious spread. --- ### Code in focus: /pathogen.dm Specifically, all the code contained in /datum/pathogen that follows after the defining vars. ## Clear() Function: Reset all vars defined in the datum. ## Clone() Creates a true-identical clone of a pathogen. Used by the old pathogen analyzer and may not be needed. ## do_prefab(var/strength = 0) strength is a var from /pathogen_microbodies.dm. This function calls functions from below. This function fills in vars not explicitly defined for pathogens in /pathogen_ailments.dm. # Subtopic: Pathogen Generation ## setup(0,null,0) **This is the main pathogen generator function.** The old inputs: (status, datum/pathogen/origin, may_mutate, var/datum/pathogendna/sample = null) Inherently, the pathogen created is not in remission (i.e. not being cured). status: preliminary var, has 0,1,2 as valid inputs. * 0: if there is a reference pathogen (../origin), copy all values from that original pathogen and add it to the stack heap (Add.src). If there is no valid reference pathogen, return. Good code, will just update vars. * 1: Create a completely randomized pathogen. Uses one integer input for 'strength' (centered at 8) to scale multiple different components of the pathogen. This should accept at least one more input for different tiers of pathogens. * 2: Used by predefined pathogens in setup. Refer to pathogen_ailments.dm to see usage. #### Changes After updating vars, setup() will have 3 inputs: status, origin, and tier. ## create_weak() Generates a random pathogen with -8 bias against 'strength'. This is the function used to create natural ## cdc_announce(var/mob/M) ## generate_name() Generates a random name for a pathogen. Code is included to account for mutation. **Code for name customization and replica nomenclature must be added, either in this file as new functions or integrated with TGUI. ## generate_components(var/datum/pathogen_cdc/cdc, var/strength) This function handles both the cure and the microbody type. **This function will be split into "generate_cure" and "generate_microbody" procs.** ### generate_microbody(var/datum/pathogen_cdc/cdc, var/strength) This function chooses a generated pathogen's microbody. This function will handle forced microbody selection. ### generate_cure(var/datum/pathogen_cdc/cdc, var/strength) This function chooses both the cure type and cure threshold for a generated pathogen. ## generate_randomized_effects(var/strength) Chooses randomized **symptoms** based on the input strength value. Strength affects both quantity and rarity in selection (... too general) **This function should accept additional parameters (tier, isnatural) to get more pronounced generation differences.** ## generate_attributes(var/strength) Chooses advance speed, contagiousness, and description. Also sets other parameters. **This function will become a generator for description and preloading for variables, because simple cures replace suppression and the microbody/emagged creation console determines stages/spread/advancing speed.** ## randomize(var/strength) [!!!] Calls the above functions to generate a pathogen. Contains an adminlog line. Called twice in /pathogen.dm, one for proc/setup, one for create_weak(). **Mostly OK, just need to get to pathogen_cdc datum to figure out what is being used there** --- # Symptom Selection on Generation ## generate_weak_effect() Chooses a symptom **(Type 1,2,3)** from a distribution using a switch-rand. ## generate_effect() Chooses a symptom **(T1,2,3,4)** from a distribution using a switch-rand. ## generate_strong_effect() Chooses a symptom **(T2,3,4)** from a distribution using a switch-rand. **To be clear, I believe that T5 should be emag-exclusive, as beneficial symptoms in my reworked threat system go up to 4.** **These distributions need to be tweaked through playtesting.** --- # Stage Progression Handling ## process() Used strictly for progress_pathogen(). **Wraps functions disease_act and similar.** ## progress_pathogen() original comment: "handles pathogen advancing or receding in stage and also being cured" **Because curing is now a 'one-and-done' procedure, this proc is simplified to only handle stage progression/regression. The function will accept the 'in_remission' var to handle this.** **Cooldown (3) means that every 3 on.Life ticks, the pathogen will either progress or regress. This value should be playtested.** ## disease_act() **This executes symptom effects on the player.** Calls on code from on.Life (oh god). **Will revisit on writing up a doc for peripheral files.** ## disease_act_dead() Same code as above, but checks for dead. **Will revisit on writing up a doc for peripheral files.** ## advance(), reduce() Near-identical code: when called, updates the current stage var and changes the cooldown linearly as stages increase. The reduce function includes a line for when a person is cured. **Maybe consider using a different mathematical parent (log+floor?) for cooldown changes.** ## is_carried_by(var/reagent) comment: "Carrier query. Currently unused." **Carrier mechanism is removed. This function is removed.** ## remission() When called, sets in_remission to 1. **Kept.** --- # Events Thankfully past devs left a healthy explanation box for these event handlers. **The following procs are linked to code in /symptoms.dm, lines 101-157. There will be a section in the symptoms file detailing how these events will be handled.** ## The four intent procs (on{}[]) Uses on.Life code, and has a for loop to scan through data defined from /symptoms.dm and from datums in /pathogen_suppressants.dm. **get_disease_protection() and associated vars are not used. "viralprot" should be used to remove certainty from contagious spreading.** ## onshocked onshocked uses vars (amt,wattage,skipsupp) created locally to for-loop through the respective on.Life function. **Comments note that this function is particularly complex. Will review with the suppressant doc.** ## onsay Applies accents/changes to say, returning the altered message. **Apparently speech was planned to be a curetype. I'll look into this.** ## onemote Calls code from the /carbon/human/procs file. **Also intended to be a curetype. This may need a separate doc.** ## ondeath Triggers effects and suppressants on death. **...I guess death can be a cure?** ## oncured Triggers effects and suppressants on cured. --- # Pathogen Manipulation **Symptoms were essentially a list() of effects that were appended to/deleted from a pathogen's effect list(). A symptom was able to gain or lose effects through mutation or from the DNA reconstruction system.** **For the initial rework, symptoms will be immutable lists of effects. Later on, customizable symptoms may be a consideration.** ## add_new_symptom(var/list/allowed, var/allow_duplicates = 0) Generates a new... symptom? In a for loop (10 iterations), select a pathogen effect and link the effect to a symptom. If the effect is allowed and not a dupe, increment the loop. **In the redesign, symptoms are the building blocks of a pathogen. Symptoms have assigned effects, and should (probably) not be customizable...** **Custom symptoms is a strong idea, but for the initial rework, it can be shelved.** ## add_symptom(var/datum/pathogeneffects/E, var/allow_duplicates = 0) Adds a symptom to a pathogen after checking for mutex rules. **Integrate hierarchy checking here as a function call(?)** ## remove_symptom(var/datum/pathogeneffects/E, var/all = 0) Removes a symptom from a pathogen. ## rebuild_mutex() Updates mutex rules for the pathogen. **Include hierarchy call here** ## getHighestTier() **Why is there a . = 0?** Finds the highest rarity value of all the effects in a pathogen. **Change this after reworking the symptoms code to find the highest threat/rarity symptom instead of effect.** ## The procs after this are related to the DNA system and are commented out (in case someone wants to use them elsewhere): - dig2hex(num) - num2hexoc(num,pad) - hex2numoc(var/num) - rand3seq() --- # From the top... ## datum/pathogen_cdc Defines vars used in only the following datums. **Used for logging. Should be simplified after reworking /controller/.** --- # datum/controller/pathogen Follows backend design rule for controllers (see ctrl+f datum/controller/). Creates many vars used across different files. **Let's first address the procs in which the vars are used.** ## mob_infected(var/datum/pathogen/P, var/mob/living/carbon/human/H) Used in **/human.dm.** ... ## mob_cured(var/datum/pathogen/P, var/mob/living/carbon/human/H) ... ## patient_zero(var/datum/pathogen_cdc/CDC, var/topic_holder) ... # Topic(href,href_list) **Admin subpanel for a player's pathogens.** ## severity_color(var/datum/pathogeneffects/EF) ## cdc_main(var/topic_holder) ## gen_empty(var/key) ## DNA effect contruction code --- # datum/choice, datum/shockparam **Floating var definitions**