[MIRROR] Unit test for black market items. Added missing bulwark module and jawed hook to the market. (#27637)

* Unit test for black market items. Added missing bulwark module and jawed hook to the market. (#82972)

## About The Pull Request
Jacq has come up with the suggestion of adding a unit test to the
blackmarket. I agreed ~~and I think I deserve the NO GBP label because
both of these missing items are actually my fault~~.

## Why It's Good For The Game
Let's avoid issues like this in the future.

## Changelog

🆑
fix: Added the missing bulwark MOD module and the jawed fishing hook to
the black market.
/🆑

* Unit test for black market items. Added missing bulwark module and jawed hook to the market.

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-05-09 08:39:22 +02:00
committed by GitHub
co-authored by Ghom
parent 35b8026c5b
commit efa6767b9c
10 changed files with 37 additions and 1 deletions
+4 -1
View File
@@ -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
@@ -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"
@@ -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"
@@ -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)
@@ -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
@@ -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
@@ -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"
@@ -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"
+1
View File
@@ -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"
+23
View File
@@ -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")