@@ -39,11 +39,16 @@ var/datum/controller/subsystem/cargo/SScargo
39
39
40
40
// shuttle movement
41
41
var /movetime = 1200
42
+ var /min_movetime = 1200
42
43
var /datum /shuttle/ferry/supply/shuttle
43
44
44
45
// Item vars
45
46
var /last_item_id = 0 // The ID of the last item that has been added
46
47
48
+ // Exports and bounties
49
+ var /list /exports_list = list ()
50
+ var /list /bounties_list = list ()
51
+
47
52
/ datum / controller/ subsystem/ cargo/ Recover()
48
53
src . shuttle = SScargo. shuttle
49
54
src . cargo_items = SScargo. cargo_items
@@ -54,6 +59,8 @@ var/datum/controller/subsystem/cargo/SScargo
54
59
src . cargo_handlingfee_change = SScargo. cargo_handlingfee_change
55
60
src . supply_account = SScargo. supply_account
56
61
src . last_item_id = SScargo. last_item_id
62
+ src . exports_list = SScargo. exports_list
63
+ src . bounties_list = SScargo. bounties_list
57
64
58
65
/ datum / controller/ subsystem/ cargo/ Initialize(timeofday)
59
66
// Generate the ordernumber and shipmentnumber to start with
@@ -73,6 +80,10 @@ var/datum/controller/subsystem/cargo/SScargo
73
80
else
74
81
log_game (" SScargo: invalid load option specified in config" )
75
82
83
+ setupExports ()
84
+ setupBounties ()
85
+
86
+ // Spawn in the warehouse crap
76
87
var /datum /cargospawner/spawner = new
77
88
spawner. start()
78
89
qdel (spawner)
@@ -201,7 +212,6 @@ var/datum/controller/subsystem/cargo/SScargo
201
212
item_query. item[11 ])
202
213
catch (var /exception /ei )
203
214
log_debug (" SScargo: Error when loading item from sql: [ ei] " )
204
- return 1
205
215
206
216
// Loads the cargo data from JSON
207
217
/ datum / controller/ subsystem/ cargo/ proc / load_from_json()
@@ -555,7 +565,7 @@ var/datum/controller/subsystem/cargo/SScargo
555
565
if (shuttle. forbidden_atoms_check())
556
566
. = " For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons."
557
567
else
558
- movetime = 1200 // It always takes two minutes to get to centcom
568
+ movetime = min_movetime // It always takes two minutes to get to centcom
559
569
shuttle. launch(src )
560
570
. = " Initiating launch sequence"
561
571
current_shipment. shuttle_recalled_by = caller_name
@@ -573,9 +583,9 @@ var/datum/controller/subsystem/cargo/SScargo
573
583
current_shipment. shuttle_time = get_pending_shipment_time()
574
584
current_shipment. shuttle_fee = shipment_cost
575
585
576
- if (current_shipment. shuttle_time < 1200 )
577
- log_debug (" SScargo: Shuttle Time less than 1200 : [ current_shipment. shuttle_time] - Setting to 1200 " )
578
- current_shipment. shuttle_time = 1200
586
+ if (current_shipment. shuttle_time < min_movetime )
587
+ log_debug (" SScargo: Shuttle Time less than [ min_movetime ] : [ current_shipment. shuttle_time] - Setting to [ min_movetime ] " )
588
+ current_shipment. shuttle_time = min_movetime
579
589
580
590
movetime = current_shipment. shuttle_time
581
591
// Launch it
@@ -609,39 +619,39 @@ var/datum/controller/subsystem/cargo/SScargo
609
619
610
620
// Sells stuff on the shuttle to centcom
611
621
/ datum / controller/ subsystem/ cargo/ proc / sell()
612
- // TODO-CARGO: Only pay for specific stuff on the shuttle and not for everything else - Charge a cleanup fee for the rest
613
622
var /area /area_shuttle = shuttle. get_location_area()
614
623
if (! area_shuttle) return
615
624
616
- var /phoron_count = 0
617
- var /plat_count = 0
625
+ var /msg = " "
626
+ var /matched_bounty = FALSE
627
+ var /sold_atoms = " "
618
628
619
- for (var /atom/movable /MA in area_shuttle)
620
- if (MA . anchored) continue
629
+ for (var /place in area_shuttle)
630
+ var /area /shuttle/shuttle_area = place
631
+ for (var /atom/movable /AM in shuttle_area)
632
+ if (bounty_ship_item_and_contents(AM , dry_run = FALSE ))
633
+ matched_bounty = TRUE
634
+ if (! AM . anchored || istype(AM , / obj / mecha))
635
+ sold_atoms += export_item_and_contents(AM , FALSE , FALSE , dry_run = FALSE )
621
636
622
- // Must be in a crate!
623
- if (istype(MA ,/ obj / structure/ closet/ crate))
624
- callHook (" sell_crate" , list (MA , area_shuttle))
637
+ if (sold_atoms)
638
+ sold_atoms += " ."
625
639
626
- current_shipment. shipment_cost_sell += credits_per_crate
640
+ if (matched_bounty)
641
+ msg += " Bounty items received. An update has been sent to all bounty consoles.\n "
627
642
628
- for (var /atom in MA )
629
- var /atom /A = atom
630
- // Sell phoron and platinum
631
- if (istype(A, / obj / item/ stack))
632
- var /obj /item/stack/P = A
633
- switch (P. get_material_name())
634
- if (" phoron" ) phoron_count += P. get_amount()
635
- if (" platinum" ) plat_count += P. get_amount()
636
- qdel (MA )
637
-
638
- if (phoron_count)
639
- current_shipment. shipment_cost_sell += phoron_count * credits_per_phoron
643
+ for (var /a in exports_list)
644
+ var /datum /export/E = a
645
+ var /export_text = E. total_printout()
646
+ if (! export_text)
647
+ continue
640
648
641
- if (plat_count)
642
- current_shipment. shipment_cost_sell += plat_count * credits_per_platinum
649
+ msg += export_text + " \n "
650
+ current_shipment. shipment_cost_sell += E. total_cost
651
+ E. export_end()
643
652
644
653
charge_cargo (" Shipment #[ current_shipment. shipment_num] - Income" , - current_shipment. shipment_cost_sell)
654
+ current_shipment. message = msg
645
655
current_shipment. generate_invoice()
646
656
current_shipment = null // Null the current shipment because its completed
647
657
0 commit comments