diff --git a/code/__HELPERS/cmp.dm b/code/__HELPERS/cmp.dm index 183b7c70f160..65ec73432775 100644 --- a/code/__HELPERS/cmp.dm +++ b/code/__HELPERS/cmp.dm @@ -202,3 +202,7 @@ GLOBAL_VAR_INIT(cmp_field, "name") /// Orders lists by the size of lists in their contents /proc/cmp_list_length(list/A, list/B) return length(A) - length(B) + +/// Orders codex entries by name alphabetically +/proc/cmp_codex_name(datum/codex_entry/a, datum/codex_entry/b) + return sorttext(b.name, a.name) diff --git a/code/controllers/subsystem/codex.dm b/code/controllers/subsystem/codex.dm index 94f44d129483..5da94c815df2 100644 --- a/code/controllers/subsystem/codex.dm +++ b/code/controllers/subsystem/codex.dm @@ -59,6 +59,7 @@ SUBSYSTEM_DEF(codex) string = replacetextEx(string, linkRegex.match, replacement) return string +/// Returns a codex entry for the given query. May return a list if multiple are found, or null if none. /datum/controller/subsystem/codex/proc/get_codex_entry(entry) if(isatom(entry)) var/atom/entity = entry @@ -66,6 +67,9 @@ SUBSYSTEM_DEF(codex) if(.) return return entries_by_path[entity.type] || get_entry_by_string(entity.name) + + if(isdatum(entry)) + entry = entry:type if(ispath(entry)) return entries_by_path[entry] if(istext(entry)) @@ -74,13 +78,40 @@ SUBSYSTEM_DEF(codex) /datum/controller/subsystem/codex/proc/get_entry_by_string(string) return entries_by_string[codex_sanitize(string)] +/// Presents a codex entry to a mob. If it receives a list of entries, it will prompt them to choose one. /datum/controller/subsystem/codex/proc/present_codex_entry(mob/presenting_to, datum/codex_entry/entry) - if(entry && istype(presenting_to) && presenting_to.client) - var/datum/browser/popup = new(presenting_to, "codex", "Codex", nheight=425) //"codex\ref[entry]" - var/entry_data = entry.get_codex_body(presenting_to) - popup.set_content(parse_links(jointext(entry_data, null), presenting_to)) - popup.open() - + if(!entry || !istype(presenting_to) || !presenting_to.client) + return + + if(islist(entry)) + present_codex_search(presenting_to, entry) + return + + var/datum/browser/popup = new(presenting_to, "codex", "Codex", nheight=425) //"codex\ref[entry]" + var/entry_data = entry.get_codex_body(presenting_to) + popup.set_content(parse_links(jointext(entry_data, null), presenting_to)) + popup.open() + +#define CODEX_ENTRY_LIMIT 10 +/// Presents a list of codex entries to a mob. +/datum/controller/subsystem/codex/proc/present_codex_search(mob/presenting_to, list/entries, search_query) + var/list/codex_data = list() + codex_data += "

[all_entries.len] matches[search_query ? " for '[search_query]'" : ""]:

" + + if(LAZYLEN(entries) > CODEX_ENTRY_LIMIT) + codex_data += "Showing first [CODEX_ENTRY_LIMIT] entries. [all_entries.len - 5] result\s omitted.
" + codex_data += "" + + for(var/i = 1 to min(entries.len, CODEX_ENTRY_LIMIT)) + var/datum/codex_entry/entry = entries[i] + codex_data += "" + codex_data += "
[entry.name]View
" + + var/datum/browser/popup = new(presenting_to, "codex-search", "Codex Search") //"codex-search" + popup.set_content(codex_data.Join()) + popup.open() + +#undef CODEX_ENTRY_LIMIT /datum/controller/subsystem/codex/proc/get_guide(category) var/datum/codex_category/cat = codex_categories[category] . = cat?.guide_html @@ -91,25 +122,32 @@ SUBSYSTEM_DEF(codex) return list() searching = codex_sanitize(searching) + if(!searching) return list() - if(!search_cache[searching]) - var/list/results - if(entries_by_string[searching]) - results = list(entries_by_string[searching]) - else - results = list() - for(var/entry_title in entries_by_string) - var/datum/codex_entry/entry = entries_by_string[entry_title] - if(findtext(entry.name, searching) || findtext(entry.lore_text, searching) || findtext(entry.mechanics_text, searching) || findtext(entry.antag_text, searching)) - results |= entry - search_cache[searching] = sortTim(results, GLOBAL_PROC_REF(cmp_name_asc)) - return search_cache[searching] + + . = search_cache[searching] + if(.) + return . + + var/list/results = list() + if(entries_by_string[searching]) + results = entries_by_string[searching] + else + for(var/datum/codex_entry/entry as anything in all_entries) + if(findtext(entry.name, searching)) + results.Insert(1, entry) // If it's in the name, put it at the front of the list. + + else if(findtext(entry.lore_text, searching) || findtext(entry.mechanics_text, searching) || findtext(entry.antag_text, searching)) + results += entry + + search_cache[searching] = sortTim(results, GLOBAL_PROC_REF(cmp_name_asc)) + . = search_cache[searching] /datum/controller/subsystem/codex/Topic(href, href_list) . = ..() if(!. && href_list["show_examined_info"] && href_list["show_to"]) - var/mob/showing_mob = locate(href_list["show_to"]) + var/mob/showing_mob = locate(href_list["show_to"]) if(!istype(showing_mob)) return var/atom/showing_atom = locate(href_list["show_examined_info"]) diff --git a/code/modules/codex/categories/_codex_category.dm b/code/modules/codex/categories/_codex_category.dm index e0cdbfb5d58f..988f66a9860c 100644 --- a/code/modules/codex/categories/_codex_category.dm +++ b/code/modules/codex/categories/_codex_category.dm @@ -14,61 +14,64 @@ /datum/codex_category/proc/Populate() SHOULD_CALL_PARENT(TRUE) - if(length(items)) - var/lore_text = "
[desc]
" + "
" - if(guide_name && guide_html) - lore_text += "This category has an associated guide.
" + if(!length(items)) + return - items = sortTim(items, GLOBAL_PROC_REF(cmp_text_asc), TRUE) - var/list/links = list() - for(var/item as anything in items) - var/datum/codex_entry/item_entry = SScodex.get_entry_by_string(item) - if(!item_entry) - stack_trace("Invalid item supplied to codex category Populate(): [item]") - continue - var/starter = uppertext(copytext(strip_improper(item_entry.name), 1, 2)) - LAZYADD(links[starter], "[item_entry.name]") - LAZYDISTINCTADD(item_entry.categories, src) + var/lore_text = "
[desc]
" + "
" + if(guide_name && guide_html) + lore_text += "This category has an associated guide.
" - var/list/link_cells = list() - for(var/letter in GLOB.alphabet_upper) - if(length(links[letter])) - link_cells += "
[letter]
\n
\n
\n[jointext(links[letter], "\n
\n")]\n" + items = sortTim(items, GLOBAL_PROC_REF(cmp_codex_name)) - var/list/link_table = list("") - var/link_counter = 0 - for(var/i = 1 to length(link_cells)) - if(link_counter == 0) - link_table += "" - link_table += link_cells[i] - if(link_counter == link_columns) - link_table += "" - link_counter++ - if(link_counter > link_columns) - link_counter = 0 + var/list/links = list() + for(var/datum/codex_entry/item_entry as anything in items) + if(!istype(item_entry)) + stack_trace("Invalid item supplied to codex category Populate(): [item_entry]") + continue - if(link_counter != link_columns) + var/starter = uppertext(copytext(strip_improper(item_entry.name), 1, 2)) + LAZYADD(links[starter], "[item_entry.name]") + LAZYDISTINCTADD(item_entry.categories, src) + + var/list/link_cells = list() + for(var/letter in GLOB.alphabet_upper) + if(length(links[letter])) + link_cells += "\n" + + var/list/link_table = list("
[letter]
\n
\n
\n[jointext(links[letter], "\n
\n")]
") + var/link_counter = 0 + for(var/i = 1 to length(link_cells)) + if(link_counter == 0) + link_table += "" + link_table += link_cells[i] + if(link_counter == link_columns) link_table += "" - link_table += "
" + link_counter++ + if(link_counter > link_columns) + link_counter = 0 - lore_text += jointext(link_table, "\n") - var/datum/codex_entry/entry = new( - _display_name = "[name] (category)", - _lore_text = lore_text - ) - // Categorize the categories. - var/datum/codex_category/categories/cats_cat = SScodex.codex_categories[/datum/codex_category/categories] - LAZYDISTINCTADD(entry.categories, cats_cat) - LAZYDISTINCTADD(cats_cat.items, entry.name) + if(link_counter != link_columns) + link_table += "" + link_table += "" + + lore_text += jointext(link_table, "\n") + var/datum/codex_entry/entry = new( + _display_name = "[name] (category)", + _lore_text = lore_text + ) + // Categorize the categories. + var/datum/codex_category/categories/cats_cat = SScodex.codex_categories[/datum/codex_category/categories] + LAZYDISTINCTADD(entry.categories, cats_cat) + LAZYDISTINCTADD(cats_cat.items, entry) if(guide_html) - var/datum/codex_entry/entry = new( + var/datum/codex_entry/guide_entry = new( _display_name = "Guide to [capitalize(guide_name || name)]", _mechanics_text = guide_html, _disambiguator = "guide" ) - LAZYDISTINCTADD(entry.categories, src) + LAZYDISTINCTADD(guide_entry.categories, src) // It's a guide so we track it. var/datum/codex_category/guides/guides_cat = SScodex.codex_categories[/datum/codex_category/guides] - LAZYDISTINCTADD(entry.categories, guides_cat) - LAZYDISTINCTADD(guides_cat.items, entry.name) + LAZYDISTINCTADD(guide_entry.categories, guides_cat) + LAZYDISTINCTADD(guides_cat.items, guide_entry) diff --git a/code/modules/codex/categories/gases.dm b/code/modules/codex/categories/gases.dm index 54c78ac41d4b..9cdaa7ed9fa7 100644 --- a/code/modules/codex/categories/gases.dm +++ b/code/modules/codex/categories/gases.dm @@ -28,6 +28,6 @@ _mechanics_text = jointext(material_info, null) ) - items |= entry.name + items += entry return ..() diff --git a/code/modules/codex/categories/reagents.dm b/code/modules/codex/categories/reagents.dm index 9f7fec0ad2d5..9032083e46e7 100644 --- a/code/modules/codex/categories/reagents.dm +++ b/code/modules/codex/categories/reagents.dm @@ -24,12 +24,20 @@ for(var/datum/reagent/reactant as anything in reaction.required_reagents) reactant_values += "[reaction.required_reagents[reactant]]u [lowertext(initial(reactant.name))]" - var/list/catalysts = list() for(var/datum/reagent/catalyst as anything in reaction.required_catalysts) catalysts += "[reaction.required_catalysts[catalyst]]u [lowertext(initial(catalyst.name))]" + var/datum/reagent/unstable_min = null + var/datum/reagent/unstable_max = null + + for(var/datum/reagent/chemical as anything in reaction.required_catalysts + reaction.required_reagents + reaction.results) + if(chemical.unstable_temperature) + if(!chemical.unstable_cold && (!unstable_min || unstable_min.unstable_temperature > chemical.unstable_temperature)) + unstable_min = chemical + if(chemical.unstable_cold && (!unstable_max || unstable_max.unstable_temperature < chemical.unstable_temperature)) + unstable_max = chemical if(length(catalysts)) production_strings += "- [jointext(reactant_values, " + ")] (catalysts: [jointext(catalysts, ", ")]): [reaction.results[R]]u [lowertext(initial(R.name))]" @@ -38,11 +46,51 @@ production_strings += "- Optimal temperature: [KELVIN_TO_CELSIUS(reaction.optimal_temp)]C ([reaction.optimal_temp]K)" - if (reaction.overheat_temp < NO_OVERHEAT) + if (unstable_min && unstable_min.unstable_temperature < reaction.overheat_temp) + production_strings += "- Overheat temperature: [KELVIN_TO_CELSIUS(unstable_min.unstable_temperature)]C ([unstable_min.unstable_temperature]K)" + else if (reaction.overheat_temp < NO_OVERHEAT) production_strings += "- Overheat temperature: [KELVIN_TO_CELSIUS(reaction.overheat_temp)]C ([reaction.overheat_temp]K)" + + if (unstable_max) + production_strings += "- Overcooled temperature: [KELVIN_TO_CELSIUS(unstable_max.unstable_temperature)]C ([unstable_max.unstable_temperature]K)" + if (reaction.required_temp > 0) production_strings += "- Required temperature: [KELVIN_TO_CELSIUS(reaction.required_temp)]C ([reaction.required_temp]K)" + + if(reaction.thermic_constant != 0) + // lifted outta modules/reagents/chemistry/holder.dm + var/thermic_string = "" + var/thermic = reaction.thermic_constant + if(reaction.reaction_flags & REACTION_HEAT_ARBITARY) + thermic *= 100 //Because arbitary is a lower scale + switch(thermic) + if(-INFINITY to -1500) + thermic_string = "overwhelmingly endothermic" + if(-1500 to -1000) + thermic_string = "extremely endothermic" + if(-1000 to -500) + thermic_string = "strongly endothermic" + if(-500 to -200) + thermic_string = "moderately endothermic" + if(-200 to -50) + thermic_string = "endothermic" + if(-50 to 0) + thermic_string = "weakly endothermic" + if(0 to 50) + thermic_string = "weakly exothermic" + if(50 to 200) + thermic_string = "exothermic" + if(200 to 500) + thermic_string = "moderately exothermic" + if(500 to 1000) + thermic_string = "strongly exothermic" + if(1000 to 1500) + thermic_string = "extremely exothermic" + if(1500 to INFINITY) + thermic_string = "overwhelmingly exothermic" + production_strings += "- The reaction is [thermic_string]" + if(length(production_strings)) if(!entry.mechanics_text) entry.mechanics_text = "It can be produced as follows:
" @@ -50,6 +98,6 @@ entry.mechanics_text += "

It can be produced as follows:
" entry.mechanics_text += jointext(production_strings, "
") - items += entry.name + items += entry return ..() diff --git a/code/modules/codex/categories/surgery.dm b/code/modules/codex/categories/surgery.dm index cc37bad0dedc..b6ebc7ae8c01 100644 --- a/code/modules/codex/categories/surgery.dm +++ b/code/modules/codex/categories/surgery.dm @@ -88,6 +88,6 @@ _mechanics_text = jointext(info, null) ) - items |= entry.name + items += entry return ..() diff --git a/code/modules/codex/categories/uncategorized.dm b/code/modules/codex/categories/uncategorized.dm index 8c4aff560a67..f45058700903 100644 --- a/code/modules/codex/categories/uncategorized.dm +++ b/code/modules/codex/categories/uncategorized.dm @@ -7,5 +7,5 @@ for(var/datum/codex_entry/entry as anything in SScodex.all_entries) if(!length(entry.categories)) LAZYADD(entry.categories, src) - items |= entry.name + items += entry return ..() diff --git a/code/modules/codex/codex_client.dm b/code/modules/codex/codex_client.dm index dab3d6963601..79acc26db8cc 100644 --- a/code/modules/codex/codex_client.dm +++ b/code/modules/codex/codex_client.dm @@ -1,6 +1,5 @@ /client var/codex_cooldown = FALSE - var/const/max_codex_entries_shown = 10 /client/verb/search_codex(searching as text) @@ -22,36 +21,20 @@ codex_cooldown = world.time + 1 SECONDS - var/list/all_entries = SScodex.retrieve_entries_for_string(searching) + var/list/found_entries = SScodex.retrieve_entries_for_string(searching) if(mob && mob.mind && !length(mob.mind.antag_datums)) - all_entries = all_entries.Copy() // So we aren't messing with the codex search cache. - for(var/datum/codex_entry/entry in all_entries) + found_entries = found_entries.Copy() // So we aren't messing with the codex search cache. + for(var/datum/codex_entry/entry in found_entries) if(entry.antag_text && !entry.mechanics_text && !entry.lore_text) - all_entries -= entry - - //Put entries with match in the name first - for(var/datum/codex_entry/entry in all_entries) - if(findtext(entry.name, searching)) - all_entries -= entry - all_entries.Insert(1, entry) - - if(LAZYLEN(all_entries) == 1) - SScodex.present_codex_entry(mob, all_entries[1]) - else - if(LAZYLEN(all_entries) > 1) - var/list/codex_data = list("

[all_entries.len] matches for '[searching]':

") - if(LAZYLEN(all_entries) > max_codex_entries_shown) - codex_data += "Showing first [max_codex_entries_shown] entries. [all_entries.len - 5] result\s omitted.
" - codex_data += "" - for(var/i = 1 to min(all_entries.len, max_codex_entries_shown)) - var/datum/codex_entry/entry = all_entries[i] - codex_data += "" - codex_data += "
[entry.name]View
" - var/datum/browser/popup = new(mob, "codex-search", "Codex Search") //"codex-search" - popup.set_content(codex_data.Join()) - popup.open() - else + found_entries -= entry + + switch(LAZYLEN(found_entries)) + if(null) to_chat(src, span_alert("The codex reports no matches for '[searching]'.")) + if(1) + SScodex.present_codex_entry(mob, found_entries[1]) + else + SScodex.present_codex_search(mob, found_entries, searching) /client/verb/list_codex_entries() @@ -69,7 +52,7 @@ codex_cooldown = world.time + 1 SECONDS var/datum/browser/popup = new(mob, "codex", "Codex Index") //"codex-index" - var/datum/codex_entry/nexus = SScodex.get_entry_by_string("nexus") + var/datum/codex_entry/nexus = SScodex.get_codex_entry(/datum/codex_entry/nexus) var/list/codex_data = list(nexus.get_codex_header(mob).Join(), "

Codex Entries

") codex_data += "" diff --git a/code/modules/codex/entries/_codex_entry.dm b/code/modules/codex/entries/_codex_entry.dm index b80a38af534f..60015b61a677 100644 --- a/code/modules/codex/entries/_codex_entry.dm +++ b/code/modules/codex/entries/_codex_entry.dm @@ -62,6 +62,9 @@ stack_trace("Trying to save codex entry for [name] by path [associated_path] but one already exists!") SScodex.entries_by_path[associated_path] = src + /// We always point to our own entry. Duh. + SScodex.entries_by_path[type] = src + if(!name) if(length(associated_strings)) name = associated_strings[1] @@ -74,12 +77,18 @@ if(!clean_string) associated_strings -= associated_string continue + if(clean_string != associated_string) associated_strings -= associated_string associated_strings |= clean_string - if(SScodex.entries_by_string[clean_string]) - stack_trace("Trying to save codex entry for [name] by string [clean_string] but one already exists!") - SScodex.entries_by_string[clean_string] = src + + var/existing_entry = SScodex.entries_by_string[clean_string] + if(islist(existing_entry)) + existing_entry += src + else if(existing_entry) + SScodex.entries_by_string[clean_string] = list(existing_entry, src) + else + SScodex.entries_by_string[clean_string] = src ..() @@ -92,7 +101,7 @@ . = list() if(presenting_to) - var/datum/codex_entry/linked_entry = SScodex.get_entry_by_string("nexus") + var/datum/codex_entry/linked_entry = SScodex.get_codex_entry(/datum/codex_entry/nexus) . += "Home" if(presenting_to.client) . += "Search Codex" diff --git a/code/modules/codex/entries/machinery.dm b/code/modules/codex/entries/machinery.dm index 1feb94184fa8..4d3fb8c9c479 100644 --- a/code/modules/codex/entries/machinery.dm +++ b/code/modules/codex/entries/machinery.dm @@ -4,7 +4,7 @@ /datum/codex_entry/machine/New(_display_name, list/_associated_paths, list/_associated_strings, _lore_text, _mechanics_text, _antag_text, _controls_text) . = ..() - GLOB.machine_codex_entries += name + GLOB.machine_codex_entries += src /datum/codex_entry/machine/airlock name = "Airlock" diff --git a/code/modules/codex/entries/mechcomp.dm b/code/modules/codex/entries/mechcomp.dm index bfa9585dcf1c..fdf07e2dd60b 100644 --- a/code/modules/codex/entries/mechcomp.dm +++ b/code/modules/codex/entries/mechcomp.dm @@ -4,7 +4,7 @@ /datum/codex_entry/mechcomp/New(_display_name, list/_associated_paths, list/_associated_strings, _lore_text, _mechanics_text, _antag_text, _controls_text) . = ..() - GLOB.mechcomp_codex_entries += name + GLOB.mechcomp_codex_entries += src /datum/codex_entry/mechcomp/array name = "Array (Data Type)" diff --git a/code/modules/codex/entries/power.dm b/code/modules/codex/entries/power.dm index 9f021752fd86..364c8be436db 100644 --- a/code/modules/codex/entries/power.dm +++ b/code/modules/codex/entries/power.dm @@ -5,7 +5,7 @@ /datum/codex_entry/power/New(_display_name, list/_associated_paths, list/_associated_strings, _lore_text, _mechanics_text, _antag_text, _controls_text) . = ..() - GLOB.power_codex_entries += name + GLOB.power_codex_entries += src /datum/codex_entry/power/supermatter name = "Supermatter Engine" diff --git a/code/modules/codex/entries/tools.dm b/code/modules/codex/entries/tools.dm index 4d17228009e9..b508e8abe689 100644 --- a/code/modules/codex/entries/tools.dm +++ b/code/modules/codex/entries/tools.dm @@ -5,7 +5,7 @@ /datum/codex_entry/tool/New(_display_name, list/_associated_paths, list/_associated_strings, _lore_text, _mechanics_text, _antag_text, _controls_text) . = ..() - GLOB.tool_codex_entries += name + GLOB.tool_codex_entries += src /datum/codex_entry/tool/crowbar name = "Crowbar" diff --git a/code/modules/reagents/chemistry/goon_reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/goon_reagents/medicine_reagents.dm index bc0593cb1fc8..42a3ff15165d 100644 --- a/code/modules/reagents/chemistry/goon_reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/goon_reagents/medicine_reagents.dm @@ -3,8 +3,6 @@ description = "Purges alcoholic substance from the patient's body and eliminates its side effects." color = "#00B4C8" taste_description = "raw egg" - show_in_codex = TRUE - /datum/reagent/medicine/antihol/affect_blood(mob/living/carbon/C, removed) C.remove_status_effect(/datum/status_effect/dizziness) diff --git a/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm b/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm index 25e8191d7f5d..335c46bf1a34 100644 --- a/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/goon_reagents/other_reagents.dm @@ -58,7 +58,6 @@ burning_volume = 0.05 //but has a lot of hydrocarbons addiction_types = null - show_in_codex = TRUE /datum/reagent/stable_plasma name = "Stable Plasma" @@ -105,7 +104,6 @@ touch_met = 2 var/clean_types = CLEAN_WASH chemical_flags = REAGENT_CLEANS - show_in_codex = TRUE /datum/reagent/space_cleaner/expose_obj(obj/exposed_obj, reac_volume) . = ..() @@ -322,7 +320,6 @@ reagent_state = LIQUID color = "#E7EA91" taste_description = "acid" - show_in_codex = TRUE /datum/reagent/acetone name = "Acetone" @@ -332,7 +329,6 @@ color = "#808080" metabolization_rate = 0.04 value = DISPENSER_REAGENT_VALUE - show_in_codex = TRUE /datum/reagent/acetone/affect_blood(mob/living/carbon/C, removed) C.adjustToxLoss(removed * 3, FALSE) diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 0cce32a58c98..66ef5ab2f93d 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -78,7 +78,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) var/chemical_flags = NONE /// Does this reagent and its recipe appear in the Codex? - var/show_in_codex = FALSE + var/show_in_codex = TRUE ///Thermodynamic vars ///How hot this reagent burns when it's on fire - null means it can't burn @@ -86,6 +86,11 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) ///How much is consumed when it is burnt per second var/burning_volume = 0.5 + ///The highest temperature this reagent can exist at. Currently only used by codex entries. + var/unstable_temperature = null + ///If true, unstable_temperature is the /lowest/ temperature this reagent can exist at. Currently only used by codex entries. + var/unstable_cold = FALSE + ///Assoc list with key type of addiction this reagent feeds, and value amount of addiction points added per unit of reagent metabolzied (which means * REAGENTS_METABOLISM every life()) var/list/addiction_types = null diff --git a/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm b/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm index 4399e3f4e58f..f101fb1c06ad 100644 --- a/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/dispenser_reagents.dm @@ -144,7 +144,6 @@ var/meltdose = 20 // How much is needed to melt var/max_damage = 40 value = DISPENSER_REAGENT_VALUE - show_in_codex = TRUE /datum/reagent/toxin/acid/affect_blood(mob/living/carbon/C, removed) C.adjustFireLoss(removed * acidpwr, FALSE) diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index a517a7fbcc31..24becefeb02b 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -655,6 +655,7 @@ glass_icon_state = "iceglass" glass_name = "glass of ice" glass_desc = "Generally, you're supposed to put something else in there too..." + unstable_temperature = WATER_MATTERSTATE_CHANGE_TEMP+0.5 /datum/reagent/consumable/ice/affect_ingest(mob/living/carbon/C, removed) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index c38cfbd86d2a..98c7d33d2c57 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -356,7 +356,6 @@ color = "#FFFFFF" // rgb: 255,255,255 taste_description = "salt" penetrates_skin = NONE - show_in_codex = TRUE /datum/reagent/consumable/salt/expose_turf(turf/exposed_turf, reac_volume) . = ..() diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 10347a9c1a78..61938dc4904a 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -10,7 +10,6 @@ taste_description = "bitterness" chemical_flags = REAGENT_IGNORE_MOB_SIZE abstract_type = /datum/reagent/medicine - show_in_codex = TRUE /datum/reagent/medicine/adminordrazine //An OP chemical for admins name = "Adminordrazine" diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index c1f2282ee2fb..9221cedd502a 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -8,6 +8,8 @@ glass_desc = "The father of all refreshments." shot_glass_icon_state = "shotglassclear" chemical_flags = REAGENT_CLEANS + unstable_temperature = WATER_MATTERSTATE_CHANGE_TEMP-0.5 + unstable_cold = TRUE metabolization_rate = 2 ingest_met = 2 @@ -99,7 +101,6 @@ chemical_flags = REAGENT_CLEANS | REAGENT_IGNORE_MOB_SIZE touch_met = INFINITY ingest_met = INFINITY - show_in_codex = TRUE metabolization_rate = 1 // Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits. Also ALSO increases instability. @@ -572,7 +573,6 @@ name = "Technetium 99" description = "A radioactive tracer agent that can improve a scanner's ability to detect internal organ damage. Will poison the patient when present very slowly, purging or using a low dose is recommended after use." metabolization_rate = 0.2 - show_in_codex = TRUE /datum/reagent/technetium/affect_blood(mob/living/carbon/C, removed) if(!(current_cycle % 8)) @@ -921,7 +921,6 @@ color = "#c8a5dc" overdose_threshold = 30 value = 1.8 - show_in_codex = TRUE /datum/reagent/impedrezene/on_mob_metabolize(mob/living/carbon/C, class) ADD_TRAIT(C, TRAIT_IMPEDREZENE, CHEM_TRAIT_SOURCE(class)) @@ -1067,8 +1066,6 @@ color = "#D3B913" taste_description = "sweetness" - show_in_codex = TRUE - /datum/reagent/cryptobiolin name = "Cryptobiolin" description = "Cryptobiolin causes confusion and dizziness." @@ -1076,8 +1073,6 @@ metabolization_rate = 0.3 taste_description = "sourness" - show_in_codex = TRUE - /datum/reagent/cryptobiolin/affect_blood(mob/living/carbon/C, removed) . = ..() C.set_timed_status_effect(2 SECONDS, /datum/status_effect/dizziness, only_if_higher = TRUE) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index 1e3bf8de6407..d3c0715b1554 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -45,6 +45,7 @@ description = "Nitroglycerin is a heavy, colorless, oily, explosive liquid obtained by nitrating glycerol." color = "#808080" // rgb: 128, 128, 128 taste_description = "oil" + unstable_temperature = 474 /datum/reagent/stabilizing_agent @@ -102,12 +103,15 @@ exposed_mob.adjust_fire_stacks(min(reac_volume/5, 10)) var/turf/T = get_turf(exposed_mob) T.create_fire(1, 10) + + /datum/reagent/liquid_dark_matter name = "Liquid Dark Matter" description = "Sucks everything into the detonation point." reagent_state = LIQUID color = "#210021" taste_description = "compressed bitterness" + unstable_temperature = 474 /datum/reagent/gunpowder @@ -117,7 +121,7 @@ color = "#000000" metabolization_rate = 0.125 * REAGENTS_METABOLISM taste_description = "salt" - + unstable_temperature = 474 /datum/reagent/gunpowder/on_new(data) . = ..() @@ -153,6 +157,7 @@ reagent_state = SOLID color = "#FFFFFF" taste_description = "salt" + unstable_temperature = 474 /datum/reagent/tatp @@ -161,6 +166,7 @@ reagent_state = SOLID color = "#FFFFFF" taste_description = "death" + unstable_temperature = 501 // technically it goes from 501 to 599 /datum/reagent/flash_powder @@ -169,6 +175,7 @@ reagent_state = LIQUID color = "#C8C8C8" taste_description = "salt" + unstable_temperature = 374 /datum/reagent/smoke_powder @@ -177,6 +184,7 @@ reagent_state = LIQUID color = "#C8C8C8" taste_description = "smoke" + unstable_temperature = 374 /datum/reagent/sonic_powder @@ -185,6 +193,7 @@ reagent_state = LIQUID color = "#C8C8C8" taste_description = "loud noises" + unstable_temperature = 374 /datum/reagent/napalm @@ -281,3 +290,4 @@ reagent_state = LIQUID color = "#5A64C8" taste_description = "air and bitterness" + unstable_temperature = 474 diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 1af3f8c3d498..c3af4566341c 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -38,7 +38,6 @@ toxpwr = 0.5 taste_description = "slime" taste_mult = 0.9 - show_in_codex = TRUE /datum/reagent/toxin/mutagen/expose_mob(mob/living/exposed_mob, reac_volume, exposed_temperature = T20C, datum/reagents/source, methods=TOUCH, show_message = TRUE, touch_protection = 0) . = ..() @@ -74,6 +73,7 @@ penetrates_skin = NONE burning_temperature = 4500//plasma is hot!! burning_volume = 0.3//But burns fast + unstable_temperature = LIQUID_PLASMA_BP /datum/reagent/toxin/plasma/on_new(data) @@ -97,7 +97,7 @@ /// Handles plasma boiling. /datum/reagent/toxin/plasma/proc/on_temp_change(datum/reagents/_holder, old_temp) SIGNAL_HANDLER - if(holder.chem_temp < LIQUID_PLASMA_BP) + if(holder.chem_temp < unstable_temperature) return if(!holder.my_atom) return @@ -113,7 +113,7 @@ if(!istype(exposed_turf)) return - if(exposed_temperature >= LIQUID_PLASMA_BP) + if(exposed_temperature >= unstable_temperature) exposed_turf.assume_gas(GAS_PLASMA, reac_volume / REAGENT_GAS_EXCHANGE_FACTOR, exposed_temperature) /datum/reagent/toxin/plasma/expose_mob(mob/living/exposed_mob, reac_volume, exposed_temperature, datum/reagents/source, methods, show_message, touch_protection) @@ -805,7 +805,6 @@ color = "#F0FFF0" metabolization_rate = 0.5 * REAGENTS_METABOLISM toxpwr = 0 - show_in_codex = TRUE /datum/reagent/toxin/lipolicide/affect_blood(mob/living/carbon/C, removed) . = ..() diff --git a/code/modules/unit_tests/codex.dm b/code/modules/unit_tests/codex.dm index c1f3d98a4009..c747f9cb1508 100644 --- a/code/modules/unit_tests/codex.dm +++ b/code/modules/unit_tests/codex.dm @@ -1,28 +1,3 @@ -/datum/unit_test/codex_string_uniqueness - -/datum/unit_test/codex_string_uniqueness/Run() - var/list/seen_strings = list() - for(var/datum/codex_entry/entry as anything in SScodex.all_entries) - for(var/associated_string in entry.associated_strings) - if(seen_strings[associated_string]) - TEST_FAIL("Codex String Not Unique:'[associated_string]' - [entry.type]|[entry.name] - first seen: [seen_strings[associated_string]]") - else - seen_strings[associated_string] = "[entry.type]|[entry.name]" - -/datum/unit_test/codex_overlap - -/datum/unit_test/codex_overlap/Run() - for(var/check_string in SScodex.entries_by_string) - var/clean_check_string = lowertext(check_string) - for(var/other_string in SScodex.entries_by_string) - var/clean_other_string = lowertext(other_string) - if(clean_other_string != clean_check_string && SScodex.entries_by_string[other_string] != SScodex.entries_by_string[check_string]) - if(findtext(clean_check_string, clean_other_string)) - TEST_FAIL("Codex Overlap: [check_string], [other_string]") - else if(findtext(clean_other_string, clean_check_string)) - TEST_FAIL("Codex Overlap: [other_string], [check_string]") - - /datum/unit_test/codex_links /datum/unit_test/codex_links/Run()