diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 174289d3bb..9b91fb72d0 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -34,3 +34,12 @@ #define DEL_REAGENT 1 // reagent deleted (fully cleared) #define ADD_REAGENT 2 // reagent added #define REM_REAGENT 3 // reagent removed (may still exist) + +//reagent bitflags, used for altering how they works +#define REAGENT_DEAD_PROCESS (1<<0) //calls on_mob_dead() if present in a dead body +#define REAGENT_DONOTSPLIT (1<<1) //Do not split the chem at all during processing +#define REAGENT_ONLYINVERSE (1<<2) //Only invert chem, no splitting +#define REAGENT_ONMOBMERGE (1<<3) //Call on_mob_life proc when reagents are merging. +#define REAGENT_INVISIBLE (1<<4) //Doesn't appear on handheld health analyzers. +#define REAGENT_FORCEONNEW (1<<5) //Forces a on_new() call without a data overhead +#define REAGENT_SNEAKYNAME (1<<6) //When metabolised it takes the name of the splitting chem diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 0059938720..78400e9448 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -385,7 +385,7 @@ SLIME SCANNER if(M.reagents.reagent_list.len) var/list/datum/reagent/reagents = list() for(var/datum/reagent/R in M.reagents.reagent_list) - if(R.invisible) + if(R.reagentFlags & REAGENT_INVISIBLE) continue reagents += R diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 61273d181d..7b2cf164fb 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -880,10 +880,8 @@ if(my_atom) my_atom.on_reagent_change(ADD_REAGENT) if(isliving(my_atom)) - if(R.OnMobMergeCheck == TRUE)//Forces on_mob_add proc when a chem is merged + if(R.reagentFlags & REAGENT_ONMOBMERGE)//Forces on_mob_add proc when a chem is merged R.on_mob_add(my_atom, amount) - //else - // R.on_merge(data, amount, my_atom, other_purity) R.on_merge(data, amount, my_atom, other_purity) if(!no_react) handle_reactions() @@ -901,7 +899,7 @@ if(data) R.data = data R.on_new(data) - if(R.addProc == TRUE)//Allows on new without data overhead. + if(R.reagentFlags & REAGENT_FORCEONNEW)//Allows on new without data overhead. R.on_new(pH) //Add more as desired. diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index c21629ce8f..e5d1246093 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -32,19 +32,23 @@ var/addiction_stage3_end = 30 var/addiction_stage4_end = 40 var/overdosed = 0 // You fucked up and this is now triggering its overdose effects, purge that shit quick. - var/self_consuming = FALSE + var/self_consuming = FALSE //I think this uhhh, makes weird stuff happen when metabolising, but... doesn't seem to do what I think, so I'm gonna leave it. //Fermichem vars: var/purity = 1 //How pure a chemical is from 0 - 1. - var/addProc = FALSE //If the chemical should force an on_new() call var/turf/loc = null //Should be the creation location! var/pH = 7 //pH of the specific reagent, used for calculating the sum pH of a holder. var/ImpureChem = "fermiTox"// What chemical is metabolised with an inpure reaction var/InverseChemVal = 0.25 // If the impurity is below 0.5, replace ALL of the chem with InverseChem upon metabolising var/InverseChem = "fermiTox"// What chem is metabolised when purity is below InverseChemVal, this shouldn't be made, but if it does, well, I guess I'll know about it. - var/DoNotSplit = FALSE // If impurity is handled within the main chem itself - var/OnMobMergeCheck = FALSE //Call on_mob_life proc when reagents are merging. var/metabolizing = FALSE - var/invisible = FALSE //Set to true if it doesn't appear on handheld health analyzers. + var/reagentFlags //REAGENT_DEAD_PROCESS, REAGENT_DONOTSPLIT, REAGENT_ONLYINVERSE, REAGENT_ONMOBMERGE, REAGENT_INVISIBLE, REAGENT_FORCEONNEW, REAGENT_SNEAKYNAME + //REAGENT_DEAD_PROCESS Calls on_mob_dead() if present in a dead body + //REAGENT_DONOTSPLIT Do not split the chem at all during processing + //REAGENT_ONLYINVERSE Only invert chem, no splitting + //REAGENT_ONMOBMERGE Call on_mob_life proc when reagents are merging. + //REAGENT_INVISIBLE Doesn't appear on handheld health analyzers. + //REAGENT_FORCEONNEW Forces a on_new() call without a data overhead + //REAGENT_SNEAKYNAME When metabolised it takes the name of the splitting chem /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references . = ..() @@ -73,6 +77,15 @@ holder.remove_reagent(src.id, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears. return +//called when a mob processes chems when dead. +/datum/reagent/proc/on_mob_death(mob/living/carbon/M) + if(!(reagentFlags & REAGENT_DEAD_PROCESS)) //justincase + return + current_cycle++ + if(holder) + holder.remove_reagent(src.id, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears. + return + // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L) return diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index bc64d6636b..f74ff404a7 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -2003,7 +2003,7 @@ can_synth = FALSE var/datum/dna/original_dna var/reagent_ticks = 0 - invisible = TRUE + reagentFlags = REAGENT_INVISIBLE /datum/reagent/changeling_string/on_mob_metabolize(mob/living/carbon/C) if(C && C.dna && data["desired_dna"]) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm index 1508a5d519..9d90e4fcc2 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm @@ -136,7 +136,7 @@ Creating a chem with a low purity will make you permanently fall in love with so color = "#660015" // rgb: , 0, 255 taste_description = "synthetic chocolate, a base tone of alcohol, and high notes of roses" overdose_threshold = 100 //If this is too easy to get 100u of this, then double it please. - DoNotSplit = TRUE + reagentFlags = REAGENT_DONOTSPLIT metabolization_rate = 0.1//It has to be slow, so there's time for the effect. data = list("creatorID" = null, "creatorGender" = null, "creatorName" = null) var/creatorID //ckey @@ -144,7 +144,7 @@ Creating a chem with a low purity will make you permanently fall in love with so var/creatorName var/mob/living/creator pH = 10 - OnMobMergeCheck = TRUE //Procs on_mob_add when merging into a human + reagentFlags = REAGENT_ONMOBMERGE //Procs on_mob_add when merging into a human can_synth = FALSE @@ -157,7 +157,7 @@ Creating a chem with a low purity will make you permanently fall in love with so creatorGender = "Mistress" creatorName = "Fermis Yakumo" purity = 1 - DoNotSplit = TRUE + reagentFlags = REAGENT_DONOTSPLIT /datum/reagent/fermi/enthrall/test/on_new() id = "enthrall" @@ -300,13 +300,13 @@ Creating a chem with a low purity will make you permanently fall in love with so //Creates a gas cloud when the reaction blows up, causing everyone in it to fall in love with someone/something while it's in their system. /datum/reagent/fermi/enthrallExplo//Created in a gas cloud when it explodes - name = "MKUltra" + name = "Gaseous MKUltra" id = "enthrallExplo" description = "A forbidden deep red mixture that overwhelms a foreign body with waves of desire, inducing a chemial love for another. Also, how the HECC did you get this?" color = "#2C051A" // rgb: , 0, 255 metabolization_rate = 0.1 taste_description = "synthetic chocolate, a base tone of alcohol, and high notes of roses." - DoNotSplit = TRUE + reagentFlags = REAGENT_DONOTSPLIT can_synth = FALSE var/mob/living/carbon/love diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm index 8af3176746..c350326c0f 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -300,6 +300,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING description = "A chem that makes a certain chemcat angry at you if you're reading this, how did you get this???"//i.e. tell me please, figure it's a good way to get pinged for bugfixes. metabolization_rate = 1 can_synth = FALSE + reagentFlags = REAGENT_INVISIBLE /datum/reagent/fermi/SDGFtox/on_mob_life(mob/living/carbon/M)//Damages the taker if their purity is low. Extended use of impure chemicals will make the original die. (thus can't be spammed unless you've very good) M.blood_volume -= 10 diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm index 275c244a83..236dc8131a 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -14,7 +14,7 @@ return if(purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - if (purity == 1 || DoNotSplit == TRUE) + if (purity == 1 || (reagentFlags & REAGENT_DONOTSPLIT)) log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") return else if (InverseChemVal > purity)//Turns all of a added reagent into the inverse chem @@ -22,7 +22,7 @@ M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [InverseChem]") return - else + else if(!(reagentFlags & REAGENT_ONLYINVERSE)) var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem M.reagents.remove_reagent(id, (impureVol), FALSE) M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) @@ -37,7 +37,7 @@ return if (purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - if (purity == 1 || DoNotSplit == TRUE) + if (purity == 1 || (reagentFlags & REAGENT_DONOTSPLIT)) log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [id] in themselves") return else if (InverseChemVal > purity) @@ -48,7 +48,7 @@ R.name = name//Negative effects are hidden log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [InverseChem]") return - else + else if(!(reagentFlags & REAGENT_ONLYINVERSE)) var/impureVol = amount * (1 - purity) M.reagents.remove_reagent(id, impureVol, FALSE) M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) @@ -77,7 +77,7 @@ taste_description = "like jerky, whiskey and an off aftertaste of a crypt." metabolization_rate = 0.2 overdose_threshold = 25 - DoNotSplit = TRUE + reagentFlags = REAGENT_DONOTSPLIT pH = 4 can_synth = TRUE @@ -124,7 +124,7 @@ metabolization_rate = 0.5 * REAGENTS_METABOLISM InverseChemVal = 0 var/obj/item/organ/tongue/nT - DoNotSplit = TRUE + reagentFlags = REAGENT_DONOTSPLIT pH = 5 var/obj/item/organ/tongue/T can_synth = TRUE @@ -250,6 +250,7 @@ id = "nanite_b_goneTox" description = "Poorly made, and shocks you!" metabolization_rate = 1 + reagentFlags = REAGENT_INVISIBLE //Increases shock events. /datum/reagent/fermi/nanite_b_goneTox/on_mob_life(mob/living/carbon/C)//Damages the taker if their purity is low. Extended use of impure chemicals will make the original die. (thus can't be spammed unless you've very good) @@ -315,7 +316,7 @@ name = "Fermis Test Reagent" id = "fermiTest" description = "You should be really careful with this...! Also, how did you get this?" - addProc = TRUE + reagentFlags = REAGENT_FORCEONNEW can_synth = FALSE /datum/reagent/fermi/fermiTest/on_new(datum/reagents/holder) @@ -353,6 +354,7 @@ data = "merge" color = "FFFFFF" can_synth = FALSE + reagentFlags = REAGENT_INVISIBLE //I'm concerned this is too weak, but I also don't want deathmixes. /datum/reagent/fermi/fermiTox/on_mob_life(mob/living/carbon/C, method) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index b717948a20..32c09131a2 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -80,6 +80,7 @@ taste_description = "a weird, syrupy flavour, yamero" color = "#68e83a" pH = 8.6 + reagentFlags = REAGENT_INVISIBLE /datum/reagent/fermi/yamerol_tox/on_mob_life(mob/living/carbon/C) var/obj/item/organ/tongue/T = C.getorganslot(ORGAN_SLOT_TONGUE)