Files
Bubberstation/code/modules/unit_tests/market.dm
SkyratBot fc94ed2f53 [MIRROR] (Black)market Telepad (LTSRBT) Update: Restocking Edition (#29094)
* (Black)market Telepad (LTSRBT) Update: Restocking Edition (#85066)

## About The Pull Request
This is a suggestion that was to me several months ago to add the
ability to pay credits to restock the black market. I liked the idea
because it'd add anothe small reason to buy the board, though I had
forgotten about it shortly after and just happened to remember it now.

So, yeah, you can swat the LTSRBT with a holochip to restock the
market(s). The price is shared amongst all pads and starts at 675
credits, but it doubles up everytime this is done, for obvious balance
purposes.

I've also updated included this new feature in the unit test, given the
LTSRBT new sprites and renamed the Blackmarket subsystem to Market,
because of how it can support different types of market datums, not just
the blackmarket

## Why It's Good For The Game
This adds one more reason to buy and build the LTSRBT and make markets
less dependant on the bad side of RNG, if you have the credits. It's a
bit of a money sink.

## Changelog

🆑
add: You can now restock the black market by hitting the LTSRBT with
enough credits. The price doubles each time this is done.
imageadd: Updated the LTSRBT sprites.
balance: Reintroduced the LTSRBT to cargo for 2000 credits vs the
original 4000 (the ansible and crystals to build it are included btw),
and slightly lowered the average blackmarket price for the same item to
account for shipping costs.
/🆑

* (Black)market Telepad (LTSRBT) Update: Restocking Edition

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-07-28 13:49:35 +05:30

60 lines
2.6 KiB
Plaintext

#define CATEGORY_CODERBUS "Coderbus"
/// Ensures market items have acceptable variable values and restocking works.
/datum/unit_test/market
/datum/unit_test/market/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")
var/datum/market/unit_test/market = SSmarket.markets[/datum/market/unit_test]
TEST_ASSERT(market, "Couldn't find the unit test market")
var/list/category_items = market.available_items[CATEGORY_CODERBUS]
var/datum/market_item/unit_test/item = category_items[category_items[1]]
TEST_ASSERT(item, "Couldn't find the unit test market item")
TEST_ASSERT_EQUAL(item.stock, 1, "The unit test market item is incorrectly stocked. Only one should be in stock")
var/mob/living/user = allocate(/mob/living)
var/obj/item/holochip/chip = allocate(/obj/item/holochip, run_loc_floor_bottom_left, INFINITY)
var/obj/machinery/ltsrbt/pad = allocate(/obj/machinery/ltsrbt)
pad.item_interaction(user, chip)
TEST_ASSERT_EQUAL(item, category_items[category_items[1]], "The unit test market item has been replaced during restock")
TEST_ASSERT_EQUAL(item.stock, 2, "The unit test market item is incorrectly stocked after restock. There should be two in stock")
/datum/market/unit_test
name = "Unit Test Market"
shipping = list(SHIPPING_METHOD_TELEPORT = 0)
/datum/market_item/unit_test
name = "Your Own Special Singularity"
desc = "ALL HAIL LORD SINGULOTH!!!"
category = CATEGORY_CODERBUS
markets = list(/datum/market/unit_test)
item = /obj/singularity
price = 42069
stock_min = 1
stock = 1
stock_max = 2
availability_prob = 100
#undef CATEGORY_CODERBUS