hhhhhhhhhh

Signed-off-by: TheChosenEvilOne <tceo-email@protonmail.com>
This commit is contained in:
TheChosenEvilOne
2019-12-03 20:34:43 +02:00
parent 00e030b6af
commit 765ea2a4b6
12 changed files with 138 additions and 54 deletions
+55 -18
View File
@@ -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("<span class='notice'>[purchase.uplink] flashes a message noting that the order is being processed by [pad].</span>")
// 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, "<span class='notice'>[purchase.uplink] flashes a message noting that the order is being processed by [pad].</span>")
else
purchase.uplink.visible_message("<span class='notice'>[purchase.uplink] flashes a message noting that the order is being processed by [pad].</span>")
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("<span class='notice'>[purchase.uplink] flashes a message noting that the order is being teleported to [get_area(targetturf)] in 60 seconds.</span>")
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, "<span class='notice'>[purchase.uplink] flashes a message noting that the order is being teleported to [get_area(targetturf)] in 60 seconds.</span>")
else
purchase.uplink.visible_message("<span class='notice'>[purchase.uplink] flashes a message noting that the order is being teleported to [get_area(targetturf)] in 60 seconds.</span>")
// 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("<span class='notice'>[purchase.uplink] flashes a message noting that the order is being dropped to [get_area(LZ)].</span>")
// See comment for the same snipet above
if(ishuman(purchase.uplink.loc))
to_chat(purchase.uplink.loc, "<span class='notice'>[purchase.uplink] flashes a message noting that the order is being dropped to [get_area(LZ)].</span>")
else
purchase.uplink.visible_message("<span class='notice'>[purchase.uplink] flashes a message noting that the order is being dropped to [get_area(LZ)].</span>")
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("<span class='notice'>[purchase.uplink] flashes a message noting the order is being launched from [dir2text(startSide)].</span>")
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, "<span class='notice'>[purchase.uplink] flashes a message noting the order is being launched at the station from [dir2text(startSide)].</span>")
else
purchase.uplink.visible_message("<span class='notice'>[purchase.uplink] flashes a message noting the order is being launched at the station from [dir2text(startSide)].</span>")
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)
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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
@@ -21,18 +21,21 @@ export const BlackmarketDownlink = props => {
const name = deliveryMethod.name;
if (!(name === "LTSRBT" && !data.ltsrbt_built)) {
return (
<Grid.Column textAlign="center">
<Box fontSize="30px">
{name}
</Box>
<Box
mt={1}>
{deliveryMethodDesc[name]}
<Grid.Column
textAlign="center"
position="relative">
<Box>
<Box
fontSize="30px">
{name}
</Box>
<Box mt={1}>
{deliveryMethodDesc[name]}
</Box>
</Box>
<Button
key={name}
content={deliveryMethod.price+'$'}
color="green"
mt={1}
onClick={() => act(ref, 'buy', {
method: name,
@@ -97,7 +100,7 @@ export const BlackmarketDownlink = props => {
<Table.Cell bold>
{item.name}
</Table.Cell>
<Table.Cell>
<Table.Cell className="LabeledList__buttons">
{item.amount ? item.amount+" in stock" : "Out of stock"}
</Table.Cell>
<Table.Cell className="LabeledList__buttons">
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long