Creates a unit test for loadout item duplicates (#25747)

* Creates a unit test for loadout item duplicates

* Update loadout_dupes.dm

* Update loadout_dupes.dm

* Update loadout_dupes.dm

* Update loadout_datum_under.dm

* I'm going to put the cargo shorts under misc/under

* Revert "I'm going to put the cargo shorts under misc/under"

This reverts commit e4cdbd80e42424091ad76be67502ced2cbadec13.
This commit is contained in:
Bloop
2023-12-20 13:44:50 -05:00
committed by GitHub
parent c5433c8f96
commit 49b7f8445e
3 changed files with 15 additions and 8 deletions
+1
View File
@@ -275,6 +275,7 @@
#include "worn_icons.dm"
// SKYRAT EDIT START
#include "~skyrat\automapper.dm"
#include "~skyrat\loadout_dupes.dm"
#include "~skyrat\opposing_force.dm"
// SKYRAT EDIT END
// END_INCLUDE
@@ -0,0 +1,14 @@
///Checks that loadout items' item_paths are unique to the category of loadout item it belongs to
/datum/unit_test/loadout_dupes
/datum/unit_test/loadout_dupes/Run()
var/list/item_paths = list()
for(var/datum/loadout_item/item as anything in subtypesof(/datum/loadout_item))
var/loadout_item_category = initial(item.category)
var/item_path = initial(item.item_path)
if(item_paths[item_path] == loadout_item_category)
TEST_FAIL("Duplicate loadout item! [item_path] is already being used by [item].")
if(isnull(item_path)) // can be null, for subcategories of loadout items
continue
item_paths[item_path] = loadout_item_category