-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathscenario_50_gaps.lua
3287 lines (3285 loc) · 126 KB
/
scenario_50_gaps.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: Close the Gaps
-- Description: Using Nautilus class mine layer, lay mines across the space lanes expected to be used by invading enemies
---
--- Version 2 - Jan2025
---
--- Mission advice: It's better to hit an asteroid than a mine
-- Type: Mission
-- Setting[Enemies]: Configures strength and/or number of enemies in this scenario
-- Enemies[Easy]: Fewer or weaker enemies
-- Enemies[Normal|Default]: Normal number or strength of enemies
-- Enemies[Hard]: More or stronger enemies
-- Enemies[Extreme]: Much stronger, many more enemies
-- Enemies[Quixotic]: Insanely strong and/or inordinately large numbers of enemies
-- Setting[Murphy]: Configures the perversity of the universe according to Murphy's law
-- Murphy[Easy]: Random factors or puzzle difficulties are easier than normal
-- Murphy[Normal|Default]: Random factors or puzzle difficulties are normal
-- Murphy[Hard]: Random factors or puzzle difficulties are more challenging than normal
-- Setting[Timed]: Sets whether or not the scenario has a time limit. Default is no time limit
-- Timed[None|Default]: No time limit
-- Timed[30]: Scenario ends in 30 minutes
-- Timed[40]: Scenario ends in 40 minutes
-- Timed[45]: Scenario ends in 45 minutes
-- Timed[50]: Scenario ends in 50 minutes
-- Timed[55]: Scenario ends in 55 minutes
-- Timed[60]: Scenario ends in 60 minutes
-- Timed[70]: Scenario ends in 70 minutes
-- Timed[80]: Scenario ends in 80 minutes
-- Timed[90]: Scenario ends in 90 minutes
require("utils.lua")
require("place_station_scenario_utility.lua")
function init()
scenario_version = "2.0.7"
ee_version = "2024.12.08"
print(string.format(" ---- Scenario: Close the Gaps ---- Version %s ---- Tested with EE version %s ----",scenario_version,ee_version))
if _VERSION ~= nil then
print("Lua version:",_VERSION)
end
setVariations()
setConstants()
setGlobals()
mainGMButtons()
buildStations()
spawnPlayer()
plot1 = initialInstructions
initialOrderTimer = 3
buildAsteroids()
if not diagnostic then
createRandomAlongArc(Nebula, difficulty*10, 50000, 50000, 70000, 180, 270, 35000)
end
wfv = "end of init"
end
function setConstants()
missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'}
--Ship Template Name List
stnl = {"MT52 Hornet","MU52 Hornet","Adder MK5","Adder MK4","WX-Lindworm","Adder MK6","Phobos T3","Phobos M3","Piranha F8","Piranha F12","Ranus U","Nirvana R5A","Stalker Q7","Stalker R7","Atlantis X23","Starhammer II","Odin","Fighter","Cruiser","Missile Cruiser","Strikeship","Adv. Striker","Dreadnought","Battlestation","Blockade Runner","Ktlitan Fighter","Ktlitan Breaker","Ktlitan Worker","Ktlitan Drone","Ktlitan Feeder","Ktlitan Scout","Ktlitan Destroyer","Storm"}
--Ship Template Score List
stsl = {5 ,5 ,7 ,6 ,7 ,8 ,15 ,16 ,15 ,15 ,25 ,20 ,25 ,25 ,50 ,70 ,250 ,6 ,18 ,14 ,30 ,27 ,80 ,100 ,65 ,6 ,45 ,40 ,4 ,48 ,8 ,50 ,22}
-- square grid deployment
fleetPosDelta1x = {0,1,0,-1, 0,1,-1, 1,-1,2,0,-2, 0,2,-2, 2,-2,2, 2,-2,-2,1,-1, 1,-1,0, 0,3,-3,1, 1,3,-3,-1,-1, 3,-3,2, 2,3,-3,-2,-2, 3,-3,3, 3,-3,-3,4,0,-4, 0,4,-4, 4,-4,-4,-4,-4,-4,-4,-4,4, 4,4, 4,4, 4, 1,-1, 2,-2, 3,-3,1,-1,2,-2,3,-3,5,-5,0, 0,5, 5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,5, 5,5, 5,5, 5,5, 5, 1,-1, 2,-2, 3,-3, 4,-4,1,-1,2,-2,3,-3,4,-4}
fleetPosDelta1y = {0,0,1, 0,-1,1,-1,-1, 1,0,2, 0,-2,2,-2,-2, 2,1,-1, 1,-1,2, 2,-2,-2,3,-3,0, 0,3,-3,1, 1, 3,-3,-1,-1,3,-3,2, 2, 3,-3,-2,-2,3,-3, 3,-3,0,4, 0,-4,4,-4,-4, 4, 1,-1, 2,-2, 3,-3,1,-1,2,-2,3,-3,-4,-4,-4,-4,-4,-4,4, 4,4, 4,4, 4,0, 0,5,-5,5,-5, 5,-5, 1,-1, 2,-2, 3,-3, 4,-4,1,-1,2,-2,3,-3,4,-4,-5,-5,-5,-5,-5,-5,-5,-5,5, 5,5, 5,5, 5,5, 5}
-- rough hexagonal deployment
fleetPosDelta2x = {0,2,-2,1,-1, 1,-1,4,-4,0, 0,2,-2,-2, 2,3,-3, 3,-3,6,-6,1,-1, 1,-1,3,-3, 3,-3,4,-4, 4,-4,5,-5, 5,-5,8,-8,4,-4, 4,-4,5,5 ,-5,-5,2, 2,-2,-2,0, 0,6, 6,-6,-6,7, 7,-7,-7,10,-10,5, 5,-5,-5,6, 6,-6,-6,7, 7,-7,-7,8, 8,-8,-8,9, 9,-9,-9,3, 3,-3,-3,1, 1,-1,-1,12,-12,6,-6, 6,-6,7,-7, 7,-7,8,-8, 8,-8,9,-9, 9,-9,10,-10,10,-10,11,-11,11,-11,4,-4, 4,-4,2,-2, 2,-2,0, 0}
fleetPosDelta2y = {0,0, 0,1, 1,-1,-1,0, 0,2,-2,2,-2, 2,-2,1,-1,-1, 1,0, 0,3, 3,-3,-3,3,-3,-3, 3,2,-2,-2, 2,1,-1,-1, 1,0, 0,4,-4,-4, 4,3,-3, 3,-3,4,-4, 4,-4,4,-4,2,-2, 2,-2,1,-1, 1,-1, 0, 0,5,-5, 5,-5,4,-4, 4,-4,3,-3, 3,-7,2,-2, 2,-2,1,-1, 1,-1,5,-5, 5,-5,5,-5, 5,-5, 0, 0,6, 6,-6,-6,5, 5,-5,-5,4, 4,-4,-4,3, 3,-3,-3, 2, 2,-2, -2, 1, 1,-1, -1,6, 6,-6,-6,6, 6,-6,-6,6,-6}
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"),
["gold pressed latinum"] = _("trade-comms","gold pressed latinum"),
["unobtanium"] = _("trade-comms","unobtanium"),
["eludium"] = _("trade-comms","eludium"),
["impossibrium"] = _("trade-comms","impossibrium"),
}
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"}
componentGoods = {"impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"}
mineralGoods = {"nickel","platinum","gold","dilithium","tritanium","cobalt"}
end
function setGlobals()
--list of goods available to buy, sell or trade (sell still under development)
goodsList = {
{"food",0},
{"medicine",0},
{"nickel",0},
{"platinum",0},
{"gold",0},
{"dilithium",0},
{"tritanium",0},
{"luxury",0},
{"cobalt",0},
{"impulse",0},
{"warp",0},
{"shield",0},
{"tractor",0},
{"repulsor",0},
{"beam",0},
{"optic",0},
{"robotic",0},
{"filament",0},
{"transporter",0},
{"sensor",0},
{"communication",0},
{"autodoc",0},
{"lifter",0},
{"android",0},
{"nanites",0},
{"software",0},
{"circuit",0},
{"battery",0}
}
diagnostic = false
interwave_delay_name = _("buttonGM","Normal")
interWave = 150
goods = {} --overall tracking of goods
stationList = {} --friendly and neutral stations
enemyStationList = {}
tradeFood = {} --stations that will trade food for other goods
tradeLuxury = {} --stations that will trade luxury for other goods
tradeMedicine = {} --stations that will trade medicine for other goods
--Player ship name lists to supplant standard randomized call sign generation
playerShipNamesForMP52Hornet = {"Dragonfly","Scarab","Mantis","Yellow Jacket","Jimminy","Flik","Thorny","Buzz"}
playerShipNamesForPiranha = {"Razor","Biter","Ripper","Voracious","Carnivorous","Characid","Vulture","Predator"}
playerShipNamesForFlaviaPFalcon = {"Ladyhawke","Hunter","Seeker","Gyrefalcon","Kestrel","Magpie","Bandit","Buccaneer"}
playerShipNamesForPhobosM3P = {"Blinder","Shadow","Distortion","Diemos","Ganymede","Castillo","Thebe","Retrograde"}
playerShipNamesForAtlantis = {"Excaliber","Thrasher","Punisher","Vorpal","Protang","Drummond","Parchim","Coronado"}
playerShipNamesForCruiser = {"Excelsior","Velociraptor","Thunder","Kona","Encounter","Perth","Aspern","Panther"}
playerShipNamesForMissileCruiser = {"Projectus","Hurlmeister","Flinger","Ovod","Amatola","Nakhimov","Antigone"}
playerShipNamesForFighter = {"Buzzer","Flitter","Zippiticus","Hopper","Molt","Stinger","Stripe"}
playerShipNamesForBenedict = {"Elizabeth","Ford","Vikramaditya","Liaoning","Avenger","Naruebet","Washington","Lincoln","Garibaldi","Eisenhower"}
playerShipNamesForKiriya = {"Cavour","Reagan","Gaulle","Paulo","Truman","Stennis","Kuznetsov","Roosevelt","Vinson","Old Salt"}
playerShipNamesForStriker = {"Sparrow","Sizzle","Squawk","Crow","Phoenix","Snowbird","Hawk"}
playerShipNamesForLindworm = {"Seagull","Catapult","Blowhard","Flapper","Nixie","Pixie","Tinkerbell"}
playerShipNamesForRepulse = {"Fiddler","Brinks","Loomis","Mowag","Patria","Pandur","Terrex","Komatsu","Eitan"}
playerShipNamesForEnder = {"Mongo","Godzilla","Leviathan","Kraken","Jupiter","Saturn"}
playerShipNamesForNautilus = {"October", "Abdiel", "Manxman", "Newcon", "Nusret", "Pluton", "Amiral", "Amur", "Heinkel", "Dornier"}
playerShipNamesForHathcock = {"Hayha", "Waldron", "Plunkett", "Mawhinney", "Furlong", "Zaytsev", "Pavlichenko", "Pegahmagabow", "Fett", "Hawkeye", "Hanzo"}
playerShipNamesForLeftovers = {"Foregone","Righteous","Masher"}
primaryOrders = ""
secondaryOrders = ""
optionalOrders = ""
transportList = {}
transportSpawnDelay = 10
healthCheckTimer = 5
healthCheckTimerInterval = 5
northMineCount = -1
southMineCount = -1
eastMineCount = -1
westMineCount = -1
northObjCount = -1
southObjCount = -1
eastObjCount = -1
westObjCount = -1
northClosed = false
southClosed = false
eastClosed = false
westClosed = false
northMet = false
southMet = false
eastMet = false
westMet = false
--North
ndiv2s1 = 0 --division 2, section 1
ndiv2s2 = 0 --division 2, section 2
ndiv2s3 = 0 --division 2, section 3
ndiv2s4 = 0 --division 2, section 4
ndiv1s1 = 0 --division 1, section 1
ndiv1s2 = 0 --division 1, section 2
--South
sdiv2s1 = 0 --division 2, section 1
sdiv2s2 = 0 --division 2, section 2
sdiv2s3 = 0 --division 3, section 3
sdiv2s4 = 0 --division 4, section 4
sdiv1s1 = 0 --division 1, section 1
sdiv1s2 = 0 --division 1, section 2
--East
ediv2s1 = 0 --division 2, section 1
ediv2s2 = 0 --division 2, section 2
ediv2s3 = 0 --division 2, section 3
ediv2s4 = 0 --division 2, section 4
ediv1s1 = 0 --division 1, section 1
ediv1s2 = 0 --division 1, section 2
--West
wdiv2s1 = 0 --division 2, section 1
wdiv2s2 = 0 --division 2, section 2
wdiv2s3 = 0 --division 2, section 3
wdiv2s4 = 0 --division 2, section 4
wdiv1s1 = 0 --division 1, section 1
wdiv1s2 = 0 --division 1, section 2
north_gap_graphic = false
south_gap_graphic = false
east_gap_graphic = false
west_gap_graphic = false
end
function mainGMButtons()
clearGMFunctions()
addGMFunction(string.format(_("buttonGM","Diagnostic %s"),diagnostic),function()
if diagnostic then
diagnostic = false
mainGMButtons()
else
diagnostic = true
mainGMButtons()
end
end)
addGMFunction(string.format(_("buttonGM","+Delay %s"),interwave_delay_name),setDelay)
end
function setDelay()
clearGMFunctions()
addGMFunction(_("buttonGM","-Main from delay"),mainGMButtons)
--Slow is used for testing when the tester does not want constant enemy ships spawned while testing
local button_label = _("buttonGM","Slow")
if interwave_delay_name == _("buttonGM","Slow") then
button_label = button_label .. "*"
end
addGMFunction(button_label,function()
interwave_delay_name = _("buttonGM","Slow")
interWave = 600
setDelay()
end)
--Normal is the normal amount of time between enemy ship spawns
button_label = _("buttonGM","Normal")
if interwave_delay_name == _("buttonGM","Normal") then
button_label = button_label .. "*"
end
addGMFunction(button_label,function()
interwave_delay_name = _("buttonGM","Normal")
interWave = 150
setDelay()
end)
--Fast is for testing of the enemy ship spawn routine
button_label = _("buttonGM","Fast")
if interwave_delay_name == _("buttonGM","Fast") then
button_label = button_label .. "*"
end
addGMFunction(button_label,function()
interwave_delay_name = _("buttonGM","Fast")
interWave = 20
setDelay()
end)
end
function setVariations()
local enemy_config = {
["Easy"] = {number = .5},
["Normal"] = {number = 1},
["Hard"] = {number = 2},
["Extreme"] = {number = 3},
["Quixotic"] = {number = 5},
}
enemy_power = enemy_config[getScenarioSetting("Enemies")].number
local murphy_config = {
["Easy"] = {number = .5, gap = 5, },
["Normal"] = {number = 1, gap = 10, },
["Hard"] = {number = 2, gap = 15, },
}
difficulty = murphy_config[getScenarioSetting("Murphy")].number
gapCheckDelayTimer = murphy_config[getScenarioSetting("Murphy")].gap
gapCheckInterval = gapCheckDelayTimer
local timed_config = {
["None"] = {limit = 0, limited = false, },
["30"] = {limit = 30,limited = true, },
["40"] = {limit = 40,limited = true, },
["45"] = {limit = 45,limited = true, },
["50"] = {limit = 50,limited = true, },
["55"] = {limit = 55,limited = true, },
["60"] = {limit = 60,limited = true, },
["70"] = {limit = 70,limited = true, },
["80"] = {limit = 80,limited = true, },
["90"] = {limit = 90,limited = true, },
}
playWithTimeLimit = timed_config[getScenarioSetting("Timed")].limited
defaultGameTimeLimitInMinutes = timed_config[getScenarioSetting("Timed")].limit
gameTimeLimit = defaultGameTimeLimitInMinutes*60
end
function createRandomAlongArc(object_type, amount, x, y, distance, startArc, endArcClockwise, randomize)
-- Create amount of objects of type object_type along arc
-- Center defined by x and y
-- Radius defined by distance
-- Start of arc between 0 and 360 (startArc), end arc: endArcClockwise
-- Use randomize to vary the distance from the center point. Omit to keep distance constant
-- Example:
-- createRandomAlongArc(Asteroid, 100, 500, 3000, 65, 120, 450)
if randomize == nil then randomize = 0 end
if amount == nil then amount = 1 end
arcLen = endArcClockwise - startArc
if startArc > endArcClockwise then
endArcClockwise = endArcClockwise + 360
arcLen = arcLen + 360
end
if amount > arcLen then
for ndex=1,arcLen do
radialPoint = startArc+ndex
pointDist = distance + random(-randomize,randomize)
object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
end
for ndex=1,amount-arcLen do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
end
else
for ndex=1,amount do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
end
end
end
function buildStations()
stationFaction = "Human Navy"
psx = 0 --place station x coordinate
psy = 0 --place station y coordinate
homeStation = placeStation(0,0,"RandomHumanNeutral","Human Navy")
table.insert(stationList,homeStation)
table.insert(stationList,placeStation(31000,31000,"RandomHumanNeutral","Independent"))
table.insert(stationList,placeStation(-31000,31000,"RandomHumanNeutral","Independent"))
table.insert(stationList,placeStation(31000,-31000,"RandomHumanNeutral","Independent"))
table.insert(stationList,placeStation(-31000,-31000,"RandomHumanNeutral","Independent"))
local placed_station = placeStation(0,-60000,"Sinister","Kraylor")
table.insert(enemyStationList,placed_station)
local fleet = spawnEnemies(0,-60000,10,"Kraylor")
for i,ship in ipairs(fleet) do
ship:orderDefendTarget(placed_station)
end
placed_station = placeStation(0,60000,"Sinister","Ghosts")
table.insert(enemyStationList,placed_station)
fleet = spawnEnemies(0,60000,10,"Ghosts")
for i,ship in ipairs(fleet) do
ship:orderDefendTarget(placed_station)
end
placed_station = placeStation(60000,0,"Sinister","Exuari")
table.insert(enemyStationList,placed_station)
fleet = spawnEnemies(60000,0,10,"Exuari")
for i,ship in ipairs(fleet) do
ship:orderDefendTarget(placed_station)
end
placed_station = placeStation(-60000,0,"Sinister","Ktlitans")
table.insert(enemyStationList,placed_station)
fleet = spawnEnemies(-60000,0,10,"Ktlitans")
for i,ship in ipairs(fleet) do
ship:orderDefendTarget(placed_station)
end
end
function spawnPlayer()
local px, py = vectorFromAngle(random(0,360),random(2500,3000))
player = PlayerSpaceship():setFaction("Human Navy"):setTemplate("Nautilus"):setPosition(px,py)
ni = math.random(1,#playerShipNamesForNautilus)
player:setCallSign(playerShipNamesForNautilus[ni])
table.remove(playerShipNamesForNautilus,ni)
player.nameAssigned = true
player.shipScore = 12
player.maxCargo = 7
player.cargo = 7
player.maxRepairCrew = player:getRepairCrewCount()
player.healthyShield = 1.0
player.prevShield = 1.0
player.healthyReactor = 1.0
player.prevReactor = 1.0
player.healthyManeuver = 1.0
player.prevManeuver = 1.0
player.healthyImpulse = 1.0
player.prevImpulse = 1.0
player.healthyBeam = 1.0
player.prevBeam = 1.0
player.healthyMissile = 1.0
player.prevMissile = 1.0
player.healthyJump = 1.0
player.prevJump = 1.0
player.healthyWarp = 1.0
player.prevWarp = 1.0
goods[player] = goodsList
player:addReputationPoints(100)
player.initialRep = true
allowNewPlayerShips(false)
end
function buildAsteroids()
local lowerDensity = 70
local upperDensity = 150
local thickness = 2000
--Arcs
createRandomAlongArc(Asteroid, random(lowerDensity,upperDensity), 0, 0, 20000, 5, 85, thickness)
createRandomAlongArc(Asteroid, random(lowerDensity,upperDensity), 0, 0, 20000, 95, 175, thickness)
createRandomAlongArc(Asteroid, random(lowerDensity,upperDensity), 0, 0, 20000, 185, 265, thickness)
createRandomAlongArc(Asteroid, random(lowerDensity,upperDensity), 0, 0, 20000, 275, 355, thickness)
--Bulges
local ax, ay = vectorFromAngle(random(20,70),20000)
placeRandomAroundPoint(Asteroid,40,1,5000,ax,ay)
ax, ay = vectorFromAngle(random(110,160),20000)
placeRandomAroundPoint(Asteroid,40,1,5000,ax,ay)
ax, ay = vectorFromAngle(random(200,250),20000)
placeRandomAroundPoint(Asteroid,40,1,5000,ax,ay)
ax, ay = vectorFromAngle(random(290,340),20000)
placeRandomAroundPoint(Asteroid,40,1,5000,ax,ay)
end
-- Transport ship generation and handling
function nearStations(station, compareStationList)
remainingStations = {}
if compareStationList[1]:isValid() then
if station:getCallSign() ~= compareStationList[1]:getCallSign() then
closest = compareStationList[1]
else
if compareStationList[2]:isValid() then
closest = compareStationList[2]
end
end
end
for ri, obj in ipairs(compareStationList) do
if obj:isValid() then
if station:getCallSign() ~= obj:getCallSign() then
table.insert(remainingStations,obj)
if distance(station,obj) < distance(station,closest) then
closest = obj
end
end
else
table.remove(compareStationList,ri)
end
end
for ri, obj in ipairs(remainingStations) do
if obj:getCallSign() == closest:getCallSign() then
table.remove(remainingStations,ri)
end
end
return closest, remainingStations
end
function randomNearStation5(nobj)
distanceStations = {}
cs, rs1 = nearStations(nobj,stationList)
table.insert(distanceStations,cs)
cs, rs2 = nearStations(nobj,rs1)
table.insert(distanceStations,cs)
cs, rs3 = nearStations(nobj,rs2)
table.insert(distanceStations,cs)
cs, rs4 = nearStations(nobj,rs3)
table.insert(distanceStations,cs)
cs, rs5 = nearStations(nobj,rs4)
table.insert(distanceStations,cs)
return distanceStations[irandom(1,5)]
end
function transportPlot(delta)
if transportSpawnDelay > 0 then
transportSpawnDelay = transportSpawnDelay - delta
end
if transportSpawnDelay < 0 then
transportSpawnDelay = delta + random(5,15)
transportCount = 0
for tidx, obj in ipairs(transportList) do
if obj:isValid() then
if obj:isDocked(obj.target) then
if obj.undock_delay > 0 then
obj.undock_delay = obj.undock_delay - 1
else
obj.target = randomNearStation5(obj)
obj.undock_delay = irandom(1,4)
obj:orderDock(obj.target)
end
end
transportCount = transportCount + 1
end
end
lastTransportCount = transportCount
if transportCount < #transportList then
tempTransportList = {}
for _, obj in ipairs(transportList) do
if obj:isValid() then
table.insert(tempTransportList,obj)
end
end
transportList = tempTransportList
end
if #transportList < #stationList then
target = nil
repeat
candidate = stationList[math.random(1,#stationList)]
if candidate:isValid() then
target = candidate
end
until(target ~= nil)
rnd = irandom(1,5)
if rnd == 1 then
name = "Personnel"
elseif rnd == 2 then
name = "Goods"
elseif rnd == 3 then
name = "Garbage"
elseif rnd == 4 then
name = "Equipment"
else
name = "Fuel"
end
if irandom(1,100) < 30 then
name = name .. " Jump Freighter " .. irandom(3, 5)
else
name = name .. " Freighter " .. irandom(1, 5)
end
obj = CpuShip():setTemplate(name):setFaction('Independent'):setCommsScript(""):setCommsFunction(commsShip)
obj.target = target
obj.undock_delay = irandom(1,4)
rifl = math.floor(random(1,#goodsList)) -- random item from list
goodsType = goodsList[rifl][1]
if goodsType == nil then
goodsType = "nickel"
end
rcoi = math.floor(random(30,90)) -- random cost of item
goods[obj] = {{goodsType,1,rcoi}}
obj:orderDock(obj.target)
x, y = obj.target:getPosition()
xd, yd = vectorFromAngle(random(0, 360), random(25000, 40000))
obj:setPosition(x + xd, y + yd)
table.insert(transportList, obj)
end
end
end
-- Station communication
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 commsStation()
if comms_target.comms_data == nil then
comms_target.comms_data = {}
end
mergeTables(comms_target.comms_data, {
friendlyness = random(0.0, 100.0),
weapons = {
Homing = "neutral",
HVLI = "neutral",
Mine = "neutral",
Nuke = "friend",
EMP = "friend"
},
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)
},
services = {
supplydrop = "friend",
reinforcements = "friend",
},
service_cost = {
supplydrop = math.random(80,120),
reinforcements = math.random(125,175)
},
reputation_cost_multipliers = {
friend = 1.0,
neutral = 3.0
},
max_weapon_refill_amount = {
friend = 1.0,
neutral = 0.5
}
})
setPlayers()
if comms_source:isEnemy(comms_target) then
return false
end
if comms_target:areEnemiesInRange(5000) then
setCommsMessage(_("station-comms", "We are under attack! No time for chatting!"));
return true
end
if not comms_source:isDocked(comms_target) then
handleUndockedState()
else
handleDockedState()
end
return true
end
function handleDockedState()
if comms_source:isFriendly(comms_target) then
oMsg = _("station-comms", "Good day, officer!\nWhat can we do for you today?\n")
else
oMsg = _("station-comms", "Welcome to our lovely station.\n")
end
if comms_target:areEnemiesInRange(20000) then
oMsg = oMsg .. _("station-comms", "Forgive us if we seem a little distracted. We are carefully monitoring the enemies nearby.")
end
setCommsMessage(oMsg)
missilePresence = 0
for _, missile_type in ipairs(missile_types) do
missilePresence = missilePresence + comms_source:getWeaponStorageMax(missile_type)
end
if missilePresence > 0 then
if comms_target.nukeAvail == nil then
comms_target.nukeAvail = random(1,10) < (4 - difficulty)
comms_target.empAvail = random(1,10) < (5 - difficulty)
comms_target.homeAvail = random(1,10) < (6 - difficulty)
if comms_target == homeStation then
comms_target.mineAvail = true
else
comms_target.mineAvail = random(1,10) < (7 - difficulty)
end
comms_target.hvliAvail = random(1,10) < (9 - difficulty)
end
if comms_target.nukeAvail or comms_target.empAvail or comms_target.homeAvail or comms_target.mineAvail or comms_target.hvliAvail then
addCommsReply(_("ammo-comms", "I need ordnance restocked"), function()
setCommsMessage(_("ammo-comms", "What type of ordnance?"))
if comms_source:getWeaponStorageMax("Nuke") > 0 then
if comms_target.nukeAvail then
if math.random(1,10) <= 5 then
nukePrompt = _("ammo-comms", "Can you supply us with some nukes? (")
else
nukePrompt = _("ammo-comms", "We really need some nukes (")
end
addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), nukePrompt, getWeaponCost("Nuke")), function()
handleWeaponRestock("Nuke")
end)
end
end
if comms_source:getWeaponStorageMax("EMP") > 0 then
if comms_target.empAvail then
if math.random(1,10) <= 5 then
empPrompt = _("ammo-comms", "Please re-stock our EMP missiles. (")
else
empPrompt = _("ammo-comms", "Got any EMPs? (")
end
addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), empPrompt, getWeaponCost("EMP")), function()
handleWeaponRestock("EMP")
end)
end
end
if comms_source:getWeaponStorageMax("Homing") > 0 then
if comms_target.homeAvail then
if math.random(1,10) <= 5 then
homePrompt = _("ammo-comms", "Do you have spare homing missiles for us? (")
else
homePrompt = _("ammo-comms", "Do you have extra homing missiles? (")
end
addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), homePrompt, getWeaponCost("Homing")), function()
handleWeaponRestock("Homing")
end)
end
end
if comms_source:getWeaponStorageMax("Mine") > 0 then
if comms_target.mineAvail then
local mine_prompts = {
_("ammo-comms", "We could use some mines. ("),
_("ammo-comms", "How about mines? ("),
_("ammo-comms", "More mines ("),
_("ammo-comms", "All the mines we can take. ("),
_("ammo-comms", "Mines! What else? ("),
}
addCommsReply(string.format(_("ammo-comms","%s%d rep each)"),tableSelectRandom(mine_prompts),getWeaponCost("Mine")), function()
handleWeaponRestock("Mine")
end)
end
end
if comms_source:getWeaponStorageMax("HVLI") > 0 then
if comms_target.hvliAvail then
if math.random(1,10) <= 5 then
hvliPrompt = _("ammo-comms", "What about HVLI? (")
else
hvliPrompt = _("ammo-comms", "Could you provide HVLI? (")
end
addCommsReply(string.format(_("ammo-comms", "%s%d rep each)"), hvliPrompt, getWeaponCost("HVLI")), function()
handleWeaponRestock("HVLI")
end)
end
end
end)
end
end
if comms_source:isFriendly(comms_target) then
addCommsReply(_("orders-comms", "What are my current orders?"), function()
setOptionalOrders()
ordMsg = primaryOrders .. "\n" .. secondaryOrders .. optionalOrders
if playWithTimeLimit then
ordMsg = ordMsg .. string.format(_("orders-comms", "\n %i Minutes remain in game"),math.floor(gameTimeLimit/60))
end
setCommsMessage(ordMsg)
addCommsReply(_("minefield-comms", "What is a minefield?"), function()
local mMsg = string.format(_("minefield-comms", "For the automated sensors on station %s to register a minefield as completed across a gap, it must meet the following criteria:"),homeStation:getCallSign())
mMsg = string.format(_("minefield-comms", "%s\n 1. Must contain at least 12 mines: Nautilus class standard load"),mMsg)
mMsg = string.format(_("minefield-comms", "%s\n 2. Must be within a 1.5U radius of sector corner in gap"),mMsg)
if difficulty > .5 then
mMsg = string.format(_("minefield-comms", "%s\n 3. Must be centered: 6 on one side and 6 on the other"),mMsg)
end
if difficulty > 1 then
mMsg = string.format(_("minefield-comms", "%s\n 4. Must be along 20U distance from station line connecting asteroids"),mMsg)
end
setCommsMessage(mMsg)
if not northMet then
addCommsReply(_("minefield-comms", "What do the sensors show for the north gap?"), commsNorthGap)
end
if not southMet then
addCommsReply(_("minefield-comms", "What do the sensors show for the south gap?"), commsSouthGap)
end
if not eastMet then
addCommsReply(_("minefield-comms", "What do the sensors show for the east gap?"), commsEastGap)
end
if not westMet then
addCommsReply(_("minefield-comms", "What do the sensors show for the west gap?"), commsWestGap)
end
addCommsReply(_("Back"), commsStation)
end)
addCommsReply(_("Back"), commsStation)
end)
if math.random(1,6) <= (4 - difficulty) then
if comms_source:getRepairCrewCount() < comms_source.maxRepairCrew then
hireCost = math.random(30,60)
else
hireCost = math.random(45,90)
end
addCommsReply(string.format(_("trade-comms", "Recruit repair crew member for %i reputation"),hireCost), function()
if not comms_source:takeReputationPoints(hireCost) then
setCommsMessage(_("needRep-comms", "Insufficient reputation"))
else
comms_source:setRepairCrewCount(comms_source:getRepairCrewCount() + 1)
setCommsMessage(_("trade-comms", "Repair crew member hired"))
end
end)
end
else
if math.random(1,6) <= (4 - difficulty) then
if comms_source:getRepairCrewCount() < comms_source.maxRepairCrew then
hireCost = math.random(45,90)
else
hireCost = math.random(60,120)
end
addCommsReply(string.format(_("trade-comms", "Recruit repair crew member for %i reputation"),hireCost), function()
if not comms_source:takeReputationPoints(hireCost) then
setCommsMessage(_("needRep-comms", "Insufficient reputation"))
else
comms_source:setRepairCrewCount(comms_source:getRepairCrewCount() + 1)
setCommsMessage(_("trade-comms", "Repair crew member hired"))
end
end)
end
end
if comms_target.publicRelations then
addCommsReply(_("station-comms", "Tell me more about your station"), function()
setCommsMessage(_("station-comms", "What would you like to know?"))
addCommsReply(_("stationGeneralInfo-comms", "General information"), function()
setCommsMessage(comms_target.generalInformation)
addCommsReply(_("Back"), commsStation)
end)
if comms_target.stationHistory ~= nil then
addCommsReply(_("stationStory-comms", "Station history"), function()
setCommsMessage(comms_target.stationHistory)
addCommsReply(_("Back"), commsStation)
end)
end
if comms_source:isFriendly(comms_target) then
if comms_target.gossip ~= nil then
if random(1,100) < 50 then
addCommsReply(_("gossip-comms", "Gossip"), function()
setCommsMessage(comms_target.gossip)
addCommsReply(_("Back"), commsStation)
end)
end
end
end
end)
end
local goodCount = 0
if comms_target.comms_data.goods ~= nil then
for good, goodData in pairs(comms_target.comms_data.goods) do
goodCount = goodCount + 1
end
end
if goodCount > 0 then
addCommsReply(_("trade-comms", "Buy, sell, trade"), function()
local goodsReport = string.format(_("trade-comms", "Station %s:\nGoods or components available for sale: quantity, cost in reputation\n"),comms_target:getCallSign())
for good, goodData in pairs(comms_target.comms_data.goods) do
goodsReport = string.format(_("trade-comms", "%s %s: %i, %i\n"),goodsReport,good_desc[good],goodData["quantity"],goodData["cost"])
end
if comms_target.comms_data.buy ~= nil then
goodsReport = string.format(_("trade-comms", "%sGoods or components station will buy: price in reputation\n"),goodsReport)
for good, price in pairs(comms_target.comms_data.buy) do
goodsReport = string.format(_("trade-comms", "%s %s: %i\n"),goodsReport,good_desc[good],price)
end
end
goodsReport = string.format(_("trade-comms", "%sCurrent cargo aboard %s:\n"),goodsReport,comms_source:getCallSign())
local cargoHoldEmpty = true
local player_good_count = 0
if comms_source.goods ~= nil then
for good, goodQuantity in pairs(comms_source.goods) do
player_good_count = player_good_count + 1
goodsReport = string.format(_("trade-comms", "%s %s: %i\n"),goodsReport,good_desc[good],goodQuantity)
end
end
if player_good_count < 1 then
goodsReport = string.format(_("trade-comms", "%s Empty\n"),goodsReport)
end
goodsReport = string.format(_("trade-comms", "%sAvailable Space: %i, Available Reputation: %i\n"),goodsReport,comms_source.cargo,math.floor(comms_source:getReputationPoints()))
setCommsMessage(goodsReport)
for good, goodData in pairs(comms_target.comms_data.goods) do
addCommsReply(string.format(_("trade-comms", "Buy one %s for %i reputation"),good_desc[good],goodData["cost"]), function()
if not comms_source:isDocked(comms_target) then
setCommsMessage(_("station-comms", "You need to stay docked for that action."))
return
end
local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i, Rep: %i"),good_desc[good],goodData["quantity"],goodData["cost"])
if comms_source.cargo < 1 then
goodTransactionMessage = string.format(_("trade-comms", "%s\nInsufficient cargo space for purchase"),goodTransactionMessage)
elseif goodData["cost"] > math.floor(comms_source:getReputationPoints()) then
goodTransactionMessage = string.format(_("needRep-comms", "%s\nInsufficient reputation for purchase"),goodTransactionMessage)
elseif goodData["quantity"] < 1 then
goodTransactionMessage = string.format(_("trade-comms", "%s\nInsufficient station inventory"),goodTransactionMessage)
else
if comms_source:takeReputationPoints(goodData["cost"]) then
comms_source.cargo = comms_source.cargo - 1
goodData["quantity"] = goodData["quantity"] - 1
if comms_source.goods == nil then
comms_source.goods = {}
end
if comms_source.goods[good] == nil then
comms_source.goods[good] = 0
end
comms_source.goods[good] = comms_source.goods[good] + 1
goodTransactionMessage = string.format(_("trade-comms", "%s\npurchased"),goodTransactionMessage)
else
goodTransactionMessage = string.format( _("needRep-comms", "%s\nInsufficient reputation for purchase"),goodTransactionMessage)
end
end
setCommsMessage(goodTransactionMessage)
addCommsReply(_("Back"), commsStation)
end)
end
if comms_target.comms_data.buy ~= nil then
for good, price in pairs(comms_target.comms_data.buy) do
if comms_source.goods[good] ~= nil and comms_source.goods[good] > 0 then
addCommsReply(string.format(_("trade-comms", "Sell one %s for %i reputation"),good_desc[good],price), function()
if not comms_source:isDocked(comms_target) then
setCommsMessage(_("station-comms", "You need to stay docked for that action."))
return
end
local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Reputation price: %i"),good_desc[good],price)
comms_source.goods[good] = comms_source.goods[good] - 1
comms_source:addReputationPoints(price)
goodTransactionMessage = string.format(_("trade-comms", "%s\nOne sold"),goodTransactionMessage)
comms_source.cargo = comms_source.cargo + 1
setCommsMessage(goodTransactionMessage)
addCommsReply(_("Back"), commsStation)
end)
end
end
end
if comms_target.comms_data.trade.food then
if comms_source.goods ~= nil then
if comms_source.goods.food ~= nil then
if comms_source.goods.food.quantity > 0 then
for good, goodData in pairs(comms_target.comms_data.goods) do
addCommsReply(string.format(_("trade-comms", "Trade food for %s"),good_desc[good]), function()
if not comms_source:isDocked(comms_target) then
setCommsMessage(_("station-comms", "You need to stay docked for that action."))
return
end
local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i"),good_desc[good],goodData["quantity"])
if goodData["quantity"] < 1 then
goodTransactionMessage = string.format(_("trade-comms", "%s\nInsufficient station inventory"),goodTransactionMessage)
else
goodData["quantity"] = goodData["quantity"] - 1
if comms_source.goods == nil then
comms_source.goods = {}
end
if comms_source.goods[good] == nil then
comms_source.goods[good] = 0
end
comms_source.goods[good] = comms_source.goods[good] + 1
comms_source.goods["food"] = comms_source.goods["food"] - 1
goodTransactionMessage = string.format(_("trade-comms", "%s\nTraded"),goodTransactionMessage)
end
setCommsMessage(goodTransactionMessage)
addCommsReply(_("Back"), commsStation)
end)
end
end
end
end
end
if comms_target.comms_data.trade.medicine then
if comms_source.goods ~= nil then
if comms_source.goods.medicine ~= nil then
if comms_source.goods.medicine.quantity > 0 then
for good, goodData in pairs(comms_target.comms_data.goods) do
addCommsReply(string.format(_("trade-comms", "Trade medicine for %s"),good_desc[good]), function()
if not comms_source:isDocked(comms_target) then
setCommsMessage(_("station-comms", "You need to stay docked for that action."))
return
end
local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i"),good_desc[good],goodData["quantity"])
if goodData["quantity"] < 1 then
goodTransactionMessage = string.format(_("trade-comms", "%s\nInsufficient station inventory"),goodTransactionMessage)
else
goodData["quantity"] = goodData["quantity"] - 1
if comms_source.goods == nil then
comms_source.goods = {}
end
if comms_source.goods[good] == nil then
comms_source.goods[good] = 0
end
comms_source.goods[good] = comms_source.goods[good] + 1
comms_source.goods["medicine"] = comms_source.goods["medicine"] - 1
goodTransactionMessage = string.format(_("trade-comms", "\nTraded"),goodTransactionMessage)
end
setCommsMessage(goodTransactionMessage)
addCommsReply(_("Back"), commsStation)
end)
end
end
end
end
end
if comms_target.comms_data.trade.luxury then
if comms_source.goods ~= nil then
if comms_source.goods.luxury ~= nil then
if comms_source.goods.luxury.quantity > 0 then
for good, goodData in pairs(comms_target.comms_data.goods) do
addCommsReply(string.format(_("trade-comms", "Trade luxury for %s"),good_desc[good]), function()
if not comms_source:isDocked(comms_target) then
setCommsMessage(_("station-comms", "You need to stay docked for that action."))
return
end
local goodTransactionMessage = string.format(_("trade-comms", "Type: %s, Quantity: %i"),good_desc[good],goodData["quantity"])
if goodData[quantity] < 1 then
goodTransactionMessage = string.format(_("trade-comms", "%s\nInsufficient station inventory"),goodTransactionMessage)
else
goodData["quantity"] = goodData["quantity"] - 1
if comms_source.goods == nil then
comms_source.goods = {}
end
if comms_source.goods[good] == nil then
comms_source.goods[good] = 0
end
comms_source.goods[good] = comms_source.goods[good] + 1
comms_source.goods["luxury"] = comms_source.goods["luxury"] - 1
goodTransactionMessage = string.format(_("trade-comms", "\nTraded"),goodTransactionMessage)
end
setCommsMessage(goodTransactionMessage)
addCommsReply(_("Back"), commsStation)
end)
end
end
end
end
end
addCommsReply(_("Back"), commsStation)
end)
local player_good_count = 0
if comms_source.goods ~= nil then
for good, goodQuantity in pairs(comms_source.goods) do
player_good_count = player_good_count + 1
end
end
if player_good_count > 0 then
addCommsReply(_("trade-comms", "Jettison cargo"), function()
setCommsMessage(string.format(_("trade-comms", "Available space: %i\nWhat would you like to jettison?"),comms_source.cargo))
for good, good_quantity in pairs(comms_source.goods) do
if good_quantity > 0 then
addCommsReply(good_desc[good], function()
comms_source.goods[good] = comms_source.goods[good] - 1
comms_source.cargo = comms_source.cargo + 1
setCommsMessage(string.format(_("trade-comms", "One %s jettisoned"),good_desc[good]))
addCommsReply(_("Back"), commsStation)
end)
end
end
addCommsReply(_("Back"), commsStation)
end)
end
addCommsReply(_("explainGoods-comms", "No tutorial covered goods or cargo. Explain"), function()
setCommsMessage(_("explainGoods-comms", "Different types of cargo or goods may be obtained from stations, freighters or other sources. They go by one word descriptions such as dilithium, optic, warp, etc. Certain mission goals may require a particular type or types of cargo. Each player ship differs in cargo carrying capacity. Goods may be obtained by spending reputation points or by trading other types of cargo (typically food, medicine or luxury)"))
addCommsReply(_("Back"), commsStation)
end)
end
end
function commsNorthGap()
string.format("")
local cMsg = string.format(_("minefield-comms", "Count within 1.5U radius: %i."),northObjCount)
if difficulty < 1 then