From 2bd5ee184d48e62a91093aed643adc1dbc5fdbe2 Mon Sep 17 00:00:00 2001
From: Fermi <>
Date: Sat, 21 Sep 2019 01:50:39 +0100
Subject: [PATCH 1/4] THIS SHOULDN'T FIND IT'S WAY INTO A PR
---
code/modules/reagents/chem_wiki_render.dm | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/code/modules/reagents/chem_wiki_render.dm b/code/modules/reagents/chem_wiki_render.dm
index e403e147a6..ed5c223556 100644
--- a/code/modules/reagents/chem_wiki_render.dm
+++ b/code/modules/reagents/chem_wiki_render.dm
@@ -33,7 +33,7 @@
var/alco = ""
var/grinded = ""
var/blob = ""
- //var/impure
+ var/impure = ""
//Chem_dispencer
var/list/dispensable_reagents = list(
@@ -190,10 +190,10 @@
else if(istype(R, /datum/reagent/blob))
blob += generate_chemwiki_line(R, X, processCR)
- /* when merged
+ // when merged
else if(istype(R, /datum/reagent/impure))
impure += generate_chemwiki_line(R, X, processCR)
- */
+
else
remainder += generate_chemwiki_line(R, X, processCR)
@@ -207,7 +207,7 @@
to_chat(usr, "finished chems")
var/wholeString = ("\n# DISPENCEABLE REAGENTS\n\n[prefix][basic]\n\n# COMPONENT REAGENTS\n\n[prefix][upgraded]\n\n# GRINDABLE REAGENTS\n\n[prefix][grinded]\n")
- wholeString += ("\n# MEDICINE:\n\n[prefix][medicine]\n\n# TOXIN:\n\n[prefix][toxin]\n\n# DRUGS\n\n[prefix][drug]\n\n# FERMI\n\nThese chems lie on the cutting edge of chemical technology, and as such are not recommended for beginners!\n\n[prefix][fermi]\n\n# GENERAL REAGENTS\n\n[prefix][remainder]\n\n# DISPENCEABLE SOFT DRINKS\n\n[prefix][drinks]\n\n# DISPENCEABLE HARD DRINKS\n\n[prefix][alco]\n\n# CONSUMABLE\n\n[prefix][consumable]\n\n# PLANTS\n\n[prefix][plant]\n\n# URANIUM\n\n[prefix][uranium]\n\n# COLOURS\n\n[prefix][colours]\n\n# RACE MUTATIONS\n\n[prefix][muta]\n\n\n# BLOB REAGENTS\n\n[prefix][blob]\n")
+ wholeString += ("\n# MEDICINE:\n\n[prefix][medicine]\n\n# TOXIN:\n\n[prefix][toxin]\n\n# DRUGS\n\n[prefix][drug]\n\n# FERMI\n\nThese chems lie on the cutting edge of chemical technology, and as such are not recommended for beginners!\n\n[prefix][fermi]\n\n# IMPURE REAGENTS\n\n[prefix][impure]\n\n# GENERAL REAGENTS\n\n[prefix][remainder]\n\n# DISPENCEABLE SOFT DRINKS\n\n[prefix][drinks]\n\n# DISPENCEABLE HARD DRINKS\n\n[prefix][alco]\n\n# CONSUMABLE\n\n[prefix][consumable]\n\n# PLANTS\n\n[prefix][plant]\n\n# URANIUM\n\n[prefix][uranium]\n\n# COLOURS\n\n[prefix][colours]\n\n# RACE MUTATIONS\n\n[prefix][muta]\n\n\n# BLOB REAGENTS\n\n[prefix][blob]\n")
prefix = "|Name | Reagents | Reaction vars | Description |\n|---|---|---|----------|\n"
var/CRparse = ""
@@ -290,12 +290,12 @@
//Description, OD, Addict, Meta
outstring += "[R.description] |
- Metabolism_rate: [R.metabolization_rate/2]u/s
[(R.overdose_threshold?"- Overdose: [R.overdose_threshold]u
":"")] [(R.addiction_threshold?"- Addiction: [R.addiction_threshold]u
":"")] "
- if(R.ImpureChem != "fermiTox" || !R.ImpureChem)
- R3 = GLOB.chemical_reagents_list[R.ImpureChem]
+ if(R.impure_chem != "fermiTox" || !R.impure_chem)
+ R3 = GLOB.chemical_reagents_list[R.impure_chem]
outstring += "- Impure chem:[R3.name]
"
- if(R.InverseChem != "fermiTox" || !R.InverseChem)
- R3 = GLOB.chemical_reagents_list[R.InverseChem]
+ if(R.inverse_chem != "fermiTox" || !R.inverse_chem)
+ R3 = GLOB.chemical_reagents_list[R.inverse_chem]
outstring += "- Inverse chem:[R3.name]
"
From 491ff293c568ba774b57714300c5fd05aebd4ee5 Mon Sep 17 00:00:00 2001
From: Fermi <>
Date: Sat, 21 Sep 2019 02:59:06 +0100
Subject: [PATCH 2/4] Tweaks and jazz
---
code/modules/reagents/chem_wiki_render.dm | 9 ++++++---
.../reagents/chemistry/reagents/impure_reagents.dm | 2 +-
.../reagents/chemistry/reagents/other_reagents.dm | 1 +
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/code/modules/reagents/chem_wiki_render.dm b/code/modules/reagents/chem_wiki_render.dm
index ed5c223556..2daa0f6638 100644
--- a/code/modules/reagents/chem_wiki_render.dm
+++ b/code/modules/reagents/chem_wiki_render.dm
@@ -133,6 +133,8 @@
for(var/i = 1, i <= 2, i+=1)
for(var/X in GLOB.chemical_reagents_list)
R = GLOB.chemical_reagents_list[X]
+ if(!R.description) //No description? It's not worth my time.
+ continue
for(var/Y in dispensable_reagents) //Why do you have to do this
if(R.id == Y)
@@ -206,7 +208,7 @@
to_chat(usr, "finished chems")
- var/wholeString = ("\n# DISPENCEABLE REAGENTS\n\n[prefix][basic]\n\n# COMPONENT REAGENTS\n\n[prefix][upgraded]\n\n# GRINDABLE REAGENTS\n\n[prefix][grinded]\n")
+ var/wholeString = ("\n# DISPENCEABLE REAGENTS\n\n[prefix][basic]\n\n# COMPONENT REAGENTS\n\n[prefix][upgraded]\n\n# GROUND REAGENTS\n\n[prefix][grinded]\n")
wholeString += ("\n# MEDICINE:\n\n[prefix][medicine]\n\n# TOXIN:\n\n[prefix][toxin]\n\n# DRUGS\n\n[prefix][drug]\n\n# FERMI\n\nThese chems lie on the cutting edge of chemical technology, and as such are not recommended for beginners!\n\n[prefix][fermi]\n\n# IMPURE REAGENTS\n\n[prefix][impure]\n\n# GENERAL REAGENTS\n\n[prefix][remainder]\n\n# DISPENCEABLE SOFT DRINKS\n\n[prefix][drinks]\n\n# DISPENCEABLE HARD DRINKS\n\n[prefix][alco]\n\n# CONSUMABLE\n\n[prefix][consumable]\n\n# PLANTS\n\n[prefix][plant]\n\n# URANIUM\n\n[prefix][uranium]\n\n# COLOURS\n\n[prefix][colours]\n\n# RACE MUTATIONS\n\n[prefix][muta]\n\n\n# BLOB REAGENTS\n\n[prefix][blob]\n")
prefix = "|Name | Reagents | Reaction vars | Description |\n|---|---|---|----------|\n"
@@ -290,11 +292,12 @@
//Description, OD, Addict, Meta
outstring += "[R.description] | - Metabolism_rate: [R.metabolization_rate/2]u/s
[(R.overdose_threshold?"- Overdose: [R.overdose_threshold]u
":"")] [(R.addiction_threshold?"- Addiction: [R.addiction_threshold]u
":"")] "
- if(R.impure_chem != "fermiTox" || !R.impure_chem)
+
+ if(R.impure_chem && R.impure_chem != "fermiTox")
R3 = GLOB.chemical_reagents_list[R.impure_chem]
outstring += "- Impure chem:[R3.name]
"
- if(R.inverse_chem != "fermiTox" || !R.inverse_chem)
+ if(R.inverse_chem && R.impure_chem != "fermiTox")
R3 = GLOB.chemical_reagents_list[R.inverse_chem]
outstring += "- Inverse chem:[R3.name]
"
diff --git a/code/modules/reagents/chemistry/reagents/impure_reagents.dm b/code/modules/reagents/chemistry/reagents/impure_reagents.dm
index e24b811131..c96347cda2 100644
--- a/code/modules/reagents/chemistry/reagents/impure_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/impure_reagents.dm
@@ -9,7 +9,7 @@
/datum/reagent/impure/fermiTox
name = "Chemical Isomers"
id = "fermiTox"
- 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."
+ 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. This is default impure chem for all chems, and changes only if stated."
data = "merge"
color = "FFFFFF"
can_synth = FALSE
diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm
index 60620af71b..47e9d3cb10 100644
--- a/code/modules/reagents/chemistry/reagents/other_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm
@@ -3,6 +3,7 @@
name = "Blood"
id = "blood"
color = "#C80000" // rgb: 200, 0, 0
+ description = "Blood from a human, or otherwise."
metabolization_rate = 5 //fast rate so it disappears fast.
taste_description = "iron"
taste_mult = 1.3
From 4aca2c1b31de7ee9ac43d82e3daf1d8165e48b42 Mon Sep 17 00:00:00 2001
From: Fermi <>
Date: Sat, 21 Sep 2019 13:23:28 +0100
Subject: [PATCH 3/4] Breakout
---
code/modules/reagents/chem_wiki_render.dm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/code/modules/reagents/chem_wiki_render.dm b/code/modules/reagents/chem_wiki_render.dm
index 2daa0f6638..a5558eed41 100644
--- a/code/modules/reagents/chem_wiki_render.dm
+++ b/code/modules/reagents/chem_wiki_render.dm
@@ -129,7 +129,7 @@
"applejack"
)
-
+ var/breakout = FALSE
for(var/i = 1, i <= 2, i+=1)
for(var/X in GLOB.chemical_reagents_list)
R = GLOB.chemical_reagents_list[X]
@@ -139,28 +139,36 @@
for(var/Y in dispensable_reagents) //Why do you have to do this
if(R.id == Y)
basic += generate_chemwiki_line(R, X, processCR)
+ breakout = TRUE
continue
for(var/Y in components)
if(R.id == Y)
upgraded += generate_chemwiki_line(R, X, processCR)
+ breakout = TRUE
continue
for(var/Y in dispence_drinks)
if(R.id == Y)
drinks += generate_chemwiki_line(R, X, processCR)
+ breakout = TRUE
continue
for(var/Y in dispence_alco)
if(R.id == Y)
alco += generate_chemwiki_line(R, X, processCR)
+ breakout = TRUE
continue
for(var/Y in grind)
if(R.id == Y)
grinded += generate_chemwiki_line(R, X, processCR)
+ breakout = TRUE
continue
+ if(breakout)
+ breakout = FALSE
+ continue
if(istype(R, /datum/reagent/medicine))
medicine += generate_chemwiki_line(R, X, processCR)
From 13c28933c66de6378099c00dae2c44259b727e94 Mon Sep 17 00:00:00 2001
From: Fermi <>
Date: Sat, 21 Sep 2019 13:51:27 +0100
Subject: [PATCH 4/4] There we are
---
code/modules/reagents/chem_wiki_render.dm | 39 ++++++++++++++++++++---
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/code/modules/reagents/chem_wiki_render.dm b/code/modules/reagents/chem_wiki_render.dm
index a5558eed41..c4b6f9ff56 100644
--- a/code/modules/reagents/chem_wiki_render.dm
+++ b/code/modules/reagents/chem_wiki_render.dm
@@ -1,14 +1,45 @@
//Generates a markdown txt file for use with the wiki
+/proc/find_reagent(input)
+ . = FALSE
+ if(GLOB.chemical_reagents_list[input]) //prefer IDs!
+ return input
+ else
+ for(var/X in GLOB.chemical_reagents_list)
+ var/datum/reagent/R = GLOB.chemical_reagents_list[X]
+ if(input == replacetext(lowertext(R.name), " ", ""))
+ return X
+ if(input == replacetext(lowertext(R.id), " ", ""))
+ return X
+
+
+
+
/client/proc/generate_wikichem_list()
set name = "Generate Wikichems"
set category = "Debug"
set desc = "Generate a huge loglist of all the chems. Do not click unless you want lag."
- message_admins("Someone pressed the lag button. (Generate Wikichems)")
- to_chat(usr, "Generating list")
- var/prefix = "|Name | Reagents | Reaction vars | Description | Chem properties |\n|---|---|---|-----------|---|\n"
+
+ var/prefix = "|Name | Reagents | Reaction vars | Description | Chem properties |\n|---|---|---|-----------|---|\n"
+ var/input_reagent = replacetext(lowertext(input("Input the name/id of a reagent to get it's description on it's own, or leave blank to parse every chem.", "Input") as text), " ", "") //95% of the time, the reagent id is a lowercase/no spaces version of the name
+ if(input_reagent)
+ var/input_reagent2 = find_reagent(input_reagent)
+ if(!input_reagent2)
+ to_chat(usr, "Unable to find reagent, stopping proc.")
+ var/single_parse = generate_chemwiki_line(input_reagent2, input_reagent, FALSE)
+ text2file(single_parse, "[GLOB.log_directory]/chem_parse.md")
+ to_chat(usr, "[single_parse].")
+
+ single_parse = generate_chemwiki_line(input_reagent2, input_reagent, FALSE)
+ text2file(single_parse, "[GLOB.log_directory]/chem_parse.md")
+ to_chat(usr, "[single_parse].")
+ to_chat(usr, "Saved line to (wherever your root folder is, i.e. where the DME is)/[GLOB.log_directory]/chem_parse.md OR use the Get Current Logs verb under the Admin tab. (if you click Open, and it does nothing, that's because you've not set a .md default program! Try downloading it instead, and use that file to set a default program! Also have a cute day.)")
+ //Do things here
+ return
+ to_chat(usr, "Generating big list")
+ message_admins("Someone pressed the lag button. (Generate Wikichems)")
///datum/reagent/medicine, /datum/reagent/toxin, /datum/reagent/consumable, /datum/reagent/plantnutriment, /datum/reagent/uranium,
///datum/reagent/colorful_reagent, /datum/reagent/mutationtoxin, /datum/reagent/fermi, /datum/reagent/drug, /datum/reagent/impure
@@ -298,7 +329,7 @@
outstring += " | "
//Description, OD, Addict, Meta
- outstring += "[R.description] | - Metabolism_rate: [R.metabolization_rate/2]u/s
[(R.overdose_threshold?"- Overdose: [R.overdose_threshold]u
":"")] [(R.addiction_threshold?"- Addiction: [R.addiction_threshold]u
":"")] "
+ outstring += "[R.description] | - Metabolism rate: [R.metabolization_rate/2]u/s
[(R.overdose_threshold?"- Overdose: [R.overdose_threshold]u
":"")] [(R.addiction_threshold?"- Addiction: [R.addiction_threshold]u
":"")] "
if(R.impure_chem && R.impure_chem != "fermiTox")