From 0bab3d1cfbe99d801caf351e9c334deb3d9bfca1 Mon Sep 17 00:00:00 2001 From: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Date: Fri, 4 Mar 2022 19:15:32 -0800 Subject: [PATCH] [COOL BUG READ FOR MORE INFO] Fix vaccines not working in chem masters by giving Fungal TB's vaccine (and others) a name + Add unit test for duplicate chem names + Rename fake beer + Ratio (#65241) Reagents work based off their name. Vaccines and fungal TB's vaccine had the same name. Renames fake beer from "Beer" to "Beer...?", because it's been used 10 times this entire year and it's obvious it doesn't matter. Fixes some typos in some other chemical names, where typepaths were not correct. --- .../blob/blobstrains/energized_jelly.dm | 2 +- code/modules/reagents/chemistry/reagents.dm | 2 +- .../reagents/chemistry/reagents/drink_reagents.dm | 8 ++++---- .../chemistry/reagents/medicine_reagents.dm | 1 - .../reagents/chemistry/reagents/other_reagents.dm | 1 + .../reagents/chemistry/reagents/toxin_reagents.dm | 6 +++--- code/modules/unit_tests/_unit_tests.dm | 1 + code/modules/unit_tests/reagent_names.dm | 15 +++++++++++++++ 8 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 code/modules/unit_tests/reagent_names.dm diff --git a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm index 349ca1b5722..9fa5ed9ab96 100644 --- a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm +++ b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm @@ -22,7 +22,7 @@ B.take_damage(damage, BURN, ENERGY) /datum/reagent/blob/energized_jelly - name = "Energized Jelly" + name = "Energized Blob Jelly" taste_description = "gelatin" color = "#EFD65A" diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 12338f3645b..13abd53f1b6 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -17,7 +17,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) /// A single reagent /datum/reagent /// datums don't have names by default - var/name = "Reagent" + var/name = "" /// nor do they have descriptions var/description = "" ///J/(K*mol) diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index ad377282472..bac6907088b 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -431,7 +431,7 @@ /datum/reagent/consumable/roy_rogers name = "Roy Rogers" description = "A sweet fizzy drink." - color = "#53090B" + color = "#53090B" quality = DRINK_GOOD taste_description = "fruity overlysweet cola" glass_icon_state = "royrogers" @@ -439,7 +439,7 @@ glass_desc = "90% sugar in a glass." chemical_flags = REAGENT_CAN_BE_SYNTHESIZED -/datum/reagent/consumable/roy_roger/on_mob_life(mob/living/carbon/M, delta_time, times_fired) +/datum/reagent/consumable/roy_rogers/on_mob_life(mob/living/carbon/M, delta_time, times_fired) M.Jitter(6 * REM * delta_time) //not as strong as coffe, still this is a lot of sugar M.adjust_drowsyness(-5 * REM * delta_time) M.adjust_bodytemperature(-5 * REM * TEMPERATURE_DAMAGE_COEFFICIENT * delta_time, M.get_body_temp_normal()) @@ -805,7 +805,7 @@ /datum/reagent/consumable/cinderella name = "Cinderella" description = "Most definitely a fruity alcohol cocktail to have while partying with your friends." - color = "#FF6A50" + color = "#FF6A50" quality = DRINK_VERYGOOD taste_description = "sweet tangy fruit" glass_icon_state = "cinderella" @@ -1171,7 +1171,7 @@ /datum/reagent/consumable/agua_fresca name = "Agua Fresca" description = "A refreshing watermelon agua fresca. Perfect on a day at the holodeck." - color = "#D25B66" + color = "#D25B66" quality = DRINK_VERYGOOD taste_description = "cool refreshing watermelon" glass_icon_state = "aguafresca" diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 259e4219589..18524f63ddd 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -7,7 +7,6 @@ // where all the reagents related to medicine go. /datum/reagent/medicine - name = "Medicine" taste_description = "bitterness" failed_chem = /datum/reagent/impurity/healing/medicine_failure diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 75eb49fdcba..589c5ec4fc1 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -135,6 +135,7 @@ src.data |= data.Copy() /datum/reagent/vaccine/fungal_tb + name = "Vaccine (Fungal Tuberculosis)" /datum/reagent/vaccine/fungal_tb/New(data) . = ..() diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 1abba7c6719..8cc7f1a13cd 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -456,7 +456,7 @@ ..() /datum/reagent/toxin/fakebeer //disguised as normal beer for use by emagged brobots - name = "Beer" + name = "Beer...?" description = "A specially-engineered sedative disguised as beer. It induces instant sleep in its target." color = "#664300" // rgb: 102, 67, 0 metabolization_rate = 1.5 * REAGENTS_METABOLISM @@ -790,11 +790,11 @@ toxpwr = 0 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_NO_RANDOM_RECIPE -/datum/reagent/medicine/sodium_thiopental/on_mob_add(mob/living/L, amount) +/datum/reagent/toxin/sodium_thiopental/on_mob_add(mob/living/L, amount) . = ..() ADD_TRAIT(L, TRAIT_ANTICONVULSANT, name) -/datum/reagent/medicine/sodium_thiopental/on_mob_delete(mob/living/L) +/datum/reagent/toxin/sodium_thiopental/on_mob_delete(mob/living/L) . = ..() REMOVE_TRAIT(L, TRAIT_ANTICONVULSANT, name) diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index f5de816e136..f1088eb1477 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -97,6 +97,7 @@ #include "reagent_id_typos.dm" #include "reagent_mod_expose.dm" #include "reagent_mod_procs.dm" +#include "reagent_names.dm" #include "reagent_recipe_collisions.dm" #include "resist.dm" #include "say.dm" diff --git a/code/modules/unit_tests/reagent_names.dm b/code/modules/unit_tests/reagent_names.dm new file mode 100644 index 00000000000..540dead0d3b --- /dev/null +++ b/code/modules/unit_tests/reagent_names.dm @@ -0,0 +1,15 @@ +/// Test that all reagent names are different in order to prevent #65231 +/datum/unit_test/reagent_names + +/datum/unit_test/reagent_names/Run() + var/used_names = list() + + for (var/datum/reagent/reagent as anything in subtypesof(/datum/reagent)) + var/name = initial(reagent.name) + if (!name) + continue + + if (name in used_names) + Fail("[used_names[name]] shares a name with [reagent] ([name])") + else + used_names[name] = reagent