-
Notifications
You must be signed in to change notification settings - Fork 6
/
comms_scenario_utility.lua
11499 lines (11498 loc) · 609 KB
/
comms_scenario_utility.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Name: Comms Utility
-- Description: Make external flexible utility for handling communications
-- Author: Xansta
--------------------------------------------------------------------------
-- General instructions for how to use this utility
-- Set booleans for the aspects you want to use.
-- Define any functions that work in conjunction with this utility.
-- Add any applicable lines in your update function to use enabled utility aspects.
-- The available booleans and functions are described in this utility just above
-- the function where they are used. If you are here trying to use this utility, then
-- you will probably want to read the code that applies to the aspect you are
-- interested in using.
-- Motivation
-- I'm mainly writing this for myself. I find I spend a significant amount of time
-- copying and pasting code from scenario to scenario related to communications.
-- With this utility, I hope to reduce the amount of time coding and reduce the
-- amount of time it takes to review new scenarios. Anyone is welcome to use
-- this utility. I made some effort to have it approachable, but I am fairly confident
-- that someone will find something they'd like to improve upon. If you decide to
-- make changes directly, be sure to test existing scenarios that use this utility.
-- I intend to start switching several scenarios to using this utility.
-- Scenarios that depend on this utility:
-- Liberation Day scenario_27_liberation.lua
-- Surf's Up! scenario_29_surf.lua
-- Shop Til You Drop scenario_40_shop.lua
----------------------------------------------
-- Functions you may want to set up outside of this utility
-- setCommsStationFriendliness - returns a number between 0 and 100 representing the
-- station's friendliness. Useful if you have a category of stations that need
-- a range of friendliness other than a random value between 0 and 100.
-- Example of wanting the inner stations generally friendlier:
-- function setCommsStationFriendliness()
-- local friendliness = random(0,100)
-- for i,station in ipairs(inner_stations) do
-- if station ~= nil and station:isValid() and station == comms_target then
-- if comms_target.comms_data ~= nil and comms_target.comms_data.friendlyness ~= nil then
-- if comms_target.comms_data.friendlyness < 50 then
-- friendliness = random(50,100)
-- else
-- friendliness = comms_target.comms_data.friendlyness
-- end
-- end
-- end
-- end
-- return friendliness
-- end
-- handleEnemiesInRange - returns true if a message is sent about enemies being
-- too close to allow communication with the station.
-- See handle_enemies_in_short_range boolean below.
-- Example:
-- function handleEnemiesInRange()
-- local short_range_radar = comms_target:getShortRangeRadarRange()
-- if comms_target:areEnemiesInRange(short_range_radar/3) then
-- setCommsMessage(string.format((_"station-comms","[Automated Response]\nWe're sorry, but we cannot take your call right now. All personnel are busy at emergency stations due to hostile entities within %.1f units"),short_range_radar/3/1000))
-- if isAllowedTo(comms_target.comms_data.services.activatedefensefleet) then
-- stationDefenseFleet()
-- end
-- return true
-- end
-- end
-- Booleans to set outside of this utility to control this utility. Default is false
-- fixed_ordnance_cost - sets the price for ordnance to fixed values. Default (false)
-- is to set ordnance to range appropriate random values.
-- fixed_service_cost - sets the price for services to fixed values. Default (false)
-- is to set service costs to range appropriate random values.
-- add_station_to_database - puts the station in the science database when a player
-- contacts the station. Updates some of the values as applicable each contact.
-- set_players - calls function setPlayers() when the players contact the station.
-- handle_enemies_in_short_range - The default (false) is to respond to the player
-- that the station cannot talk when enemies are within 5u. If this boolean is
-- true, the short range radar range is used as the range at which the station
-- does not talk to players. This boolean is ignored if the handleEnemiesInRange
-- function exists.
-- Note: more booleans are listed before each function to which they apply
require("utils.lua")
require("generate_call_sign_scenario_utility.lua")
require("cpu_ship_diversification_scenario_utility.lua")
function commsStation()
if comms_target.comms_data == nil then
comms_target.comms_data = {}
end
local friendliness = random(0,100)
if setCommsStationFriendliness ~= nil then
friendliness = setCommsStationFriendliness()
end
local homing_availability = random(1,10)<=7
local hvli_availability = random(1,10)<=8
local mine_availability = random(1,10)<=6
local nuke_availability = random(1,10)<=4
local emp_availability = random(1,10)<=5
if difficulty ~= nil then
homing_availability = random(1,13)<=(9-difficulty)
hvli_availability = random(1,13)<=(10-difficulty)
mine_availability = random(1,13)<=(8-difficulty)
nuke_availability = random(1,13)<=(6-difficulty)
emp_availability = random(1,13)<=(7-difficulty)
end
if fixed_weapon_availability then
homing_availability = true
hvli_availability = true
mine_availability = true
nuke_availability = true
emp_availability = true
end
local homing_cost = math.random(1,4)
local hvli_cost = math.random(1,3)
local mine_cost = math.random(2,5)
local nuke_cost = math.random(12,18)
local emp_cost = math.random(7,13)
if fixed_ordnance_cost then
homing_cost = 2
hvli_cost = 2
mine_cost = 2
nuke_cost = 15
emp_cost = 10
end
local supply_drop_cost = math.random(80,120)
local jump_supply_drop_cost = math.random(110,140)
local fling_supply_drop_cost = math.random(140,170)
local reinforcements_cost = math.random(125,175)
local phobos_reinforcements_cost = math.random(200,250)
local stalker_reinforcements_cost = math.random(275,325)
local amk3_reinforcement_cost = math.random(85,115)
local hornet_reinforcement_cost = math.random(85,115)
local amk8_reinforcement_cost = math.random(180,220)
local activate_defense_fleet_cost = math.random(15,30)
if fixed_service_cost then
supply_drop_cost = 100
jump_supply_drop_cost = 125
fling_supply_drop_cost = 155
reinforcements_cost = 150
phobos_reinforcements_cost = 225
stalker_reinforcements_cost = 300
amk3_reinforcement_cost = 100
hornet_reinforcement_cost = 100
amk8_reinforcement_cost = 200
activate_defense_fleet_cost = 20
end
mergeTables(comms_target.comms_data, {
friendlyness = friendliness,
weapons = {
Homing = "neutral",
HVLI = "neutral",
Mine = "neutral",
Nuke = "friend",
EMP = "friend"
},
weapon_available = {
Homing = homing_availability,
HVLI = hvli_availability,
Mine = mine_availability,
Nuke = nuke_availability,
EMP = emp_availability,
},
weapon_cost = {
Homing = homing_cost,
HVLI = hvli_cost,
Mine = mine_cost,
Nuke = nuke_cost,
EMP = emp_cost,
},
services = {
supplydrop = "friend",
jumpsupplydrop = "friend",
flingsupplydrop = "friend",
reinforcements = "friend",
activatedefensefleet = "neutral"
},
service_cost = {
supplydrop = supply_drop_cost,
jumpsupplydrop = jump_supply_drop_cost,
flingsupplydrop = fling_supply_drop_cost,
reinforcements = reinforcements_cost,
phobos_reinforcements = phobos_reinforcements_cost,
stalker_reinforcements = stalker_reinforcements_cost,
amk3_reinforcements = amk3_reinforcement_cost,
hornet_reinforcements = hornet_reinforcement_cost,
amk8_reinforcements = amk8_reinforcement_cost,
activatedefensefleet = activate_defense_fleet_cost,
},
reputation_cost_multipliers = {
friend = 1.0,
neutral = 3.0
},
max_weapon_refill_amount = {
friend = 1.0,
neutral = 0.5
}
})
-- comms_data = comms_target.comms_data
if add_station_to_database then
if not comms_source:isEnemy(comms_target) then
if player_faction == nil then
player_faction = comms_source:getFaction()
end
addStationToDatabase(comms_target)
end
end
if set_players then
setPlayers()
end
if comms_source:isEnemy(comms_target) then
return false
end
local no_relay_panic_responses = {
_("station-comms","No communication officers available due to station emergency."),
_("station-comms","Relay officers unavailable during station emergency."),
_("station-comms","Relay officers reassigned for station emergency."),
_("station-comms","Station emergency precludes response from relay officer."),
_("station-comms","We are under attack! No time for chatting!"),
}
if handleEnemiesInRange ~= nil then
handleEnemiesInRange()
elseif handle_enemies_in_short_range then
if comms_target:areEnemiesInRange(comms_target:getShortRangeRadarRange()) then
setCommsMessage(tableSelectRandom(no_relay_panic_responses))
return true
end
else
if comms_target:areEnemiesInRange(5000) then
setCommsMessage(tableSelectRandom(no_relay_panic_responses))
return true
end
end
if comms_source:isDocked(comms_target) then
handleDockedState()
else
handleUndockedState()
end
end
-----------------
-- Utilities --
-----------------
function tableRemoveRandom(array)
-- Remove random element from array and return it.
-- Returns nil if the array is empty,
-- analogous to `table.remove`.
local array_item_count = #array
if array_item_count == 0 then
return nil
end
local selected_item = math.random(array_item_count)
local temp = array[selected_item]
array[selected_item] = array[array_item_count]
array[array_item_count] = temp
return table.remove(array)
end
function tableSelectRandom(array)
local array_item_count = #array
if array_item_count == 0 then
return nil
end
return array[math.random(1,#array)]
end
function angleFromVectorNorth(p1x,p1y,p2x,p2y)
TWOPI = 6.2831853071795865
RAD2DEG = 57.2957795130823209
atan2parm1 = p2x - p1x
atan2parm2 = p2y - p1y
theta = math.atan2(atan2parm1, atan2parm2)
if theta < 0 then
theta = theta + TWOPI
end
return (360 - (RAD2DEG * theta)) % 360
end
function vectorFromAngleNorth(angle,distance)
angle = (angle + 270) % 360
local x, y = vectorFromAngle(angle,distance)
return x, y
end
-- Initialization utilities
function initializeGoodDescription()
good_desc = {
["food"] = _("trade-comms","food"),
["medicine"] = _("trade-comms","medicine"),
["luxury"] = _("trade-comms","luxury"),
["cobalt"] = _("trade-comms","cobalt"),
["dilithium"] = _("trade-comms","dilithium"),
["gold"] = _("trade-comms","gold"),
["nickel"] = _("trade-comms","nickel"),
["platinum"] = _("trade-comms","platinum"),
["tritanium"] = _("trade-comms","tritanium"),
["autodoc"] = _("trade-comms","autodoc"),
["android"] = _("trade-comms","android"),
["battery"] = _("trade-comms","battery"),
["beam"] = _("trade-comms","beam"),
["circuit"] = _("trade-comms","circuit"),
["communication"] = _("trade-comms","communication"),
["filament"] = _("trade-comms","filament"),
["impulse"] = _("trade-comms","impulse"),
["lifter"] = _("trade-comms","lifter"),
["nanites"] = _("trade-comms","nanites"),
["optic"] = _("trade-comms","optic"),
["repulsor"] = _("trade-comms","repulsor"),
["robotic"] = _("trade-comms","robotic"),
["sensor"] = _("trade-comms","sensor"),
["shield"] = _("trade-comms","shield"),
["software"] = _("trade-comms","software"),
["tractor"] = _("trade-comms","tractor"),
["transporter"] = _("trade-comms","transporter"),
["warp"] = _("trade-comms","warp"),
}
end
function initializeCommonGoods()
if commonGoods == nil then
commonGoods = {"food","medicine","nickel","platinum","gold","dilithium","tritanium","luxury","cobalt","impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"}
end
if componentGoods == nil then
componentGoods = {"impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"}
end
if mineralGoods == nil then
mineralGoods = {"nickel","platinum","gold","dilithium","tritanium","cobalt"}
end
max_repeat_loop = 100
end
function initializeImprovementMissions()
local mission_reasons = {
["energy"] = {
[_("situationReport-comms", "A recent reactor failure has put us on auxiliary power, so we cannot recharge ships.")] = {
"nickel","platinum","gold","dilithium","tritanium","cobalt","optic","filament","sensor","lifter","software","circuit","battery"
},
[_("situationReport-comms", "A damaged power coupling makes it too dangerous to recharge ships.")] = {
"nickel","platinum","gold","dilithium","tritanium","cobalt","optic","filament","sensor","lifter","circuit","battery"
},
[_("situationReport-comms", "An asteroid strike damaged our solar cells and we are short on power, so we can't recharge ships right now.")] = {
"nickel","platinum","gold","dilithium","tritanium","cobalt","optic","filament","sensor","circuit","battery"
},
},
["hull"] = {
[_("situationReport-comms", "We're out of the necessary materials and supplies for hull repair.")] = {
"nickel","platinum","dilithium","tritanium","cobalt","lifter","filament","sensor","circuit","repulsor","nanites","shield"
},
[_("situationReport-comms", "Hull repair automation unavailable while it is undergoing maintenance.")] = {
"nickel","platinum","gold","dilithium","tritanium","cobalt","optic","filament","sensor","lifter","software","circuit","android","robotic","nanites"
},
[_("situationReport-comms", "All hull repair technicians quarantined to quarters due to illness.")] = {
"medicine","transporter","sensor","communication","autodoc","android","nanites"
},
},
["restock_probes"] = {
[_("situationReport-comms", "Cannot replenish scan probes due to fabrication unit failure.")] = {
"nickel","platinum","gold","dilithium","tritanium","cobalt","optic","filament","sensor","lifter","software","circuit","battery"
},
[_("situationReport-comms", "Parts shortage prevents scan probe replenishment.")] = {
"optic","filament","shield","impulse","warp","sensor","lifter","circuit","battery","communication"
},
[_("situationReport-comms", "Station management has curtailed scan probe replenishment for cost cutting reasons.")] = {
"nickel","platinum","gold","dilithium","tritanium","cobalt","luxury"
},
}
}
mission_goods = {}
local player_faction = player_faction
if player_faction == nil then
player_faction = comms_source:getFaction()
end
local tpa = Artifact():setFaction(player_faction) --temporary player artifact
local mission_stations = {}
for i,station in ipairs(regionStations) do
if station:isValid() then
if not station:isEnemy(tpa) then
local station_type = station:getTypeName()
if station_type == "Small Station" or station_type == "Medium Station" or station_type == "Large Station" or station_type == "Huge Station" then
table.insert(mission_stations,station)
end
end
end
end
for i,station in ipairs(mission_stations) do
if not station:isEnemy(tpa) then
if not station:getRestocksScanProbes() then
if station.probe_fail_reason == nil then
local reason_list = {
_("situationReport-comms", "Cannot replenish scan probes due to fabrication unit failure."),
_("situationReport-comms", "Parts shortage prevents scan probe replenishment."),
_("situationReport-comms", "Station management has curtailed scan probe replenishment for cost cutting reasons."),
}
station.probe_fail_reason = reason_list[math.random(1,#reason_list)]
mission_goods["restock_probes"] = mission_reasons["restock_probes"][station.probe_fail_reason]
end
end
if not station:getRepairDocked() then
if station.repair_fail_reason == nil then
reason_list = {
_("situationReport-comms", "We're out of the necessary materials and supplies for hull repair."),
_("situationReport-comms", "Hull repair automation unavailable while it is undergoing maintenance."),
_("situationReport-comms", "All hull repair technicians quarantined to quarters due to illness."),
}
station.repair_fail_reason = reason_list[math.random(1,#reason_list)]
mission_goods["hull"] = mission_reasons["hull"][station.repair_fail_reason]
end
end
if not station:getSharesEnergyWithDocked() then
if station.energy_fail_reason == nil then
reason_list = {
_("situationReport-comms", "A recent reactor failure has put us on auxiliary power, so we cannot recharge ships."),
_("situationReport-comms", "A damaged power coupling makes it too dangerous to recharge ships."),
_("situationReport-comms", "An asteroid strike damaged our solar cells and we are short on power, so we can't recharge ships right now."),
}
station.energy_fail_reason = reason_list[math.random(1,#reason_list)]
mission_goods["energy"] = mission_reasons["energy"][station.energy_fail_reason]
end
end
end
end
local ordnance_missions = {
"Homing","Nuke","EMP","Mine","HVLI",
}
for i,mission in ipairs(ordnance_missions) do
mission_goods[mission] = {"nickel","platinum","gold","dilithium","tritanium","cobalt","circuit","filament"}
end
table.insert(mission_goods.Homing,"sensor")
table.insert(mission_goods.Nuke,"sensor")
table.insert(mission_goods.EMP,"sensor")
local missions_stations_goods = {}
for i,station in ipairs(mission_stations) do
if not station:isEnemy(tpa) then
if station.comms_data ~= nil and station.comms_data.goods ~= nil then
for station_good,details in pairs(station.comms_data.goods) do
for mission,mission_goods in pairs(mission_goods) do
for k,mission_good in ipairs(mission_goods) do
if mission_good == station_good then
if missions_stations_goods[mission] == nil then
missions_stations_goods[mission] = {}
end
if missions_stations_goods[mission][station] == nil then
missions_stations_goods[mission][station] = {}
end
table.insert(missions_stations_goods[mission][station],mission_good)
end
end
end
end
end
end
end
mission_good = {}
-- Pick goods for missions
local already_selected_station = {}
local already_selected_good = {}
for mission,stations_goods in pairs(missions_stations_goods) do
local station_pool = {}
for station,goods in pairs(stations_goods) do
if #already_selected_station > 0 then
local exclude = false
for i,previous_station in ipairs(already_selected_station) do
if station == previous_station then
exclude = true
end
end
if not exclude then
table.insert(station_pool,station)
end
else
table.insert(station_pool,station)
end
end
if #station_pool > 0 then
local selected_station = station_pool[math.random(1,#station_pool)]
table.insert(already_selected_station,selected_station)
local good = stations_goods[selected_station][math.random(1,#stations_goods[selected_station])]
if #already_selected_good > 0 then
local good_selected = false
for i,previous_good in ipairs(already_selected_good) do
if previous_good == good then
good_selected = true
break
end
end
if not good_selected then
mission_good[mission] = {good = good, station = selected_station}
mission_goods[mission] = {good}
table.insert(already_selected_good,good)
selected_station.selected_mission_good = good
end
else
mission_good[mission] = {good = good, station = selected_station}
mission_goods[mission] = {good}
table.insert(already_selected_good,good)
selected_station.selected_mission_good = good
end
end
end
-- complete goods selection for missions
for mission,goods in pairs(mission_goods) do
local selected_good = nil
if #goods > 1 then
local good_pool = {}
for i,good in ipairs(goods) do
local good_selected = false
for j,previous_good in ipairs(already_selected_good) do
if good == previous_good then
good_selected = true
break
end
end
if not good_selected then
table.insert(good_pool,good)
end
end
if #good_pool > 0 then
selected_good = good_pool[math.random(1,#good_pool)]
mission_good[mission] = {good = selected_good}
table.insert(already_selected_good,selected_good)
else
selected_good = goods[math.random(1,#goods)]
mission_good[mission] = {good = selected_good}
end
else
selected_good = goods[1]
end
end
for mission,details in pairs(mission_good) do
if details.station == nil then
for i,station in ipairs(mission_stations) do
if not station:isEnemy(tpa) then
if station.selected_mission_good == nil then
if station.comms_data.goods == nil then
station.comms_data.goods = {}
end
station.comms_data.goods[details.good] = {quantity = math.random(3,8), cost = math.random(40,80)}
station.selected_mission_good = details.good
details.station = station
break
end
end
end
end
end
print("Missions and goods final:")
for mission,details in pairs(mission_good) do
local out_station = "None"
if details.station ~= nil then
out_station = details.station:getCallSign()
end
print("Mission:",mission,"Good:",details.good,"Station:",out_station)
end
tpa:destroy()
end
function initializeCharacters()
characters = {
{name = "Frank Brown", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Joyce Miller", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Harry Jones", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Emma Davis", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Zhang Wei Chen", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Yu Yan Li", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Li Wei Wang", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Li Na Zhao", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Sai Laghari", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Anaya Khatri", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Vihaan Reddy", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Trisha Varma", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Henry Gunawan", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Putri Febrian", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Stanley Hartono", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Citra Mulyadi", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Bashir Pitafi", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Hania Kohli", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Gohar Lehri", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Sohelia Lau", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Gabriel Santos", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Ana Melo", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Lucas Barbosa", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Juliana Rocha", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Habib Oni", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Chinara Adebayo", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Tanimu Ali", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Naija Bello", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Shamim Khan", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Barsha Tripura", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Sumon Das", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Farah Munsi", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Denis Popov", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Pasha Sokolov", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Burian Ivanov", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Radka Vasiliev", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Jose Hernandez", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Victoria Garcia", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
{name = "Miguel Lopez", subject_pronoun = _("characterInfo-comms","he"), object_pronoun = _("characterInfo-comms","him"), possessive_adjective = _("characterInfo-comms","his")},
{name = "Renata Rodriguez", subject_pronoun = _("characterInfo-comms","she"), object_pronoun = _("characterInfo-comms","her"), possessive_adjective = _("characterInfo-comms","her")},
}
end
function initializeStationCoolantEconomy()
station_coolant_inventory_min = 0
station_coolant_inventory_max = 5
station_coolant_very_friendly_threshold = 66
station_coolant_cost_excess_fee_min = 20
station_coolant_cost_excess_fee_max = 40
station_coolant_stranger_fee_min = 20
station_coolant_stranger_fee_max = 40
station_coolant_friendly_min = 30
station_coolant_friendly_max = 60
station_coolant_neutral_min = 45
station_coolant_neutral_max = 90
end
function initializeStationRepairCrewEconomy()
station_repair_crew_inventory_min = 0
station_repair_crew_inventory_max = 5
station_repair_crew_very_friendly_threshold = 66
station_repair_crew_cost_excess_fee_min = 20
station_repair_crew_cost_excess_fee_max = 40
station_repair_crew_stranger_fee_min = 20
station_repair_crew_stranger_fee_max = 40
station_repair_crew_friendly_min = 30
station_repair_crew_friendly_max = 60
station_repair_crew_neutral_min = 45
station_repair_crew_neutral_max = 90
end
function initializeCommsSourceMaxRepairCrew()
comms_source.maxRepairCrew = comms_source:getRepairCrewCount()
end
function initializeCommsSourceInitialCoolant()
comms_source.initialCoolant = comms_source:getMaxCoolant()
end
function initializePrettySystems()
pretty_system = {
["reactor"] = _("stationServices-comms","reactor"),
["beamweapons"] = _("stationServices-comms","beam weapons"),
["missilesystem"] = _("stationServices-comms","missile system"),
["maneuver"] = _("stationServices-comms","maneuver"),
["impulse"] = _("stationServices-comms","impulse engines"),
["warp"] = _("stationServices-comms","warp drive"),
["jumpdrive"] = _("stationServices-comms","jump drive"),
["frontshield"] = _("stationServices-comms","front shield"),
["rearshield"] = _("stationServices-comms","rear shield"),
}
pretty_short_system = {
["reactor"] = _("stationServices-comms","reactor"),
["beamweapons"] = _("stationServices-comms","beams"),
["missilesystem"] = _("stationServices-comms","missiles"),
["maneuver"] = _("stationServices-comms","maneuver"),
["impulse"] = _("stationServices-comms","impulse"),
["warp"] = _("stationServices-comms","warp"),
["jumpdrive"] = _("stationServices-comms","jump"),
["frontshield"] = _("stationServices-comms","front shield"),
["rearshield"] = _("stationServices-comms","rear shield"),
}
end
function initializeSystemList()
system_list = {"reactor","beamweapons","missilesystem","maneuver","impulse","warp","jumpdrive","frontshield","rearshield"}
end
function initializeUpgradeDowngrade()
upgrade_price = 3
end
-------------------------------------
-- Docked and undocked functions --
-------------------------------------
function addStationToDatabase(station)
-- Assumes all player ships will be the same faction
local stations_key = _("scienceDB","Stations")
local stations_db = queryScienceDatabase(stations_key)
if stations_db == nil then
stations_db = ScienceDatabase():setName(stations_key)
end
local station_db = nil
local station_key = station:getCallSign()
local temp_artifact = Artifact():setFaction(player_faction)
local first_time_entry = false
if station:isFriendly(temp_artifact) then
local friendly_key = _("scienceDB","Friendly")
local friendly_db = queryScienceDatabase(stations_key,friendly_key)
if friendly_db == nil then
stations_db:addEntry(friendly_key)
friendly_db = queryScienceDatabase(stations_key,friendly_key)
friendly_db:setLongDescription(_("scienceDB","Friendly stations share their short range telemetry with your ship on the Relay and Strategic Map consoles. These are the known friendly stations."))
end
station_db = queryScienceDatabase(stations_key,friendly_key,station_key)
if station_db == nil then
friendly_db:addEntry(station_key)
station_db = queryScienceDatabase(stations_key,friendly_key,station_key)
first_time_entry = true
end
elseif not station:isEnemy(temp_artifact) then
local neutral_key = _("scienceDB","Neutral")
local neutral_db = queryScienceDatabase(stations_key,neutral_key)
if neutral_db == nil then
stations_db:addEntry(neutral_key)
neutral_db = queryScienceDatabase(stations_key,neutral_key)
neutral_db:setLongDescription(_("scienceDB","Neutral stations don't share their short range telemetry with your ship, but they do allow for docking. These are the known neutral stations."))
end
station_db = queryScienceDatabase(stations_key,neutral_key,station_key)
if station_db == nil then
neutral_db:addEntry(station_key)
station_db = queryScienceDatabase(stations_key,neutral_key,station_key)
first_time_entry = true
end
end
if first_time_entry then
local out = ""
if station:getDescription() ~= nil then
out = station:getDescription()
end
if station.comms_data ~= nil then
if station.comms_data.general ~= nil and station.comms_data.general ~= "" then
if out == "" then
out = string.format(_("scienceDB","General Information: %s"),station.comms_data.general)
else
out = string.format(_("scienceDB","%s\n\nGeneral Information: %s"),out,station.comms_data.general)
end
end
if station.comms_data.history ~= nil and station.comms_data.history ~= "" then
if out == "" then
out = string.format(_("scienceDB","History: %s"),station.comms_data.history)
else
out = string.format(_("scienceDB","%s\n\nHistory: %s"),out,station.comms_data.history)
end
end
end
if out ~= "" then
station_db:setLongDescription(out)
end
local station_type = station:getTypeName()
local size_value = ""
local small_station_key = _("scienceDB","Small Station")
local medium_station_key = _("scienceDB","Medium Station")
local large_station_key = _("scienceDB","Large Station")
local huge_station_key = _("scienceDB","Huge Station")
if station_type == small_station_key then
size_value = _("scienceDB","Small")
local small_db = queryScienceDatabase(stations_key,small_station_key)
if small_db ~= nil then
station_db:setImage(small_db:getImage())
end
station_db:setModelDataName("space_station_4")
elseif station_type == medium_station_key then
size_value = _("scienceDB","Medium")
local medium_db = queryScienceDatabase(stations_key,medium_station_key)
if medium_db ~= nil then
station_db:setImage(medium_db:getImage())
end
station_db:setModelDataName("space_station_3")
elseif station_type == large_station_key then
size_value = _("scienceDB","Large")
local large_db = queryScienceDatabase(stations_key,large_station_key)
if large_db ~= nil then
station_db:setImage(large_db:getImage())
end
station_db:setModelDataName("space_station_2")
elseif station_type == huge_station_key then
size_value = _("scienceDB","Huge")
local huge_db = queryScienceDatabase(stations_key,huge_station_key)
if huge_db ~= nil then
station_db:setImage(huge_db:getImage())
end
station_db:setModelDataName("space_station_1")
end
if size_value ~= "" then
local size_key = _("scienceDB","Size")
station_db:setKeyValue(size_key,size_value)
end
local location_key = _("scienceDB","Location, Faction")
if station.roving then
station_db:setKeyValue(location_key,string.format(_("scienceDB","Roving, %s"),station:getFaction()))
else
station_db:setKeyValue(location_key,string.format("%s, %s",station:getSectorName(),station:getFaction()))
end
end
local dock_service = ""
local service_count = 0
if station:getSharesEnergyWithDocked() then
dock_service = _("scienceDB","share energy")
service_count = service_count + 1
end
if station:getRepairDocked() then
if dock_service == "" then
dock_service = _("scienceDB","repair hull")
else
dock_service = string.format(_("scienceDB","%s, repair hull"),dock_service)
end
service_count = service_count + 1
end
if station:getRestocksScanProbes() then
if dock_service == "" then
dock_service = _("scienceDB","replenish probes")
else
dock_service = string.format(_("scienceDB","%s, replenish probes"),dock_service)
end
service_count = service_count + 1
end
if service_count > 0 then
local docking_services_key = _("scienceDB","Docking Services")
if service_count == 1 then
docking_services_key = _("scienceDB","Docking Service")
end
station_db:setKeyValue(docking_services_key,dock_service)
end
if station.comms_data ~= nil then
if station.comms_data.weapon_available ~= nil then
if station.comms_data.weapon_cost == nil then
station.comms_data.weapon_cost = {
Homing = math.random(1,4),
HVLI = math.random(1,3),
Mine = math.random(2,5),
Nuke = math.random(12,18),
EMP = math.random(7,13),
}
end
if station.comms_data.reputation_cost_multipliers == nil then
station.comms_data.reputation_cost_multipliers = {
friend = 1.0,
neutral = 3.0,
}
end
local station_missiles = {
{name = "Homing", key = _("scienceDB","Restock Homing")},
{name = "HVLI", key = _("scienceDB","Restock HVLI")},
{name = "Mine", key = _("scienceDB","Restock Mine")},
{name = "Nuke", key = _("scienceDB","Restock Nuke")},
{name = "EMP", key = _("scienceDB","Restock EMP")},
}
for i,sm in ipairs(station_missiles) do
if station.comms_data.weapon_available[sm.name] then
if station.comms_data.weapon_cost[sm.name] ~= nil then
local val = string.format(_("scienceDB","%i reputation each"),math.ceil(station.comms_data.weapon_cost[sm.name] * station.comms_data.reputation_cost_multipliers["friend"]))
station_db:setKeyValue(sm.key,val)
end
end
end
end
local secondary_system_repair = {
{name = "scan_repair", key = _("scienceDB","Repair scanners")},
{name = "combat_maneuver_repair", key = _("scienceDB","Repair combat maneuver")},
{name = "hack_repair", key = _("scienceDB","Repair hacking")},
{name = "probe_launch_repair", key = _("scienceDB","Repair probe launch")},
{name = "tube_slow_down_repair", key = _("scienceDB","Repair slow tube")},
{name = "self_destruct_repair", key = _("scienceDB","Repair self destruct")},
}
for i,ssr in ipairs(secondary_system_repair) do
if station.comms_data[ssr.name] then
if station.comms_data.service_cost[ssr.name] ~= nil then
local val = string.format(_("scienceDB","%s reputation"),station.comms_data.service_cost[ssr.name])
station_db:setKeyValue(ssr.key,val)
end
end
end
if station.comms_data.service_available ~= nil then
local general_service = {
{name = "supplydrop", key = _("scienceDB","Drop supplies")},
{name = "jumpsupplydrop", key = _("scienceDB","Jump ship drops supplies")},
{name = "flingsupplydrop", key = _("scienceDB","Flinger drops supplies")},
{name = "reinforcements", key = _("scienceDB","Standard reinforcements")},
{name = "hornet_reinforcements", key = _("scienceDB","Hornet reinforcements")},
{name = "phobos_reinforcements", key = _("scienceDB","Phobos reinforcements")},
{name = "stalker_reinforcements", key = _("scienceDB","Stalker reinforcements")},
{name = "amk8_reinforcements", key = _("scienceDB","Adder8 reinforcements")},
{name = "activatedefensefleet", key = _("scienceDB","Activate defense fleet")},
{name = "servicejonque", key = _("scienceDB","Provide service jonque")},
}
for i,gs in ipairs(general_service) do
if station.comms_data.service_available[gs.name] then
if station.comms_data.service_cost[gs.name] ~= nil then
local val = string.format(_("scienceDB","%s reputation"),station.comms_data.service_cost[gs.name])
station_db:setKeyValue(gs.key,val)
end
end
end
end
if station.comms_data.upgrade_path ~= nil then
local upgrade_service = {
["beam"] = _("scienceDB","Beam weapons"),
["missiles"] = _("scienceDB","Misslie systems"),
["shield"] = _("scienceDB","Shield"),
["hull"] = _("scienceDB","Hull"),
["impulse"] = _("scienceDB","Impulse systems"),
["ftl"] = _("scienceDB","FTL engines"),
["sensors"] = _("scienceDB","Sensor systems"),
}
for template,upgrade in pairs(station.comms_data.upgrade_path) do
for u_type, u_blob in pairs(upgrade) do
local u_key = string.format("%s %s",template,upgrade_service[u_type])
station_db:setKeyValue(u_key,string.format(_("scienceDB","Max upgrade level: %i"),u_blob))
end
end
end
end
temp_artifact:destroy()
end
-- Booleans to set outside of this utility to control this utility. Default is false
-- include_major_systems_repair_in_status - set true if you want the status report
-- to include a list of major systems that can be repaired at the station, eg
-- reactor, impulse, missiles, beams, shields, warp, jump, maneuver
-- include_minor_systems_repair_in_status - set true if you want the status report
-- to include a list of minor systems that can be repaired at the station, eg
-- combat maneuver, hacking, scanning, self destruct, probe launch
-- include_goods_for_sale_in_status - set true if you want the goods that a station
-- sells to appear in the status report
-- upgrade_button_in_status - set true if you want the status report to include a
-- list of systems that can be upgraded, eg beams, missiles, impulse, ftl,
-- shields. Stock player ships don't qualify for upgrades.
-- station_improvement_button_in_status - set true if you want a button to appear
-- showing what systems the station could have improved and what the player needs
-- to do to enable that system, eg, battery charging, hull repair, probe
-- replenishment, different kinds of ordnance replenishment (side quests). You
-- will probably want to also enable stations_sell_goods to complete the
-- side quests
function stationStatusReport()
if system_list == nil then
initializeSystemList()
end
if good_desc == nil then
initializeGoodDescription()
end
local status_prompts = {
_("situationReport-comms","Report status"),
_("situationReport-comms","Report station status"),
string.format(_("situationReport-comms","Report station %s status"),comms_target:getCallSign()),
_("situationReport-comms","What is your status?"),
string.format(_("situationReport-comms","What is the condition of station %s?"),comms_target:getCallSign()),
}
addCommsReply(tableSelectRandom(status_prompts), function()
msg = string.format(_("situationReport-comms","Hull:%s%%"),math.floor(comms_target:getHull() / comms_target:getHullMax() * 100))
local shields = comms_target:getShieldCount()
if shields == 1 then
msg = string.format(_("situationReport-comms","%s\nShield:%s%%"),msg,math.floor(comms_target:getShieldLevel(0) / comms_target:getShieldMax(0) * 100))
else
msg = string.format(_("situationReport-comms","%s\nShields:"),msg)
for n=0,shields-1 do
msg = string.format(_("situationReport-comms","%s %s:%s%%"),msg,n,math.floor(comms_target:getShieldLevel(n) / comms_target:getShieldMax(n) * 100))
end
end
local improvements = {}
msg, improvements = catalogImprovements(msg)
if include_major_systems_repair_in_status then
system_list_desc = {
["reactor"] = _("situationReport-comms","reactor"),
["beamweapons"] = _("situationReport-comms","beam weapons"),
["missilesystem"] = _("situationReport-comms","missile system"),
["maneuver"] = _("situationReport-comms","maneuver"),
["impulse"] = _("situationReport-comms","impulse"),
["warp"] = _("situationReport-comms","warp drive"),
["jumpdrive"] = _("situationReport-comms","jump drive"),
["frontshield"] = _("situationReport-comms","front shield"),
["rearshield"] = _("situationReport-comms","rear shield"),
}
local major_repairs = _("situationReport-comms","Repair these major systems:")
for i,system in ipairs(system_list) do
if comms_target.comms_data.system_repair[system] then
if major_repairs == _("situationReport-comms","Repair these major systems:") then
major_repairs = string.format("%s %s",major_repairs,system_list_desc[system])
else
major_repairs = string.format("%s, %s",major_repairs,system_list_desc[system])
end
end
end
if major_repairs ~= _("situationReport-comms","Repair these major systems:") then
msg = string.format("%s\n%s.",msg,major_repairs)
end
end
if include_minor_systems_repair_in_status then
local secondary_system_repair_desc = {
{name = "scan_repair", desc = _("situationReport-comms","scanners")},
{name = "combat_maneuver_repair", desc = _("situationReport-comms","combat maneuver")},
{name = "hack_repair", desc = _("situationReport-comms","hacking")},
{name = "probe_launch_repair", desc = _("situationReport-comms","probe launch")},
{name = "tube_slow_down_repair", desc = _("situationReport-comms","slow tube")},
{name = "self_destruct_repair", desc = _("situationReport-comms","self destruct")},
}
local minor_repairs = _("situationReport-comms","Repair these minor systems:")
for i,system in ipairs(secondary_system_repair_desc) do
if comms_target.comms_data[system.name] then
if minor_repairs == _("situationReport-comms","Repair these minor systems:") then
minor_repairs = string.format("%s %s",minor_repairs,system.desc)
else
minor_repairs = string.format("%s, %s",minor_repairs,system.desc)
end
end
end
if minor_repairs ~= _("situationReport-comms","Repair these minor systems:") then
msg = string.format("%s\n%s.",msg,minor_repairs)
end
end
if include_goods_for_sale_in_status then
local goods_available = false
if comms_target.comms_data.goods ~= nil then
for good, good_data in pairs(comms_target.comms_data.goods) do
if good_data["quantity"] > 0 then
goods_available = true
break
end
end
end
if goods_available then
msg = string.format(_("situationReport-comms","%s\nGoods or components available:"),msg)
for good, good_data in pairs(comms_target.comms_data.goods) do
if good_data["quantity"] > 0 then
msg = string.format(_("situationReport-comms","%s %s@%s"),msg,good_desc[good],good_data["cost"])
end
end
end
end
setCommsMessage(msg)
if upgrade_button_in_status then
addCommsReply(_("situationReport-comms","Can your station perform upgrades on our ship?"),function()
if comms_target.comms_data.upgrade_path ~= nil then
local p_ship_type = comms_source:getTypeName()
if comms_target.comms_data.upgrade_path[p_ship_type] ~= nil then
local upgrade_count = 0
local out = _(_("dockingServicesStatus-comms","We can provide the following upgrades:\n system: description"))