-
Notifications
You must be signed in to change notification settings - Fork 6
/
scenario_47_scavenger.lua
5698 lines (5695 loc) · 263 KB
/
scenario_47_scavenger.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: Scurvy Scavenger
-- Description: Stay alive while scavenging treasures. Length: > 2 hours
---
--- Version 1
-- Type: Mission
-- 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
-- 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
require("utils.lua")
require("cpu_ship_diversification_scenario_utility.lua")
require("place_station_scenario_utility.lua")
require("generate_call_sign_scenario_utility.lua")
require("spawn_ships_scenario_utility.lua")
function init()
scenario_version = "1.1.2"
ee_version = "2023.06.17"
print(string.format(" ---- Scenario: Scurvy Scavenger ---- Version %s ---- Tested with EE version %s ----",scenario_version,ee_version))
print(_VERSION)
stationCommsDiagnostic = false
exuari_harass_diagnostic = false
spawn_enemy_diagnostic = false
efficient_battery_diagnostic = false
prefix_length = 0
suffix_index = 0
contract_eligible = false --should start out as false
transition_contract_message = false --should start out as false
contract_station = {}
setVariations()
setConstants() --missle type names, template names and scores, deployment directions, player ship names, etc.
player = PlayerSpaceship():setFaction("Independent"):setTemplate("Striker"):setJumpDrive(false):setWarpDrive(false):setLongRangeRadarRange(25000)
plot_faction = "Independent"
setPlayer()
allowNewPlayerShips(false)
--stationCommunication could be nil (default), commsStation (embedded function) or comms_station_enhanced (external script)
stationCommunication = "commsStation"
stationStaticAsteroids = true
primaryOrders = _("orders-comms", "No primary orders")
plot1 = exuariHarassment
plotH = healthCheck --Damage to ship can kill repair crew members
healthCheckTimer = 5
healthCheckTimerInterval = 5
independent_station = {}
station_list = {}
-- print("init: place first station")
--place first station where missions start
first_station_angle = random(0,360)
local player_to_station_distance = random(8000,15000)
psx, psy = vectorFromAngle(first_station_angle,player_to_station_distance)
first_station_x = psx
first_station_y = psy
local pStation = placeStation(psx,psy,nil,"Independent")
table.insert(independent_station,pStation)
table.insert(station_list,pStation)
first_station = pStation
first_station.comms_data.weapon_available.Homing = true
first_station.comms_data.weapon_available.EMP = true
first_station.comms_data.weapon_available.Nuke = true
first_station.comms_data.weapon_cost = {Homing = 2, HV, HVLI = math.random(1,3), Mine = math.random(2,5), Nuke = 12, EMP = 9}
-- print("init: place first enemy station")
--place first enemy station for first mission
exuari_station = {}
local exuari_station_angle = first_station_angle + random(-20,20)
local enemy_station_distance = random(11000,15000)
cnx, cny = vectorFromAngle(exuari_station_angle,enemy_station_distance-2500)
concealing_nebula = Nebula():setPosition(first_station_x+cnx,first_station_y+cny)
nebula_list = {}
table.insert(nebula_list,concealing_nebula)
for i=1,math.random(2,2+difficulty*2) do
local ref_x, ref_y = nebula_list[#nebula_list]:getPosition()
local far_enough = true
local expand_distance = 0
local new_x, new_y = vectorFromAngle(random(0,360),random(4000,20000+expand_distance))
repeat
far_enough = true
new_x, new_y = vectorFromAngle(random(0,360),random(4000,20000+expand_distance))
new_x = new_x + ref_x
new_y = new_y + ref_y
for j=1,#nebula_list do
if distance(nebula_list[j],new_x,new_y) < 4000 then
far_enough = false
end
end
expand_distance = expand_distance + 1000
until(far_enough)
local new_nebula = Nebula():setPosition(new_x,new_y)
table.insert(nebula_list,new_nebula)
end
psx, psy = vectorFromAngle(exuari_station_angle,enemy_station_distance)
psx = psx + first_station_x
psy = psy + first_station_y
pStation = placeStation(psx,psy,"Sinister","Exuari","Large Station")
table.insert(exuari_station,pStation)
table.insert(station_list,pStation)
exuari_harassing_station = pStation
evx, evy = vectorFromAngle(exuari_station_angle,20000)
evx = evx + psx
evy = evy + psy
ev_angle = (exuari_station_angle + 180) % 360 --exuari vengeance attack angle
-- print("init: place research asteroids")
local arx, ary, brx, bry, asteroids = curvaceousAsteroids1(first_station_x, first_station_y, player_to_station_distance)
research_asteroids = asteroids
--place artifact near asteroids
local avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
beam_damage_artifact = Artifact():setPosition(arx+avx,ary+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
beam_damage_artifact:setDescriptions(_("scienceDescription-artifact", "Object of unknown origin"),_("scienceDescription-artifact", "Object of unknown origin, advanced technology detected")):allowPickup(true):onPickUp(beamDamageArtifactPickup)
avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
burn_out_artifact = Artifact():setPosition(brx+avx,bry+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
burn_out_artifact:setDescriptions(_("scienceDescription-artifact", "Object of unknown origin"),_("scienceDescription-artifact", "Object of unknown origin, advanced technology detected")):allowPickup(true):onPickUp(burnOutArtifactPickup)
if difficulty >= 1 then
avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
burn_out_artifact_2 = Artifact():setPosition(crx+avx,cry+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
burn_out_artifact_2:setDescriptions(_("scienceDescription-artifact", "Object of unknown origin"),_("scienceDescription-artifact", "Object of unknown origin, advanced technology detected")):allowPickup(true):onPickUp(burnOutArtifactPickup)
end
if difficulty > 1 then
avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
burn_out_artifact_3 = Artifact():setPosition(drx+avx,dry+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
burn_out_artifact_3:setDescriptions(_("scienceDescription-artifact", "Object of unknown origin"),_("scienceDescription-artifact", "Object of unknown origin, advanced technology detected")):allowPickup(true):onPickUp(burnOutArtifactPickup)
end
-- print("init: place second and third stations")
--place second and third stations
local second_station_angle = first_station_angle + random(90,140)
if second_station_angle > 360 then
second_station_angle = second_station_angle - 360
end
player_to_station_distance = player_to_station_distance + random(1000,8000)
psx, psy = vectorFromAngle(second_station_angle,player_to_station_distance)
pStation = placeStation(psx,psy,nil,"Independent")
table.insert(independent_station,pStation)
table.insert(station_list,pStation)
setOptionalAddBeamMission(pStation)
second_station_angle = first_station_angle - random(90,140)
if second_station_angle < 0 then
second_station_angle = second_station_angle + 360
end
player_to_station_distance = player_to_station_distance + random(1000,8000)
psx, psy = vectorFromAngle(second_station_angle,player_to_station_distance)
pStation = placeStation(psx,psy,nil,"Independent")
table.insert(independent_station,pStation)
table.insert(station_list,pStation)
setOptionalEfficientBatteriesMisison(pStation)
setInitialContractDetails()
first_station:setSharesEnergyWithDocked(true)
first_station:setRepairDocked(true)
first_station.comms_data.scan_repair = true
first_station.comms_data.jump_overcharge = true
-- print("init: set work transports")
--Independent trio transports
plotT = workingTransports
transports_around_independent_trio = {}
transportCheckDelayInterval = 4
transportCheckDelayTimer = transportCheckDelayInterval
local transportType = {"Personnel","Goods","Garbage","Equipment","Fuel"}
local name = nil
local prefix = generateCallSignPrefix(1)
for i=1,3 do
j = i + 2
if j > 3 then
j = j - 3
end
name = transportType[math.random(1,#transportType)]
if random(1,100) < 30 then
name = name .. " Jump Freighter " .. math.random(3, 5)
else
name = name .. " Freighter " .. math.random(1, 5)
end
psx, psy = independent_station[i]:getPosition()
local tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(independent_station[i]:getFaction()):setCommsScript(""):setCommsFunction(commsShip)
tempTransport.targetStart = independent_station[i]
tempTransport.targetEnd = independent_station[j]
if random(1,100) < 50 then
tempTransport:orderDock(tempTransport.targetStart)
else
tempTransport:orderDock(tempTransport.targetEnd)
end
tempTransport:setCallSign(generateCallSign(prefix))
table.insert(transports_around_independent_trio,tempTransport)
end
mainGMButtons()
-- print("end of init")
allowNewPlayerShips(false)
end
-- Initialization
function setVariations()
local enemy_config = {
["Easy"] = {number = .5},
["Normal"] = {number = 1},
["Hard"] = {number = 2},
}
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
gameTimeLimit = 0
playWithTimeLimit = false
end
function setConstants()
repeatExitBoundary = 100
scarceResources = false
missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'}
pool_selectivity = "full"
ship_template = { --ordered by relative strength
["Gnat"] = {strength = 2, short_range_radar = 4500, create = gnat},
["Lite Drone"] = {strength = 3, short_range_radar = 5000, create = droneLite},
["Jacket Drone"] = {strength = 4, short_range_radar = 5000, create = droneJacket},
["Ktlitan Drone"] = {strength = 4, short_range_radar = 5000, create = stockTemplate},
["Heavy Drone"] = {strength = 5, short_range_radar = 5500, create = droneHeavy},
["Adder MK3"] = {strength = 5, short_range_radar = 5000, create = stockTemplate},
["MT52 Hornet"] = {strength = 5, short_range_radar = 5000, create = stockTemplate},
["MU52 Hornet"] = {strength = 5, short_range_radar = 5000, create = stockTemplate},
["Dagger"] = {strength = 6, short_range_radar = 5000, create = stockTemplate},
["MV52 Hornet"] = {strength = 6, short_range_radar = 5000, create = hornetMV52},
["MT55 Hornet"] = {strength = 6, short_range_radar = 5000, create = hornetMT55},
["Adder MK4"] = {strength = 6, short_range_radar = 5000, create = stockTemplate},
["Fighter"] = {strength = 6, short_range_radar = 5000, create = stockTemplate},
["Ktlitan Fighter"] = {strength = 6, short_range_radar = 5000, create = stockTemplate},
["FX64 Hornet"] = {strength = 7, short_range_radar = 5000, create = hornetFX64},
["Blade"] = {strength = 7, short_range_radar = 5000, create = stockTemplate},
["Gunner"] = {strength = 7, short_range_radar = 5000, create = stockTemplate},
["K2 Fighter"] = {strength = 7, short_range_radar = 5000, create = k2fighter},
["Adder MK5"] = {strength = 7, short_range_radar = 5000, create = stockTemplate},
["WX-Lindworm"] = {strength = 7, short_range_radar = 5500, create = stockTemplate},
["K3 Fighter"] = {strength = 8, short_range_radar = 5000, create = k3fighter},
["Shooter"] = {strength = 8, short_range_radar = 5000, create = stockTemplate},
["Jagger"] = {strength = 8, short_range_radar = 5000, create = stockTemplate},
["Adder MK6"] = {strength = 8, short_range_radar = 5000, create = stockTemplate},
["Ktlitan Scout"] = {strength = 8, short_range_radar = 7000, create = stockTemplate},
["WZ-Lindworm"] = {strength = 9, short_range_radar = 5500, create = wzLindworm},
["Adder MK7"] = {strength = 9, short_range_radar = 5000, create = stockTemplate},
["Adder MK8"] = {strength = 10, short_range_radar = 5500, create = stockTemplate},
["Adder MK9"] = {strength = 11, short_range_radar = 6000, create = stockTemplate},
["Nirvana R3"] = {strength = 12, short_range_radar = 5000, create = stockTemplate},
["Phobos R2"] = {strength = 13, short_range_radar = 5000, create = phobosR2},
["Missile Cruiser"] = {strength = 14, short_range_radar = 7000, create = stockTemplate},
["Waddle 5"] = {strength = 15, short_range_radar = 5000, create = waddle5},
["Jade 5"] = {strength = 15, short_range_radar = 5000, create = jade5},
["Phobos T3"] = {strength = 15, short_range_radar = 5000, create = stockTemplate},
["Guard"] = {strength = 15, short_range_radar = 5000, create = stockTemplate},
["Piranha F8"] = {strength = 15, short_range_radar = 6000, create = stockTemplate},
["Piranha F12"] = {strength = 15, short_range_radar = 6000, create = stockTemplate},
["Piranha F12.M"] = {strength = 16, short_range_radar = 6000, create = stockTemplate},
["Phobos M3"] = {strength = 16, short_range_radar = 5500, create = stockTemplate},
["Farco 3"] = {strength = 16, short_range_radar = 8000, create = farco3},
["Farco 5"] = {strength = 16, short_range_radar = 8000, create = farco5},
["Karnack"] = {strength = 17, short_range_radar = 5000, create = stockTemplate},
["Gunship"] = {strength = 17, short_range_radar = 5000, create = stockTemplate},
["Phobos T4"] = {strength = 18, short_range_radar = 5000, create = phobosT4},
["Cruiser"] = {strength = 18, short_range_radar = 6000, create = stockTemplate},
["Nirvana R5"] = {strength = 19, short_range_radar = 5000, create = stockTemplate},
["Farco 8"] = {strength = 19, short_range_radar = 8000, create = farco8},
["Nirvana R5A"] = {strength = 20, short_range_radar = 5000, create = stockTemplate},
["Adv. Gunship"] = {strength = 20, short_range_radar = 7000, create = stockTemplate},
["Ktlitan Worker"] = {strength = 20, short_range_radar = 5000, create = stockTemplate},
["Farco 11"] = {strength = 21, short_range_radar = 8000, create = farco11},
["Storm"] = {strength = 22, short_range_radar = 6000, create = stockTemplate},
["Warden"] = {strength = 22, short_range_radar = 6000, create = stockTemplate},
["Racer"] = {strength = 22, short_range_radar = 5000, create = stockTemplate},
["Strike"] = {strength = 23, short_range_radar = 5500, create = stockTemplate},
["Dash"] = {strength = 23, short_range_radar = 5500, create = stockTemplate},
["Farco 13"] = {strength = 24, short_range_radar = 5000, create = farco13},
["Sentinel"] = {strength = 24, short_range_radar = 5000, create = stockTemplate},
["Ranus U"] = {strength = 25, short_range_radar = 6000, create = stockTemplate},
["Flash"] = {strength = 25, short_range_radar = 6000, create = stockTemplate},
["Ranger"] = {strength = 25, short_range_radar = 6000, create = stockTemplate},
["Buster"] = {strength = 25, short_range_radar = 6000, create = stockTemplate},
["Stalker Q7"] = {strength = 25, short_range_radar = 5000, create = stockTemplate},
["Stalker R7"] = {strength = 25, short_range_radar = 5000, create = stockTemplate},
["Whirlwind"] = {strength = 26, short_range_radar = 6000, create = whirlwind},
["Hunter"] = {strength = 26, short_range_radar = 5500, create = stockTemplate},
["Adv. Striker"] = {strength = 27, short_range_radar = 5000, create = stockTemplate},
["Tempest"] = {strength = 30, short_range_radar = 6000, create = tempest},
["Strikeship"] = {strength = 30, short_range_radar = 5000, create = stockTemplate},
["Maniapak"] = {strength = 34, short_range_radar = 6000, create = maniapak},
["Fiend G4"] = {strength = 35, short_range_radar = 6500, create = stockTemplate},
["Cucaracha"] = {strength = 36, short_range_radar = 5000, create = cucaracha},
["Fiend G6"] = {strength = 39, short_range_radar = 6500, create = stockTemplate},
["Predator"] = {strength = 42, short_range_radar = 7500, create = predator},
["Ktlitan Breaker"] = {strength = 45, short_range_radar = 5000, create = stockTemplate},
["Hurricane"] = {strength = 46, short_range_radar = 6000, create = hurricane},
["Ktlitan Feeder"] = {strength = 48, short_range_radar = 5000, create = stockTemplate},
["Atlantis X23"] = {strength = 50, short_range_radar = 10000, create = stockTemplate},
["Ktlitan Destroyer"] = {strength = 50, short_range_radar = 9000, create = stockTemplate},
["K2 Breaker"] = {strength = 55, short_range_radar = 5000, create = k2breaker},
["Atlantis Y42"] = {strength = 60, short_range_radar = 10000, create = atlantisY42},
["Blockade Runner"] = {strength = 63, short_range_radar = 5500, create = stockTemplate},
["Starhammer II"] = {strength = 70, short_range_radar = 10000, create = stockTemplate},
["Enforcer"] = {strength = 75, short_range_radar = 9000, create = enforcer},
["Dreadnought"] = {strength = 80, short_range_radar = 9000, create = stockTemplate},
["Starhammer III"] = {strength = 85, short_range_radar = 12000, create = starhammerIII},
["Starhammer V"] = {strength = 90, short_range_radar = 15000, create = starhammerV},
["Tyr"] = {strength = 150,short_range_radar = 9500, create = tyr},
}
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},
},
},
}
--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","Baza","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"}
playerShipNamesForAtlantisII = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"}
playerShipNamesForProtoAtlantis = {"Narsil", "Blade", "Decapitator", "Trisect", "Sabre"}
playerShipNamesForSurkov = {"Sting", "Sneak", "Bingo", "Thrill", "Vivisect"}
playerShipNamesForRedhook = {"Headhunter", "Thud", "Troll", "Scalper", "Shark"}
playerShipNamesForLeftovers = {"Foregone","Righteous","Masher"}
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"}
characterNames = {"Frank Brown",
"Joyce Miller",
"Harry Jones",
"Emma Davis",
"Zhang Wei Chen",
"Yu Yan Li",
"Li Wei Wang",
"Li Na Zhao",
"Sai Laghari",
"Anaya Khatri",
"Vihaan Reddy",
"Trisha Varma",
"Henry Gunawan",
"Putri Febrian",
"Stanley Hartono",
"Citra Mulyadi",
"Bashir Pitafi",
"Hania Kohli",
"Gohar Lehri",
"Sohelia Lau",
"Gabriel Santos",
"Ana Melo",
"Lucas Barbosa",
"Juliana Rocha",
"Habib Oni",
"Chinara Adebayo",
"Tanimu Ali",
"Naija Bello",
"Shamim Khan",
"Barsha Tripura",
"Sumon Das",
"Farah Munsi",
"Denis Popov",
"Pasha Sokolov",
"Burian Ivanov",
"Radka Vasiliev",
"Jose Hernandez",
"Victoria Garcia",
"Miguel Lopez",
"Renata Rodriguez"}
end
function setPlayer()
player = getPlayerShip(-1)
if not player.name_assigned then
if player:getTypeName() == "Striker" then
if #playerShipNamesForStriker > 0 then
local name_index = math.random(1,#playerShipNamesForStriker)
player:setCallSign(playerShipNamesForStriker[name_index])
table.remove(playerShipNamesForStriker,name_index)
end
player:setImpulseMaxSpeed(60)
player.shipScore = 8
player.maxCargo = 4
player:setFaction(plot_faction)
else
if #playerShipNamesForLeftovers > 0 then
name_index = math.random(1,#playerShipNamesForLeftovers)
player:setCallSign(playerShipNamesForLeftovers[name_index])
table.remove(playerShipNamesForLeftovers,name_index)
end
player.shipScore = 24
player.maxCargo = 5
end
player.cargo = player.maxCargo
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
if player:getBeamWeaponRange(0) > 0 then
player.healthyBeam = 1.0
player.prevBeam = 1.0
end
if player:getWeaponTubeCount() > 0 then
player.healthyMissile = 1.0
player.prevMissile = 1.0
end
if player:hasWarpDrive() then
player.healthyWarp = 1.0
player.prevWarp = 1.0
end
if player:hasJumpDrive() then
player.healthyJump = 1.0
player.prevJump = 1.0
end
player:addReputationPoints(20)
player.name_assigned = true
end
end
function setInitialContractDetails()
--contract details: first to second station
first_station.comms_data.contract = {}
first_station.comms_data.contract["one_to_two"] = {
type = "start",
prompt = string.format(_("contract-comms", "Deliver three %s to %s. Upon delivery, they will increase your hull strength"),independent_station[2].comms_data.characterGood,independent_station[2]:getCallSign()),
short_prompt = string.format(_("contract-comms", "Three %s to %s"),independent_station[2].comms_data.characterGood,independent_station[2]:getCallSign()),
accepted = false,
func = start1to2delivery,
}
independent_station[2].comms_data.contract = {}
independent_station[2].comms_data.contract["one_to_two"] = {
type = "fulfill",
prompt = string.format(_("contract-comms", "Fulfill %s 3 %s %s contract"),first_station:getCallSign(),independent_station[2].comms_data.characterGood,independent_station[2]:getCallSign()),
short_prompt = string.format(_("contract-comms", "Three %s from %s"),independent_station[2].comms_data.characterGood,first_station:getCallSign()),
fulfilled = false,
func = complete1to2delivery,
}
--contract details: second to third station
independent_station[2].comms_data.contract["two_to_three"] = {
type = "start",
prompt = string.format(_("contract-comms", "Deliver two %s to %s. Upon delivery, they will increase your shield strength"),independent_station[3].comms_data.characterGood,independent_station[3]:getCallSign()),
short_prompt = string.format(_("contract-comms", "Two %s to %s"),independent_station[3].comms_data.characterGood,independent_station[3]:getCallSign()),
accepted = false,
func = start2to3delivery,
}
independent_station[3].comms_data.contract = {}
independent_station[3].comms_data.contract["two_to_three"] = {
type = "fulfill",
prompt = string.format(_("contract-comms", "Fulfill %s 2 %s %s contract"),independent_station[2]:getCallSign(),independent_station[3].comms_data.characterGood,independent_station[3]:getCallSign()),
short_prompt = string.format(_("contract-comms", "Two %s from %s"),independent_station[3].comms_data.characterGood,independent_station[2]:getCallSign()),
fulfilled = false,
func = complete2to3delivery,
}
end
function mainGMButtons()
clearGMFunctions()
addGMFunction(_("buttonGM", "+Missions"),missionSelection)
addGMFunction(_("buttonGM","+Spawn Ship(s)"),spawnGMShips)
-- addGMFunction("Explode test",function()
-- plot7 = explodingPlanetDebris
-- end)
end
function missionSelection()
clearGMFunctions()
addGMFunction(_("buttonGM", "-Main from missions"),mainGMButtons)
addGMFunction(_("buttonGM","Mission Status"),function()
local out = _("msgGM","Plot 1:")
if plot1 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
if plot1 == kraylorDiversionarySabotage then
out = string.format(_("msgGM","%s Kraylor diversionary sabotage"),out)
elseif plot1 == longDistanceCargo then
out = string.format(_("msgGM","%s long distance cargo"),out)
elseif plot1 == transitionContract then
out = string.format(_("msgGM","%s transition contract"),out)
elseif plot1 == exuariHarassment then
out = string.format(_("msgGM","%s Exuari harassment"),out)
end
if plot1_type ~= nil and plot1_type == "optional" then
out = string.format(_("msgGM","%s (optional)"),out)
end
if plot1 == exuariHarassment then
if plot1_time ~= nil then
out = string.format(_("msgGM","%s\n seconds remaining until next harassment wave:%i"),out,math.floor(plot1_time - getScenarioTime()))
end
if plot1_defensive_fleet_spawned ~= nil and plot1_defensive_fleet_spawned then
if plot1_defensive_fleet ~= nil then
out = string.format(_("msgGM","%s\n defensive fleet size:%i"),out,#plot1_defensive_fleet)
end
else
if plot1_defensive_time ~= nil then
out = string.format(_("msgGM","%s\n seconds remaining until next defensive fleet:%i"),out,math.floor(plot1_defensive_time - getScenarioTime()))
end
end
if plot1_danger ~= nil then
out = string.format(_("msgGM","%s\n danger:%.2f"),out,plot1_danger)
end
if plot1_fleets_destroyed ~= nil then
out = string.format(_("msgGM","%s\n fleets destroyed:%i"),out,plot1_fleets_destroyed)
end
if plot1_last_defense ~= nil and plot1_last_defense then
if plot1_last_defense_fleet ~= nil then
local fleet_count = 0
for i,ship in pairs(plot1_last_defense_fleet) do
if ship:isValid() then
fleet_count = fleet_count + 1
end
end
out = string.format(_("msgGM","%s\n last defense fleet size:%i"),out,fleet_count)
end
end
end
if plot1 == kraylorDiversionarySabotage then
if diversionary_sabotage_fleet ~= nil then
local fleet_count = 0
for i,ship in ipairs(diversionary_sabotage_fleet) do
if ship:isValid() then
fleet_count = fleet_count + 1
end
end
out = string.format(_("msgGM","%s\n Kraylor diversionary fleet size:%i"),out,fleet_count)
end
if kraylor_sabotage_diversion_time ~= nil then
out = string.format(_("msgGM","%s\n seconds remaining until next check for reinforcements:%i"),out,math.floor(kraylor_sabotage_diversion_time - getScenarioTime()))
end
if kraylor_diversion_danger ~= nil then
out = string.format(_("msgGM","%s\n Kraylor diversion danger:%i"),out,kraylor_diversion_danger)
end
if defend_against_kraylor_fleet ~= nil then
local fleet_count = 0
for i,ship in ipairs(defend_against_kraylor_fleet) do
if ship:isValid() then
fleet_count = fleet_count + 1
end
end
out = string.format(_("msgGM","%s/n defend against Kraylor fleet size:%i"),out,fleet_count)
end
if supply_depot_station ~= nil and supply_depot_station:isValid() then
if supply_depot_station.sabotaged ~= nil and supply_depot_station.sabotaged then
out = string.format(_("msgGM","%s\n supply depot station %s has been sabotaged."),out,supply_depot_station:getCallSign())
end
else
out = string.format(_("msgGM","%s\n supply depot station has been destroyed"),out)
end
end
if plot1 == longDistanceCargo then
if supply_depot_station ~= nil and supply_depot_station:isValid() then
out = string.format(_("msgGM","%s distance between %s and %s:%i units"),out,player:getCallSign(),supply_depot_station:getCallSign(),math.floor(distance(player,supply_depot_station)/1000))
end
if supply_sabotage_fleet ~= nil then
local sabotage_fleet_count = 0
for i,ship in ipairs(supply_sabotage_fleet) do
if ship:isValid() then
sabotage_fleet_count = sabotage_fleet_count + 1
end
end
out = string.format(_("msgGM","%s\n supply sabotage fleet size:%i"),out,sabotage_fleet_count)
end
end
end
out = string.format(_("msgGM","%s\nPlot 2:"),out)
if plot2 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
out = string.format(_("msgGM","%s contract target"),out)
if exuari_vengance_fleet_time ~= nil then
out = string.format(_("msgGM","%s\n seconds remaining until next Exuari vengance fleet:%i"),out,math.floor(exuari_vengance_fleet_time - getScenarioTime()))
end
for i,station in ipairs(contract_station) do
if station ~= nil and station:isValid() then
out = string.format(_("msgGM","%s\n contract target station %s"),out,station:getCallSign())
if station.harass_fleet ~= nil then
local fleet_count = 0
for i,ship in pairs(station.harass_fleet) do
if ship ~= nil and ship:isValid() then
fleet_count = fleet_count + 1
end
end
out = string.format(_("msgGM","%s, harassing Exuari fleet size:%i"),out,fleet_count)
else
if station.delay_timer ~= nil then
out = string.format(_("msgGM","%s, seconds until next harassment check:%i"),out,math.floor(station.delay_timer - getScenarioTime()))
end
end
end
end
for i,station in ipairs(independent_station) do
if station:isValid() then
if station.comms_data.contract ~= nil then
for contract,details in pairs(station.comms_data.contract) do
local status = ""
if details.type == "start" then
if details.accepted then
status = _("msgGM","accepted")
else
status = _("msgGM","not accepted")
end
else
if details.fulfilled then
status = _("msgGM","fulfilled")
else
status = _("msgGM","not fulfilled")
end
end
out = string.format(_("msgGM","%s\n contract at %s: %s status: %s"),out,station:getCallSign(),contract,status)
end
end
end
end
if transition_contract_delay ~= nil then
out = string.format(_("msgGM","%s\n seconds until transition contract:%i"),out,math.floor(transition_contract_delay - getScenarioTime()))
end
end
out = string.format(_("msgGM","%s\nPlot 3:"),out)
if plot3 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
out = string.format(_("msgGM","%s Jenny asteroid (optional)"),out)
if player.asteroid_start_time ~= nil then
if getScenarioTime() - player.asteroid_start_time > 300 then
out = string.format(_("msgGM","%s\n asteroid structure in notes"),out)
end
end
if player.asteroid_identified ~= nil and player.asteroid_identified then
out = string.format(_("msgGM","%s\n asteroid identified"),out)
if player.jenny_aboard ~= nil and player.jenny_aboard then
out = string.format(_("msgGM","%s\n Jenny is aboard"),out)
if first_station:isValid() then
if first_station.asteroid_upgrade ~= nil and first_station.asteroid_upgrade then
out = string.format(_("msgGM","%s\n asteroid research reward is available on %s"),out,first_station:getCallSign())
if player.asteroid_upgrade == nil then
out = string.format(_("msgGM","%s\n asteroid research reward has not yet been claimed by %s"),out,player:getCallSign())
end
else
out = string.format(_("msgGM","%s\n asteroid research reward is not yet available on %s"),out,first_station:getCallSign())
end
else
out = string.format(_("msgGM","%s\n mission cannot be completed due to the destruction of the first mission station."),out)
end
else
out = string.format(_("msgGM","%s\n Jenny has not yet boarded %s"),out,player:getCallSign())
end
else
out = string.format(_("msgGM","%s\n asteroid has not yet been identified"),out)
end
end
out = string.format(_("msgGM","%s\nPlot 4:"),out)
if plot4 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
if plot4 == highwaymen then
out = string.format(_("msgGM","%s highwaymen"),out)
elseif plot4 == highwaymenAlerted then
out = string.format(_("msgGM","%s highwaymen alerted"),out)
elseif plot4 == highwaymenPounce then
out = string.format(_("msgGM","%s highwaymen pounce"),out)
elseif plot4 == highwaymenAftermath then
out = string.format(_("msgGM","%s highwaymen aftermath"),out)
elseif plot4 == highwaymenReset then
out = string.format(_("msgGM","%s highwaymen reset"),out)
end
if highway_time ~= nil then
out = string.format(_("msgGM","%s\n seconds until next event:%i"),out,math.floor(highway_time - getScenarioTime()))
end
if highwaymen_fleet ~= nil then
local fleet_count = 0
for i,ship in ipairs(highwaymen_fleet) do
if ship:isValid() then
fleet_count = fleet_count + 1
end
end
out = string.format(_("msgGM","%s\n highwaymen fleet size:%i"),out,fleet_count)
end
end
out = string.format(_("msgGM","%s\nPlot 5:"),out)
if plot5 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
out = string.format(_("msgGM","%s highwaymen warning zone"),out)
if zone_time ~= nil then
out = string.format(_("msgGM","%s: seconds until zone removal:%i"),out,math.floor(zone_time - getScenarioTime()))
end
end
out = string.format(_("msgGM","%s\nPlot 6:"),out)
if plot6 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
if plot6 == worldEnd then
out = string.format(_("msgGM","%s world end"),out)
elseif plot6 == kraylorPlanetBuster then
out = string.format(_("msgGM","%s Kraylor planet buster"),out)
if kraylor_planet_buster_time ~= nil then
out = string.format(_("msgGM","%s\n seconds until next fleet check:%i"),out,math.floor(kraylor_planet_buster_time - getScenarioTime()))
end
if planetary_attack_fleet_adjust_time ~= nil then
out = string.format(_("msgGM","%s\n seconds until next fleet target adjustment/planet check:%i"),out,math.floor(planetary_attack_fleet_adjust_time - getScenarioTime()))
end
if planetary_attack_fleet ~= nil then
local fleet_count = 0
local fleet_ships = ""
for i,ship in ipairs(planetary_attack_fleet) do
if ship:isValid() then
fleet_count = fleet_count + 1
if fleet_ships == "" then
fleet_ships = string.format(_("msgGM","Ships: %s"),ship:getCallSign())
else
fleet_ships = string.format(_("msgGM","%s, %s"),fleet_ships,ship:getCallSign())
end
end
end
out = string.format(_("msgGM","%s\n planetary attack fleet size:%i"),out,fleet_count)
if fleet_count > 0 then
out = string.format(_("msgGM","%s\n %s"),out,fleet_ships)
end
end
if kraylor_planetary_danger ~= nil then
out = string.format(_("msgGM","%s\n Kraylor planetary danger:%i"),out,kraylor_planetary_danger)
end
end
end
out = string.format(_("msgGM","%s\nPlot 7:"),out)
if plot7 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
out = string.format(_("msgGM","%s exploding planet debris"),out)
if exploding_planet_time ~= nil then
out = string.format(_("msgGM","%s\n seconds remaining until explosion actions are done:%i"),out,math.floor(exploding_planet_time - getScenarioTime()))
end
end
out = string.format(_("msgGM","%s\nPlot 8:"),out)
if plot8 == nil then
out = string.format(_("msgGM","%s nil"),out)
else
out = string.format(_("msgGM","%s opportunistic pirates"),out)
if greedy_pirate_fleet ~= nil then
local pirate_count = 0
for i,ship in ipairs(greedy_pirate_fleet) do
if ship:isValid() then
pirate_count = pirate_count + 1
end
end
out = string.format(_("msgGM","%s\n greedy pirate fleet size:%i"),out,pirate_count)
end
if pirate_adjust_time ~= nil then
out = string.format(_("msgGM","%s\n seconds remaining until next pirate fleet adjustment check:%i"),out,math.floor(pirate_adjust_time - getScenarioTime()))
end
if greedy_pirate_danger ~= nil then
out = string.format(_("msgGM","%s\n greedy pirate danger:%i"),out,greedy_pirate_danger)
end
end
addGMMessage(out)
end)
if plot1 ~= nil and plot1 ~= kraylorDiversionarySabotage then
addGMFunction(_("buttonGM", "Skip Harassment"),function()
player = getPlayerShip(-1)
impulseUpgrade(player)
missileTubeUpgrade(player)
-- beamUpgrade(damage,cycle_time,power_use,heat_generated,artifact_scanned)
beamUpgrade(true,nil,true,true)
player.beam_damage_upgrade = true
jumpDriveUpgrade(player)
player:addReputationPoints(200)
plot1 = nil
plot1_type = nil
plot1_time = nil
plot1_defensive_time = nil
plot1_danger = nil
plot1_fleet_spawned = nil
plot1_defensive_fleet_spawned = nil
exuari_harassment_upgrade = true
plot2 = contractTarget
addGMMessage(_("msgGM", "Harassment skipped"))
missionSelection()
end)
end
if plot2 == contractTarget then
addGMFunction(_("buttonGM", "Skip Local Contracts"),function()
player = getPlayerShip(-1)
--add forward beam
local beam_index = 0
repeat
beam_index = beam_index + 1
until(player:getBeamWeaponRange(beam_index) < 1)
player:setBeamWeapon(beam_index,20,0,1200,6,5)
--add energy
player:setMaxEnergy(player:getMaxEnergy()*1.5)
player:setEnergy(player:getMaxEnergy())
--strengthen hull
player:setHullMax(player:getHullMax()*1.5)
player:setHull(player:getHullMax())
--strengthen shields
if player:getShieldCount() == 1 then
player:setShieldsMax(player:getShieldMax(0)*1.25)
else
player:setShieldsMax(player:getShieldMax(0)*1.25,player:getShieldMax(1)*1.25)
end
player:addToShipLog(string.format(_("contract-shipLog", "A rare long range contract has been posted at station %s"),first_station:getCallSign()),"Magenta")
transition_contract_message = true
plot2 = nil
addGMMessage(_("msgGM", "Local contracts skipped"))
missionSelection()
end)
end
addGMFunction(_("buttonGM", "Mark asteroids"),function()
for i,asteroid in pairs(research_asteroids) do
if asteroid.osmium ~= nil and asteroid.iridium ~= nil then
local ax, ay = asteroid:getPosition()
local d = 250
Zone():setPoints(ax-d,ay-d,ax+d,ay-d,ax+d,ay+d,ax-d,ay+d):setColor(128,0,0)
end
end
end)
end
-----------------
-- Utilities --
-----------------
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)
local function asteroidSize()
return random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20)
end
local object_list = {}
if randomize == nil then randomize = 0 end
if amount == nil then amount = 1 end
local arcLen = endArcClockwise - startArc
if startArc > endArcClockwise then
endArcClockwise = endArcClockwise + 360
arcLen = arcLen + 360
end
local last_object = nil