diff --git a/code/modules/cargo/markets/market_item.dm b/code/modules/cargo/markets/market_item.dm index 51651ffdc47..21ff3d01deb 100644 --- a/code/modules/cargo/markets/market_item.dm +++ b/code/modules/cargo/markets/market_item.dm @@ -16,6 +16,9 @@ /// Path to or the item itself what this entry is for, this should be set even if you override spawn_item to spawn your item. var/atom/movable/item + /// Used to exclude abstract/special paths from the unit test if the value matches the type itself. + var/abstract_path + /// Minimum price for the item if generated randomly. var/price_min = 0 /// Maximum price for the item if generated randomly. @@ -25,7 +28,7 @@ /// Maximum amount that there should be of this item in the market if generated randomly. var/stock_max = 0 /// Probability for this item to be available. Used by SSblackmarket on init. - var/availability_prob = 0 + var/availability_prob ///The identifier for the market item, generated on runtime and used to access them in the market categories. var/identifier diff --git a/code/modules/cargo/markets/market_items/clothing.dm b/code/modules/cargo/markets/market_items/clothing.dm index b38cf4caf2e..946a64431a9 100644 --- a/code/modules/cargo/markets/market_items/clothing.dm +++ b/code/modules/cargo/markets/market_items/clothing.dm @@ -1,5 +1,6 @@ /datum/market_item/clothing category = "Clothing" + abstract_path = /datum/market_item/clothing /datum/market_item/clothing/ninja_mask name = "Space Ninja Mask" diff --git a/code/modules/cargo/markets/market_items/consumables.dm b/code/modules/cargo/markets/market_items/consumables.dm index 5550d31c5f8..f002ff99424 100644 --- a/code/modules/cargo/markets/market_items/consumables.dm +++ b/code/modules/cargo/markets/market_items/consumables.dm @@ -1,5 +1,6 @@ /datum/market_item/consumable category = "Consumables" + abstract_path = /datum/market_item/consumable /datum/market_item/consumable/clown_tears name = "Bottle of Clown's Tears" diff --git a/code/modules/cargo/markets/market_items/hostages.dm b/code/modules/cargo/markets/market_items/hostages.dm index 6551ee6156b..ed5b1f10a7f 100644 --- a/code/modules/cargo/markets/market_items/hostages.dm +++ b/code/modules/cargo/markets/market_items/hostages.dm @@ -1,6 +1,7 @@ ///A special category for mobs captured by pirates, tots and contractors, should someone ever want to get them back in advance. /datum/market_item/hostage category = "Hostages" + abstract_path = /datum/market_item/hostage stock = 1 availability_prob = 100 shipping_override = list(SHIPPING_METHOD_LTSRBT = 0, SHIPPING_METHOD_SUPPLYPOD = 350) diff --git a/code/modules/cargo/markets/market_items/misc.dm b/code/modules/cargo/markets/market_items/misc.dm index de0fcaa9256..435396c15f2 100644 --- a/code/modules/cargo/markets/market_items/misc.dm +++ b/code/modules/cargo/markets/market_items/misc.dm @@ -1,5 +1,6 @@ /datum/market_item/misc category = "Miscellaneous" + abstract_path = /datum/market_item/misc /datum/market_item/misc/Clear_PDA name = "Clear PDA" @@ -53,6 +54,7 @@ /datum/market_item/misc/shove_blocker name = "MOD Bulwark Module" desc = "You have no idea how much effort it took us to extract this module from that damn safeguard MODsuit last shift." + item = /obj/item/mod/module/shove_blocker price_min = CARGO_CRATE_VALUE * 4 price_max = CARGO_CRATE_VALUE * 5.75 stock_max = 1 @@ -108,6 +110,7 @@ /datum/market_item/misc/jawed_hook name = "Jawed Fishing Hook" desc = "The thing ya use if y'are strugglin' with fishes. Just rememeber to whoop yer rod before it's too late, 'cause this thing's gonna hurt them like an Arkansas toothpick." + item = /obj/item/fishing_hook/jaws price_min = CARGO_CRATE_VALUE * 0.75 price_max = CARGO_CRATE_VALUE * 2 stock_max = 3 diff --git a/code/modules/cargo/markets/market_items/stolen_goods.dm b/code/modules/cargo/markets/market_items/stolen_goods.dm index c9c17f1d2b6..02a72f05d26 100644 --- a/code/modules/cargo/markets/market_items/stolen_goods.dm +++ b/code/modules/cargo/markets/market_items/stolen_goods.dm @@ -1,6 +1,7 @@ ///A special category for goods stolen by spies for their bounties. /datum/market_item/stolen_good category = "Fenced Goods" + abstract_path = /datum/market_item/stolen_good stock = 1 availability_prob = 100 diff --git a/code/modules/cargo/markets/market_items/tools.dm b/code/modules/cargo/markets/market_items/tools.dm index 5d036fae0ef..9576810b3a3 100644 --- a/code/modules/cargo/markets/market_items/tools.dm +++ b/code/modules/cargo/markets/market_items/tools.dm @@ -1,5 +1,6 @@ /datum/market_item/tool category = "Tools" + abstract_path = /datum/market_item/tool /datum/market_item/tool/blackmarket_telepad name = "Black Market LTSRBT" diff --git a/code/modules/cargo/markets/market_items/weapons.dm b/code/modules/cargo/markets/market_items/weapons.dm index 11f242d57c8..3323e169162 100644 --- a/code/modules/cargo/markets/market_items/weapons.dm +++ b/code/modules/cargo/markets/market_items/weapons.dm @@ -1,5 +1,6 @@ /datum/market_item/weapon category = "Weapons" + abstract_path = /datum/market_item/weapon /datum/market_item/weapon/bear_trap name = "Bear Trap" diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 98a234cbf0e..1d7654b7530 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -101,6 +101,7 @@ #include "bespoke_id.dm" #include "binary_insert.dm" #include "bitrunning.dm" +#include "blackmarket.dm" #include "blindness.dm" #include "bloody_footprints.dm" #include "breath.dm" diff --git a/code/modules/unit_tests/blackmarket.dm b/code/modules/unit_tests/blackmarket.dm new file mode 100644 index 00000000000..984e2ea8155 --- /dev/null +++ b/code/modules/unit_tests/blackmarket.dm @@ -0,0 +1,23 @@ +/// Ensures black market items have acceptable variable values. +/datum/unit_test/blackmarket + +/datum/unit_test/blackmarket/Run() + for(var/datum/market_item/prototype as anything in subtypesof(/datum/market_item)) + if(prototype::abstract_path == prototype) //skip abstract paths + continue + if(!prototype::category) + TEST_FAIL("[prototype] doesn't have a set category (or the abstract path var isn't correctly set)") + continue + if(!prototype::item) + TEST_FAIL("[prototype] doesn't have a set item (or the abstract path var isn't correctly set)") + continue + if(isnull(prototype::price) && prototype::price_max <= prototype::price_min) + TEST_FAIL("[prototype] doesn't have a correctly set random price (price_max should be higher than price_min)") + if(isnull(prototype::stock) && prototype::stock_max < prototype::stock_min) + TEST_FAIL("[prototype] doesn't have a correctly set random stock (stock_max shouldn't be lower than stock_min)") + if(!isnum(prototype::availability_prob)) + TEST_FAIL("[prototype] doesn't have a set availability_prob (must be a number)") + if(!prototype::name) + TEST_FAIL("[prototype] doesn't have a set name") + if(!prototype::desc) + TEST_FAIL("[prototype] doesn't have a set desc")