Merge pull request #9287 from Thalpy/Wiki
Adds a markdown parse of all chems for use with github wiki to debug menu.
This commit is contained in:
@@ -169,6 +169,7 @@ GLOBAL_LIST_INIT(admin_verbs_debug, world.AVerbsDebug())
|
||||
/client/proc/cmd_display_overlay_log,
|
||||
/client/proc/reload_configuration,
|
||||
/datum/admins/proc/create_or_modify_area,
|
||||
/client/proc/generate_wikichem_list //DO NOT PRESS UNLESS YOU WANT SUPERLAG
|
||||
)
|
||||
GLOBAL_PROTECT(admin_verbs_possess)
|
||||
GLOBAL_LIST_INIT(admin_verbs_possess, list(/proc/possess, /proc/release))
|
||||
|
||||
@@ -0,0 +1,354 @@
|
||||
//Generates a markdown txt file for use with the wiki
|
||||
|
||||
/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"
|
||||
|
||||
///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
|
||||
|
||||
//Probably not the most eligant of solutions.
|
||||
to_chat(usr, "Attempting reagent scan. Length of list [LAZYLEN(GLOB.chemical_reagents_list)*2]")
|
||||
var/datum/reagent/R
|
||||
var/tally = 0
|
||||
var/processCR = TRUE //Process reactions first
|
||||
var/medicine = ""
|
||||
var/toxin = ""
|
||||
var/consumable = ""
|
||||
var/plant = ""
|
||||
var/uranium = ""
|
||||
var/colours = ""
|
||||
var/muta = ""
|
||||
var/fermi = ""
|
||||
var/remainder = ""
|
||||
var/drug = ""
|
||||
var/basic = ""
|
||||
var/upgraded = ""
|
||||
var/drinks = ""
|
||||
var/alco = ""
|
||||
var/grinded = ""
|
||||
var/blob = ""
|
||||
//var/impure
|
||||
|
||||
//Chem_dispencer
|
||||
var/list/dispensable_reagents = list(
|
||||
"hydrogen",
|
||||
"lithium",
|
||||
"carbon",
|
||||
"nitrogen",
|
||||
"oxygen",
|
||||
"fluorine",
|
||||
"sodium",
|
||||
"aluminium",
|
||||
"silicon",
|
||||
"phosphorus",
|
||||
"sulfur",
|
||||
"chlorine",
|
||||
"potassium",
|
||||
"iron",
|
||||
"copper",
|
||||
"mercury",
|
||||
"radium",
|
||||
"water",
|
||||
"ethanol",
|
||||
"sugar",
|
||||
"sacid",
|
||||
"welding_fuel",
|
||||
"silver",
|
||||
"iodine",
|
||||
"bromine",
|
||||
"stable_plasma"
|
||||
)
|
||||
var/list/components = list(
|
||||
"oil",
|
||||
"ammonia",
|
||||
"ash",
|
||||
"acetone",
|
||||
"phenol",
|
||||
"diethylamine",
|
||||
"saltpetre",
|
||||
"sodiumchloride",
|
||||
"lye"
|
||||
)
|
||||
|
||||
var/list/grind = list(
|
||||
"bluespace",
|
||||
"gold",
|
||||
"plasma",
|
||||
"uranium"
|
||||
)
|
||||
|
||||
//Bartender
|
||||
var/dispence_drinks = list(
|
||||
"water",
|
||||
"ice",
|
||||
"coffee",
|
||||
"cream",
|
||||
"tea",
|
||||
"icetea",
|
||||
"cola",
|
||||
"spacemountainwind",
|
||||
"dr_gibb",
|
||||
"space_up",
|
||||
"tonic",
|
||||
"sodawater",
|
||||
"lemon_lime",
|
||||
"pwr_game",
|
||||
"shamblers",
|
||||
"sugar",
|
||||
"orangejuice",
|
||||
"grenadine",
|
||||
"limejuice",
|
||||
"tomatojuice",
|
||||
"lemonjuice",
|
||||
"menthol"
|
||||
)
|
||||
var/dispence_alco = list(
|
||||
"beer",
|
||||
"kahlua",
|
||||
"whiskey",
|
||||
"wine",
|
||||
"vodka",
|
||||
"gin",
|
||||
"rum",
|
||||
"tequila",
|
||||
"vermouth",
|
||||
"cognac",
|
||||
"ale",
|
||||
"absinthe",
|
||||
"hcider",
|
||||
"creme_de_menthe",
|
||||
"creme_de_cacao",
|
||||
"triple_sec",
|
||||
"sake",
|
||||
"applejack"
|
||||
)
|
||||
|
||||
|
||||
for(var/i = 1, i <= 2, i+=1)
|
||||
for(var/X in GLOB.chemical_reagents_list)
|
||||
R = GLOB.chemical_reagents_list[X]
|
||||
|
||||
for(var/Y in dispensable_reagents) //Why do you have to do this
|
||||
if(R.id == Y)
|
||||
basic += generate_chemwiki_line(R, X, processCR)
|
||||
continue
|
||||
|
||||
for(var/Y in components)
|
||||
if(R.id == Y)
|
||||
upgraded += generate_chemwiki_line(R, X, processCR)
|
||||
continue
|
||||
|
||||
for(var/Y in dispence_drinks)
|
||||
if(R.id == Y)
|
||||
drinks += generate_chemwiki_line(R, X, processCR)
|
||||
continue
|
||||
|
||||
for(var/Y in dispence_alco)
|
||||
if(R.id == Y)
|
||||
alco += generate_chemwiki_line(R, X, processCR)
|
||||
continue
|
||||
|
||||
for(var/Y in grind)
|
||||
if(R.id == Y)
|
||||
grinded += generate_chemwiki_line(R, X, processCR)
|
||||
continue
|
||||
|
||||
|
||||
if(istype(R, /datum/reagent/medicine))
|
||||
medicine += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/toxin))
|
||||
toxin += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/consumable))
|
||||
consumable += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/plantnutriment))
|
||||
plant += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/uranium))
|
||||
uranium += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/colorful_reagent))
|
||||
colours += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/mutationtoxin))
|
||||
muta += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/fermi))
|
||||
fermi += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/drug))
|
||||
drug += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
else if(istype(R, /datum/reagent/blob))
|
||||
blob += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
/* when merged
|
||||
else if(istype(R, /datum/reagent/impure))
|
||||
impure += generate_chemwiki_line(R, X, processCR)
|
||||
*/
|
||||
|
||||
else
|
||||
remainder += generate_chemwiki_line(R, X, processCR)
|
||||
|
||||
tally++
|
||||
if((tally%50)==0)
|
||||
to_chat(usr, "[tally] of [LAZYLEN(GLOB.chemical_reagents_list)*2] done.")
|
||||
|
||||
processCR = FALSE
|
||||
|
||||
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")
|
||||
|
||||
prefix = "|Name | Reagents | Reaction vars | Description |\n|---|---|---|----------|\n"
|
||||
var/CRparse = ""
|
||||
to_chat(usr, "starting reactions")
|
||||
|
||||
//generate the reactions that we missed from before
|
||||
for(var/reagent in GLOB.chemical_reactions_list)
|
||||
for(var/datum/chemical_reaction/CR in GLOB.chemical_reactions_list[reagent])
|
||||
CRparse += generate_chemreactwiki_line(CR)
|
||||
|
||||
wholeString += ("\n# CHEMICAL REACTIONS\n\n[prefix][CRparse]\n")
|
||||
text2file(wholeString, "[GLOB.log_directory]/chem_parse.md")
|
||||
to_chat(usr, "finished reactions")
|
||||
to_chat(usr, "Saved file 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.)")
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//Generate the big list of reagent based reactions.
|
||||
/proc/generate_chemwiki_line(datum/reagent/R, X, processCR)
|
||||
//name | Reagent pH | reagents | reaction temp | explosion temp | pH range | Kinetics | description | OD level | Addiction level | Metabolism rate | impure chem | inverse chem
|
||||
|
||||
var/datum/chemical_reaction/CR = get_chemical_reaction(R.id)
|
||||
if((!CR && processCR) || (CR && !processCR)) // Do reactions first.
|
||||
return ""
|
||||
|
||||
|
||||
var/outstring = "|<a href=\"#[R.name]\"><h5 id=\"[R.name]\">!\[[R.color]\](https://placehold.it/15/[copytext(R.color, 2, 8)]/000000?text=+)[R.name]</h5></a> pH: [R.pH] | "
|
||||
var/datum/reagent/R3
|
||||
if(CR)
|
||||
outstring += "<ul>"
|
||||
for(var/R2 in CR.required_reagents)
|
||||
R3 = GLOB.chemical_reagents_list[R2]//What a convoluted mess
|
||||
outstring += "<li><a href=\"#[R3.name]\">[R3.name]</a>: [CR.required_reagents[R3.id]]u</li>"
|
||||
if(CR.required_catalysts)
|
||||
for(var/R2 in CR.required_catalysts)
|
||||
R3 = GLOB.chemical_reagents_list[R2]
|
||||
outstring += "<li>Catalyst: <a href=\"#[R3.name]\">[R3.name]</a>: [CR.required_catalysts[R3.id]]u</li>"
|
||||
outstring += "</ul> | "
|
||||
else
|
||||
outstring += "N/A | "
|
||||
|
||||
|
||||
//Temp, Explosions and pH
|
||||
if(CR)
|
||||
outstring += "<ul>[(CR.FermiChem?"<li>Min react temp: [CR.OptimalTempMin]K</li>":"[(CR.required_temp?"<li>Min react temp: [CR.required_temp]K</li>":"")]")] [(CR.FermiChem?"<li>Explosion_temp: [CR.ExplodeTemp]K</li>":"")] [(CR.FermiChem?"<li>pH range: [max((CR.OptimalpHMin - CR.ReactpHLim), 0)] to [min((CR.OptimalpHMax + CR.ReactpHLim), 14)]</li>":"")] "
|
||||
else
|
||||
outstring += ""
|
||||
|
||||
//Kinetics
|
||||
if(CR)
|
||||
if(CR.FermiChem)
|
||||
switch(CR.ThermicConstant)
|
||||
if(-INFINITY to -9.9)
|
||||
outstring += "<li>Extremely endothermic</li> "
|
||||
if(-9.9 to -4.9)
|
||||
outstring += "<li>Very endothermic</li> "
|
||||
if(-4.9 to -0.1)
|
||||
outstring += "<li>Endothermic</li> "
|
||||
if(-0.1 to 0.1)
|
||||
outstring += "<li>Neutral</li> "
|
||||
if(0.1 to 4.9)
|
||||
outstring += "<li>Exothermic</li> "
|
||||
if(4.9 to 9.9)
|
||||
outstring += "<li>Very exothermic</li> "
|
||||
if(9.9 to 19.9)
|
||||
outstring += "<li>Extremely exothermic</li> "
|
||||
if(19.9 to INFINITY )
|
||||
outstring += "<li>**Dangerously exothermic**</li> "
|
||||
//if("cheesey")
|
||||
//outstring += "<li>Dangerously Cheesey</li>"
|
||||
|
||||
outstring += "</ul>| "
|
||||
else
|
||||
outstring += " | "
|
||||
|
||||
//Description, OD, Addict, Meta
|
||||
outstring += "[R.description] | <ul><li>Metabolism_rate: [R.metabolization_rate/2]u/s</li> [(R.overdose_threshold?"<li>Overdose: [R.overdose_threshold]u</li>":"")] [(R.addiction_threshold?"<li>Addiction: [R.addiction_threshold]u</li>":"")] "
|
||||
|
||||
if(R.ImpureChem != "fermiTox" || !R.ImpureChem)
|
||||
R3 = GLOB.chemical_reagents_list[R.ImpureChem]
|
||||
outstring += "<li>Impure chem:<a href=\"#[R3.name]\">[R3.name]</a></li>"
|
||||
|
||||
if(R.InverseChem != "fermiTox" || !R.InverseChem)
|
||||
R3 = GLOB.chemical_reagents_list[R.InverseChem]
|
||||
outstring += "<li>Inverse chem:<a href=\"#[R3.name]\">[R3.name]</a></li> "
|
||||
|
||||
|
||||
|
||||
if(CR)
|
||||
if(CR.required_container)
|
||||
/*var/obj/item/I
|
||||
I = istype(I, CR.required_container) if you can work out how to get this to work, by all means.
|
||||
outstring += "<li>Required container: [I.name]</li>"*/
|
||||
outstring += "<li>Required container: [CR.required_container]</li>"
|
||||
|
||||
if(CR.FermiChem)
|
||||
outstring += "<li>Minimum purity: [CR.PurityMin]</li> [(CR.FermiExplode?"<li>Special explosion: Yes</li>":"")]"
|
||||
|
||||
|
||||
outstring += "</ul>|\n"
|
||||
return outstring
|
||||
|
||||
|
||||
|
||||
|
||||
//Generate the big list of reaction based reactions.
|
||||
//|Name | Reagents | Reaction vars | Description | Chem properties
|
||||
/proc/generate_chemreactwiki_line(datum/chemical_reaction/CR)
|
||||
if(CR.results.len) //Handled prior
|
||||
return
|
||||
var/outstring = "|[CR.name] | <ul>"
|
||||
|
||||
//reagents
|
||||
var/datum/reagent/R3
|
||||
for(var/R2 in CR.required_reagents)
|
||||
R3 = GLOB.chemical_reagents_list[R2]
|
||||
outstring += "<li><a href=\"#[R3.name]\">[R3.name]</a>: [CR.required_reagents[R3.id]]u</li>"
|
||||
if(CR.required_catalysts)
|
||||
for(var/R2 in CR.required_catalysts)
|
||||
R3 = GLOB.chemical_reagents_list[R2]
|
||||
outstring += "<li>Catalyst: <a href=\"#[R3.name]\">[R3.name]</a>: [CR.required_catalysts[R3.id]]u</li>"
|
||||
outstring += "</ul> | <ul>"
|
||||
|
||||
//Reaction vars
|
||||
if(CR.required_temp)
|
||||
outstring += "<li>Min react temp: [CR.required_temp]K</li>"
|
||||
if(CR.FermiChem)
|
||||
outstring += "[(CR.FermiChem?"<li>Min react temp: [CR.OptimalTempMin]K</li>":"[(CR.required_temp?"<li>Min react temp: [CR.required_temp]K</li>":"")]")] [(CR.FermiChem?"<li>Explosion temp: [CR.ExplodeTemp]K</li>":"")] [(CR.FermiChem?"<li>pH range: [max((CR.OptimalpHMin - CR.ReactpHLim), 0)] to [min((CR.OptimalpHMax + CR.ReactpHLim), 14)]</li>":"")] <li>Minimum purity: [CR.PurityMin] [(CR.FermiExplode?"<li>Special explosion: Yes</li>":"")]"
|
||||
if(CR.is_cold_recipe)
|
||||
outstring += "<li>Cold: Yes</li>"
|
||||
if(CR.required_container)
|
||||
outstring += "<li>Required container: [CR.required_container]</li>"
|
||||
if(CR.mob_react)
|
||||
outstring += "<li>Can react in mob: Yes</li>"
|
||||
|
||||
//description
|
||||
outstring += "</ul>| fill in manually "
|
||||
|
||||
outstring += "<ul>|\n"
|
||||
return outstring
|
||||
Reference in New Issue
Block a user