-
Notifications
You must be signed in to change notification settings - Fork 6
/
scenario_73_dodge.lua
10603 lines (10593 loc) · 484 KB
/
scenario_73_dodge.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: Dodge
-- Description: Single player ship of type Repulse. Suggest Science and Relay vs. Operations due to Relay's view. Goal: save as many as possible. Limited bases. Diverse factions
---
--- Designed to be short, challenging and different each time. Players scored between 0 and 100 based on how many survivors and their faction: friendlies are worth more than neutrals which are worth more than enemies. Score determines final rank: Admirals score > 90. Cadets score <= 30.
---
--- Duration: 30 minutes
---
--- Version 0
-- Type: Replayable 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 are more in your favor
-- Murphy[Normal|Default]: Random factors are normal
-- Murphy[Hard]: Random factors are more against you
-- Setting[Sensor Jammer Range]: Configure the upper limit of the range of the sensor jammers. The shorter, the easier
-- Sensor Jammer Range[Short]: Sensor jammers have short range
-- Sensor Jammer Range[Medium|Default]: Sensor jammers have medium range
-- Sensor Jammer Range[Long]: Sensor jammers have long range
-- Setting[Sensor Jammer Strength]: Configure the upper limit of the strength of the sensor jammers. The weaker, the easier
-- Sensor Jammer Strength[Weak]: Sensor jammers are weak
-- Sensor Jammer Strength[Normal|Default]: Sensor jammers have average strength
-- Sensor Jammer Strength[Strong]: Sensor jammers are strong
-- Setting[Scan Defense]: Configure the upper limit of Science's scan difficulty of artifacts in the scenario. The higher, the harder
-- Scan Defense[Easy]: Easy artifact scans
-- Scan Defense[Simple]: Simple artifact scans
-- Scan Defense[Normal|Default]: Normal artifact scans
-- Scan Defense[Tricky]: Tricky artifact scans
-- Scan Defense[Hard]: Hard artifact scans
-- Scan Defense[Difficult]: Difficult artifact scans
-- Scan Defense[Challenging]: Challenging artifact scans
-- Environment exists roughly along a line
-- One base per faction in the environment
-- All factions patrol the line
-- Disaster approaches from a perpendicular location
-- Improvement ideas:
-- Service jonques to repair ship (in progress)
-- Timer for end of game after black holes appear
-- Brain game for weapons
require("utils.lua")
require("place_station_scenario_utility.lua")
-- also uses supply_drop.lua
--------------------
-- Initialization --
--------------------
function init()
scenario_version = "0.2.1"
print(string.format(" ----- Scenario: Dodge ----- Version %s -----",scenario_version))
print(_VERSION)
patrol_maintenance_diagnostic = false
expedition_maintenance_diagnostic = false
task_maintenance_diagnostic = false
spawn_enemy_diagnostic = false
setVariations()
setConstants() --missle type names, template names and scores, deployment directions, player ship names, etc.
constructEnvironment()
mainGMButtons()
end
function setPlayer(p)
if p == nil then
return
end
p:setTemplate("Repulse")
p:setImpulseMaxSpeed(70) -- up from default of 55
p:setHullMax(170 - (difficulty*20)) -- stronger hull (vs 120)
p:setHull(170 - (difficulty*20))
p:addReputationPoints(70 - (difficulty*20))
p.impulse_upgrade = 0
p.shield_upgrade = 0
p.tube_speed_upgrade = 0
p.goods = {}
p.maxRepairCrew = p:getRepairCrewCount()
p.shipScore = playerShipStats["Repulse"].strength
p.maxCargo = playerShipStats["Repulse"].cargo
p:setLongRangeRadarRange(playerShipStats["Repulse"].long_range_radar)
p:setShortRangeRadarRange(playerShipStats["Repulse"].short_range_radar)
p.normal_long_range_radar = p:getLongRangeRadarRange()
p.tractor = playerShipStats["Repulse"].tractor
p.mining = playerShipStats["Repulse"].mining
local name = tableRemoveRandom(player_ship_names)
if name ~= nil then
p:setCallSign(name)
end
p.residents = {
["friend"] = 0,
["neutral"] = 0,
["enemy"] = 0,
}
p.resident_capacity = 30
p.cargo = p.maxCargo
p.initialCoolant = p:getMaxCoolant()
p.healthyShield = 1.0
p.prevShield = 1.0
p.healthyReactor = 1.0
p.prevReactor = 1.0
p.healthyManeuver = 1.0
p.prevManeuver = 1.0
p.healthyImpulse = 1.0
p.prevImpulse = 1.0
p.healthyBeam = 1.0
p.prevBeam = 1.0
p.healthyMissile = 1.0
p.prevMissile = 1.0
local system_types = {"reactor","beamweapons","missilesystem","maneuver","impulse","warp","jumpdrive","frontshield","rearshield"}
p.normal_coolant_rate = {}
p.normal_power_rate = {}
for _, system in ipairs(system_types) do
p.normal_coolant_rate[system] = p:getSystemCoolantRate(system)
p.normal_power_rate[system] = p:getSystemPowerRate(system)
end
p:onDestroyed(playerDestroyed)
end
function setVariations()
if getScenarioSetting == nil then
difficulty = 1
adverseEffect = .995
coolant_loss = .99995
coolant_gain = .001
starting_rep = 20
enemy_power = 1
sensor_jammer_upper_strength = 25000
else
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, rep = 70, adverse = .999, lose_coolant = .99999, gain_coolant = .005},
["Normal"] = {number = 1, rep = 50, adverse = .995, lose_coolant = .99995, gain_coolant = .001},
["Hard"] = {number = 2, rep = 30, adverse = .99, lose_coolant = .9999, gain_coolant = .0001},
}
difficulty = murphy_config[getScenarioSetting("Murphy")].number
adverseEffect = murphy_config[getScenarioSetting("Murphy")].adverse
coolant_loss = murphy_config[getScenarioSetting("Murphy")].lose_coolant
coolant_gain = murphy_config[getScenarioSetting("Murphy")].gain_coolant
starting_rep = murphy_config[getScenarioSetting("Murphy")].rep
local sensor_jammer_range_config = {
["Short"] = 30000,
["Medium"] = 40000,
["Long"] = 50000,
}
sensor_jammer_upper_range = sensor_jammer_range_config[getScenarioSetting("Sensor Jammer Range")]
local sensor_jammer_strength_config = {
["Weak"] = 20000,
["Normal"] = 25000,
["Strong"] = 30000,
}
sensor_jammer_upper_strength = sensor_jammer_strength_config[getScenarioSetting("Sensor Jammer Strength")]
artifact_scan_config = {
["Easy"] = 4,
["Simple"] = 5,
["Normal"] = 6,
["Tricky"] = 7,
["Hard"] = 8,
["Difficult"] = 9,
["Challenging"] = 10,
}
artifact_scan_upper_limit = artifact_scan_config[getScenarioSetting("Scan Defense")]
end
end
function setConstants()
distance_diagnostic = false
stationCommsDiagnostic = false
change_enemy_order_diagnostic = false
healthDiagnostic = false
sensor_jammer_diagnostic = false
max_repeat_loop = 100
local c_x, c_y = vectorFromAngleNorth(random(0,360),random(0,60000))
center_x = 909000 + c_x
center_y = 151000 + c_y
primary_orders = _("orders-comms","Protect and save the civilian population who live on space stations.")
plotCI = cargoInventory
plotH = healthCheck --Damage to ship can kill repair crew members
healthCheckTimerInterval = 8
healthCheckTimer = healthCheckTimerInterval
maintenance_timer_interval = 7
maintenance_timer = maintenance_timer_interval
prefix_length = 0
suffix_index = 0
system_list = {
"reactor",
"beamweapons",
"missilesystem",
"maneuver",
"impulse",
"warp",
"jumpdrive",
"frontshield",
"rearshield",
}
player_ship_names = {
"Fiddler",
"Brinks",
"Loomis",
"Mowag",
"Patria",
"Pandur",
"Terrex",
"Komatsu",
"Eitan",
}
missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'}
pool_selectivity = "full"
template_pool_size = 5
ship_template = { --ordered by relative strength
["Gnat"] = {strength = 2, create = gnat},
["Lite Drone"] = {strength = 3, create = droneLite},
["Jacket Drone"] = {strength = 4, create = droneJacket},
["Ktlitan Drone"] = {strength = 4, create = stockTemplate},
["Heavy Drone"] = {strength = 5, create = droneHeavy},
["MT52 Hornet"] = {strength = 5, create = stockTemplate},
["MU52 Hornet"] = {strength = 5, create = stockTemplate},
["MV52 Hornet"] = {strength = 6, create = hornetMV52},
["Adder MK3"] = {strength = 5, create = stockTemplate},
["Adder MK4"] = {strength = 6, create = stockTemplate},
["Fighter"] = {strength = 6, create = stockTemplate},
["Ktlitan Fighter"] = {strength = 6, create = stockTemplate},
["K2 Fighter"] = {strength = 7, create = k2fighter},
["Adder MK5"] = {strength = 7, create = stockTemplate},
["WX-Lindworm"] = {strength = 7, create = stockTemplate},
["K3 Fighter"] = {strength = 8, create = k3fighter},
["Adder MK6"] = {strength = 8, create = stockTemplate},
["Ktlitan Scout"] = {strength = 8, create = stockTemplate},
["WZ-Lindworm"] = {strength = 9, create = wzLindworm},
["Adder MK7"] = {strength = 9, create = stockTemplate},
["Adder MK8"] = {strength = 10, create = stockTemplate},
["Adder MK9"] = {strength = 11, create = stockTemplate},
["Nirvana R3"] = {strength = 12, create = stockTemplate},
["Phobos R2"] = {strength = 13, create = phobosR2},
["Missile Cruiser"] = {strength = 14, create = stockTemplate},
["Waddle 5"] = {strength = 15, create = waddle5},
["Jade 5"] = {strength = 15, create = jade5},
["Phobos T3"] = {strength = 15, create = stockTemplate},
["Piranha F8"] = {strength = 15, create = stockTemplate},
["Piranha F12"] = {strength = 15, create = stockTemplate},
["Piranha F12.M"] = {strength = 16, create = stockTemplate},
["Phobos M3"] = {strength = 16, create = stockTemplate},
["Farco 3"] = {strength = 16, create = farco3},
["Farco 5"] = {strength = 16, create = farco5},
["Karnack"] = {strength = 17, create = stockTemplate},
["Gunship"] = {strength = 17, create = stockTemplate},
["Phobos T4"] = {strength = 18, create = phobosT4},
["Cruiser"] = {strength = 18, create = stockTemplate},
["Nirvana R5"] = {strength = 19, create = stockTemplate},
["Farco 8"] = {strength = 19, create = farco8},
["Nirvana R5A"] = {strength = 20, create = stockTemplate},
["Adv. Gunship"] = {strength = 20, create = stockTemplate},
["Ktlitan Worker"] = {strength = 21, create = stockTemplate},
["Farco 11"] = {strength = 21, create = farco11},
["Storm"] = {strength = 22, create = stockTemplate},
["Stalker R5"] = {strength = 22, create = stockTemplate},
["Stalker Q5"] = {strength = 22, create = stockTemplate},
["Farco 13"] = {strength = 24, create = farco13},
["Ranus U"] = {strength = 25, create = stockTemplate},
["Stalker Q7"] = {strength = 25, create = stockTemplate},
["Stalker R7"] = {strength = 25, create = stockTemplate},
["Whirlwind"] = {strength = 26, create = whirlwind},
["Adv. Striker"] = {strength = 27, create = stockTemplate},
["Elara P2"] = {strength = 28, create = stockTemplate},
["Tempest"] = {strength = 30, create = tempest},
["Strikeship"] = {strength = 30, create = stockTemplate},
["Fiend G3"] = {strength = 33, create = stockTemplate},
["Fiend G4"] = {strength = 35, create = stockTemplate},
["Cucaracha"] = {strength = 36, create = cucaracha},
["Fiend G5"] = {strength = 37, create = stockTemplate},
["Fiend G6"] = {strength = 39, create = stockTemplate},
["Predator"] = {strength = 42, create = predator},
["Ktlitan Breaker"] = {strength = 45, create = stockTemplate},
["Hurricane"] = {strength = 46, create = hurricane},
["Ktlitan Feeder"] = {strength = 48, create = stockTemplate},
["Atlantis X23"] = {strength = 50, create = stockTemplate},
["K2 Breaker"] = {strength = 55, create = k2breaker},
["Ktlitan Destroyer"] = {strength = 50, create = stockTemplate},
["Atlantis Y42"] = {strength = 60, create = atlantisY42},
["Blockade Runner"] = {strength = 65, create = stockTemplate},
["Starhammer II"] = {strength = 70, create = stockTemplate},
["Enforcer"] = {strength = 75, create = enforcer},
["Dreadnought"] = {strength = 80, create = stockTemplate},
["Starhammer III"] = {strength = 85, create = starhammerIII},
["Starhammer V"] = {strength = 90, create = starhammerV},
["Battlestation"] = {strength = 100, create = stockTemplate},
["Tyr"] = {strength = 150, create = tyr},
["Odin"] = {strength = 250, create = stockTemplate},
}
fly_formation = {
["V"] = {
{angle = 60 , dist = 1 },
{angle = 300, dist = 1 },
},
["Vac"] = {
{angle = 30 , dist = 1 },
{angle = 330, dist = 1 },
},
["V4"] = {
{angle = 60 , dist = 1 },
{angle = 300, dist = 1 },
{angle = 60 , dist = 2 },
{angle = 300, dist = 2 },
},
["Vac4"] = {
{angle = 30 , dist = 1 },
{angle = 330, dist = 1 },
{angle = 30 , dist = 2 },
{angle = 330, dist = 2 },
},
["A"] = {
{angle = 120, dist = 1 },
{angle = 240, dist = 1 },
},
["Aac"] = {
{angle = 150, dist = 1 },
{angle = 210, dist = 1 },
},
["A4"] = {
{angle = 120, dist = 1 },
{angle = 240, dist = 1 },
{angle = 120, dist = 2 },
{angle = 240, dist = 2 },
},
["Aac4"] = {
{angle = 150, dist = 1 },
{angle = 210, dist = 1 },
{angle = 150, dist = 2 },
{angle = 210, dist = 2 },
},
["/"] = {
{angle = 60 , dist = 1 },
{angle = 240, dist = 1 },
},
["-"] = {
{angle = 90 , dist = 1 },
{angle = 270, dist = 1 },
},
["-4"] = {
{angle = 90 , dist = 1 },
{angle = 270, dist = 1 },
{angle = 90 , dist = 2 },
{angle = 270, dist = 2 },
},
["\\"] = {
{angle = 300, dist = 1 },
{angle = 120, dist = 1 },
},
["|"] = {
{angle = 0 , dist = 1 },
{angle = 180, dist = 1 },
},
["|4"] = {
{angle = 0 , dist = 1 },
{angle = 180, dist = 1 },
{angle = 0 , dist = 2 },
{angle = 180, dist = 2 },
},
["/ac"] = {
{angle = 30 , dist = 1 },
{angle = 210, dist = 1 },
},
["\\ac"] = {
{angle = 330, dist = 1 },
{angle = 150, dist = 1 },
},
["M"] = {
{angle = 60 , dist = 1 },
{angle = 90 , dist = 1 },
{angle = 300, dist = 1 },
{angle = 270, dist = 1 },
},
["Mac"] = {
{angle = 30 , dist = 1 },
{angle = 90 , dist = 1 },
{angle = 330, dist = 1 },
{angle = 270, dist = 1 },
},
["M6"] = {
{angle = 60 , dist = 1 },
{angle = 90 , dist = 1 },
{angle = 300, dist = 1 },
{angle = 270, dist = 1 },
{angle = 120, dist = 1.3},
{angle = 240, dist = 1.3},
},
["Mac6"] = {
{angle = 30 , dist = 1 },
{angle = 90 , dist = 1 },
{angle = 330, dist = 1 },
{angle = 270, dist = 1 },
{angle = 125, dist = 1.7},
{angle = 235, dist = 1.7},
},
["W"] = {
{angle = 120, dist = 1 },
{angle = 240, dist = 1 },
{angle = 90 , dist = 1 },
{angle = 270, dist = 1 },
},
["Wac"] = {
{angle = 150, dist = 1 },
{angle = 210, dist = 1 },
{angle = 90 , dist = 1 },
{angle = 270, dist = 1 },
},
["W6"] = {
{angle = 120, dist = 1 },
{angle = 240, dist = 1 },
{angle = 90 , dist = 1 },
{angle = 270, dist = 1 },
{angle = 60 , dist = 1.3},
{angle = 300, dist = 1.3},
},
["Wac6"] = {
{angle = 150, dist = 1 },
{angle = 210, dist = 1 },
{angle = 90 , dist = 1 },
{angle = 270, dist = 1 },
{angle = 55 , dist = 1.7},
{angle = 295, dist = 1.7},
},
["X"] = {
{angle = 60 , dist = 1 },
{angle = 300, dist = 1 },
{angle = 120, dist = 1 },
{angle = 240, dist = 1 },
},
["Xac"] = {
{angle = 30 , dist = 1 },
{angle = 330, dist = 1 },
{angle = 150, dist = 1 },
{angle = 210, dist = 1 },
},
["X8"] = {
{angle = 60 , dist = 1 },
{angle = 300, dist = 1 },
{angle = 120, dist = 1 },
{angle = 240, dist = 1 },
{angle = 60 , dist = 2 },
{angle = 300, dist = 2 },
{angle = 120, dist = 2 },
{angle = 240, dist = 2 },
},
["Xac8"] = {
{angle = 30 , dist = 1 },
{angle = 330, dist = 1 },
{angle = 150, dist = 1 },
{angle = 210, dist = 1 },
{angle = 30 , dist = 2 },
{angle = 330, dist = 2 },
{angle = 150, dist = 2 },
{angle = 210, dist = 2 },
},
}
formation_delta = {
["square"] = {
x = {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},
y = {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},
},
["hexagonal"] = {
x = {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},
y = {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},
},
["pyramid"] = {
[1] = {
{angle = 0, distance = 0},
},
[2] = {
{angle = -1, distance = 1},
{angle = 1, distance = 1},
},
[3] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
},
[4] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = 0, distance = 2},
},
[5] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
},
[6] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
},
[7] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
},
[8] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
},
[9] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -4, distance = 4},
{angle = 4, distance = 4},
},
[10] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -2, distance = 3},
{angle = 2, distance = 3},
},
[11] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -4, distance = 4},
{angle = 4, distance = 4},
{angle = -3, distance = 4},
{angle = 3, distance = 4},
},
[12] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -2, distance = 3},
{angle = 2, distance = 3},
{angle = -1, distance = 3},
{angle = 1, distance = 3},
},
[13] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = 0, distance = 3},
{angle = -2, distance = 4},
{angle = 2, distance = 4},
{angle = -1, distance = 5},
{angle = 1, distance = 5},
{angle = 0, distance = 6},
},
[14] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = 0, distance = 4},
{angle = -2, distance = 4},
{angle = 2, distance = 4},
{angle = -1, distance = 5},
{angle = 1, distance = 5},
{angle = 0, distance = 6},
},
[15] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = 0, distance = 3},
{angle = 0, distance = 4},
{angle = -2, distance = 4},
{angle = 2, distance = 4},
{angle = -1, distance = 5},
{angle = 1, distance = 5},
{angle = 0, distance = 6},
},
},
}
max_pyramid_tier = 15
playerShipStats = {
["MP52 Hornet"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 4000, tractor = false, mining = false },
["Piranha"] = { strength = 16, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 6000, tractor = false, mining = false },
["Flavia P.Falcon"] = { strength = 13, cargo = 15, distance = 200, long_range_radar = 40000, short_range_radar = 5000, tractor = true, mining = true },
["Phobos M3P"] = { strength = 19, cargo = 10, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = true, mining = false },
["Atlantis"] = { strength = 52, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true },
["Player Cruiser"] = { strength = 40, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false },
["Player Missile Cr."] = { strength = 45, cargo = 8, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = false },
["Player Fighter"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 15000, short_range_radar = 4500, tractor = false, mining = false },
["Benedict"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true },
["Kiriya"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 35000, short_range_radar = 5000, tractor = true, mining = true },
["Striker"] = { strength = 8, cargo = 4, distance = 200, long_range_radar = 35000, short_range_radar = 5000, tractor = false, mining = false },
["ZX-Lindworm"] = { strength = 8, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 5500, tractor = false, mining = false },
["Repulse"] = { strength = 14, cargo = 12, distance = 200, long_range_radar = 38000, short_range_radar = 5000, tractor = true, mining = false },
["Ender"] = { strength = 100, cargo = 20, distance = 2000,long_range_radar = 45000, short_range_radar = 7000, tractor = true, mining = false },
["Nautilus"] = { strength = 12, cargo = 7, distance = 200, long_range_radar = 22000, short_range_radar = 4000, tractor = false, mining = false },
["Hathcock"] = { strength = 30, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = true },
["Maverick"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = true },
["Crucible"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false },
["Proto-Atlantis"] = { strength = 40, cargo = 4, distance = 400, long_range_radar = 30000, short_range_radar = 4500, tractor = false, mining = true },
["Stricken"] = { strength = 40, cargo = 4, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = false },
["Surkov"] = { strength = 35, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = false },
["Redhook"] = { strength = 11, cargo = 8, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false },
["Pacu"] = { strength = 18, cargo = 7, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false },
["Phobos T2"] = { strength = 19, cargo = 9, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = true, mining = false },
["Wombat"] = { strength = 13, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 6000, tractor = false, mining = false },
["Holmes"] = { strength = 35, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 4000, tractor = true, mining = false },
["Focus"] = { strength = 35, cargo = 4, distance = 200, long_range_radar = 32000, short_range_radar = 5000, tractor = false, mining = true },
["Flavia 2C"] = { strength = 25, cargo = 12, distance = 200, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = true },
["Destroyer IV"] = { strength = 25, cargo = 5, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false },
["Destroyer III"] = { strength = 25, cargo = 7, distance = 200, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false },
["MX-Lindworm"] = { strength = 10, cargo = 3, distance = 100, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false },
["Striker LX"] = { strength = 16, cargo = 4, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = false },
["Maverick XP"] = { strength = 23, cargo = 5, distance = 200, long_range_radar = 25000, short_range_radar = 7000, tractor = true, mining = false },
["Era"] = { strength = 14, cargo = 14, distance = 200, long_range_radar = 50000, short_range_radar = 5000, tractor = true, mining = true },
["Squid"] = { strength = 14, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = false, mining = false },
["Atlantis II"] = { strength = 60, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true },
["Chavez"] = { strength = 8, cargo = 6, distance = 200, long_range_radar = 20000, short_range_radar = 4500, tractor = true, mining = true },
}
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"}
vapor_goods = {"gold pressed latinum","unobtanium","eludium","impossibrium"}
artifactCounter = 0
artifactNumber = 0
sensor_impact = 1 --normal
sensor_jammer_list = {}
sensor_jammer_range = 60000
sensor_jammer_impact = 40000
sensor_jammer_scan_complexity = 3
sensor_jammer_scan_depth = 3
sensor_jammer_power_units = true --false means percentage, true is units
end
function environmentObject(ref_x, ref_y, dist, axis)
if ref_x == nil or ref_y == nil or dist == nil then
print("function environmentObject expects ref_x, ref_y and dist to be provided")
return
end
if axis == nil then
local axis_choice = {"gross","invert"}
axis = axis_choice[math.random(1,#axis_choice)]
end
local forward_angle = gross_angle
local backward_angle = invert_angle
local forward_angle_start = gross_angle_start
local backward_angle_start = invert_angle_start
if axis ~= "gross" then
forward_angle = invert_angle
backward_angle = gross_angle
forward_angle_start = invert_angle_start
backward_angle_start = gross_angle_start
end
local count_repeat_loop = 0
repeat
local o_x, o_y = vectorFromAngleNorth((random(forward_angle_start,forward_angle_start+place_arc))%360,random(lower_bound,upper_bound))
if random(1,100) > axis_bias then
o_x, o_y = vectorFromAngleNorth((random(backward_angle_start,backward_angle_start+place_arc))%360,random(lower_bound,upper_bound))
end
ref_x = ref_x + o_x
ref_y = ref_y + o_y
count_repeat_loop = count_repeat_loop + 1
until(farEnough(ref_x,ref_y,dist) or count_repeat_loop > max_repeat_loop)
if count_repeat_loop > max_repeat_loop then
print("repeated too many times when trying to get far enough away")
print("last ref_x:",ref_x,"last ref_y:",ref_y)
return nil
else
return ref_x, ref_y
end
end
function constructEnvironment()
safety_x = 0
safety_y = 0
black_hole_milestone = 600 --final: 600, test: 140
place_space = {}
transport_stations = {}
-- Spawn player
local p = PlayerSpaceship():setTemplate("Repulse")
p:onTakingDamage(playerDamage)
p.pidx = 1
setPlayer(p)
p:setPosition(center_x, center_y)
allowNewPlayerShips(false)
table.insert(place_space,{obj=p,dist=100,shape="circle"})
-- Determine angles
gross_angle = random(0,360)
invert_angle = (gross_angle + 180) % 360
place_arc = 50
gross_angle_start = gross_angle - place_arc/2
if gross_angle_start < 0 then
gross_angle_start = gross_angle_start + 360
end
invert_angle_start = invert_angle - place_arc/2
if invert_angle_start < 0 then
invert_angle_start = invert_angle_start + 360
end
lower_bound = 10000
upper_bound = 50000
axis_bias = 61
-- Add stars and planets
local star_list = {
{radius = random(600,1400), distance = random(-2500,-1400),
name = {"Gamma Piscium","Beta Lyporis","Sigma Draconis","Iota Carinae","Theta Arietis","Epsilon Indi","Beta Hydri"},
color = {
red = random(0.8,1), green = random(0.8,1), blue = random(0.8,1)
},
texture = {
atmosphere = "planets/star-1.png"
},
},
}
local planet_list = {
{radius = random(1700,3400), distance = random(-3500,-1200), rotation = random(200,350),
name = {"Bespin","Aldea","Bersallis"},
texture = {
surface = "planets/gas-1.png"
},
},
{radius = random(1700,3400), distance = random(-3500,-1200), rotation = random(200,350),
name = {"Farius Prime","Deneb","Mordan"},
texture = {
surface = "planets/gas-2.png"
},
},
{radius = random(1700,3400), distance = random(-3500,-1200), rotation = random(200,350),
name = {"Kepler-7b","Alpha Omicron","Nelvana"},
texture = {
surface = "planets/gas-3.png"
},
},
{radius = random(1500,2500), distance = random(-3100,-1200), rotation = random(350,500),
name = {"Alderaan","Dagobah","Dantooine","Rigel"},
color = {
red = random(0,0.2), green = random(0,0.2), blue = random(0.8,1)
},
texture = {
surface = "planets/planet-1.png", cloud = "planets/clouds-1.png", atmosphere = "planets/atmosphere.png"
},
},
{radius = random(1500,2500), distance = random(-3100,-1200), rotation = random(350,500),
name = {"Pahvo","Penthara","Scalos"},
color = {
red = random(0,0.2), green = random(0,0.2), blue = random(0.8,1)
},
texture = {
surface = "planets/planet-4.png", cloud = "planets/clouds-3.png", atmosphere = "planets/atmosphere.png"
},
},
{radius = random(1500,2500), distance = random(-3100,-1200), rotation = random(350,500),
name = {"Tanuga","Vacca","Terlina","Timor"},
color = {
red = random(0,0.2), green = random(0,0.2), blue = random(0.8,1)
},
texture = {
surface = "planets/planet-5.png", cloud = "planets/clouds-2.png", atmosphere = "planets/atmosphere.png"
},
},
}
local eo_x, eo_y = environmentObject(center_x, center_y, star_list[1].radius + 1000, "gross")
local the_sun = Planet():setPosition(eo_x, eo_y):setPlanetRadius(star_list[1].radius):setDistanceFromMovementPlane(star_list[1].distance)
the_sun:setCallSign(star_list[1].name[math.random(1,#star_list[1].name)])
the_sun:setPlanetAtmosphereTexture(star_list[1].texture.atmosphere):setPlanetAtmosphereColor(star_list[1].color.red,star_list[1].color.green,star_list[1].color.blue)
table.insert(place_space,{obj=the_sun,dist=star_list[1].radius + 1000,shape="circle"})
local inner_orbit = 0
local outer_orbit = 0
local p2p_dist = distance(p,the_sun)
local selected_planet_index = math.random(1,#planet_list)
local count_repeat_loop = 0
repeat
inner_orbit = random(10000,50000)
outer_orbit = inner_orbit + (planet_list[selected_planet_index].radius * 2) + 1000
count_repeat_loop = count_repeat_loop + 1
until(p2p_dist < inner_orbit or p2p_dist > outer_orbit or count_repeat_loop > max_repeat_loop)
if count_repeat_loop > max_repeat_loop then
print("repeated too many times when trying to determine an inner and outer orbit")
print("last inner orbit:",inner_orbit,"last outer orbit:",outer_orbit,"selected planet index:",selected_planet_index,"radius:",planet_list[selected_planet_index].radius)
end
local planet_x, planet_y = vectorFromAngleNorth(gross_angle,inner_orbit + planet_list[selected_planet_index].radius + 500)
planet_x = planet_x + eo_x
planet_y = planet_y + eo_y
local planet = Planet():setPosition(planet_x, planet_y):setPlanetRadius(planet_list[selected_planet_index].radius):setDistanceFromMovementPlane(planet_list[selected_planet_index].distance)
planet:setCallSign(planet_list[selected_planet_index].name[math.random(1,#planet_list[selected_planet_index].name)])
if planet_list[selected_planet_index].texture.surface ~= nil then
planet:setPlanetSurfaceTexture(planet_list[selected_planet_index].texture.surface)
end
if planet_list[selected_planet_index].texture.atmosphere ~= nil then
planet:setPlanetAtmosphereTexture(planet_list[selected_planet_index].texture.atmosphere)
end
if planet_list[selected_planet_index].texture.cloud ~= nil then
planet:setPlanetCloudTexture(planet_list[selected_planet_index].texture.cloud)
end
if planet_list[selected_planet_index].color ~= nil then
planet:setPlanetAtmosphereColor(planet_list[selected_planet_index].color.red,planet_list[selected_planet_index].color.green,planet_list[selected_planet_index].color.blue)
end
if planet_list[selected_planet_index].rotation ~= nil then
planet:setAxialRotationTime(planet_list[selected_planet_index].rotation)
end
-- planet:setOrbit(the_sun,(60000-inner_orbit)/50)
planet:setOrbit(the_sun,math.pi*2*inner_orbit/250)
table.insert(place_space,{obj=the_sun,inner_orbit = inner_orbit, outer_orbit = outer_orbit, shape="toroid"})
-- Set up for terrain feature creation loop
local station_faction = {"Human Navy","Independent","Kraylor","Arlenians","Exuari","Ghosts","Ktlitans","TSN","USN","CUF"}
local bus_faction = {"Human Navy","Independent","Kraylor","Arlenians","Exuari","Ghosts","Ktlitans","TSN","USN","CUF"}
station_list = {}
residents = {
["friend"] = 0,
["neutral"] = 0,
["enemy"] = 0,
}
bus_list = {}
transport_list = {}
local black_hole_chance = 1
black_hole_count = math.random(1,6)
local probe_chance = 6
local warp_jammer_chance = 3
local worm_hole_chance = 2
worm_hole_count = math.random(1,4)
local sensor_jammer_chance = 6
local sensor_buoy_chance = 6
local ad_buoy_chance = 8
local nebula_chance = 5
local mine_chance = 4
local station_chance = 3
local bus_chance = 3
local mine_field_chance = 4
mine_field_count = math.random(3,8)
local asteroid_field_chance = 4
asteroid_field_count = math.random(2,6)
local transport_chance = 7
repeat
local current_object_chance = 0
local object_roll = random(0,100)
current_object_chance = current_object_chance + black_hole_chance
if object_roll <= current_object_chance then
placeBlackHole()
goto iterate
end
current_object_chance = current_object_chance + probe_chance
if object_roll <= current_object_chance then
placeProbe()
goto iterate
end
current_object_chance = current_object_chance + warp_jammer_chance
if object_roll <= current_object_chance then
placeWarpJammer()
goto iterate
end
current_object_chance = current_object_chance + worm_hole_chance
if object_roll <= current_object_chance then
placeWormHole()
goto iterate
end
current_object_chance = current_object_chance + sensor_jammer_chance
if object_roll <= current_object_chance then
placeSensorJammer()
goto iterate
end
current_object_chance = current_object_chance + sensor_buoy_chance
if object_roll <= current_object_chance then
placeSensorBuoy()
goto iterate
end
current_object_chance = current_object_chance + ad_buoy_chance
if object_roll <= current_object_chance then
placeAdBuoy()
goto iterate
end
current_object_chance = current_object_chance + nebula_chance
if object_roll <= current_object_chance then
placeNebula()
goto iterate
end
current_object_chance = current_object_chance + mine_chance
if object_roll <= current_object_chance then
placeMine()
goto iterate
end
current_object_chance = current_object_chance + station_chance
if object_roll <= current_object_chance then
if #station_faction > 0 then
placeEnvironmentStation(tableRemoveRandom(station_faction))
else
placeAsteroid()
end
goto iterate
end
current_object_chance = current_object_chance + bus_chance
if object_roll <= current_object_chance then
if #bus_faction > 0 then
placeBus(tableRemoveRandom(bus_faction))
else
placeAsteroid()
end
goto iterate
end
current_object_chance = current_object_chance + mine_field_chance
if object_roll <= current_object_chance then
placeMineField()
goto iterate
end
current_object_chance = current_object_chance + asteroid_field_chance
if object_roll <= current_object_chance then
placeAsteroidField()
goto iterate
end
current_object_chance = current_object_chance + transport_chance
if object_roll <= current_object_chance then
placeTransport()
goto iterate
end
placeAsteroid()
::iterate::
until((#station_faction < 1 and #bus_faction < 1))
maintenancePlot = defenseMaintenance
taxi_missions = {}
local taxi_stations = {}
for _, station in ipairs(station_list) do
if station:isFriendly(p) or not station:isEnemy(p) then
table.insert(taxi_stations,station)
end
end
local jump_charge_count = 0
local jump_charge_candidate_stations = {}
local combat_maneuver_count = 0
local combat_maneuver_fix_candidate_stations = {}
for _, station in ipairs(station_list) do
if station:isFriendly(p) or not station:isEnemy(p) then
if station.comms_data ~= nil then
if station.comms_data.jump_overcharge then
jump_charge_count = jump_charge_count + 1
else
table.insert(jump_charge_candidate_stations,station)
end
if station.comms_data.combat_maneuver_repair then
combat_maneuver_count = combat_maneuver_count + 1
else
table.insert(combat_maneuver_fix_candidate_stations,station)
end
else
table.insert(jump_charge_candidate_stations,station)
table.insert(combat_maneuver_fix_candidate_stations,station)
end
end
end
if jump_charge_count < 3 then
for i=1,3-jump_charge_count do
local station = tableRemoveRandom(jump_charge_candidate_stations)
if station.comms_data == nil then
station.comms_data = {
friendlyness = random(0.0, 100.0)
}
end
station.comms_data.jump_overcharge = true
end
end