Ghommies' requests.
This commit is contained in:
@@ -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
|
||||
),
|
||||
))
|
||||
),
|
||||
"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
|
||||
),
|
||||
))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
///////////////
|
||||
|
||||
@@ -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
|
||||
```
|
||||
@@ -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.
|
||||
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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"])
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user