mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
[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>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
SUBSYSTEM_DEF(blackmarket)
|
||||
name = "Blackmarket"
|
||||
SUBSYSTEM_DEF(market)
|
||||
name = "Market"
|
||||
flags = SS_BACKGROUND
|
||||
init_order = INIT_ORDER_DEFAULT
|
||||
|
||||
@@ -18,27 +18,27 @@ SUBSYSTEM_DEF(blackmarket)
|
||||
/// Currently queued purchases.
|
||||
var/list/queued_purchases = list()
|
||||
|
||||
/datum/controller/subsystem/blackmarket/Initialize()
|
||||
/datum/controller/subsystem/market/Initialize()
|
||||
for(var/market in subtypesof(/datum/market))
|
||||
markets[market] += new market
|
||||
|
||||
for(var/datum/market_item/item as anything in subtypesof(/datum/market_item))
|
||||
if(!initial(item.item))
|
||||
continue
|
||||
if(!prob(initial(item.availability_prob)))
|
||||
continue
|
||||
|
||||
var/datum/market_item/item_instance = new item()
|
||||
for(var/potential_market in item_instance.markets)
|
||||
if(!markets[potential_market])
|
||||
stack_trace("SSblackmarket: Item [item_instance] available in market that does not exist.")
|
||||
continue
|
||||
// If this fails the market item will just be GC'd
|
||||
markets[potential_market].add_item(item_instance)
|
||||
for(var/path in subtypesof(/datum/market_item))
|
||||
initialize_item(path)
|
||||
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
/datum/controller/subsystem/blackmarket/fire(resumed)
|
||||
/datum/controller/subsystem/market/proc/initialize_item(datum/market_item/path, list/market_whitelist)
|
||||
if(!path::item || !prob(path::availability_prob))
|
||||
return
|
||||
var/datum/market_item/item_instance = new path()
|
||||
for(var/potential_market in item_instance.markets)
|
||||
if(!markets[potential_market])
|
||||
stack_trace("SSmarket: Item [item_instance] available in market that does not exist.")
|
||||
continue
|
||||
if(isnull(market_whitelist) || (potential_market in market_whitelist))
|
||||
markets[potential_market].add_item(item_instance)
|
||||
|
||||
/datum/controller/subsystem/market/fire(resumed)
|
||||
while(length(queued_purchases))
|
||||
var/datum/market_purchase/purchase = queued_purchases[1]
|
||||
queued_purchases.Cut(1,2)
|
||||
@@ -55,9 +55,9 @@ SUBSYSTEM_DEF(blackmarket)
|
||||
// The time left of the shortest cooldown amongst all telepads.
|
||||
var/lowest_timeleft = INFINITY
|
||||
for(var/obj/machinery/ltsrbt/pad as anything in telepads)
|
||||
if(!COOLDOWN_FINISHED(pad, recharge_cooldown))
|
||||
var/timeleft = COOLDOWN_TIMELEFT(pad, recharge_cooldown)
|
||||
if(timeleft < lowest_timeleft)
|
||||
if(!COOLDOWN_FINISHED(pad, recharge_cooldown) || (pad.machine_stat & NOPOWER))
|
||||
var/timeleft = pad.machine_stat & NOPOWER ? INFINITY - 1 : COOLDOWN_TIMELEFT(pad, recharge_cooldown)
|
||||
if(timeleft <= lowest_timeleft)
|
||||
lowest_cd_pad = pad
|
||||
lowest_timeleft = timeleft
|
||||
continue
|
||||
@@ -79,7 +79,7 @@ SUBSYSTEM_DEF(blackmarket)
|
||||
to_chat(buyer, span_notice("[purchase.uplink] flashes a message noting that the order is being teleported to [get_area(targetturf)] in 60 seconds."))
|
||||
|
||||
// do_teleport does not want to teleport items from nullspace, so it just forceMoves and does sparks.
|
||||
addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/controller/subsystem/blackmarket, fake_teleport), purchase, targetturf), 60 SECONDS)
|
||||
addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/controller/subsystem/market, fake_teleport), purchase, targetturf), 60 SECONDS)
|
||||
|
||||
// Get the current location of the uplink if it exists, then throws the item from space at the station from a random direction.
|
||||
if(SHIPPING_METHOD_LAUNCH)
|
||||
@@ -106,7 +106,7 @@ SUBSYSTEM_DEF(blackmarket)
|
||||
break
|
||||
|
||||
/// Used to make a teleportation effect as do_teleport does not like moving items from nullspace.
|
||||
/datum/controller/subsystem/blackmarket/proc/fake_teleport(datum/market_purchase/purchase, turf/target)
|
||||
/datum/controller/subsystem/market/proc/fake_teleport(datum/market_purchase/purchase, turf/target)
|
||||
// Oopsie, whoopsie, the item is gone. So long, and thanks for all the money.
|
||||
if(QDELETED(purchase))
|
||||
return
|
||||
@@ -119,9 +119,31 @@ SUBSYSTEM_DEF(blackmarket)
|
||||
qdel(purchase)
|
||||
|
||||
/// Used to add /datum/market_purchase to queued_purchases var. Returns TRUE when queued.
|
||||
/datum/controller/subsystem/blackmarket/proc/queue_item(datum/market_purchase/purchase)
|
||||
/datum/controller/subsystem/market/proc/queue_item(datum/market_purchase/purchase)
|
||||
if((purchase.method == SHIPPING_METHOD_LTSRBT && !telepads.len) || isnull(purchase.uplink))
|
||||
qdel(purchase)
|
||||
return FALSE
|
||||
queued_purchases += purchase
|
||||
return TRUE
|
||||
|
||||
///A proc that restocks one or more markets, or all if the market_whitelist is null.
|
||||
/datum/controller/subsystem/market/proc/restock(list/market_whitelist)
|
||||
var/market_name = "Markets"
|
||||
if(market_whitelist && !islist(market_whitelist))
|
||||
var/datum/market/market_path = market_whitelist
|
||||
market_name = market_path::name
|
||||
market_whitelist = list(market_path)
|
||||
|
||||
var/list/existing_types = list()
|
||||
for(var/path in markets)
|
||||
if(isnull(market_whitelist) || (path in market_whitelist))
|
||||
markets[path].restock(existing_types)
|
||||
|
||||
for(var/datum/market_item/path as anything in (subtypesof(/datum/market_item) - existing_types))
|
||||
if(!path::restockable)
|
||||
continue
|
||||
initialize_item(path, market_whitelist)
|
||||
|
||||
for(var/obj/machinery/ltsrbt/pad as anything in telepads)
|
||||
pad.say("[market_name] restocked!")
|
||||
playsound(src, 'sound/effects/cashregister.ogg', 40, FALSE)
|
||||
@@ -186,7 +186,7 @@
|
||||
|
||||
var/datum/market_item/stolen_good/new_item = new(thing, item_price)
|
||||
|
||||
return SSblackmarket.markets[/datum/market/blackmarket].add_item(new_item)
|
||||
return SSmarket.markets[/datum/market/blackmarket].add_item(new_item)
|
||||
|
||||
/// Steal an item
|
||||
/datum/spy_bounty/objective_item
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
var/list/shipping
|
||||
|
||||
// Automatic vars, do not touch these.
|
||||
/// Items available from this market, populated by SSblackmarket on initialization. Automatically assigned, so don't manually adjust.
|
||||
/// Items available from this market, populated by SSmarket on initialization. Automatically assigned, so don't manually adjust.
|
||||
var/list/available_items = list()
|
||||
/// Item categories available from this market, only items which are in these categories can be gotten from this market. Automatically assigned, so don't manually adjust.
|
||||
var/list/categories = list()
|
||||
@@ -73,6 +73,20 @@
|
||||
|
||||
return FALSE
|
||||
|
||||
/**
|
||||
* A proc that restocks only the EXISTING items of this market.
|
||||
* If you want to selectively restock markets, call SSmarket.restock(market_or_list_of_markets) instead.
|
||||
*/
|
||||
/datum/market/proc/restock(list/existing_items)
|
||||
for(var/category in available_items)
|
||||
var/category_list = available_items[category]
|
||||
for(var/identifier in category_list)
|
||||
var/datum/market_item/item = category_list[identifier]
|
||||
existing_items |= item.type
|
||||
if(!item.restockable || item.stock >= item.stock_max || !prob(item.availability_prob))
|
||||
continue
|
||||
item.stock += rand(1, item.stock_max - item.stock)
|
||||
|
||||
/datum/market/blackmarket
|
||||
name = "Black Market"
|
||||
shipping = list(
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
var/desc
|
||||
/// The category this item belongs to, should be already declared in the market that this item is accessible in.
|
||||
var/category
|
||||
/// "/datum/market"s that this item should be in, used by SSblackmarket on init.
|
||||
/// "/datum/market"s that this item should be in, used by SSmarket on init.
|
||||
var/list/markets = list(/datum/market/blackmarket)
|
||||
|
||||
/// Price for the item, if not set creates a price according to the *_min and *_max vars.
|
||||
@@ -27,7 +27,7 @@
|
||||
var/stock_min = 1
|
||||
/// 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.
|
||||
/// Probability for this item to be available. Used by SSmarket on init.
|
||||
var/availability_prob
|
||||
|
||||
///The identifier for the market item, generated on runtime and used to access them in the market categories.
|
||||
@@ -36,6 +36,9 @@
|
||||
///If set, these will override the shipment methods set by the market
|
||||
var/list/shipping_override
|
||||
|
||||
/// Can this item be restocked
|
||||
var/restockable = TRUE
|
||||
|
||||
/datum/market_item/New()
|
||||
if(isnull(price))
|
||||
price = rand(price_min, price_max)
|
||||
@@ -82,7 +85,7 @@
|
||||
CRASH("Invalid item type for market item [item || "null"]")
|
||||
|
||||
/**
|
||||
* Buys the item and makes SSblackmarket handle it.
|
||||
* Buys the item and makes SSmarket handle it.
|
||||
*
|
||||
* @param uplink The uplink that is buying the item.
|
||||
* @param buyer The mob that is buying the item.
|
||||
@@ -102,8 +105,8 @@
|
||||
// Alright, the item has been purchased.
|
||||
var/datum/market_purchase/purchase = new(src, uplink, shipping_method, legal_status)
|
||||
|
||||
// SSblackmarket takes care of the shipping.
|
||||
if(SSblackmarket.queue_item(purchase))
|
||||
// SSmarket takes care of the shipping.
|
||||
if(SSmarket.queue_item(purchase))
|
||||
stock--
|
||||
buyer.log_message("has succesfully purchased [name] using [shipping_method] for shipping.", LOG_ECON)
|
||||
return TRUE
|
||||
@@ -139,7 +142,7 @@
|
||||
/datum/market_purchase/Destroy()
|
||||
entry = null
|
||||
uplink = null
|
||||
SSblackmarket.queued_purchases -= src
|
||||
SSmarket.queued_purchases -= src
|
||||
return ..()
|
||||
|
||||
/datum/market_purchase/proc/on_instance_del(datum/source)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
stock = 1
|
||||
availability_prob = 100
|
||||
shipping_override = list(SHIPPING_METHOD_LTSRBT = 0, SHIPPING_METHOD_SUPPLYPOD = 350)
|
||||
restockable = FALSE
|
||||
/// temporary reference to the 4 in 7 chances of signaler and electropack.
|
||||
var/obj/item/assembly/signaler/signaler
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
abstract_path = /datum/market_item/stolen_good
|
||||
stock = 1
|
||||
availability_prob = 100
|
||||
restockable = FALSE
|
||||
|
||||
/datum/market_item/stolen_good/New(atom/movable/thing, thing_price)
|
||||
..()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
stock_min = 2
|
||||
stock_max = 4
|
||||
price_min = CARGO_CRATE_VALUE * 2.5
|
||||
price_max = CARGO_CRATE_VALUE * 3.75
|
||||
price_max = CARGO_CRATE_VALUE * 3.25
|
||||
availability_prob = 100
|
||||
|
||||
/datum/market_item/tool/caravan_wrench
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#define DEFAULT_RESTOCK_COST 675
|
||||
|
||||
/obj/item/circuitboard/machine/ltsrbt
|
||||
name = "LTSRBT (Machine Board)"
|
||||
icon_state = "bluespacearray"
|
||||
@@ -13,7 +15,8 @@
|
||||
name = "Long-To-Short-Range-Bluespace-Transceiver"
|
||||
desc = "The LTSRBT is a compact teleportation machine for receiving and sending items outside the station and inside the station.\nUsing teleportation frequencies stolen from NT it is near undetectable.\nEssential for any illegal market operations on NT stations.\n"
|
||||
icon = 'icons/obj/machines/telecomms.dmi'
|
||||
icon_state = "exonet_node"
|
||||
icon_state = "exonet_node_idle"
|
||||
base_icon_state = "exonet_node"
|
||||
circuit = /obj/item/circuitboard/machine/ltsrbt
|
||||
density = TRUE
|
||||
|
||||
@@ -35,19 +38,43 @@
|
||||
var/datum/market_purchase/transmitting
|
||||
/// Queue for purchases that the machine should receive and send.
|
||||
var/list/datum/market_purchase/queue = list()
|
||||
/**
|
||||
* Attacking the machinery with enough credits will restock the markets, allowing for more/better items.
|
||||
* The cost doubles each time this is done.
|
||||
*/
|
||||
var/static/restock_cost = DEFAULT_RESTOCK_COST
|
||||
|
||||
/obj/machinery/ltsrbt/Initialize(mapload)
|
||||
. = ..()
|
||||
SSblackmarket.telepads += src
|
||||
register_context()
|
||||
SSmarket.telepads += src
|
||||
|
||||
/obj/machinery/ltsrbt/Destroy()
|
||||
SSblackmarket.telepads -= src
|
||||
SSmarket.telepads -= src
|
||||
// Bye bye orders.
|
||||
if(length(SSblackmarket.telepads))
|
||||
if(length(SSmarket.telepads))
|
||||
for(var/datum/market_purchase/P in queue)
|
||||
SSblackmarket.queue_item(P)
|
||||
SSmarket.queue_item(P)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/ltsrbt/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
||||
if(held_item && held_item.get_item_credit_value())
|
||||
context[SCREENTIP_CONTEXT_LMB] = "Restock"
|
||||
return CONTEXTUAL_SCREENTIP_SET
|
||||
return NONE
|
||||
|
||||
/obj/machinery/ltsrbt/examine(mob/user)
|
||||
. = ..()
|
||||
if(machine_stat & NOPOWER)
|
||||
. += span_info("A display reads: \"Current market restock price: [EXAMINE_HINT("[restock_cost] cr")]\".")
|
||||
|
||||
/obj/machinery/ltsrbt/update_icon_state()
|
||||
. = ..()
|
||||
if(machine_stat & NOPOWER)
|
||||
icon_state = "[base_icon_state]_off"
|
||||
else
|
||||
icon_state = "[base_icon_state][(receiving || length(queue)) ? "" : "_idle"]"
|
||||
|
||||
/obj/machinery/ltsrbt/RefreshParts()
|
||||
. = ..()
|
||||
recharge_time = base_recharge_time
|
||||
@@ -67,6 +94,7 @@
|
||||
/obj/machinery/ltsrbt/proc/add_to_queue(datum/market_purchase/purchase)
|
||||
if(!recharge_cooldown && !receiving && !transmitting)
|
||||
receiving = purchase
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
else
|
||||
queue += purchase
|
||||
|
||||
@@ -80,6 +108,8 @@
|
||||
if(transmitting == purchase)
|
||||
transmitting = null
|
||||
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
|
||||
/obj/machinery/ltsrbt/process(seconds_per_tick)
|
||||
if(machine_stat & NOPOWER)
|
||||
return
|
||||
@@ -113,3 +143,32 @@
|
||||
|
||||
if(length(queue))
|
||||
receiving = pick_n_take(queue)
|
||||
|
||||
/obj/machinery/ltsrbt/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
||||
var/creds_value = tool.get_item_credit_value()
|
||||
if(!creds_value)
|
||||
return NONE
|
||||
|
||||
. = ITEM_INTERACT_SUCCESS
|
||||
|
||||
if(machine_stat & NOPOWER)
|
||||
return
|
||||
|
||||
if(creds_value < restock_cost)
|
||||
say("Insufficient credits!")
|
||||
playsound(src, 'sound/machines/buzz-sigh.ogg', 40, FALSE)
|
||||
return
|
||||
|
||||
if(istype(tool, /obj/item/holochip))
|
||||
var/obj/item/holochip/chip = tool
|
||||
chip.spend(restock_cost)
|
||||
else
|
||||
qdel(tool)
|
||||
if(creds_value != restock_cost)
|
||||
var/obj/item/holochip/change = new(creds_value - restock_cost)
|
||||
user.put_in_hands(change)
|
||||
|
||||
SSmarket.restock()
|
||||
restock_cost *= 2
|
||||
|
||||
#undef DEFAULT_RESTOCK_COST
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
/obj/item/market_uplink/Initialize(mapload)
|
||||
. = ..()
|
||||
// We don't want to go through this at mapload because the SSblackmarket isn't initialized yet.
|
||||
// We don't want to go through this at mapload because the SSmarket isn't initialized yet.
|
||||
if(mapload)
|
||||
return
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
/obj/item/market_uplink/proc/update_viewing_category()
|
||||
if(accessible_markets.len)
|
||||
viewing_market = accessible_markets[1]
|
||||
var/list/categories = SSblackmarket.markets[viewing_market].categories
|
||||
var/list/categories = SSmarket.markets[viewing_market].categories
|
||||
if(categories?.len)
|
||||
viewing_category = categories[1]
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/obj/item/market_uplink/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/datum/market/market = viewing_market ? SSblackmarket.markets[viewing_market] : null
|
||||
var/datum/market/market = viewing_market ? SSmarket.markets[viewing_market] : null
|
||||
var/obj/item/card/id/id_card
|
||||
if(isliving(user))
|
||||
var/mob/living/livin = user
|
||||
@@ -86,11 +86,11 @@
|
||||
|
||||
/obj/item/market_uplink/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["delivery_method_description"] = SSblackmarket.shipping_method_descriptions
|
||||
data["ltsrbt_built"] = SSblackmarket.telepads.len
|
||||
data["delivery_method_description"] = SSmarket.shipping_method_descriptions
|
||||
data["ltsrbt_built"] = SSmarket.telepads.len
|
||||
data["markets"] = list()
|
||||
for(var/M in accessible_markets)
|
||||
var/datum/market/BM = SSblackmarket.markets[M]
|
||||
var/datum/market/BM = SSmarket.markets[M]
|
||||
data["markets"] += list(list(
|
||||
"id" = M,
|
||||
"name" = BM.name
|
||||
@@ -107,7 +107,7 @@
|
||||
return
|
||||
if(isnull(viewing_market))
|
||||
return
|
||||
if(!(params["category"] in SSblackmarket.markets[viewing_market].categories))
|
||||
if(!(params["category"] in SSmarket.markets[viewing_market].categories))
|
||||
return
|
||||
viewing_category = params["category"]
|
||||
. = TRUE
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
viewing_market = market
|
||||
|
||||
var/list/categories = SSblackmarket.markets[viewing_market].categories
|
||||
var/list/categories = SSmarket.markets[viewing_market].categories
|
||||
if(categories?.len)
|
||||
viewing_category = categories[1]
|
||||
else
|
||||
@@ -142,7 +142,7 @@
|
||||
if(isnull(selected_item))
|
||||
buying = FALSE
|
||||
return
|
||||
var/datum/market/market = SSblackmarket.markets[viewing_market]
|
||||
var/datum/market/market = SSmarket.markets[viewing_market]
|
||||
market.purchase(selected_item, viewing_category, params["method"], src, usr)
|
||||
|
||||
buying = FALSE
|
||||
|
||||
@@ -321,3 +321,20 @@
|
||||
)
|
||||
crate_name = "floortile camouflauge crate"
|
||||
crate_type = /obj/structure/closet/crate/secure/weapon
|
||||
|
||||
/**
|
||||
* The Long To Short Range Bluespace Teleporter, used to deliver (black) market purchases more effiiently
|
||||
* It can also be used to restock it, if you hit it with enough credits.
|
||||
*/
|
||||
/datum/supply_pack/imports/blackmarket_telepad
|
||||
name = "Black Market LTSRBT"
|
||||
desc = "Need a faster and better way of transporting your illegal goods from and to the \
|
||||
station? Fear not, the Long-To-Short-Range-Bluespace-Transceiver (LTSRBT for short) \
|
||||
is here to help. Contains a LTSRBT circuit, two bluespace crystals, and one ansible."
|
||||
cost = CARGO_CRATE_VALUE * 10
|
||||
contraband = TRUE
|
||||
contains = list(
|
||||
/obj/item/circuitboard/machine/ltsrbt,
|
||||
/obj/item/stack/ore/bluespace_crystal/artificial = 2,
|
||||
/obj/item/stock_parts/subspace/ansible,
|
||||
)
|
||||
|
||||
@@ -2740,7 +2740,7 @@ GLOBAL_LIST_EMPTY(fire_appearances)
|
||||
|
||||
///The price should be high enough that the contractor can't just buy 'em back with their cut alone.
|
||||
var/datum/market_item/hostage/market_item = new(src, black_market_price || ransom_price)
|
||||
SSblackmarket.markets[/datum/market/blackmarket].add_item(market_item)
|
||||
SSmarket.markets[/datum/market/blackmarket].add_item(market_item)
|
||||
|
||||
if(mind)
|
||||
ADD_TRAIT(mind, TRAIT_HAS_BEEN_KIDNAPPED, TRAIT_GENERIC)
|
||||
|
||||
@@ -102,7 +102,6 @@
|
||||
#include "bespoke_id.dm"
|
||||
#include "binary_insert.dm"
|
||||
#include "bitrunning.dm"
|
||||
#include "blackmarket.dm"
|
||||
#include "blindness.dm"
|
||||
#include "bloody_footprints.dm"
|
||||
#include "breath.dm"
|
||||
@@ -183,6 +182,7 @@
|
||||
#include "mapload_space_verification.dm"
|
||||
#include "mapping.dm"
|
||||
#include "mapping_nearstation_test.dm"
|
||||
#include "market.dm"
|
||||
#include "mecha_damage.dm"
|
||||
#include "medical_wounds.dm"
|
||||
#include "merge_type.dm"
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/// 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")
|
||||
@@ -0,0 +1,59 @@
|
||||
#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
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
+3
-3
@@ -49,7 +49,6 @@
|
||||
#include "code\__DEFINES\basic_mobs.dm"
|
||||
#include "code\__DEFINES\basketball.dm"
|
||||
#include "code\__DEFINES\bitrunning.dm"
|
||||
#include "code\__DEFINES\blackmarket.dm"
|
||||
#include "code\__DEFINES\blend_modes.dm"
|
||||
#include "code\__DEFINES\blob_defines.dm"
|
||||
#include "code\__DEFINES\blood.dm"
|
||||
@@ -137,6 +136,7 @@
|
||||
#include "code\__DEFINES\map_switch.dm"
|
||||
#include "code\__DEFINES\mapping.dm"
|
||||
#include "code\__DEFINES\maps.dm"
|
||||
#include "code\__DEFINES\market.dm"
|
||||
#include "code\__DEFINES\maths.dm"
|
||||
#include "code\__DEFINES\matrices.dm"
|
||||
#include "code\__DEFINES\MC.dm"
|
||||
@@ -299,7 +299,6 @@
|
||||
#include "code\__DEFINES\dcs\signals\signals_backpack.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_beam.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_bitrunning.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_blackmarket.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_blob.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_bot.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_camera.dm"
|
||||
@@ -329,6 +328,7 @@
|
||||
#include "code\__DEFINES\dcs\signals\signals_leash.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_lift.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_light_eater.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_market.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_material_container.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_medical.dm"
|
||||
#include "code\__DEFINES\dcs\signals\signals_mind.dm"
|
||||
@@ -728,7 +728,6 @@
|
||||
#include "code\controllers\subsystem\ban_cache.dm"
|
||||
#include "code\controllers\subsystem\bitrunning.dm"
|
||||
#include "code\controllers\subsystem\blackbox.dm"
|
||||
#include "code\controllers\subsystem\blackmarket.dm"
|
||||
#include "code\controllers\subsystem\chat.dm"
|
||||
#include "code\controllers\subsystem\circuit_component.dm"
|
||||
#include "code\controllers\subsystem\dbcore.dm"
|
||||
@@ -753,6 +752,7 @@
|
||||
#include "code\controllers\subsystem\lua.dm"
|
||||
#include "code\controllers\subsystem\machines.dm"
|
||||
#include "code\controllers\subsystem\mapping.dm"
|
||||
#include "code\controllers\subsystem\market.dm"
|
||||
#include "code\controllers\subsystem\materials.dm"
|
||||
#include "code\controllers\subsystem\minor_mapping.dm"
|
||||
#include "code\controllers\subsystem\mobs.dm"
|
||||
|
||||
Reference in New Issue
Block a user