Forbid ReagentIDs As Reagent Names (#19145)

* forbid this

* pitcher nectar fix

* illegal ids

* oop

* these

* forbid that too

* do it right
This commit is contained in:
Will
2026-02-06 09:39:30 -05:00
committed by GitHub
parent 850f6bea38
commit badf12800c
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -898,7 +898,7 @@
industrial_use = REFINERYEXPORT_REASON_PRECURSOR
/datum/reagent/nutriment/pitcher_nectar //Pitcher plant reagent, doubles plant growth speed.
name = REAGENT_ID_PITCHERNECTAR
name = REAGENT_PITCHERNECTAR
id = REAGENT_ID_PITCHERNECTAR
description = "An odd, sticky slurry which promotes rapid plant growth."
taste_description = "pineapple"
+5
View File
@@ -10,6 +10,8 @@
/datum/unit_test/reagent_shall_have_unique_name_and_id/Run()
var/collection_name = list()
var/collection_id = list()
var/regex/name_legal = regex(@"[_\t\r\n]")
var/regex/id_legal = regex(@"[\s\t\r\n]")
for(var/Rpath in subtypesof(/datum/reagent))
var/datum/reagent/R = new Rpath()
@@ -21,6 +23,9 @@
TEST_ASSERT_NOTEQUAL(R.id, REAGENT_ID_DEVELOPER_WARNING, "[Rpath]: Reagents - reagent ID not set.")
TEST_ASSERT_NOTEQUAL(R.description, REAGENT_DESC_DEVELOPER_WARNING, "[Rpath]: Reagents - reagent description unset.")
TEST_ASSERT(!name_legal.Find(R.name), "[Rpath]: Reagents - reagent name contains illegal characters: [R.name].")
TEST_ASSERT(!id_legal.Find(R.id), "[Rpath]: Reagents - reagent id contains illegal characters or spaces: [R.id].")
TEST_ASSERT(R.id != "", "[Rpath]: Reagents - reagent ID blank.")
TEST_ASSERT_EQUAL(R.id, lowertext(R.id), "[Rpath]: Reagents - Reagent ID must be all lowercase.")