diff --git a/code/modules/reagents/chem_wiki_render.dm b/code/modules/reagents/chem_wiki_render.dm index d4a629c508..efb6bdecfd 100644 --- a/code/modules/reagents/chem_wiki_render.dm +++ b/code/modules/reagents/chem_wiki_render.dm @@ -1,14 +1,46 @@ //Generates a markdown txt file for use with the wiki +/proc/find_reagent(input) + . = FALSE + if(GLOB.chemical_reagents_list[input]) //prefer IDs! + var/datum/reagent/R = GLOB.chemical_reagents_list[input] + return R + 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 R + if(input == replacetext(lowertext(R.id), " ", "")) + return R + + + + /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 @@ -33,7 +65,7 @@ var/alco = "" var/grinded = "" var/blob = "" - //var/impure + var/impure = "" //Chem_dispencer var/list/dispensable_reagents = list( @@ -129,36 +161,46 @@ "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] + 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) 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) @@ -190,10 +232,8 @@ else if(istype(R, /datum/reagent/blob)) blob += generate_chemwiki_line(R, X, processCR) - /* else if(istype(R, /datum/reagent/impure)) impure += generate_chemwiki_line(R, X, processCR) - */ else remainder += generate_chemwiki_line(R, X, processCR) @@ -206,8 +246,8 @@ 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") + 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" var/CRparse = "" @@ -257,6 +297,8 @@ //Temp, Explosions and pH if(CR) outstring += "