mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-21 03:56:47 +01:00
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:
@@ -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"
|
||||
|
||||
@@ -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.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user