From 765ea2a4b69963ecef37b2b9492f1e01bfd5d2a6 Mon Sep 17 00:00:00 2001 From: TheChosenEvilOne Date: Tue, 3 Dec 2019 20:34:43 +0200 Subject: [PATCH] hhhhhhhhhh Signed-off-by: TheChosenEvilOne --- code/controllers/subsystem/blackmarket.dm | 73 ++++++++++++++----- .../cargo/blackmarket/blackmarket_item.dm | 7 +- .../blackmarket/blackmarket_items/clothing.dm | 4 +- .../blackmarket_items/consumables.dm | 21 ++++++ .../blackmarket/blackmarket_items/misc.dm | 10 +++ .../blackmarket/blackmarket_items/tools.dm | 11 +++ .../blackmarket/blackmarket_items/weapons.dm | 4 +- .../cargo/blackmarket/blackmarket_telepad.dm | 13 +++- .../cargo/blackmarket/blackmarket_uplink.dm | 22 +++--- .../tgui/interfaces/BlackmarketDownlink.js | 21 +++--- .../packages/tgui/public/tgui.bundle.css | 2 +- tgui-next/packages/tgui/public/tgui.bundle.js | 4 +- 12 files changed, 138 insertions(+), 54 deletions(-) diff --git a/code/controllers/subsystem/blackmarket.dm b/code/controllers/subsystem/blackmarket.dm index a9616ffeade..5be00023cb4 100644 --- a/code/controllers/subsystem/blackmarket.dm +++ b/code/controllers/subsystem/blackmarket.dm @@ -24,10 +24,7 @@ SUBSYSTEM_DEF(blackmarket) for(var/item in subtypesof(/datum/blackmarket_item)) var/datum/blackmarket_item/I = new item - if(!I.item) - qdel(I) - continue - if(!prob(I.availability_prob)) + if(!I.item || !prob(I.availability_prob)) qdel(I) continue for(var/M in I.markets) @@ -38,8 +35,16 @@ SUBSYSTEM_DEF(blackmarket) . = ..() /datum/controller/subsystem/blackmarket/fire(resumed) - // This whole system will break if the uplink gets removed before the order is processed. - for(var/datum/blackmarket_purchase/purchase in queued_purchases) + while(length(queued_purchases)) + var/datum/blackmarket_purchase/purchase = queued_purchases[1] + queued_purchases.Cut(1,2) + + // Uh oh, uplink is gone. We will just keep the money and you will not get your order. + if(!purchase.uplink || QDELETED(purchase.uplink)) + queued_purchases -= purchase + qdel(purchase) + continue + switch(purchase.method) // Find a ltsrbt pad and make it handle the shipping. if(SHIPPING_METHOD_LTSRBT) @@ -59,7 +64,13 @@ SUBSYSTEM_DEF(blackmarket) continue var/obj/machinery/ltsrbt/pad = pick(telepads) - purchase.uplink.visible_message("[purchase.uplink] flashes a message noting that the order is being processed by [pad].") + + // See this? this is terrible and it is all because visible_message does not show the message to the holder. + if(ishuman(purchase.uplink.loc)) + to_chat(purchase.uplink.loc, "[purchase.uplink] flashes a message noting that the order is being processed by [pad].") + else + purchase.uplink.visible_message("[purchase.uplink] flashes a message noting that the order is being processed by [pad].") + queued_purchases -= purchase pad.add_to_queue(purchase) // Get random area, throw it somewhere there. @@ -69,13 +80,19 @@ SUBSYSTEM_DEF(blackmarket) if (!targetturf) continue - purchase.uplink.visible_message("[purchase.uplink] flashes a message noting that the order is being teleported to [get_area(targetturf)] in 60 seconds.") - addtimer(CALLBACK(GLOBAL_PROC, /proc/do_teleport, purchase.entry.spawn_item(), targetturf), 60 SECONDS) + // See comment for the same snipet above + if(ishuman(purchase.uplink.loc)) + to_chat(purchase.uplink.loc, "[purchase.uplink] flashes a message noting that the order is being teleported to [get_area(targetturf)] in 60 seconds.") + else + purchase.uplink.visible_message("[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, /datum/controller/subsystem/blackmarket/proc/fake_teleport, purchase.entry.spawn_item(), targetturf), 60 SECONDS) queued_purchases -= purchase qdel(purchase) - // Get the current area of the uplink if it exists, drop the item there. if(SHIPPING_METHOD_DROPPOD) + // This is mostly just copied from express cargo console but that should be fine. var/area/A = get_area(purchase.uplink) var/LZ if(A.valid_territory) @@ -84,23 +101,30 @@ SUBSYSTEM_DEF(blackmarket) if(is_blocked_turf(T)) continue LAZYADD(empty_turfs, T) - CHECK_TICK + if(MC_TICK_CHECK) + break if(empty_turfs && empty_turfs.len) LZ = pick(empty_turfs) - // Alright, bad area. cancel would happen here but I am too lazy to do that. Anyways just drop it on the uplink + // Bad area most likely, just drop it on the uplink. Sure this makes it just go to space and buy but w/e. else LZ = get_turf(purchase.uplink) if(LZ) new /obj/effect/DPtarget(LZ, supplypod_type, purchase.entry.spawn_item()) - purchase.uplink.visible_message("[purchase.uplink] flashes a message noting that the order is being dropped to [get_area(LZ)].") + + // See comment for the same snipet above + if(ishuman(purchase.uplink.loc)) + to_chat(purchase.uplink.loc, "[purchase.uplink] flashes a message noting that the order is being dropped to [get_area(LZ)].") + else + purchase.uplink.visible_message("[purchase.uplink] flashes a message noting that the order is being dropped to [get_area(LZ)].") + queued_purchases -= purchase qdel(purchase) continue - // Guessing the uplink got sent to the void realm. This will refund at some point + // Guessing the uplink got sent to the void realm. queued_purchases -= purchase qdel(purchase) // Get the current location of the uplink if it exists, then throws the item from space at the station from a random direction. @@ -109,14 +133,27 @@ SUBSYSTEM_DEF(blackmarket) var/pickedloc = spaceDebrisStartLoc(startSide, purchase.uplink.z) var/atom/movable/item = purchase.entry.spawn_item(pickedloc) - item.throw_at(purchase.uplink, 3, 3) - - purchase.uplink.visible_message("[purchase.uplink] flashes a message noting the order is being launched from [dir2text(startSide)].") + item.throw_at(purchase.uplink, 3, 3, spin = FALSE) + + // See comment for the same snipet above + if(ishuman(purchase.uplink.loc)) + to_chat(purchase.uplink.loc, "[purchase.uplink] flashes a message noting the order is being launched at the station from [dir2text(startSide)].") + else + purchase.uplink.visible_message("[purchase.uplink] flashes a message noting the order is being launched at the station from [dir2text(startSide)].") + queued_purchases -= purchase qdel(purchase) if(MC_TICK_CHECK) - return + break + +// This exists because do_teleport does not like moving items from nullspace. +/datum/controller/subsystem/blackmarket/proc/fake_teleport(atom/movable/item, turf/target) + item.forceMove(target) + var/datum/effect_system/spark_spread/sparks = new + sparks.set_up(5, 1, target) + sparks.attach(item) + sparks.start() // Add to queued_purchases after checking if shipping method is available. /datum/controller/subsystem/blackmarket/proc/queue_item(datum/blackmarket_purchase/P) diff --git a/code/modules/cargo/blackmarket/blackmarket_item.dm b/code/modules/cargo/blackmarket/blackmarket_item.dm index c505dcf5949..b9a4f9f614a 100644 --- a/code/modules/cargo/blackmarket/blackmarket_item.dm +++ b/code/modules/cargo/blackmarket/blackmarket_item.dm @@ -49,23 +49,20 @@ stock-- uplink.money -= price - var/datum/blackmarket_purchase/purchase = new(src, buyer, uplink, shipping_method) + var/datum/blackmarket_purchase/purchase = new(src, uplink, shipping_method) // SSblackmarket takes care of the shipping. SSblackmarket.queued_purchases += purchase - uplink.purchases += purchase return TRUE // This only exists because I don't want to make a list for the values. /datum/blackmarket_purchase var/datum/blackmarket_item/entry var/item - var/mob/reciever var/obj/item/blackmarket_uplink/uplink var/method -/datum/blackmarket_purchase/New(_entry, _reciever, _uplink, _method) +/datum/blackmarket_purchase/New(_entry, _uplink, _method) entry = _entry - reciever = _reciever uplink = _uplink method = _method diff --git a/code/modules/cargo/blackmarket/blackmarket_items/clothing.dm b/code/modules/cargo/blackmarket/blackmarket_items/clothing.dm index ca3fa39f282..0a3198b9743 100644 --- a/code/modules/cargo/blackmarket/blackmarket_items/clothing.dm +++ b/code/modules/cargo/blackmarket/blackmarket_items/clothing.dm @@ -13,7 +13,7 @@ /datum/blackmarket_item/clothing/durathread_vest name = "Durathread Vest" - desc = "" + desc = "Dont let them tell you this stuff is \"Like asbestos\" or \"Pulled from the market for safety concerns\". It could be the difference between a robusting and a retaliation." item = /obj/item/clothing/suit/armor/vest/durathread price_min = 200 @@ -23,7 +23,7 @@ /datum/blackmarket_item/clothing/durathread_helmet name = "Durathread Helmet" - desc = "" + desc = "Customers ask why it's called a helmet when it's just made from armoured fabric and I always say the same thing: No refunds." item = /obj/item/clothing/head/helmet/durathread price_min = 100 diff --git a/code/modules/cargo/blackmarket/blackmarket_items/consumables.dm b/code/modules/cargo/blackmarket/blackmarket_items/consumables.dm index fa384daa91f..a473c45afe7 100644 --- a/code/modules/cargo/blackmarket/blackmarket_items/consumables.dm +++ b/code/modules/cargo/blackmarket/blackmarket_items/consumables.dm @@ -40,3 +40,24 @@ /obj/item/storage/pill_bottle/aranesp, /obj/item/storage/pill_bottle/stimulant)) return new pillbottle(loc) + +/datum/blackmarket_item/consumable/floor_pill + name = "Strange Pill" + desc = "The Russian Roulette of the Maintenance Tunnels." + item = /obj/item/reagent_containers/pill/floorpill + + stock_min = 5 + stock_max = 35 + price_min = 10 + price_max = 60 + availability_prob = 50 + +/datum/blackmarket_item/consumable/pumpup + name = "Maintenance Pumpup" + desc = "Resist any Baton stun with this handy device!" + item = /obj/item/reagent_containers/hypospray/medipen/pumpup + + stock_max = 3 + price_min = 50 + price_max = 150 + availability_prob = 90 diff --git a/code/modules/cargo/blackmarket/blackmarket_items/misc.dm b/code/modules/cargo/blackmarket/blackmarket_items/misc.dm index e0aeef2da8c..34e17e627c7 100644 --- a/code/modules/cargo/blackmarket/blackmarket_items/misc.dm +++ b/code/modules/cargo/blackmarket/blackmarket_items/misc.dm @@ -41,3 +41,13 @@ stock_min = 2 stock_max = 5 availability_prob = 50 + +/datum/blackmarket_item/misc/smugglers_satchel + name = "Smuggler's Satchel" + desc = "This easily hidden satchel can become a versatile tool to anybody with the desire to keep certain items out of sight and out of mind." + item = /obj/item/storage/backpack/satchel/flat/empty + + price_min = 1000 + price_max = 1500 + stock_max = 2 + availability_prob = 30 diff --git a/code/modules/cargo/blackmarket/blackmarket_items/tools.dm b/code/modules/cargo/blackmarket/blackmarket_items/tools.dm index 63581df08db..9c88b41f6eb 100644 --- a/code/modules/cargo/blackmarket/blackmarket_items/tools.dm +++ b/code/modules/cargo/blackmarket/blackmarket_items/tools.dm @@ -74,4 +74,15 @@ /datum/blackmarket_item/tool/thermite_bottle/spawn_item(loc) var/obj/item/reagent_containers/glass/bottle/B = ..() B.reagents.add_reagent(/datum/reagent/thermite, 30) + B.name = "Thermite Bottle" return B + +/datum/blackmarket_item/tool/science_goggles + name = "Science Goggles" + desc = "These glasses scan the contents of containers and projects their contents to the user in an easy to read format." + item = /obj/item/clothing/glasses/science + + price_min = 150 + price_max = 200 + stock_max = 3 + availability_prob = 50 diff --git a/code/modules/cargo/blackmarket/blackmarket_items/weapons.dm b/code/modules/cargo/blackmarket/blackmarket_items/weapons.dm index b93fdfce195..b8b6dbbb504 100644 --- a/code/modules/cargo/blackmarket/blackmarket_items/weapons.dm +++ b/code/modules/cargo/blackmarket/blackmarket_items/weapons.dm @@ -39,7 +39,7 @@ desc = "Use this grenade for SHOCKING results!" item = /obj/item/grenade/empgrenade - price_min = 1000 - price_max = 4000 + price_min = 100 + price_max = 400 stock_max = 2 availability_prob = 50 diff --git a/code/modules/cargo/blackmarket/blackmarket_telepad.dm b/code/modules/cargo/blackmarket/blackmarket_telepad.dm index 4a63af6e50d..c70dfc9587a 100644 --- a/code/modules/cargo/blackmarket/blackmarket_telepad.dm +++ b/code/modules/cargo/blackmarket/blackmarket_telepad.dm @@ -4,8 +4,8 @@ build_path = /obj/machinery/ltsrbt req_components = list( /obj/item/stack/ore/bluespace_crystal = 2, - /obj/item/stock_parts/subspace/ansible, - /obj/item/stock_parts/micro_laser, + /obj/item/stock_parts/subspace/ansible = 1, + /obj/item/stock_parts/micro_laser = 1, /obj/item/stock_parts/scanning_module = 2) def_components = list(/obj/item/stack/ore/bluespace_crystal = /obj/item/stack/ore/bluespace_crystal/artificial) @@ -57,7 +57,6 @@ /obj/machinery/ltsrbt/proc/add_to_queue(datum/blackmarket_purchase/purchase) if(!recharge_cooldown && !recieving) recieving = purchase - recharge_cooldown = recharge_time return queue += purchase @@ -80,6 +79,13 @@ CRASH("LTSRBT: SELLING NOT IMPLEMENTED YET.") else P.item = P.entry.spawn_item(T) + + use_power(power_usage_per_teleport / power_efficiency) + var/datum/effect_system/spark_spread/sparks = new + sparks.set_up(5, 1, get_turf(src)) + sparks.attach(P.item) + sparks.start() + recieving = null transmitting = P @@ -96,6 +102,7 @@ qdel(P) return do_teleport(P.item, get_turf(P.uplink)) + use_power(power_usage_per_teleport / power_efficiency) transmitting = null qdel(P) diff --git a/code/modules/cargo/blackmarket/blackmarket_uplink.dm b/code/modules/cargo/blackmarket/blackmarket_uplink.dm index 108c101675e..49e66021067 100644 --- a/code/modules/cargo/blackmarket/blackmarket_uplink.dm +++ b/code/modules/cargo/blackmarket/blackmarket_uplink.dm @@ -4,16 +4,15 @@ icon = 'icons/obj/assemblies.dmi' icon_state = "timer-radio2" + // UI variables. var/ui_x = 720 var/ui_y = 480 - - var/money = 0 var/viewing_category var/viewing_market var/selected_item var/buying - var/list/purchases = list() + var/money = 0 var/list/accessible_markets = list(/datum/blackmarket_market/blackmarket) /obj/item/blackmarket_uplink/Initialize() @@ -50,16 +49,8 @@ if(market) for(var/delivery in market.shipping) data["delivery_methods"] += list(list("name" = delivery, "price" = market.shipping[delivery])) - data["markets"] = list() - for(var/M in accessible_markets) - var/datum/blackmarket_market/BM = SSblackmarket.markets[M] - data["markets"] += list(list( - "id" = M, - "name" = BM.name - )) data["money"] = money data["buying"] = buying - data["purchases"] = purchases data["items"] = list() data["viewing_category"] = viewing_category data["viewing_market"] = viewing_market @@ -79,6 +70,13 @@ 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/blackmarket_market/BM = SSblackmarket.markets[M] + data["markets"] += list(list( + "id" = M, + "name" = BM.name + )) return data /obj/item/blackmarket_uplink/ui_act(action, params) @@ -153,4 +151,4 @@ /obj/item/radio = 1, /obj/item/analyzer = 1 ) - category = CATEGORY_MISC + category = CAT_MISC diff --git a/tgui-next/packages/tgui/interfaces/BlackmarketDownlink.js b/tgui-next/packages/tgui/interfaces/BlackmarketDownlink.js index 7d3cdabee12..cff55b67c21 100644 --- a/tgui-next/packages/tgui/interfaces/BlackmarketDownlink.js +++ b/tgui-next/packages/tgui/interfaces/BlackmarketDownlink.js @@ -21,18 +21,21 @@ export const BlackmarketDownlink = props => { const name = deliveryMethod.name; if (!(name === "LTSRBT" && !data.ltsrbt_built)) { return ( - - - {name} - - - {deliveryMethodDesc[name]} + + + + {name} + + + {deliveryMethodDesc[name]} +