Files
Bubberstation/code/modules/cargo/markets/market_uplink.dm
T
GhomandGitHub 737822398a Blackmarket refactor and balance, fixing spy bounties, plus a new category for people captured by pirates/tots/contractors. (#81818)
## About The Pull Request
This PR aims to take care of a few potential hard dels and fix the
fenced goods category first and foremost.

The PR also adds a new one that enables you to buy mobs captured by
antags in advance, before they're sent back to the station. Unlike other
categories, it doesn't have "Launch" and "Teleport" as delivery methods,
instead it uses a special "Supply Pod" delivery method that ships the
chattel directly to your location. This method costs 400 credits,
however, if you've built the LTSRBT, shipment will be free.

Another thing, I always felt LTSRBT to be pretty fucking dumb as is. Way
too overpriced for the benefits it offers: a slighty cheaper delivery
method that, while definitely better than the other two, doesn't really
pay off or honestly even remotely compensate the 4000 credits you just
spent to get it, especially if you're only buying a couple items at
most. So I decided to remove it from cargo and add it to the blackmarket
as a 500 to 750 creds item, available every round.

Human mobs sold by the pirate bounty pad are no longer deleted, instead
they're properly ransomed and sent to the holding facility, much like
for contractors and tots. This means they're also added to the black
market.

## Why It's Good For The Game
The blackmarket system has some issues to it that need to be fixed
(otherwise the "Fenced Goods" and "Hostages" categories wouldn't work).
The Pirate Pad deleting "ransomed" mobs instead of actually ransoming
them is lame. The LTSRBT shouldn't suck as much. Also more market stuff.

This will fix #81809.

## Changelog

🆑
fix: Fixed the "Fenced Goods" black market category.
balance: Removed the LTSRBT from cargo and added it to the blackmarket,
reduced the price from 4000 to 625 on average.
balance: The time it takes for captured mobs to be automatically sent
back to the station from the holding facility has been increased from
3-4 minutes to 6.
add: You can buy mobs captured by contractors, traitors and pirates from
the black market and have them sent back to the station in advance. For
safety, they'll also be handcuffed (not always) upon delivery.
add: Human mobs sold by pirates are not deleted anymore. Instead,
they're now captured and sent to the holding facility.
/🆑
2024-03-13 15:22:01 -04:00

179 lines
5.6 KiB
Plaintext

/obj/item/market_uplink
name = "\improper Market Uplink"
desc = "An market uplink. Usable with markets. You probably shouldn't have this!"
icon = 'icons/obj/blackmarket.dmi'
icon_state = "uplink"
// UI variables.
/// What category is the current uplink viewing?
var/viewing_category
/// What market is currently being bought from by the uplink?
var/viewing_market
/// the identifier of the item that the current uplink is attempting to buy
var/selected_item
/// Is the uplink in the process of buying the selected item?
var/buying
///Reference to the currently logged in user's bank account.
var/datum/bank_account/current_user
/// List of typepaths for "/datum/market"s that this uplink can access.
var/list/accessible_markets = list(/datum/market/blackmarket)
/obj/item/market_uplink/Initialize(mapload)
. = ..()
// We don't want to go through this at mapload because the SSblackmarket isn't initialized yet.
if(mapload)
return
update_viewing_category()
/// Simple internal proc for updating the viewing_category variable.
/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
if(categories?.len)
viewing_category = categories[1]
/obj/item/market_uplink/ui_interact(mob/user, datum/tgui/ui)
if(!viewing_category)
update_viewing_category()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "BlackMarketUplink", name)
ui.open()
/obj/item/market_uplink/ui_data(mob/user)
var/list/data = list()
var/datum/market/market = viewing_market ? SSblackmarket.markets[viewing_market] : null
var/obj/item/card/id/id_card
if(isliving(user))
var/mob/living/livin = user
id_card = livin.get_idcard()
if(id_card?.registered_account)
current_user = id_card.registered_account
else
current_user = null
data["categories"] = market ? market.categories : null
data["delivery_methods"] = list()
data["money"] = "N/A cr"
if(current_user)
data["money"] = current_user.account_balance
data["buying"] = buying
if(buying && market)
var/datum/market_item/target_item = market.available_items[viewing_category][selected_item]
var/list/shipping_list = market.shipping
if(length(target_item?.shipping_override))
shipping_list = target_item.shipping_override
for(var/delivery in shipping_list)
UNTYPED_LIST_ADD(data["delivery_methods"], list("name" = delivery, "price" = shipping_list[delivery]))
data["items"] = list()
data["viewing_category"] = market.categories[viewing_category] ? viewing_category : null
data["viewing_market"] = viewing_market
if(viewing_category && market)
if(market.available_items[viewing_category])
var/list/market_category = market.available_items[viewing_category]
for(var/id in market_category)
var/datum/market_item/item = market_category[id]
data["items"] += list(list(
"id" = id,
"name" = item.name,
"cost" = item.price,
"amount" = item.stock,
"desc" = item.desc || item.name
))
return data
/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["markets"] = list()
for(var/M in accessible_markets)
var/datum/market/BM = SSblackmarket.markets[M]
data["markets"] += list(list(
"id" = M,
"name" = BM.name
))
return data
/obj/item/market_uplink/ui_act(action, params)
. = ..()
if(.)
return
switch(action)
if("set_category")
if(isnull(params["category"]))
return
if(isnull(viewing_market))
return
if(!(params["category"] in SSblackmarket.markets[viewing_market].categories))
return
viewing_category = params["category"]
. = TRUE
if("set_market")
if(isnull(params["market"]))
return
var/market = text2path(params["market"])
if(!(market in accessible_markets))
return
viewing_market = market
var/list/categories = SSblackmarket.markets[viewing_market].categories
if(categories?.len)
viewing_category = categories[1]
else
viewing_category = null
. = TRUE
if("select")
if(isnull(params["item"]))
return
selected_item = params["item"]
buying = TRUE
. = TRUE
if("cancel")
selected_item = null
buying = FALSE
. = TRUE
if("buy")
if(isnull(params["method"]))
return
if(isnull(selected_item))
buying = FALSE
return
var/datum/market/market = SSblackmarket.markets[viewing_market]
market.purchase(selected_item, viewing_category, params["method"], src, usr)
buying = FALSE
selected_item = null
/obj/item/market_uplink/blackmarket
name = "\improper Black Market Uplink"
desc = "An illegal black market uplink. If command wanted you to have these, they wouldn't have made it so hard to get one."
icon = 'icons/obj/blackmarket.dmi'
icon_state = "uplink"
//The original black market uplink
accessible_markets = list(/datum/market/blackmarket)
custom_premium_price = PAYCHECK_CREW * 2.5
/datum/crafting_recipe/blackmarket_uplink
name = "Black Market Uplink"
result = /obj/item/market_uplink/blackmarket
time = 30
tool_behaviors = list(TOOL_SCREWDRIVER, TOOL_WIRECUTTER, TOOL_MULTITOOL)
reqs = list(
/obj/item/stock_parts/micro_laser = 1,
/obj/item/assembly/signaler = 1,
/obj/item/stack/cable_coil = 15,
/obj/item/radio = 1,
/obj/item/analyzer = 1
)
category = CAT_EQUIPMENT
/datum/crafting_recipe/blackmarket_uplink/New()
..()
blacklist |= typesof(/obj/item/radio/headset) // because we got shit like /obj/item/radio/off ... WHY!?!
blacklist |= typesof(/obj/item/radio/intercom)