From 7ef5ab03321150776a8f42a45c73ccda2f1feeaa Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Thu, 19 Sep 2019 17:52:45 +0100 Subject: [PATCH 01/17] TO TEST - also needs #9099 merging. --- code/__DEFINES/reagents.dm | 9 ++++++++ code/game/objects/items/devices/scanners.dm | 2 +- code/modules/reagents/chemistry/holder.dm | 6 ++--- code/modules/reagents/chemistry/reagents.dm | 23 +++++++++++++++---- .../chemistry/reagents/other_reagents.dm | 2 +- .../reagents/chemistry/reagents/MKUltra.dm | 10 ++++---- .../reagents/chemistry/reagents/SDGF.dm | 1 + .../chemistry/reagents/fermi_reagents.dm | 16 +++++++------ .../reagents/chemistry/reagents/healing.dm | 1 + 9 files changed, 47 insertions(+), 23 deletions(-) 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) From d2c49d798713317704d28de01e220d7e3e212aee Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Thu, 19 Sep 2019 20:30:35 +0100 Subject: [PATCH 02/17] On_mob_dead! --- code/modules/mob/living/carbon/life.dm | 7 ++++ code/modules/reagents/chemistry/reagents.dm | 42 +++++++++++++-------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 36e4e18817..675f17d37e 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -33,6 +33,7 @@ if(stat == DEAD) stop_sound_channel(CHANNEL_HEARTBEAT) + handle_death() rot() //Updates the number of stored chemicals for powers @@ -41,6 +42,12 @@ if(stat != DEAD) return 1 +//Procs called while dead +/mob/living/carbon/handle_death() + for(var/datum/reagents/R in reagents.reagent_list) + if(R.reagentFlag & REAGENT_DEAD_PROCESS) + R.on_mob_dead(src) + /////////////// // BREATHING // /////////////// diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 2febd1fd78..26b8b7dc6e 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -43,13 +43,14 @@ 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/metabolizing = FALSE 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 + //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 inverted, the inverted chem uses the name of the original chem + //REAGENT_SPLITRETAINVOL Retains initial volume of chem when splitting /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references . = ..() @@ -93,20 +94,27 @@ var/mob/living/carbon/M = L if(!M) return - if(purity < 0) + if(cached_purity == 1) + cached_purity = purity + if(cached_purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") if (purity == 1 || DoNotSplit == TRUE) 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 - M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) + if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) + M.reagents.remove_reagent(id, amount, FALSE) + M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1-cached_purity) log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [InverseChem]") return else 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) + M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1-cached_purity) + if(reagentFlags & REAGENT_SNEAKYNAME) + var/datum/reagent/R = has_reagent("[InverseChem]") + R.name = name//Negative effects are hidden + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [id]") log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [ImpureChem]") return @@ -135,13 +143,16 @@ if(SplitChem) if(!ishuman(M)) return + if(cached_purity == 1) + cached_purity = purity if (purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") if (purity == 1 || DoNotSplit == TRUE) log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [id] in themselves") return else if (InverseChemVal > purity) - M.reagents.remove_reagent(id, amount, FALSE) + if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) + M.reagents.remove_reagent(id, amount, FALSE) M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) for(var/datum/reagent/fermi/R in M.reagents.reagent_list) if(R.name == "") @@ -152,9 +163,10 @@ var/impureVol = amount * (1 - purity) M.reagents.remove_reagent(id, impureVol, FALSE) M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) - for(var/datum/reagent/fermi/R in M.reagents.reagent_list) - if(R.name == "") - R.name = name//Negative effects are hidden + if(reagentFlags & REAGENT_SNEAKYNAME) + var/datum/reagent/R = has_reagent("[InverseChem]") + R.name = name//Negative effects are hidden + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [id]") log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [ImpureChem]") return From b8190552f142566096e7e07ae5e52d29d01f40a9 Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Thu, 19 Sep 2019 21:24:50 +0100 Subject: [PATCH 03/17] Update defines, and vars, and created new procs --- code/__DEFINES/reagents.dm | 7 ++- code/modules/mob/living/carbon/life.dm | 6 +- code/modules/reagents/chemistry/reagents.dm | 59 ++++++++++--------- .../chemistry/reagents/alcohol_reagents.dm | 2 +- code/modules/reagents/chemistry/recipes.dm | 1 + .../reagents/chemistry/reagents/MKUltra.dm | 3 +- .../reagents/chemistry/reagents/SDGF.dm | 1 + .../chemistry/reagents/fermi_reagents.dm | 7 ++- .../reagents/chemistry/reagents/healing.dm | 2 +- .../reagents/chemistry/recipes/fermi.dm | 18 +++++- 10 files changed, 66 insertions(+), 40 deletions(-) diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 9b91fb72d0..36ea64de2c 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -42,4 +42,9 @@ #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 +#define REAGENT_SNEAKYNAME (1<<6) //When inverted, the inverted chem uses the name of the original chem +#define REAGENT_SPLITRETAINVOL (1<<7) //Retains initial volume of chem when splitting + +//Chemical reaction flags, for determining reaction specialties +#define REACTION_CLEAR_IMPURE (1<<0) //Convert into impure/pure on reaction completion +#define REACTION_CLEAR_INVERSE (1<<1) //Convert into inverse on reaction completion when purity is low enough diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 675f17d37e..2d55797a48 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -43,9 +43,9 @@ return 1 //Procs called while dead -/mob/living/carbon/handle_death() - for(var/datum/reagents/R in reagents.reagent_list) - if(R.reagentFlag & REAGENT_DEAD_PROCESS) +/mob/living/carbon/proc/handle_death() + for(var/datum/reagent/R in reagents.reagent_list) + if(R.reagentFlags & REAGENT_DEAD_PROCESS) R.on_mob_dead(src) /////////////// diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 26b8b7dc6e..3d6740aba3 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -34,13 +34,14 @@ var/overdosed = 0 // You fucked up and this is now triggering its overdose effects, purge that shit quick. 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/purity = 1 //How pure a chemical is from 0 - 1. + var/cached_purity = 1 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/SplitChem = FALSE //If the chem splits on metabolism - 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/SplitChem = FALSE //If the chem splits on metabolism + var/ImpureChem // What chemical is metabolised with an inpure reaction + var/InverseChemVal = 0 // If the impurity is below 0.5, replace ALL of the chem with InverseChem upon metabolising + var/InverseChem // 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/metabolizing = FALSE 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 @@ -80,7 +81,7 @@ return //called when a mob processes chems when dead. -/datum/reagent/proc/on_mob_death(mob/living/carbon/M) +/datum/reagent/proc/on_mob_dead(mob/living/carbon/M) if(!(reagentFlags & REAGENT_DEAD_PROCESS)) //justincase return current_cycle++ @@ -90,29 +91,29 @@ // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L, amount) - if(SplitChem) + if(!(reagentFlags & REAGENT_DONOTSPLIT)) var/mob/living/carbon/M = L if(!M) return + if (purity == 1) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") + return if(cached_purity == 1) cached_purity = purity if(cached_purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - if (purity == 1 || DoNotSplit == TRUE) - 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 - if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) - M.reagents.remove_reagent(id, amount, FALSE) + else if ((InverseChemVal > purity) && (InverseChem))//Turns all of a added reagent into the inverse chem + M.reagents.remove_reagent(id, amount, FALSE) M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1-cached_purity) log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [InverseChem]") return - else + else if (ImpureChem) var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem - M.reagents.remove_reagent(id, (impureVol), FALSE) + if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) + M.reagents.remove_reagent(id, (impureVol), FALSE) M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1-cached_purity) if(reagentFlags & REAGENT_SNEAKYNAME) - var/datum/reagent/R = has_reagent("[InverseChem]") + var/datum/reagent/R = M.reagents.has_reagent("[InverseChem]") R.name = name//Negative effects are hidden log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [id]") @@ -140,31 +141,31 @@ // Called when two reagents of the same are mixing. /datum/reagent/proc/on_merge(data, amount, mob/living/carbon/M, purity) - if(SplitChem) - if(!ishuman(M)) + if(!(reagentFlags & REAGENT_DONOTSPLIT)) + if(!iscarbon(M)) + return + if (purity == 1) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") return if(cached_purity == 1) cached_purity = purity if (purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - if (purity == 1 || DoNotSplit == TRUE) - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [id] in themselves") - return - else if (InverseChemVal > purity) - if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) - M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) + else if ((InverseChemVal > purity) && (InverseChem)) + M.reagents.remove_reagent(id, amount, FALSE) + M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1-cached_purity) for(var/datum/reagent/fermi/R in M.reagents.reagent_list) if(R.name == "") R.name = name//Negative effects are hidden log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [InverseChem]") return - else + else if (ImpureChem) var/impureVol = amount * (1 - purity) - M.reagents.remove_reagent(id, impureVol, FALSE) - M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) + if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) + M.reagents.remove_reagent(id, impureVol, FALSE) + M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1-cached_purity) if(reagentFlags & REAGENT_SNEAKYNAME) - var/datum/reagent/R = has_reagent("[InverseChem]") + var/datum/reagent/R = M.reagents.has_reagent("[InverseChem]") R.name = name//Negative effects are hidden log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [id]") diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 88073ca5f3..9a3d9b4b88 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -1383,7 +1383,7 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_icon_state = "neurotoxinglass" glass_name = "Neurotoxin" glass_desc = "A drink that is guaranteed to knock you silly." - SplitChem = TRUE + //SplitChem = TRUE ImpureChem = "neuroweak" InverseChemVal = 0 //Clear conversion InverseChem = "neuroweak" diff --git a/code/modules/reagents/chemistry/recipes.dm b/code/modules/reagents/chemistry/recipes.dm index 32155c9b89..a55262c41e 100644 --- a/code/modules/reagents/chemistry/recipes.dm +++ b/code/modules/reagents/chemistry/recipes.dm @@ -32,6 +32,7 @@ var/RateUpLim = 10 // Optimal/max rate possible if all conditions are perfect var/FermiChem = FALSE // If the chemical uses the Fermichem reaction mechanics//If the chemical uses the Fermichem reaction mechanics var/FermiExplode = FALSE // If the chemical explodes in a special way + var/ClearConversion //bitflags for clear conversions; REACTION_CLEAR_IMPURE or REACTION_CLEAR_INVERSE var/PurityMin = 0.15 //If purity is below 0.15, it explodes too. Set to 0 to disable this. diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm index 9d90e4fcc2..7ff43d63d2 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm @@ -136,7 +136,6 @@ 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. - 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 +143,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 - reagentFlags = REAGENT_ONMOBMERGE //Procs on_mob_add when merging into a human + reagentFlags = REAGENT_ONMOBMERGE | REAGENT_DONOTSPLIT //Procs on_mob_add when merging into a human can_synth = FALSE diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm index c350326c0f..f9536f663c 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -316,6 +316,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING metabolization_rate = 0.5 * REAGENTS_METABOLISM var/startHunger can_synth = TRUE + reagentFlags = REAGENT_SNEAKYNAME /datum/reagent/fermi/SDZF/on_mob_life(mob/living/carbon/M) //If you're bad at fermichem, turns your clone into a zombie instead. switch(current_cycle)//Pretends to be normal 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 9acf3d3dfc..18458f509d 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -6,7 +6,10 @@ id = "fermi" taste_description = "affection and love!" can_synth = FALSE - SplitChem = TRUE + //SplitChem = TRUE + ImpureChem = "fermiTox"// What chemical is metabolised with an inpure reaction + InverseChemVal = 0.25 // If the impurity is below 0.5, replace ALL of the chem with InverseChem upon metabolising + InverseChem = "fermiTox" //This should process fermichems to find out how pure they are and what effect to do. /datum/reagent/fermi/on_mob_add(mob/living/carbon/M, amount) @@ -16,7 +19,7 @@ //When merging two fermichems, see above /datum/reagent/fermi/on_merge(data, amount, mob/living/carbon/M, purity)//basically on_mob_add but for merging . = ..() - + //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index 32c09131a2..33ca422785 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -80,7 +80,7 @@ taste_description = "a weird, syrupy flavour, yamero" color = "#68e83a" pH = 8.6 - reagentFlags = REAGENT_INVISIBLE + 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) diff --git a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm index d993322fcb..d017868120 100644 --- a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm +++ b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm @@ -6,7 +6,23 @@ return //Called when reaction STOP_PROCESSING -/datum/chemical_reaction/proc/FermiFinish(datum/reagents/holder) +/datum/chemical_reaction/proc/FermiFinish(datum/reagents/holder, var/atom/my_atom) + if(ClearConversion == REACTION_CLEAR_IMPURE | REACTION_CLEAR_INVERSE) + for(var/id in results) + var/datum/reagent/R = my_atom.reagents.has_reagent("[id]") + if(R.purity == 1) + continue + + var/cached_volume = R.volume + if(ClearConversion == REACTION_CLEAR_INVERSE && R.InverseChem) + if(R.InverseChemVal > R.purity) + my_atom.reagents.remove_reagent(R.id, cached_volume, FALSE) + my_atom.reagents.add_reagent(R.InverseChem, cached_volume, FALSE, other_purity = 1) + + else if (ClearConversion == REACTION_CLEAR_IMPURE && R.ImpureChem) + var/impureVol = cached_volume * (1 - R.purity) + my_atom.reagents.remove_reagent(R.id, (impureVol), FALSE) + my_atom.reagents.add_reagent(R.ImpureChem, impureVol, FALSE, other_purity = 1) return //Called when temperature is above a certain threshold, or if purity is too low. From 3f2933adbf0ff746c1ff92e8ca682b1105f1ad42 Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Thu, 19 Sep 2019 23:31:36 +0100 Subject: [PATCH 04/17] Ghommies' requests. --- code/_globalvars/bitfields.dm | 20 ++++++- code/game/objects/items/devices/scanners.dm | 2 +- code/modules/mob/living/carbon/life.dm | 2 +- .../reagents/chemistry/fermi/readme.md | 23 ++++++++ code/modules/reagents/chemistry/holder.dm | 4 +- .../chemistry/machinery/chem_master.dm | 4 +- code/modules/reagents/chemistry/reagents.dm | 59 ++++++++----------- .../chemistry/reagents/alcohol_reagents.dm | 6 +- .../chemistry/reagents/other_reagents.dm | 2 +- code/modules/reagents/chemistry/recipes.dm | 2 +- .../reagents/chemistry/reagents/MKUltra.dm | 6 +- .../reagents/chemistry/reagents/SDGF.dm | 10 ++-- .../reagents/chemistry/reagents/astrogen.dm | 2 +- .../chemistry/reagents/enlargement.dm | 12 ++-- .../chemistry/reagents/fermi_reagents.dm | 24 ++++---- .../reagents/chemistry/reagents/healing.dm | 8 +-- .../reagents/chemistry/recipes/fermi.dm | 12 ++-- 17 files changed, 114 insertions(+), 84 deletions(-) create mode 100644 code/modules/reagents/chemistry/fermi/readme.md diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 3b32745b5c..0681351395 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -171,10 +171,24 @@ GLOBAL_LIST_INIT(bitfields, list( "rad_flags" = list( "RAD_PROTECT_CONTENTS" = RAD_PROTECT_CONTENTS, "RAD_NO_CONTAMINATE" = RAD_NO_CONTAMINATE, - ), + ), "disease_flags" = list( "CURABLE" = CURABLE, "CAN_CARRY" = CAN_CARRY, "CAN_RESIST" = CAN_RESIST - ), - )) \ No newline at end of file + ), + "reagent_flags" = list( + "REAGENT_DEAD_PROCESS" = REAGENT_DEAD_PROCESS, + "REAGENT_DONOTSPLIT" = REAGENT_DONOTSPLIT, + "REAGENT_ONLYINVERSE" = REAGENT_ONLYINVERSE, + "REAGENT_ONMOBMERGE" = REAGENT_ONMOBMERGE, + "REAGENT_INVISIBLE" = REAGENT_INVISIBLE, + "REAGENT_FORCEONNEW" = REAGENT_FORCEONNEW, + "REAGENT_SNEAKYNAME" = REAGENT_SNEAKYNAME, + "REAGENT_SPLITRETAINVOL" = REAGENT_SPLITRETAINVOL + ), + "clear_conversion" = list( + "REACTION_CLEAR_IMPURE" = REACTION_CLEAR_IMPURE, + "REACTION_CLEAR_INVERSE" = REACTION_CLEAR_INVERSE + ), + )) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 78400e9448..5d4cd883f4 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.reagentFlags & REAGENT_INVISIBLE) + if(R.reagent_flags & REAGENT_INVISIBLE) continue reagents += R diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 2d55797a48..43a1b30916 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -45,7 +45,7 @@ //Procs called while dead /mob/living/carbon/proc/handle_death() for(var/datum/reagent/R in reagents.reagent_list) - if(R.reagentFlags & REAGENT_DEAD_PROCESS) + if(R.reagent_flags & REAGENT_DEAD_PROCESS) R.on_mob_dead(src) /////////////// diff --git a/code/modules/reagents/chemistry/fermi/readme.md b/code/modules/reagents/chemistry/fermi/readme.md new file mode 100644 index 0000000000..59f0faccef --- /dev/null +++ b/code/modules/reagents/chemistry/fermi/readme.md @@ -0,0 +1,23 @@ +How to code fermichem reactions: +First off, probably read though the readme for standard reagent mechanisms, this builds on top of that. + +#bitflags +for `datum/reagent/` you have the following options with `var/reagent_flags`: + +``` +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 inverted, the inverted chem uses the name of the original chem +REAGENT_SPLITRETAINVOL Retains initial volume of chem when splitting +``` + +for `datum/chemical_reaction/` under `var/clear_conversion` + +``` +REACTION_CLEAR_IMPURE Convert into impure/pure on reaction completion +REACTION_CLEAR_INVERSE Convert into inverse on reaction completion when purity is low enough +``` diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 7b2cf164fb..59311a056c 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -880,7 +880,7 @@ if(my_atom) my_atom.on_reagent_change(ADD_REAGENT) if(isliving(my_atom)) - if(R.reagentFlags & REAGENT_ONMOBMERGE)//Forces on_mob_add proc when a chem is merged + if(R.reagent_flags & REAGENT_ONMOBMERGE)//Forces on_mob_add proc when a chem is merged R.on_mob_add(my_atom, amount) R.on_merge(data, amount, my_atom, other_purity) if(!no_react) @@ -899,7 +899,7 @@ if(data) R.data = data R.on_new(data) - if(R.reagentFlags & REAGENT_FORCEONNEW)//Allows on new without data overhead. + if(R.reagent_flags & REAGENT_FORCEONNEW)//Allows on new without data overhead. R.on_new(pH) //Add more as desired. diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 85cf5e5011..96aa0901e0 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -405,7 +405,7 @@ if(!targetReagent) CRASH("Tried to find a reagent that doesn't exist in the chem_master!") - analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold), "purityF" = targetReagent.purity, "inverseRatioF" = initial(R.InverseChemVal), "purityE" = initial(Rcr.PurityMin), "minTemp" = initial(Rcr.OptimalTempMin), "maxTemp" = initial(Rcr.OptimalTempMax), "eTemp" = initial(Rcr.ExplodeTemp), "pHpeak" = pHpeakCache) + analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold), "purityF" = targetReagent.purity, "inverseRatioF" = initial(R.inverse_chem_val), "purityE" = initial(Rcr.PurityMin), "minTemp" = initial(Rcr.OptimalTempMin), "maxTemp" = initial(Rcr.OptimalTempMax), "eTemp" = initial(Rcr.ExplodeTemp), "pHpeak" = pHpeakCache) else fermianalyze = FALSE analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold)) @@ -432,7 +432,7 @@ if(!targetReagent) CRASH("Tried to find a reagent that doesn't exist in the chem_master!") - analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold), "purityF" = targetReagent.purity, "inverseRatioF" = initial(R.InverseChemVal), "purityE" = initial(Rcr.PurityMin), "minTemp" = initial(Rcr.OptimalTempMin), "maxTemp" = initial(Rcr.OptimalTempMax), "eTemp" = initial(Rcr.ExplodeTemp), "pHpeak" = pHpeakCache) + analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold), "purityF" = targetReagent.purity, "inverseRatioF" = initial(R.inverse_chem_val), "purityE" = initial(Rcr.PurityMin), "minTemp" = initial(Rcr.OptimalTempMin), "maxTemp" = initial(Rcr.OptimalTempMax), "eTemp" = initial(Rcr.ExplodeTemp), "pHpeak" = pHpeakCache) else fermianalyze = FALSE analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold)) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 3d6740aba3..422bf8e4be 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -39,19 +39,12 @@ 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/SplitChem = FALSE //If the chem splits on metabolism - var/ImpureChem // What chemical is metabolised with an inpure reaction - var/InverseChemVal = 0 // If the impurity is below 0.5, replace ALL of the chem with InverseChem upon metabolising - var/InverseChem // 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/impure_chem // What chemical is metabolised with an inpure reaction + var/inverse_chem_val = 0 // If the impurity is below 0.5, replace ALL of the chem with inverse_chemupon metabolising + var/inverse_chem // What chem is metabolised when purity is below inverse_chem_val, this shouldn't be made, but if it does, well, I guess I'll know about it. var/metabolizing = FALSE - 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 inverted, the inverted chem uses the name of the original chem - //REAGENT_SPLITRETAINVOL Retains initial volume of chem when splitting + var/reagent_flags // See fermi/readme.dm REAGENT_DEAD_PROCESS, REAGENT_DONOTSPLIT, REAGENT_ONLYINVERSE, REAGENT_ONMOBMERGE, REAGENT_INVISIBLE, REAGENT_FORCEONNEW, REAGENT_SNEAKYNAME + /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references . = ..() @@ -82,7 +75,7 @@ //called when a mob processes chems when dead. /datum/reagent/proc/on_mob_dead(mob/living/carbon/M) - if(!(reagentFlags & REAGENT_DEAD_PROCESS)) //justincase + if(!(reagent_flags & REAGENT_DEAD_PROCESS)) //justincase return current_cycle++ if(holder) @@ -91,7 +84,7 @@ // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L, amount) - if(!(reagentFlags & REAGENT_DONOTSPLIT)) + if(!(reagent_flags & REAGENT_DONOTSPLIT)) var/mob/living/carbon/M = L if(!M) return @@ -102,22 +95,22 @@ cached_purity = purity if(cached_purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - else if ((InverseChemVal > purity) && (InverseChem))//Turns all of a added reagent into the inverse chem + else if ((inverse_chem_val > purity) && (inverse_chem))//Turns all of a added reagent into the inverse chem M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1-cached_purity) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [InverseChem]") + M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [inverse_chem]") return - else if (ImpureChem) + else if (impure_chem) var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem - if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) + if(!(reagent_flags & REAGENT_SPLITRETAINVOL)) M.reagents.remove_reagent(id, (impureVol), FALSE) - M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1-cached_purity) - if(reagentFlags & REAGENT_SNEAKYNAME) - var/datum/reagent/R = M.reagents.has_reagent("[InverseChem]") + M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) + if(reagent_flags & REAGENT_SNEAKYNAME) + var/datum/reagent/R = M.reagents.has_reagent("[inverse_chem]") R.name = name//Negative effects are hidden log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [id]") - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [ImpureChem]") + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [impure_chem]") return // Called when this reagent is removed while inside a mob @@ -141,7 +134,7 @@ // Called when two reagents of the same are mixing. /datum/reagent/proc/on_merge(data, amount, mob/living/carbon/M, purity) - if(!(reagentFlags & REAGENT_DONOTSPLIT)) + if(!(reagent_flags & REAGENT_DONOTSPLIT)) if(!iscarbon(M)) return if (purity == 1) @@ -151,25 +144,25 @@ cached_purity = purity if (purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - else if ((InverseChemVal > purity) && (InverseChem)) + else if ((inverse_chem_val > purity) && (inverse_chem)) M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1-cached_purity) + M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) for(var/datum/reagent/fermi/R in M.reagents.reagent_list) if(R.name == "") R.name = name//Negative effects are hidden - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [InverseChem]") + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [inverse_chem]") return - else if (ImpureChem) + else if (impure_chem) var/impureVol = amount * (1 - purity) - if(!(reagentFlags & REAGENT_SPLITRETAINVOL)) + if(!(reagent_flags & REAGENT_SPLITRETAINVOL)) M.reagents.remove_reagent(id, impureVol, FALSE) - M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1-cached_purity) - if(reagentFlags & REAGENT_SNEAKYNAME) - var/datum/reagent/R = M.reagents.has_reagent("[InverseChem]") + M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) + if(reagent_flags & REAGENT_SNEAKYNAME) + var/datum/reagent/R = M.reagents.has_reagent("[inverse_chem]") R.name = name//Negative effects are hidden log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [id]") - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [ImpureChem]") + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [impure_chem]") return /datum/reagent/proc/on_update(atom/A) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 9a3d9b4b88..0ca7f48b36 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -1384,9 +1384,9 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_name = "Neurotoxin" glass_desc = "A drink that is guaranteed to knock you silly." //SplitChem = TRUE - ImpureChem = "neuroweak" - InverseChemVal = 0 //Clear conversion - InverseChem = "neuroweak" + impure_chem = "neuroweak" + inverse_chem_val = 0 //Clear conversion + inverse_chem = "neuroweak" /datum/reagent/consumable/ethanol/neurotoxin/proc/pickt() return (pick(TRAIT_PARALYSIS_L_ARM,TRAIT_PARALYSIS_R_ARM,TRAIT_PARALYSIS_R_LEG,TRAIT_PARALYSIS_L_LEG)) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index f74ff404a7..8ea8ef54a3 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 - reagentFlags = REAGENT_INVISIBLE + reagent_flags = REAGENT_INVISIBLE /datum/reagent/changeling_string/on_mob_metabolize(mob/living/carbon/C) if(C && C.dna && data["desired_dna"]) diff --git a/code/modules/reagents/chemistry/recipes.dm b/code/modules/reagents/chemistry/recipes.dm index a55262c41e..a915087428 100644 --- a/code/modules/reagents/chemistry/recipes.dm +++ b/code/modules/reagents/chemistry/recipes.dm @@ -32,7 +32,7 @@ var/RateUpLim = 10 // Optimal/max rate possible if all conditions are perfect var/FermiChem = FALSE // If the chemical uses the Fermichem reaction mechanics//If the chemical uses the Fermichem reaction mechanics var/FermiExplode = FALSE // If the chemical explodes in a special way - var/ClearConversion //bitflags for clear conversions; REACTION_CLEAR_IMPURE or REACTION_CLEAR_INVERSE + var/clear_conversion //bitflags for clear conversions; REACTION_CLEAR_IMPURE or REACTION_CLEAR_INVERSE var/PurityMin = 0.15 //If purity is below 0.15, it explodes too. Set to 0 to disable this. diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm index 7ff43d63d2..2ebb671124 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm @@ -143,7 +143,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 - reagentFlags = REAGENT_ONMOBMERGE | REAGENT_DONOTSPLIT //Procs on_mob_add when merging into a human + reagent_flags = REAGENT_ONMOBMERGE | REAGENT_DONOTSPLIT //Procs on_mob_add when merging into a human can_synth = FALSE @@ -156,7 +156,7 @@ Creating a chem with a low purity will make you permanently fall in love with so creatorGender = "Mistress" creatorName = "Fermis Yakumo" purity = 1 - reagentFlags = REAGENT_DONOTSPLIT + reagent_flags = REAGENT_DONOTSPLIT /datum/reagent/fermi/enthrall/test/on_new() id = "enthrall" @@ -305,7 +305,7 @@ Creating a chem with a low purity will make you permanently fall in love with so color = "#2C051A" // rgb: , 0, 255 metabolization_rate = 0.1 taste_description = "synthetic chocolate, a base tone of alcohol, and high notes of roses." - reagentFlags = REAGENT_DONOTSPLIT + reagent_flags = 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 f9536f663c..56bb9b47b0 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -54,9 +54,9 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING var/pollStarted = FALSE var/location_created var/startHunger - ImpureChem = "SDGFtox" - InverseChemVal = 0.5 - InverseChem = "SDZF" + impure_chem = "SDGFtox" + inverse_chem_val = 0.5 + inverse_chem = "SDZF" can_synth = TRUE @@ -300,7 +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 + reagent_flags = 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 @@ -316,7 +316,7 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING metabolization_rate = 0.5 * REAGENTS_METABOLISM var/startHunger can_synth = TRUE - reagentFlags = REAGENT_SNEAKYNAME + reagent_flags = REAGENT_SNEAKYNAME /datum/reagent/fermi/SDZF/on_mob_life(mob/living/carbon/M) //If you're bad at fermichem, turns your clone into a zombie instead. switch(current_cycle)//Pretends to be normal diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm index d05cfb552e..88586b423e 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/astrogen.dm @@ -28,7 +28,7 @@ I'd like to point out from my calculations it'll take about 60-80 minutes to die var/datum/mind/originalmind var/antiGenetics = 255 var/sleepytime = 0 - InverseChemVal = 0.25 + inverse_chem_val = 0.25 can_synth = FALSE /datum/action/chem/astral diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm index d603f3ba10..50c405e33b 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm @@ -26,9 +26,9 @@ taste_description = "a milky ice cream like flavour." overdose_threshold = 17 metabolization_rate = 0.25 - ImpureChem = "BEsmaller" //If you make an inpure chem, it stalls growth - InverseChemVal = 0.35 - InverseChem = "BEsmaller" //At really impure vols, it just becomes 100% inverse + impure_chem = "BEsmaller" //If you make an inpure chem, it stalls growth + inverse_chem_val = 0.35 + inverse_chem = "BEsmaller" //At really impure vols, it just becomes 100% inverse can_synth = FALSE /datum/reagent/fermi/breast_enlarger/on_mob_add(mob/living/carbon/M) @@ -211,9 +211,9 @@ taste_description = "chinese dragon powder" overdose_threshold = 17 //ODing makes you male and removes female genitals metabolization_rate = 0.5 - ImpureChem = "PEsmaller" //If you make an inpure chem, it stalls growth - InverseChemVal = 0.35 - InverseChem = "PEsmaller" //At really impure vols, it just becomes 100% inverse and shrinks instead. + impure_chem = "PEsmaller" //If you make an inpure chem, it stalls growth + inverse_chem_val = 0.35 + inverse_chem = "PEsmaller" //At really impure vols, it just becomes 100% inverse and shrinks instead. can_synth = FALSE /datum/reagent/fermi/penis_enlarger/on_mob_add(mob/living/carbon/M) 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 18458f509d..4b646135e2 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -7,9 +7,9 @@ taste_description = "affection and love!" can_synth = FALSE //SplitChem = TRUE - ImpureChem = "fermiTox"// What chemical is metabolised with an inpure reaction - InverseChemVal = 0.25 // If the impurity is below 0.5, replace ALL of the chem with InverseChem upon metabolising - InverseChem = "fermiTox" + impure_chem = "fermiTox"// What chemical is metabolised with an inpure reaction + inverse_chem_val = 0.25 // If the impurity is below 0.5, replace ALL of the chem with inverse_chemupon metabolising + inverse_chem = "fermiTox" //This should process fermichems to find out how pure they are and what effect to do. /datum/reagent/fermi/on_mob_add(mob/living/carbon/M, amount) @@ -39,7 +39,7 @@ taste_description = "like jerky, whiskey and an off aftertaste of a crypt." metabolization_rate = 0.2 overdose_threshold = 25 - reagentFlags = REAGENT_DONOTSPLIT + reagent_flags = REAGENT_DONOTSPLIT pH = 4 can_synth = TRUE @@ -84,9 +84,9 @@ color = "#f9b9bc" // rgb: , 0, 255 taste_description = "dewicious degenyewacy" metabolization_rate = 0.5 * REAGENTS_METABOLISM - InverseChemVal = 0 + inverse_chem_val = 0 var/obj/item/organ/tongue/nT - reagentFlags = REAGENT_DONOTSPLIT + reagent_flags = REAGENT_DONOTSPLIT pH = 5 var/obj/item/organ/tongue/T can_synth = TRUE @@ -173,9 +173,9 @@ description = "A stablised EMP that is highly volatile, shocking small nano machines that will kill them off at a rapid rate in a patient's system." color = "#708f8f" overdose_threshold = 15 - ImpureChem = "nanite_b_goneTox" //If you make an inpure chem, it stalls growth - InverseChemVal = 0.25 - InverseChem = "nanite_b_goneTox" //At really impure vols, it just becomes 100% inverse + impure_chem = "nanite_b_goneTox" //If you make an inpure chem, it stalls growth + inverse_chem_val = 0.25 + inverse_chem = "nanite_b_goneTox" //At really impure vols, it just becomes 100% inverse taste_description = "what can only be described as licking a battery." pH = 9 can_synth = FALSE @@ -212,7 +212,7 @@ id = "nanite_b_goneTox" description = "Poorly made, and shocks you!" metabolization_rate = 1 - reagentFlags = REAGENT_INVISIBLE + reagent_flags = 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) @@ -278,7 +278,7 @@ name = "Fermis Test Reagent" id = "fermiTest" description = "You should be really careful with this...! Also, how did you get this?" - reagentFlags = REAGENT_FORCEONNEW + reagent_flags = REAGENT_FORCEONNEW can_synth = FALSE /datum/reagent/fermi/fermiTest/on_new(datum/reagents/holder) @@ -316,7 +316,7 @@ data = "merge" color = "FFFFFF" can_synth = FALSE - reagentFlags = REAGENT_INVISIBLE + reagent_flags = 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 33ca422785..f57c051161 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -6,9 +6,9 @@ color = "#68e83a" pH = 8.6 overdose_threshold = 35 - ImpureChem = "yamerol_tox" - InverseChemVal = 0.4 - InverseChem = "yamerol_tox" + impure_chem = "yamerol_tox" + inverse_chem_val = 0.4 + inverse_chem = "yamerol_tox" can_synth = TRUE /datum/reagent/fermi/yamerol/on_mob_life(mob/living/carbon/C) @@ -80,7 +80,7 @@ taste_description = "a weird, syrupy flavour, yamero" color = "#68e83a" pH = 8.6 - reagentFlags = REAGENT_INVISIBLE + reagent_flags = 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) diff --git a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm index d017868120..8f471332ad 100644 --- a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm +++ b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm @@ -7,22 +7,22 @@ //Called when reaction STOP_PROCESSING /datum/chemical_reaction/proc/FermiFinish(datum/reagents/holder, var/atom/my_atom) - if(ClearConversion == REACTION_CLEAR_IMPURE | REACTION_CLEAR_INVERSE) + if(clear_conversion == REACTION_CLEAR_IMPURE | REACTION_CLEAR_INVERSE) for(var/id in results) var/datum/reagent/R = my_atom.reagents.has_reagent("[id]") if(R.purity == 1) continue var/cached_volume = R.volume - if(ClearConversion == REACTION_CLEAR_INVERSE && R.InverseChem) - if(R.InverseChemVal > R.purity) + if(clear_conversion == REACTION_CLEAR_INVERSE && R.inverse_chem) + if(R.inverse_chem_val > R.purity) my_atom.reagents.remove_reagent(R.id, cached_volume, FALSE) - my_atom.reagents.add_reagent(R.InverseChem, cached_volume, FALSE, other_purity = 1) + my_atom.reagents.add_reagent(R.inverse_chem, cached_volume, FALSE, other_purity = 1) - else if (ClearConversion == REACTION_CLEAR_IMPURE && R.ImpureChem) + else if (clear_conversion == REACTION_CLEAR_IMPURE && R.impure_chem) var/impureVol = cached_volume * (1 - R.purity) my_atom.reagents.remove_reagent(R.id, (impureVol), FALSE) - my_atom.reagents.add_reagent(R.ImpureChem, impureVol, FALSE, other_purity = 1) + my_atom.reagents.add_reagent(R.impure_chem, impureVol, FALSE, other_purity = 1) return //Called when temperature is above a certain threshold, or if purity is too low. From 74cc70ed7286799b2f43636e32663d6136f10b59 Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 03:16:26 +0100 Subject: [PATCH 05/17] Like this? --- code/__DEFINES/flags.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index d64fa30047..d9b30bf0e3 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -10,6 +10,8 @@ #define CHECK_BITFIELD(variable, flag) (variable & (flag)) #define TOGGLE_BITFIELD(variable, flag) (variable ^= (flag)) +#define CHECK_MULTIPLE_BITFIELDS(flagvar, flags) (((flagvar) & (flags)) == (flags)) + GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768)) // for /datum/var/datum_flags From 9b2f67d67d893b5b16ab72b7f20582a9ef9fcdac Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 19:43:37 +0100 Subject: [PATCH 06/17] reagent_flags is used elsewhere, renamed to chemical_flags --- code/_globalvars/bitfields.dm | 2 +- code/game/objects/items/devices/scanners.dm | 2 +- .../food_and_drinks/recipes/drinks_recipes.dm | 13 +- code/modules/mob/living/carbon/life.dm | 2 +- .../reagents/chemistry/fermi/readme.md | 16 +-- code/modules/reagents/chemistry/holder.dm | 28 +++-- code/modules/reagents/chemistry/reagents.dm | 117 +++++++++--------- .../chemistry/reagents/alcohol_reagents.dm | 4 +- .../chemistry/reagents/impure_reagents.dm | 25 ++++ .../chemistry/reagents/other_reagents.dm | 2 +- .../reagents/chemistry/reagents/MKUltra.dm | 5 +- .../reagents/chemistry/reagents/SDGF.dm | 12 +- .../chemistry/reagents/fermi_reagents.dm | 27 +--- .../reagents/chemistry/reagents/healing.dm | 5 +- .../reagents/chemistry/recipes/fermi.dm | 4 +- 15 files changed, 144 insertions(+), 120 deletions(-) create mode 100644 code/modules/reagents/chemistry/reagents/impure_reagents.dm diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 0681351395..a1a51f8b5d 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -177,7 +177,7 @@ GLOBAL_LIST_INIT(bitfields, list( "CAN_CARRY" = CAN_CARRY, "CAN_RESIST" = CAN_RESIST ), - "reagent_flags" = list( + "chemical_flags" = list( "REAGENT_DEAD_PROCESS" = REAGENT_DEAD_PROCESS, "REAGENT_DONOTSPLIT" = REAGENT_DONOTSPLIT, "REAGENT_ONLYINVERSE" = REAGENT_ONLYINVERSE, diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 5d4cd883f4..590cfd4d10 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.reagent_flags & REAGENT_INVISIBLE) + if(R.chemical_flags & REAGENT_INVISIBLE) continue reagents += R diff --git a/code/modules/food_and_drinks/recipes/drinks_recipes.dm b/code/modules/food_and_drinks/recipes/drinks_recipes.dm index 8d63d68878..c893b5c99d 100644 --- a/code/modules/food_and_drinks/recipes/drinks_recipes.dm +++ b/code/modules/food_and_drinks/recipes/drinks_recipes.dm @@ -397,13 +397,16 @@ FermiChem = TRUE//If the chemical uses the Fermichem reaction mechanics FermiExplode = FALSE //If the chemical explodes in a special way PurityMin = 0 //The minimum purity something has to be above, otherwise it explodes. + clear_conversion = REACTION_CLEAR_INVERSE +/* /datum/chemical_reaction/neurotoxin/FermiFinish(datum/reagents/holder, var/atom/my_atom) var/datum/reagent/consumable/ethanol/neurotoxin/Nt = locate(/datum/reagent/consumable/ethanol/neurotoxin) in my_atom.reagents.reagent_list var/cached_volume = Nt.volume if(Nt.purity < 0.5) holder.remove_reagent(src.id, cached_volume) holder.add_reagent("neuroweak", cached_volume) +*/ /datum/chemical_reaction/neurotoxin/FermiExplode(datum/reagents, var/atom/my_atom, volume, temp, pH)//reduced size volume = volume/10 @@ -828,10 +831,10 @@ id = "catnip_tea" results = list("catnip_tea" = 3) required_reagents = list("tea" = 5, "catnip" = 2) - + /datum/chemical_reaction/commander_and_chief - name = "Commander and Chief" - id = "commander_and_chief" - results = list("commander_and_chief" = 50) + name = "Commander and Chief" + id = "commander_and_chief" + results = list("commander_and_chief" = 50) required_reagents = list("alliescocktail" = 50, "champagne" = 20, "doctorsdelight" = 10, "quintuple_sec" = 10, "screwdrivercocktail" = 10) - mix_message = "When your powers combine, I am Captain Pl-..." + mix_message = "When your powers combine, I am Captain Pl-..." diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 43a1b30916..36128b9c85 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -45,7 +45,7 @@ //Procs called while dead /mob/living/carbon/proc/handle_death() for(var/datum/reagent/R in reagents.reagent_list) - if(R.reagent_flags & REAGENT_DEAD_PROCESS) + if(R.chemical_flags & REAGENT_DEAD_PROCESS) R.on_mob_dead(src) /////////////// diff --git a/code/modules/reagents/chemistry/fermi/readme.md b/code/modules/reagents/chemistry/fermi/readme.md index 59f0faccef..4b897b6c4b 100644 --- a/code/modules/reagents/chemistry/fermi/readme.md +++ b/code/modules/reagents/chemistry/fermi/readme.md @@ -2,17 +2,17 @@ How to code fermichem reactions: First off, probably read though the readme for standard reagent mechanisms, this builds on top of that. #bitflags -for `datum/reagent/` you have the following options with `var/reagent_flags`: +for `datum/reagent/` you have the following options with `var/chemical_flags`: ``` 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 inverted, the inverted chem uses the name of the original chem -REAGENT_SPLITRETAINVOL Retains initial volume of chem when splitting +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 inverted, the inverted chem uses the name of the original chem +REAGENT_SPLITRETAINVOL Retains initial volume of chem when splitting ``` for `datum/chemical_reaction/` under `var/clear_conversion` diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 59311a056c..367c1a1483 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -466,7 +466,7 @@ if (C.FermiChem == TRUE && !continue_reacting) if (chem_temp > C.ExplodeTemp) //This is first to ensure explosions. - var/datum/chemical_reaction/fermi/Ferm = selected_reaction + var/datum/chemical_reaction/Ferm = selected_reaction fermiIsReacting = FALSE SSblackbox.record_feedback("tally", "fermi_chem", 1, ("[Ferm] explosion")) Ferm.FermiExplode(src, my_atom, volume = total_volume, temp = chem_temp, pH = pH) @@ -539,7 +539,7 @@ return 0 /datum/reagents/process() - var/datum/chemical_reaction/fermi/C = fermiReactID + var/datum/chemical_reaction/C = fermiReactID var/list/cached_required_reagents = C.required_reagents//update reagents list var/list/cached_results = C.results//resultant chemical list @@ -571,16 +571,16 @@ return /datum/reagents/proc/fermiEnd() - var/datum/chemical_reaction/fermi/C = fermiReactID + var/datum/chemical_reaction/C = fermiReactID STOP_PROCESSING(SSprocessing, src) fermiIsReacting = FALSE - reactedVol = 0 - targetVol = 0 //pH check, handled at the end to reduce calls. if(istype(my_atom, /obj/item/reagent_containers)) var/obj/item/reagent_containers/RC = my_atom RC.pH_check() - C.FermiFinish(src, my_atom) + C.FermiFinish(src, my_atom, reactedVol) + reactedVol = 0 + targetVol = 0 handle_reactions() update_total() //Reaction sounds and words @@ -591,7 +591,7 @@ to_chat(M, "[iconhtml] [C.mix_message]") /datum/reagents/proc/fermiReact(selected_reaction, cached_temp, cached_pH, reactedVol, targetVol, cached_required_reagents, cached_results, multiplier) - var/datum/chemical_reaction/fermi/C = selected_reaction + var/datum/chemical_reaction/C = selected_reaction var/deltaT = 0 var/deltapH = 0 var/stepChemAmmount = 0 @@ -700,7 +700,7 @@ return (reactedVol) //Currently calculates it irrespective of required reagents at the start -/datum/reagents/proc/reactant_purity(var/datum/chemical_reaction/fermi/C, holder) +/datum/reagents/proc/reactant_purity(var/datum/chemical_reaction/C, holder) var/list/cached_reagents = reagent_list var/i = 0 var/cachedPurity @@ -710,6 +710,14 @@ i++ return cachedPurity/i +/datum/reagents/proc/uncache_purity(id) + var/datum/reagent/R = has_reagent("[id]") + if(!R) + return + if(R.cached_purity == 1) + return + R.purity = R.cached_purity + /datum/reagents/proc/isolate_reagent(reagent) var/list/cached_reagents = reagent_list for(var/_reagent in cached_reagents) @@ -880,7 +888,7 @@ if(my_atom) my_atom.on_reagent_change(ADD_REAGENT) if(isliving(my_atom)) - if(R.reagent_flags & REAGENT_ONMOBMERGE)//Forces on_mob_add proc when a chem is merged + if(R.chemical_flags & REAGENT_ONMOBMERGE)//Forces on_mob_add proc when a chem is merged R.on_mob_add(my_atom, amount) R.on_merge(data, amount, my_atom, other_purity) if(!no_react) @@ -899,7 +907,7 @@ if(data) R.data = data R.on_new(data) - if(R.reagent_flags & REAGENT_FORCEONNEW)//Allows on new without data overhead. + if(R.chemical_flags & 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 422bf8e4be..00bb1b7d35 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -43,7 +43,7 @@ var/inverse_chem_val = 0 // If the impurity is below 0.5, replace ALL of the chem with inverse_chemupon metabolising var/inverse_chem // What chem is metabolised when purity is below inverse_chem_val, this shouldn't be made, but if it does, well, I guess I'll know about it. var/metabolizing = FALSE - var/reagent_flags // See fermi/readme.dm REAGENT_DEAD_PROCESS, REAGENT_DONOTSPLIT, REAGENT_ONLYINVERSE, REAGENT_ONMOBMERGE, REAGENT_INVISIBLE, REAGENT_FORCEONNEW, REAGENT_SNEAKYNAME + var/chemical_flags // See fermi/readme.dm REAGENT_DEAD_PROCESS, REAGENT_DONOTSPLIT, REAGENT_ONLYINVERSE, REAGENT_ONMOBMERGE, REAGENT_INVISIBLE, REAGENT_FORCEONNEW, REAGENT_SNEAKYNAME /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references @@ -75,7 +75,7 @@ //called when a mob processes chems when dead. /datum/reagent/proc/on_mob_dead(mob/living/carbon/M) - if(!(reagent_flags & REAGENT_DEAD_PROCESS)) //justincase + if(!(chemical_flags & REAGENT_DEAD_PROCESS)) //justincase return current_cycle++ if(holder) @@ -84,33 +84,37 @@ // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L, amount) - if(!(reagent_flags & REAGENT_DONOTSPLIT)) - var/mob/living/carbon/M = L - if(!M) - return - if (purity == 1) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") - return - if(cached_purity == 1) - cached_purity = purity - if(cached_purity < 0) - CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - else if ((inverse_chem_val > purity) && (inverse_chem))//Turns all of a added reagent into the inverse chem - M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [inverse_chem]") - return - else if (impure_chem) - var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem - if(!(reagent_flags & REAGENT_SPLITRETAINVOL)) - M.reagents.remove_reagent(id, (impureVol), FALSE) - M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) - if(reagent_flags & REAGENT_SNEAKYNAME) - var/datum/reagent/R = M.reagents.has_reagent("[inverse_chem]") - R.name = name//Negative effects are hidden + if (purity == 1) + log_game("CHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") + return + var/mob/living/carbon/M = L + if(!M) + return + if(chemical_flags & REAGENT_DONOTSPLIT) + return - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [id]") - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [impure_chem]") + if(cached_purity == 1) + cached_purity = purity + else if(cached_purity < 0) + CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") + + if ((inverse_chem_val > purity) && (inverse_chem))//Turns all of a added reagent into the inverse chem + M.reagents.remove_reagent(id, amount, FALSE) + M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) + var/datum/reagent/R = M.reagents.has_reagent("[inverse_chem]") + if(R.chemical_flags & REAGENT_SNEAKYNAME) + R.name = name//Negative effects are hidden + if(R.chemical_flags & REAGENT_INVISIBLE) + R.chemical_flags |= (REAGENT_INVISIBLE) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [inverse_chem]") + return + else if (impure_chem) + var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem + if(!(chemical_flags & REAGENT_SPLITRETAINVOL)) + M.reagents.remove_reagent(id, (impureVol), FALSE) + M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [id]") + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [impure_chem]") return // Called when this reagent is removed while inside a mob @@ -134,35 +138,36 @@ // Called when two reagents of the same are mixing. /datum/reagent/proc/on_merge(data, amount, mob/living/carbon/M, purity) - if(!(reagent_flags & REAGENT_DONOTSPLIT)) - if(!iscarbon(M)) - return - if (purity == 1) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") - return - if(cached_purity == 1) - cached_purity = purity - if (purity < 0) - CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - else if ((inverse_chem_val > purity) && (inverse_chem)) - M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) - for(var/datum/reagent/fermi/R in M.reagents.reagent_list) - if(R.name == "") - R.name = name//Negative effects are hidden - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [inverse_chem]") - return - else if (impure_chem) - var/impureVol = amount * (1 - purity) - if(!(reagent_flags & REAGENT_SPLITRETAINVOL)) - M.reagents.remove_reagent(id, impureVol, FALSE) - M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) - if(reagent_flags & REAGENT_SNEAKYNAME) - var/datum/reagent/R = M.reagents.has_reagent("[inverse_chem]") - R.name = name//Negative effects are hidden + if (purity == 1) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") + return + if(!iscarbon(M)) + return + if(chemical_flags & REAGENT_DONOTSPLIT) + return - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [id]") - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [impure_chem]") + if(cached_purity == 1) + cached_purity = purity + else if (purity < 0) + CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") + + if ((inverse_chem_val > purity) && (inverse_chem)) //INVERT + M.reagents.remove_reagent(id, amount, FALSE) + M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) + var/datum/reagent/R = M.reagents.has_reagent("[inverse_chem]") + if(R.chemical_flags & REAGENT_SNEAKYNAME) + R.name = name//Negative effects are hidden + if(R.chemical_flags & REAGENT_INVISIBLE) + R.chemical_flags |= (REAGENT_INVISIBLE) + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [inverse_chem]") + return + else if (impure_chem) //SPLIT + var/impureVol = amount * (1 - purity) + if(!(chemical_flags & REAGENT_SPLITRETAINVOL)) + M.reagents.remove_reagent(id, impureVol, FALSE) + M.reagents.add_reagent(impure_chem, impureVol, FALSE, other_purity = 1-cached_purity) + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [id]") + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [impure_chem]") return /datum/reagent/proc/on_update(atom/A) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index 0ca7f48b36..3017b73b01 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -1385,8 +1385,8 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_desc = "A drink that is guaranteed to knock you silly." //SplitChem = TRUE impure_chem = "neuroweak" - inverse_chem_val = 0 //Clear conversion - inverse_chem = "neuroweak" + inverse_chem_val = 0.5 //Clear conversion + inverse_chem = "neuroweak" /datum/reagent/consumable/ethanol/neurotoxin/proc/pickt() return (pick(TRAIT_PARALYSIS_L_ARM,TRAIT_PARALYSIS_R_ARM,TRAIT_PARALYSIS_R_LEG,TRAIT_PARALYSIS_L_LEG)) diff --git a/code/modules/reagents/chemistry/reagents/impure_reagents.dm b/code/modules/reagents/chemistry/reagents/impure_reagents.dm new file mode 100644 index 0000000000..1e65599490 --- /dev/null +++ b/code/modules/reagents/chemistry/reagents/impure_reagents.dm @@ -0,0 +1,25 @@ +//Reagents produced by metabolising/reacting fermichems inoptimally, i.e. inverse_chems or impure_chems +//Inverse = Splitting +//Invert = Whole conversion + +/datum/reagent/impure + chemical_flags = REAGENT_INVISIBLE | REAGENT_SNEAKYNAME //by default, it will stay hidden on splitting, but take the name of the source on inverting + + +/datum/reagent/impure/fermiTox + name = "FermiTox" + id = "fermiTox" + description = "You should be really careful with this...! Also, how did you get this? You shouldn't have this!" + data = "merge" + color = "FFFFFF" + can_synth = FALSE + + +//I'm concerned this is too weak, but I also don't want deathmixes. +//TODO: liver damage. +/datum/reagent/impure/fermiTox/on_mob_life(mob/living/carbon/C, method) + if(C.dna && istype(C.dna.species, /datum/species/jelly)) + C.adjustToxLoss(-2) + else + C.adjustToxLoss(2) + ..() diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 8ea8ef54a3..60620af71b 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 - reagent_flags = REAGENT_INVISIBLE + chemical_flags = 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 2ebb671124..c210c87d4e 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm @@ -143,7 +143,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 - reagent_flags = REAGENT_ONMOBMERGE | REAGENT_DONOTSPLIT //Procs on_mob_add when merging into a human + chemical_flags = REAGENT_ONMOBMERGE | REAGENT_DONOTSPLIT //Procs on_mob_add when merging into a human can_synth = FALSE @@ -156,7 +156,6 @@ Creating a chem with a low purity will make you permanently fall in love with so creatorGender = "Mistress" creatorName = "Fermis Yakumo" purity = 1 - reagent_flags = REAGENT_DONOTSPLIT /datum/reagent/fermi/enthrall/test/on_new() id = "enthrall" @@ -305,7 +304,7 @@ Creating a chem with a low purity will make you permanently fall in love with so color = "#2C051A" // rgb: , 0, 255 metabolization_rate = 0.1 taste_description = "synthetic chocolate, a base tone of alcohol, and high notes of roses." - reagent_flags = REAGENT_DONOTSPLIT + chemical_flags = 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 56bb9b47b0..4319b303d1 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -294,21 +294,21 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING ..() //Unobtainable, used if SDGF is impure but not too impure -/datum/reagent/fermi/SDGFtox +/datum/reagent/impure/SDGFtox name = "synthetic-derived growth factor" id = "SDGFtox" 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 - reagent_flags = REAGENT_INVISIBLE + chemical_flags = 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) +/datum/reagent/impure/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 M.adjustCloneLoss(2, 0) ..() //Fail state of SDGF -/datum/reagent/fermi/SDZF +/datum/reagent/impure/SDZF name = "synthetic-derived growth factor" id = "SDZF" description = "A horribly peverse mass of Embryonic stem cells made real by the hands of a failed chemist. This message should never appear, how did you manage to get a hold of this?" @@ -316,9 +316,9 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING metabolization_rate = 0.5 * REAGENTS_METABOLISM var/startHunger can_synth = TRUE - reagent_flags = REAGENT_SNEAKYNAME + chemical_flags = REAGENT_SNEAKYNAME -/datum/reagent/fermi/SDZF/on_mob_life(mob/living/carbon/M) //If you're bad at fermichem, turns your clone into a zombie instead. +/datum/reagent/impure/SDZF/on_mob_life(mob/living/carbon/M) //If you're bad at fermichem, turns your clone into a zombie instead. switch(current_cycle)//Pretends to be normal if(20) to_chat(M, "You feel the synethic cells rest uncomfortably within your body as they start to pulse and grow rapidly.") 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 4b646135e2..a21ccb34ed 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -9,7 +9,7 @@ //SplitChem = TRUE impure_chem = "fermiTox"// What chemical is metabolised with an inpure reaction inverse_chem_val = 0.25 // If the impurity is below 0.5, replace ALL of the chem with inverse_chemupon metabolising - inverse_chem = "fermiTox" + inverse_chem = "fermiTox" //This should process fermichems to find out how pure they are and what effect to do. /datum/reagent/fermi/on_mob_add(mob/living/carbon/M, amount) @@ -39,7 +39,7 @@ taste_description = "like jerky, whiskey and an off aftertaste of a crypt." metabolization_rate = 0.2 overdose_threshold = 25 - reagent_flags = REAGENT_DONOTSPLIT + chemical_flags = REAGENT_DONOTSPLIT pH = 4 can_synth = TRUE @@ -86,7 +86,7 @@ metabolization_rate = 0.5 * REAGENTS_METABOLISM inverse_chem_val = 0 var/obj/item/organ/tongue/nT - reagent_flags = REAGENT_DONOTSPLIT + chemical_flags = REAGENT_DONOTSPLIT pH = 5 var/obj/item/organ/tongue/T can_synth = TRUE @@ -212,7 +212,7 @@ id = "nanite_b_goneTox" description = "Poorly made, and shocks you!" metabolization_rate = 1 - reagent_flags = REAGENT_INVISIBLE + chemical_flags = 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) @@ -278,7 +278,7 @@ name = "Fermis Test Reagent" id = "fermiTest" description = "You should be really careful with this...! Also, how did you get this?" - reagent_flags = REAGENT_FORCEONNEW + chemical_flags = REAGENT_FORCEONNEW can_synth = FALSE /datum/reagent/fermi/fermiTest/on_new(datum/reagents/holder) @@ -309,23 +309,6 @@ playsound(get_turf(M), 'modular_citadel/sound/voice/merowr.ogg', 50, 1) holder.clear_reagents() -/datum/reagent/fermi/fermiTox - name = "FermiTox" - id = "fermiTox" - description = "You should be really careful with this...! Also, how did you get this? You shouldn't have this!" - data = "merge" - color = "FFFFFF" - can_synth = FALSE - reagent_flags = 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) - if(C.dna && istype(C.dna.species, /datum/species/jelly)) - C.adjustToxLoss(-2) - else - C.adjustToxLoss(2) - ..() - /datum/reagent/fermi/acidic_buffer name = "Acidic buffer" id = "acidic_buffer" diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index f57c051161..1d1ef1c26d 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -73,16 +73,15 @@ C.adjustOxyLoss(-3) ..() -/datum/reagent/fermi/yamerol_tox +/datum/reagent/impure/yamerol_tox name = "Yamerol" id = "yamerol_tox" description = "For when you've trouble speaking or breathing, just yell YAMEROL! A chem that helps soothe any congestion problems and at high concentrations restores damaged lungs and tongues!" taste_description = "a weird, syrupy flavour, yamero" color = "#68e83a" pH = 8.6 - reagent_flags = REAGENT_INVISIBLE -/datum/reagent/fermi/yamerol_tox/on_mob_life(mob/living/carbon/C) +/datum/reagent/impure/yamerol_tox/on_mob_life(mob/living/carbon/C) var/obj/item/organ/tongue/T = C.getorganslot(ORGAN_SLOT_TONGUE) var/obj/item/organ/lungs/L = C.getorganslot(ORGAN_SLOT_LUNGS) diff --git a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm index 8f471332ad..bb81bd8a21 100644 --- a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm +++ b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm @@ -6,7 +6,7 @@ return //Called when reaction STOP_PROCESSING -/datum/chemical_reaction/proc/FermiFinish(datum/reagents/holder, var/atom/my_atom) +/datum/chemical_reaction/proc/FermiFinish(datum/reagents/holder, var/atom/my_atom, reactVol) if(clear_conversion == REACTION_CLEAR_IMPURE | REACTION_CLEAR_INVERSE) for(var/id in results) var/datum/reagent/R = my_atom.reagents.has_reagent("[id]") @@ -23,6 +23,8 @@ var/impureVol = cached_volume * (1 - R.purity) my_atom.reagents.remove_reagent(R.id, (impureVol), FALSE) my_atom.reagents.add_reagent(R.impure_chem, impureVol, FALSE, other_purity = 1) + R.cached_purity = R.purity + R.purity = 1 return //Called when temperature is above a certain threshold, or if purity is too low. From 79b1d33008e7c271ecd996b64d453b8d8a80e437 Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 19:46:53 +0100 Subject: [PATCH 07/17] classic oops --- code/modules/reagents/chemistry/reagents.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 00bb1b7d35..4777ecc197 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -85,7 +85,7 @@ // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L, amount) if (purity == 1) - log_game("CHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") + log_game("CHEM: [L] ckey: [L.key] has ingested [volume]u of [id]") return var/mob/living/carbon/M = L if(!M) @@ -150,7 +150,7 @@ cached_purity = purity else if (purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - + if ((inverse_chem_val > purity) && (inverse_chem)) //INVERT M.reagents.remove_reagent(id, amount, FALSE) M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) From 9cca2729867f4f90e947dab9a2168e625c722ba9 Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 19:54:21 +0100 Subject: [PATCH 08/17] Fixes quant errors, I hope. --- code/modules/reagents/chemistry/holder.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 367c1a1483..560d882d88 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -749,7 +749,7 @@ total_volume = 0 for(var/reagent in cached_reagents) var/datum/reagent/R = reagent - if(R.volume < CHEMICAL_QUANTISATION_LEVEL) + if((R.volume < 0.01) && !fermiIsReacting) del_reagent(R.id) else total_volume += R.volume From d12fd72ebfce1cc3dcb851006c7ed34b14e56f1a Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 21:11:20 +0100 Subject: [PATCH 09/17] Updates a buncha stuff. --- code/game/objects/items/devices/scanners.dm | 15 +++++++++++++++ code/modules/reagents/chemistry/reagents.dm | 15 ++++++--------- .../chemistry/reagents/impure_reagents.dm | 7 ++++--- .../reagents/chemistry/reagents/MKUltra.dm | 4 ++-- .../modules/reagents/chemistry/reagents/SDGF.dm | 11 ++++++----- .../reagents/chemistry/reagents/enlargement.dm | 4 ++-- .../reagents/chemistry/reagents/fermi_reagents.dm | 8 ++++---- .../reagents/chemistry/reagents/healing.dm | 4 ++-- 8 files changed, 41 insertions(+), 27 deletions(-) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 590cfd4d10..8616e49014 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -404,6 +404,21 @@ SLIME SCANNER msg += "[R.name]\n" else msg += "Subject is not addicted to any reagents.\n" + + if(M.reagents.has_reagent("fermiTox")) + var/datum/reagent/fermiTox = M.reagents.has_reagent("fermiTox") + switch(fermiTox.volume) + if(5 to 10) + msg += "Subject contains a low amount of toxic isomers.\n" + if(10 to 25) + msg += "Subject contains toxic isomers.\n" + if(25 to 50) + msg += "Subject contains a substantial amount of toxic isomers.\n" + if(50 to 95) + msg += "Subject contains a high amount of toxic isomers.\n" + if(95 to INFINITY) + msg += "Subject contains a extremely dangerous amount of toxic isomers.\n" + msg += "*---------*" to_chat(user, msg) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 4777ecc197..51da628e25 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -90,13 +90,12 @@ var/mob/living/carbon/M = L if(!M) return - if(chemical_flags & REAGENT_DONOTSPLIT) - return - if(cached_purity == 1) cached_purity = purity - else if(cached_purity < 0) + else if(purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") + if(chemical_flags & REAGENT_DONOTSPLIT) + return if ((inverse_chem_val > purity) && (inverse_chem))//Turns all of a added reagent into the inverse chem M.reagents.remove_reagent(id, amount, FALSE) @@ -143,14 +142,12 @@ return if(!iscarbon(M)) return + cached_purity = purity //purity SHOULD be precalculated from the add_reagent, update cache. + if (purity < 0) + CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") if(chemical_flags & REAGENT_DONOTSPLIT) return - if(cached_purity == 1) - cached_purity = purity - else if (purity < 0) - CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - if ((inverse_chem_val > purity) && (inverse_chem)) //INVERT M.reagents.remove_reagent(id, amount, FALSE) M.reagents.add_reagent(inverse_chem, amount, FALSE, other_purity = 1-cached_purity) diff --git a/code/modules/reagents/chemistry/reagents/impure_reagents.dm b/code/modules/reagents/chemistry/reagents/impure_reagents.dm index 1e65599490..4a9ddc4353 100644 --- a/code/modules/reagents/chemistry/reagents/impure_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/impure_reagents.dm @@ -7,16 +7,17 @@ /datum/reagent/impure/fermiTox - name = "FermiTox" + name = "Chemical Isomers" id = "fermiTox" - description = "You should be really careful with this...! Also, how did you get this? You shouldn't have this!" + description = "Toxic chemical isomers made from impure reactions. At low volumes will cause light toxin damage, but as the volume increases, it deals larger amounts, damages the liver, then eventually the heart." data = "merge" color = "FFFFFF" can_synth = FALSE + var/potency = 1 //potency multiplies the volume when added. //I'm concerned this is too weak, but I also don't want deathmixes. -//TODO: liver damage. +//TODO: liver damage, 100+ heart /datum/reagent/impure/fermiTox/on_mob_life(mob/living/carbon/C, method) if(C.dna && istype(C.dna.species, /datum/species/jelly)) C.adjustToxLoss(-2) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm index c210c87d4e..f6fb0f72dd 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/MKUltra.dm @@ -150,7 +150,7 @@ Creating a chem with a low purity will make you permanently fall in love with so /datum/reagent/fermi/enthrall/test name = "MKUltraTest" id = "enthrallTest" - description = "A forbidden deep red mixture that overwhelms a foreign body with waves of joy, intoxicating them into servitude. When taken by the creator, it will enhance the draw of their voice to those affected by it." + description = "A forbidden deep red mixture that makes you like Fermis a little too much. Unobtainable and due to be removed from the wiki." data = list("creatorID" = "honkatonkbramblesnatch", "creatorGender" = "Mistress", "creatorName" = "Fermis Yakumo") creatorID = "honkatonkbramblesnatch"//ckey creatorGender = "Mistress" @@ -300,7 +300,7 @@ Creating a chem with a low purity will make you permanently fall in love with so /datum/reagent/fermi/enthrallExplo//Created in a gas cloud when it explodes 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?" + description = "A forbidden deep red gas that overwhelms a foreign body, causing the person they next lay their eyes on to become more interesting. Studies have shown that people are 66% more likely to make friends with this in the air. Produced when MKUltra explodes." color = "#2C051A" // rgb: , 0, 255 metabolization_rate = 0.1 taste_description = "synthetic chocolate, a base tone of alcohol, and high notes of roses." diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm index 4319b303d1..e676636b26 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -280,8 +280,9 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING //Unobtainable, used in clone spawn. /datum/reagent/fermi/SDGFheal - name = "synthetic-derived growth factor" + name = "synthetic-derived healing factor" id = "SDGFheal" + description = "Leftover SDGF is transferred into the resulting clone, which quickly heals up the stresses from suddenly splitting. Restores blood, nutrition, and repaires brain and clone damage quickly. Only obtainable from using excess SDGF, and only enters the cloned body." metabolization_rate = 1 can_synth = FALSE @@ -295,9 +296,9 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING //Unobtainable, used if SDGF is impure but not too impure /datum/reagent/impure/SDGFtox - name = "synthetic-derived growth factor" + name = "Synthetic-derived apoptosis factor" id = "SDGFtox" - 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. + description = "Impure synthetic-derived growth factor causes certain cells to undergo cell death, causing clone damage, and damaging blood cells."//i.e. tell me please, figure it's a good way to get pinged for bugfixes. metabolization_rate = 1 can_synth = FALSE chemical_flags = REAGENT_INVISIBLE @@ -309,9 +310,9 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING //Fail state of SDGF /datum/reagent/impure/SDZF - name = "synthetic-derived growth factor" + name = "synthetic-derived zombie factor" id = "SDZF" - description = "A horribly peverse mass of Embryonic stem cells made real by the hands of a failed chemist. This message should never appear, how did you manage to get a hold of this?" + description = "A horribly peverse mass of Embryonic stem cells made real by the hands of a failed chemist. Emulates normal synthetic-derived growth factor, but produces a hostile zombie at the end of it." color = "#a502e0" // rgb: 96, 0, 255 metabolization_rate = 0.5 * REAGENTS_METABOLISM var/startHunger diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm index 50c405e33b..69f76e380b 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/enlargement.dm @@ -140,7 +140,7 @@ /datum/reagent/fermi/BEsmaller name = "Modesty milk" id = "BEsmaller" - description = "A volatile collodial mixture derived from milk that encourages mammary reduction via a potent estrogen mix." + description = "A volatile collodial mixture derived from milk that encourages mammary reduction via a potent estrogen mix. Produced by reacting impure Succubus milk." color = "#E60584" // rgb: 96, 0, 255 taste_description = "a milky ice cream like flavour." metabolization_rate = 0.25 @@ -311,7 +311,7 @@ /datum/reagent/fermi/PEsmaller // Due to cozmo's request...! name = "Chastity draft" id = "PEsmaller" - description = "A volatile collodial mixture derived from various masculine solutions that encourages a smaller gentleman's package via a potent testosterone mix, formula derived from a collaboration from Fermichem and Doctor Ronald Hyatt, who is well known for his phallus palace." + description = "A volatile collodial mixture derived from various masculine solutions that encourages a smaller gentleman's package via a potent testosterone mix. Produced by reacting impure Incubus draft." color = "#888888" // This is greyish..? taste_description = "chinese dragon powder" metabolization_rate = 0.5 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 a21ccb34ed..7729af8edc 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -198,7 +198,7 @@ //empulse((get_turf(C)), 3, 2)//So the nanites randomize var/atom/T = C T.emp_act(EMP_HEAVY) - to_chat(C, "The nanites short circuit within your system!") + to_chat(C, "You feel a strange tingling sensation come from your core.") if(isnull(N)) return ..() N.nanite_volume = -2 @@ -208,10 +208,10 @@ O.emp_act(EMP_HEAVY) /datum/reagent/fermi/nanite_b_goneTox - name = "Naninte bain" + name = "Electromagnetic crystals" id = "nanite_b_goneTox" - description = "Poorly made, and shocks you!" - metabolization_rate = 1 + description = "Causes items upon the patient to sometimes short out, as well as causing a shock in the patient, if the residual charge between the crystals builds up to sufficient quantities" + metabolization_rate = 0.5 chemical_flags = REAGENT_INVISIBLE //Increases shock events. diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm index 1d1ef1c26d..83fbc31a20 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/healing.dm @@ -74,9 +74,9 @@ ..() /datum/reagent/impure/yamerol_tox - name = "Yamerol" + name = "Yamer oh no" id = "yamerol_tox" - description = "For when you've trouble speaking or breathing, just yell YAMEROL! A chem that helps soothe any congestion problems and at high concentrations restores damaged lungs and tongues!" + description = "A dangerous, cloying toxin that stucks to a patient’s respiratory system, damaging their tongue, lungs and causing suffocation." taste_description = "a weird, syrupy flavour, yamero" color = "#68e83a" pH = 8.6 From a8747449c259968d7b4e919cdcd6170b1a2cb70e Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 21:50:04 +0100 Subject: [PATCH 10/17] All good --- modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm index e676636b26..b21c7e1459 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/SDGF.dm @@ -301,7 +301,6 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING description = "Impure synthetic-derived growth factor causes certain cells to undergo cell death, causing clone damage, and damaging blood cells."//i.e. tell me please, figure it's a good way to get pinged for bugfixes. metabolization_rate = 1 can_synth = FALSE - chemical_flags = REAGENT_INVISIBLE /datum/reagent/impure/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 From 55c3a48026f6aaae6e2efcca2c1684ab6c61b75a Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 21:56:39 +0100 Subject: [PATCH 11/17] Oops --- code/modules/reagents/chemistry/reagents/impure_reagents.dm | 2 +- tgstation.dme | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/reagents/chemistry/reagents/impure_reagents.dm b/code/modules/reagents/chemistry/reagents/impure_reagents.dm index 4a9ddc4353..e24b811131 100644 --- a/code/modules/reagents/chemistry/reagents/impure_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/impure_reagents.dm @@ -13,7 +13,7 @@ data = "merge" color = "FFFFFF" can_synth = FALSE - var/potency = 1 //potency multiplies the volume when added. + var/potency = 1 //potency multiplies the volume when added. //I'm concerned this is too weak, but I also don't want deathmixes. diff --git a/tgstation.dme b/tgstation.dme index afe619593e..b675a88c85 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -2531,6 +2531,7 @@ #include "code\modules\reagents\chemistry\reagents\drink_reagents.dm" #include "code\modules\reagents\chemistry\reagents\drug_reagents.dm" #include "code\modules\reagents\chemistry\reagents\food_reagents.dm" +#include "code\modules\reagents\chemistry\reagents\impure_reagents.dm" #include "code\modules\reagents\chemistry\reagents\medicine_reagents.dm" #include "code\modules\reagents\chemistry\reagents\other_reagents.dm" #include "code\modules\reagents\chemistry\reagents\pyrotechnic_reagents.dm" From 59c82894a1c8e21db14a2331e6e247be67143266 Mon Sep 17 00:00:00 2001 From: Fermi <> Date: Fri, 20 Sep 2019 22:15:55 +0100 Subject: [PATCH 12/17] Sprinkles! --- code/modules/reagents/chemistry/reagents.dm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 51da628e25..52d3ba7822 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -84,11 +84,11 @@ // Called when this reagent is first added to a mob /datum/reagent/proc/on_mob_add(mob/living/L, amount) - if (purity == 1) - log_game("CHEM: [L] ckey: [L.key] has ingested [volume]u of [id]") + if(!iscarbon(L)) return var/mob/living/carbon/M = L - if(!M) + if (purity == 1) + log_game("CHEM: [L] ckey: [L.key] has ingested [volume]u of [id]") return if(cached_purity == 1) cached_purity = purity @@ -137,11 +137,11 @@ // Called when two reagents of the same are mixing. /datum/reagent/proc/on_merge(data, amount, mob/living/carbon/M, purity) + if(!iscarbon(M)) + return if (purity == 1) log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") return - if(!iscarbon(M)) - return cached_purity = purity //purity SHOULD be precalculated from the add_reagent, update cache. if (purity < 0) CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") From f7d14ebb2c3735f4c05af5ae2ddbc5413e8c052d Mon Sep 17 00:00:00 2001 From: Thalpy <48600475+ThalpySci@users.noreply.github.com> Date: Tue, 8 Oct 2019 07:39:19 +0100 Subject: [PATCH 13/17] Damnit webedit --- code/_globalvars/bitfields.dm | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index ee3731e7b4..0820f58470 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -191,15 +191,13 @@ GLOBAL_LIST_INIT(bitfields, list( "clear_conversion" = list( "REACTION_CLEAR_IMPURE" = REACTION_CLEAR_IMPURE, "REACTION_CLEAR_INVERSE" = REACTION_CLEAR_INVERSE - ), - - ), - "organ_flags" = list( - "ORGAN_SYNTHETIC" = ORGAN_SYNTHETIC, - "ORGAN_FROZEN" = ORGAN_FROZEN, - "ORGAN_FAILING" = ORGAN_FAILING, - "ORGAN_EXTERNAL" = ORGAN_EXTERNAL, - "ORGAN_VITAL" = ORGAN_VITAL, - "ORGAN_NO_SPOIL" = ORGAN_NO_SPOIL - ), - )) + ), + "organ_flags" = list( + "ORGAN_SYNTHETIC" = ORGAN_SYNTHETIC, + "ORGAN_FROZEN" = ORGAN_FROZEN, + "ORGAN_FAILING" = ORGAN_FAILING, + "ORGAN_EXTERNAL" = ORGAN_EXTERNAL, + "ORGAN_VITAL" = ORGAN_VITAL, + "ORGAN_NO_SPOIL" = ORGAN_NO_SPOIL + ), + )) From 4538c43ededb4fa2decd69a8dd5d5cc1c2b30b01 Mon Sep 17 00:00:00 2001 From: Thalpy <48600475+ThalpySci@users.noreply.github.com> Date: Tue, 8 Oct 2019 07:39:41 +0100 Subject: [PATCH 14/17] Oops --- code/_globalvars/bitfields.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 0820f58470..7a011ff063 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -199,5 +199,4 @@ GLOBAL_LIST_INIT(bitfields, list( "ORGAN_EXTERNAL" = ORGAN_EXTERNAL, "ORGAN_VITAL" = ORGAN_VITAL, "ORGAN_NO_SPOIL" = ORGAN_NO_SPOIL - ), )) From 281c6e04e8f46741f004cb313c629b9e2d94ede1 Mon Sep 17 00:00:00 2001 From: Thalpy <48600475+ThalpySci@users.noreply.github.com> Date: Tue, 8 Oct 2019 07:43:51 +0100 Subject: [PATCH 15/17] Hmm --- code/_globalvars/bitfields.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 7a011ff063..88f42336bf 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -199,4 +199,5 @@ GLOBAL_LIST_INIT(bitfields, list( "ORGAN_EXTERNAL" = ORGAN_EXTERNAL, "ORGAN_VITAL" = ORGAN_VITAL, "ORGAN_NO_SPOIL" = ORGAN_NO_SPOIL + ) )) From edb26eeaeb975905c3abb01a58adcc4104964430 Mon Sep 17 00:00:00 2001 From: Thalpy <48600475+ThalpySci@users.noreply.github.com> Date: Tue, 8 Oct 2019 07:44:32 +0100 Subject: [PATCH 16/17] Master of confusion --- code/_globalvars/bitfields.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 88f42336bf..a422cc3a17 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -199,5 +199,5 @@ GLOBAL_LIST_INIT(bitfields, list( "ORGAN_EXTERNAL" = ORGAN_EXTERNAL, "ORGAN_VITAL" = ORGAN_VITAL, "ORGAN_NO_SPOIL" = ORGAN_NO_SPOIL - ) + ), )) From f592fc325e768de4ec04c4371a2b03747c59d875 Mon Sep 17 00:00:00 2001 From: Thalpy <48600475+ThalpySci@users.noreply.github.com> Date: Tue, 8 Oct 2019 07:47:10 +0100 Subject: [PATCH 17/17] Formmating --- code/_globalvars/bitfields.dm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index a422cc3a17..755105dc27 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -192,12 +192,12 @@ GLOBAL_LIST_INIT(bitfields, list( "REACTION_CLEAR_IMPURE" = REACTION_CLEAR_IMPURE, "REACTION_CLEAR_INVERSE" = REACTION_CLEAR_INVERSE ), - "organ_flags" = list( - "ORGAN_SYNTHETIC" = ORGAN_SYNTHETIC, - "ORGAN_FROZEN" = ORGAN_FROZEN, - "ORGAN_FAILING" = ORGAN_FAILING, - "ORGAN_EXTERNAL" = ORGAN_EXTERNAL, - "ORGAN_VITAL" = ORGAN_VITAL, - "ORGAN_NO_SPOIL" = ORGAN_NO_SPOIL + "organ_flags" = list( + "ORGAN_SYNTHETIC" = ORGAN_SYNTHETIC, + "ORGAN_FROZEN" = ORGAN_FROZEN, + "ORGAN_FAILING" = ORGAN_FAILING, + "ORGAN_EXTERNAL" = ORGAN_EXTERNAL, + "ORGAN_VITAL" = ORGAN_VITAL, + "ORGAN_NO_SPOIL" = ORGAN_NO_SPOIL ), ))