[MIRROR] Paicontroller subsystem port (#12484)

This commit is contained in:
CHOMPStation2StaffMirrorBot
2026-03-04 20:22:33 +01:00
committed by GitHub
parent bb87aa896b
commit 33d52d9a7d
95 changed files with 4055 additions and 2704 deletions
+2
View File
@@ -106,7 +106,9 @@
#include "mapping.dm"
#include "material_tests.dm"
// #include "nuke_cinematic.dm" // TODO: This is probably fixed later on
#include "pai_tests.dm"
#include "poster_tests.dm"
#include "special_roles.dm"
// #include "preferences.dm" // This unit test is missing some other stuff
#include "reagent_tests.dm"
#include "recipe_tests.dm"
+95
View File
@@ -0,0 +1,95 @@
/datum/unit_test/pai_software_shall_have_unique_id
/datum/unit_test/pai_software_shall_have_unique_id/Run()
for(var/datum/pai_software/P as anything in subtypesof(/datum/pai_software))
// Compare against all other pai softwares
for(var/datum/pai_software/O as anything in subtypesof(/datum/pai_software))
if(P == O) // Don't test against ourselves
continue
if(initial(P.id) == initial(O.id))
TEST_FAIL("pAI software module [P] has the same id as [O]!")
/datum/unit_test/pai_sprites_shall_be_valid
/datum/unit_test/pai_sprites_shall_be_valid/Run()
var/failed = FALSE
var/list/used_names = list()
for(var/sprite_key in SSpai.get_chassis_list())
var/datum/pai_sprite/sprite = SSpai.chassis_data(sprite_key)
if(sprite.sprite_icon == null)
continue
if(sprite.name in used_names)
TEST_NOTICE(src, "[sprite.type] - Pai sprite name is not unique: \"[sprite.name]\"")
failed = TRUE
used_names.Add(sprite.name)
if(!sprite.name || sprite.name == DEVELOPER_WARNING_NAME)
TEST_NOTICE(src, "[sprite.type] - Pai sprite had invalid name: \"[sprite.name]\"")
failed = TRUE
if(!sprite.holo_projector)
// check if we have valid icons
if(!sprite.sprite_icon_state)
TEST_NOTICE(src, "[sprite.type] - Pai sprite had no iconstate assigned")
failed = TRUE
if(!icon_exists(sprite.sprite_icon, sprite.sprite_icon_state))
TEST_NOTICE(src, "[sprite.type] - Pai sprite state \"[sprite.sprite_icon_state]\" did not exist in the dmi set \"[sprite.sprite_icon]\"")
failed = TRUE
if(sprite.can_rest)
if(!icon_exists(sprite.sprite_icon, "[sprite.sprite_icon_state]_rest"))
TEST_NOTICE(src, "[sprite.type] - Pai sprite state \"[sprite.sprite_icon_state]_rest\" did not exist in the dmi set \"[sprite.sprite_icon]\"")
failed = TRUE
// Check for vore stuff
if(sprite.belly_states > 0)
for(var/i = 1 to sprite.belly_states)
var/fullness_extension = ""
if(i > 1)
fullness_extension = "_[i]"
// standing bellies
if(!icon_exists(sprite.sprite_icon, "[sprite.sprite_icon_state]_full[fullness_extension]"))
TEST_NOTICE(src, "[sprite.type] - Pai sprite state \"[sprite.sprite_icon_state]_full[fullness_extension]\" did not exist in the dmi set \"[sprite.sprite_icon]\"")
failed = TRUE
if(sprite.can_rest && sprite.resting_belly)
// resting bellies
if(!icon_exists(sprite.sprite_icon, "[sprite.sprite_icon_state]_rest_full[fullness_extension]"))
TEST_NOTICE(src, "[sprite.type] - Pai sprite state \"[sprite.sprite_icon_state]_rest_full[fullness_extension]\" did not exist in the dmi set \"[sprite.sprite_icon]\"")
failed = TRUE
// Does it have colorable eyes?
if(sprite.has_eye_sprites)
if(!icon_exists(sprite.sprite_icon, "[sprite.sprite_icon_state]-eyes"))
TEST_NOTICE(src, "[sprite.type] - Pai sprite state \"[sprite.sprite_icon_state]-eyes\" did not exist in the dmi set \"[sprite.sprite_icon]\"")
failed = TRUE
if(sprite.can_rest)
if(!icon_exists(sprite.sprite_icon, "[sprite.sprite_icon_state]_rest-eyes"))
TEST_NOTICE(src, "[sprite.type] - Pai sprite state \"[sprite.sprite_icon_state]_rest-eyes\" did not exist in the dmi set \"[sprite.sprite_icon]\"")
failed = TRUE
// Death
if(!icon_exists(sprite.sprite_icon, "[sprite.sprite_icon_state]_dead"))
TEST_NOTICE(src, "[sprite.type] - Pai sprite state \"[sprite.sprite_icon_state]_dead\" did not exist in the dmi set \"[sprite.sprite_icon]\"")
failed = TRUE
else // Holoprojector uses ai holo instead of a sprite
// Holoprojectil eyes need to exist at all sizes for the state provided
if(sprite.holo_eyes_icon_state)
if(!icon_exists('icons/mob/pai.dmi', sprite.holo_eyes_icon_state))
TEST_NOTICE(src, "[sprite.type] - Pai holoprojection eyes state \"[sprite.holo_eyes_icon_state]\" did not exist in the dmi set \"['icons/mob/pai.dmi']\"")
failed = TRUE
if(!icon_exists('icons/mob/pai32x64.dmi', sprite.holo_eyes_icon_state))
TEST_NOTICE(src, "[sprite.type] - Pai holoprojection eyes state \"[sprite.holo_eyes_icon_state]\" did not exist in the dmi set \"['icons/mob/pai32x64.dmi']\"")
failed = TRUE
if(!icon_exists('icons/mob/pai64x32.dmi', sprite.holo_eyes_icon_state))
TEST_NOTICE(src, "[sprite.type] - Pai holoprojection eyes state \"[sprite.holo_eyes_icon_state]\" did not exist in the dmi set \"['icons/mob/pai64x32.dmi']\"")
failed = TRUE
if(!icon_exists('icons/mob/pai64x64.dmi', sprite.holo_eyes_icon_state))
TEST_NOTICE(src, "[sprite.type] - Pai holoprojection eyes state \"[sprite.holo_eyes_icon_state]\" did not exist in the dmi set \"['icons/mob/pai64x64.dmi']\"")
failed = TRUE
if(failed)
TEST_FAIL("PAI sprites had invalid entries.")
+13
View File
@@ -0,0 +1,13 @@
/datum/unit_test/special_role_flags_syncronized
/datum/unit_test/special_role_flags_syncronized/Run()
if(GLOB.special_roles.len != GLOB.be_special_flags.len)
TEST_FAIL("GLOB.special_roles and GLOB.be_special_flags lengths do not match. [GLOB.special_roles] vs [GLOB.be_special_flags].")
// These get out of order way too often.
var/index = 1
for(var/key in GLOB.special_roles)
var/check_key = GLOB.be_special_flags[index]
if(lowertext(check_key) != lowertext(key))
TEST_FAIL("Special role flag misalignment index: [index], be_special_flags: [check_key], special_roles: [key]. Keys must also match when caste to lowercase.")
index++