/
githubmirror
/
vgstation13
Обзор
Документация
Войти
/
githubmirror
/
vgstation13
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
Bleeding-Edge
code/modules/unit_tests/reagent_ids.dm
28 строк
1 KB
Eneocho
The Mint Update part 1 (#39043)
23 мар 2026, 03:43
Не верифицирован
23 мар 2026, 03:43
c488bb2
Код
Авторство
О чём код?
/datum/unit_test/reagent_ids/start() var/list/id_to_reagents = list() for(var/john in subtypesof(/datum/reagent)) var/datum/reagent/reagent_path = john var/id = initial(reagent_path.id) if(id == EXPLICITLY_INVALID_REAGENT_ID) // If the id is invalid and the parent of the type also has an // invalid id, we assume this is a mistake. // This currently only works for one level of inheritance. // If you need more nested types with invalid IDs, // figure out how to change this test. :^) var/datum/reagent/parent_type = type2parent(reagent_path) if(ispath(parent_type, /datum/reagent) && initial(parent_type.id) == EXPLICITLY_INVALID_REAGENT_ID) fail("[reagent_path] does not specify an ID") continue if(id == EVEN_MORE_EXPLICITLY_INVALID_REAGENT_ID) //same thing can happen with this nested thing and I ain't fixing it properlike var/datum/reagent/parent_type = type2parent(reagent_path) if(ispath(parent_type, /datum/reagent) && initial(parent_type.id) == EVEN_MORE_EXPLICITLY_INVALID_REAGENT_ID) fail("[reagent_path] does not specify an ID") if(id_to_reagents[id]) id_to_reagents[id] += reagent_path else id_to_reagents[id] = list(reagent_path) for(var/id in id_to_reagents) var/list/reagents = id_to_reagents[id] if(reagents.len != 1) fail("Reagent ID [id] is used by more than one type: [json_encode(reagents)]")