-
Notifications
You must be signed in to change notification settings - Fork 2
/
scenario_48_visitors.lua
executable file
·10839 lines (10836 loc) · 481 KB
/
scenario_48_visitors.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: Unwanted Visitors
-- Description: Get rid of the unwanted visitors. Various other missions follow (check the dispatch office). Missions may challenge the helm officer regardless of the difficulty level chosen. You may choose to continue or stand down after each mission.
---
--- Running all missions can take several hours. Consider real life limits when given the option to stand down at the end of each mission. Some missions are easier to complete in a warp ship than in a jump ship. Only one of the last set of missions may be selected.
---
--- If you have already played one or more missions and want to choose to replay or avoid a particular mission, choose a 'Selectable' variation. Choosing a 'Random' variation gives you no mission choice. The default is partial selection control allowing you to select a mission group.
---
--- Buttons on the Game Master screen can change the speed of objects in various orbits by 10 percent per click
---
--- If you are playing on a LAN and no longer want to hear voices from the server running a main screen, change file scenario_48_visitors.lua in the scripts folder such that 'server_voices = false' rather than 'server_voices = true' on line 37. Note: case is important, so match the case in the lua file, not what you see here (which is always upper case). After editing, you will need to restart the server.
---
--- Voice Actors:
--- Admiral U. E.
--- David Priddy
--- Jordy Kruijer
--- Kilted Klingon
--- Kristen Priddy
--- Nick Mercier
--- Peter Priddy
--- Slate https://www.amazon.com/T.-L.-Ford/e/B0034Q6Q2S
--- Stephen Priddy
---
--- Version 1
-- Type: Replayable Mission
-- Variation[Easy]: Easy goals and/or enemies
-- Variation[Hard]: Hard goals and/or enemies
-- Variation[Random]: Next mission is chosen at random
-- Variation[Selectable]: Next mission may be selected
-- Variation[Easy Random]: Easy goals and/or enemies, Next mission is chosen at random
-- Variation[Easy Selectable]: Easy goals and/or enemies, Next mission may be selected
-- Variation[Hard Random]: Hard goals and/or enemies, Next mission is chosen at random
-- Variation[Hard Selectable]: Hard goals and/or enemies, Next mission may be selected
require("utils.lua")
function init()
server_voices = true
if server_voices then
voice_queue = {}
voice_delay = 0
voice_played = {}
plotV = handleVoiceQueue
end
print(_VERSION)
updateDiagnostic = false
stationCommsDiagnostic = false
planetologistDiagnostic = false
moveDiagnostic = false
pollyDiagnostic = false
fixSatelliteDiagnostic = false
shipCommsDiagnostic = false
prefix_length = 0
suffix_index = 0
--stationCommunication could be nil (default), commsStation (embedded function) or comms_station_enhanced (external script)
stationCommunication = "commsStation"
setVariations()
setConstants() --missle type names, template names and scores, deployment directions, player ship names, etc.
setGoodsList()
setListOfStations()
buildLocalSolarSystem()
setOptionalMissions()
setPlots()
plotManager = plotDelay
plotM = movingObjects
plotT = workingTransports
plotCN = coolantNebulae
plotH = healthCheck --Damage to ship can kill repair crew members
healthCheckTimer = 5
healthCheckTimerInterval = 5
mission_complete_count = 0
mission_region = 0
mainGMButtons()
end
---------------------------
-- Game Master functions --
---------------------------
function mainGMButtons()
clearGMFunctions()
addGMFunction("Player ships",playerShipGMButtons)
addGMFunction("Adjust speed",adjustSpeedGMButtons)
addGMFunction("End Mission",endMissionGMButtons)
end
-- GM player ship functions
function playerShipGMButtons()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
if playerNarsil == nil then
addGMFunction("Narsil",createPlayerShipNarsil)
end
if playerHeadhunter == nil then
addGMFunction("Headhunter",createPlayerShipHeadhunter)
end
if playerBlazon == nil then
addGMFunction("Blazon",createPlayerShipBlazon)
end
if playerSting == nil then
addGMFunction("Sting",createPlayerShipSting)
end
end
function createPlayerShipNarsil()
playerNarsil = PlayerSpaceship():setTemplate("Atlantis"):setFaction("Human Navy"):setCallSign("Narsil")
playerNarsil:setTypeName("Proto-Atlantis")
playerNarsil:setRepairCrewCount(4) --more repair crew (vs 3)
playerNarsil:setImpulseMaxSpeed(70) --slower impulse max (vs 90)
playerNarsil:setRotationMaxSpeed(14) --faster spin (vs 10)
playerNarsil:setJumpDrive(false) --no Jump
playerNarsil:setWarpDrive(true) --add warp
playerNarsil:setHullMax(200) --weaker hull (vs 250)
playerNarsil:setHull(200)
playerNarsil:setShieldsMax(150,150) --weaker shields (vs 200)
playerNarsil:setShields(150,150)
playerNarsil:setWeaponTubeCount(6) --one more forward tube, less flexible ordnance
playerNarsil:setWeaponTubeDirection(0,0) --front facing
playerNarsil:setWeaponTubeExclusiveFor(0,"HVLI") --HVLI only
playerNarsil:setWeaponTubeDirection(1,-90) --left facing
playerNarsil:weaponTubeDisallowMissle(1,"Mine") --all but mine
playerNarsil:setWeaponTubeDirection(2,-90) --left facing
playerNarsil:setWeaponTubeExclusiveFor(2,"HVLI") --HVLI only
playerNarsil:setWeaponTubeDirection(3,90) --right facing
playerNarsil:weaponTubeDisallowMissle(3,"Mine") --all but mine
playerNarsil:setWeaponTubeDirection(4,90) --right facing
playerNarsil:setWeaponTubeExclusiveFor(4,"HVLI") --HVLI only
playerNarsil:setWeaponTubeDirection(5,180) --rear facing
playerNarsil:setWeaponTubeExclusiveFor(5,"Mine") --Mine only
playerNarsil:addReputationPoints(50)
removeGMFunction("Narsil")
end
function createPlayerShipHeadhunter()
playerHeadhunter = PlayerSpaceship():setTemplate("Piranha"):setFaction("Human Navy"):setCallSign("Headhunter")
playerHeadhunter:setTypeName("Redhook")
playerHeadhunter:setRepairCrewCount(4) --more repair crew (vs 2)
playerHeadhunter:setJumpDriveRange(2000,25000) --shorter jump drive range (vs 5-50)
playerHeadhunter:setHullMax(140) --stronger hull (vs 120)
playerHeadhunter:setHull(140)
playerHeadhunter:setShieldsMax(100, 100) --stronger shields (vs 70, 70)
playerHeadhunter:setShields(100, 100)
playerHeadhunter:setBeamWeapon(0, 10, 0, 1200.0, 4.0, 4) --one beam (vs 0)
playerHeadhunter:setBeamWeaponTurret(0, 80, 0, 1) --slow turret
playerHeadhunter:setWeaponTubeCount(7) --one fewer mine tube, but EMPs added
playerHeadhunter:setWeaponTubeDirection(6, 180) --mine tube points straight back
playerHeadhunter:setWeaponTubeExclusiveFor(0,"HVLI")
playerHeadhunter:setWeaponTubeExclusiveFor(1,"HVLI")
playerHeadhunter:setWeaponTubeExclusiveFor(2,"HVLI")
playerHeadhunter:setWeaponTubeExclusiveFor(3,"HVLI")
playerHeadhunter:setWeaponTubeExclusiveFor(4,"HVLI")
playerHeadhunter:setWeaponTubeExclusiveFor(5,"HVLI")
playerHeadhunter:setWeaponTubeExclusiveFor(6,"Mine")
playerHeadhunter:weaponTubeAllowMissle(1,"Homing")
playerHeadhunter:weaponTubeAllowMissle(1,"EMP")
playerHeadhunter:weaponTubeAllowMissle(1,"Nuke")
playerHeadhunter:weaponTubeAllowMissle(4,"Homing")
playerHeadhunter:weaponTubeAllowMissle(4,"EMP")
playerHeadhunter:weaponTubeAllowMissle(4,"Nuke")
playerHeadhunter:setWeaponStorageMax("Mine",4) --fewer mines (vs 8)
playerHeadhunter:setWeaponStorage("Mine", 4)
playerHeadhunter:setWeaponStorageMax("EMP",4) --more EMPs (vs 0)
playerHeadhunter:setWeaponStorage("EMP", 4)
playerHeadhunter:setWeaponStorageMax("Nuke",4) --fewer Nukes (vs 6)
playerHeadhunter:setWeaponStorage("Nuke", 4)
playerHeadhunter:addReputationPoints(50)
removeGMFunction("Headhunter")
end
function createPlayerShipBlazon()
playerBlazon = PlayerSpaceship():setTemplate("Striker"):setFaction("Human Navy"):setCallSign("Blazon")
playerBlazon:setTypeName("Stricken")
playerBlazon:setRepairCrewCount(2)
playerBlazon:setImpulseMaxSpeed(105)
playerBlazon:setRotationMaxSpeed(35)
playerBlazon:setShieldsMax(80,50)
playerBlazon:setShields(80,50)
playerBlazon:setBeamWeaponTurret(0,60,-15,2)
playerBlazon:setBeamWeaponTurret(1,60, 15,2)
playerBlazon:setBeamWeapon(2,20,0,1200,6,5)
playerBlazon:setWeaponTubeCount(3)
playerBlazon:setWeaponTubeDirection(0,-60)
playerBlazon:setWeaponTubeDirection(1,60)
playerBlazon:setWeaponTubeDirection(2,180)
playerBlazon:weaponTubeDisallowMissle(0,"Mine")
playerBlazon:weaponTubeDisallowMissle(1,"Mine")
playerBlazon:setWeaponTubeExclusiveFor(2,"Mine")
playerBlazon:setWeaponStorageMax("Homing",6)
playerBlazon:setWeaponStorage("Homing",6)
playerBlazon:setWeaponStorageMax("EMP",2)
playerBlazon:setWeaponStorage("EMP",2)
playerBlazon:setWeaponStorageMax("Nuke",2)
playerBlazon:setWeaponStorage("Nuke",2)
playerBlazon:setWeaponStorageMax("Mine",4)
playerBlazon:setWeaponStorage("Mine",4)
playerBlazon:addReputationPoints(50)
removeGMFunction("Blazon")
end
function createPlayerShipSting()
playerSting = PlayerSpaceship():setTemplate("Hathcock"):setFaction("Human Navy"):setCallSign("Sting")
playerSting:setTypeName("Surkov")
playerSting:setRepairCrewCount(3) --more repair crew (vs 2)
playerSting:setImpulseMaxSpeed(60) --faster impulse max (vs 50)
playerSting:setJumpDrive(false) --no jump
playerSting:setWarpDrive(true) --add warp
playerSting:setWeaponTubeCount(3) --one more tube for mines, no heavy ordnance
playerSting:setWeaponTubeDirection(0, -90)
playerSting:weaponTubeDisallowMissle(0,"Mine")
playerSting:weaponTubeDisallowMissle(0,"Nuke")
playerSting:weaponTubeDisallowMissle(0,"EMP")
playerSting:setWeaponStorageMax("Mine",3)
playerSting:setWeaponStorage("Mine",3)
playerSting:setWeaponStorageMax("Nuke",0)
playerSting:setWeaponStorage("Nuke",0)
playerSting:setWeaponStorageMax("EMP",0)
playerSting:setWeaponStorage("EMP",0)
playerSting:setWeaponTubeDirection(1, 90)
playerSting:weaponTubeDisallowMissle(1,"Mine")
playerSting:weaponTubeDisallowMissle(1,"Nuke")
playerSting:weaponTubeDisallowMissle(1,"EMP")
playerSting:setWeaponTubeDirection(2,180)
playerSting:setWeaponTubeExclusiveFor(2,"Mine")
playerSting:addReputationPoints(50)
removeGMFunction("Sting")
end
-- GM adjust speed functions
function adjustSpeedGMButtons()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Primus",adjustPrimusSpeed)
addGMFunction("Primus Moon",adjustPrimusMoonSpeed)
addGMFunction("Secondus",adjustSecondusSpeed)
addGMFunction("Secondus Station",adjustSecondusStationSpeed)
addGMFunction("Sol Belt 1",adjustSolBelt1Speed)
addGMFunction("Sol Belt 2",adjustSolBelt2Speed)
addGMFunction("Tertius",adjustTertiusSpeed)
addGMFunction("Tertius Moon Belt",adjustTertiusMoonBeltSpeed)
addGMFunction("Tertius Belt 2",adjustTertiusBelt2Speed)
end
function adjustPrimusSpeed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Primus",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Primus speed: %.1f",planetPrimus.orbit_speed))
planetPrimus.orbit_speed = planetPrimus.orbit_speed * 1.1
planetPrimus:setOrbit(planetSol,planetPrimus.orbit_speed)
print(string.format("new slower Primus speed: %.1f",planetPrimus.orbit_speed))
end)
addGMFunction("Faster",function()
print(string.format("current Primus speed: %.1f",planetPrimus.orbit_speed))
planetPrimus.orbit_speed = planetPrimus.orbit_speed * .9
planetPrimus:setOrbit(planetSol,planetPrimus.orbit_speed)
print(string.format("new faster Primus speed: %.1f",planetPrimus.orbit_speed))
end)
end
function adjustPrimusMoonSpeed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Primus Moon",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Primus moon speed: %.1f",planetPrimusMoonOrbitTime))
planetPrimusMoonOrbitTime = planetPrimusMoonOrbitTime * 1.1
planetPrimusMoon:setOrbit(planetPrimus,planetPrimusMoonOrbitTime)
print(string.format("new slower Primus moon speed: %.1f",planetPrimusMoonOrbitTime))
end)
addGMFunction("Faster",function()
print(string.format("current Primus moon speed: %.1f",planetPrimusMoonOrbitTime))
planetPrimusMoonOrbitTime = planetPrimusMoonOrbitTime * .9
planetPrimusMoon:setOrbit(planetPrimus,planetPrimusMoonOrbitTime)
print(string.format("new faster Primus moon speed: %.1f",planetPrimusMoonOrbitTime))
end)
end
function adjustSecondusSpeed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Secondus",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Secondus speed: %.1f",planetSecondus.orbit_speed))
planetSecondus.orbit_speed = planetSecondus.orbit_speed * 1.1
planetSecondus:setOrbit(planetSol,planetSecondus.orbit_speed)
print(string.format("new slower Secondus speed: %.1f",planetSecondus.orbit_speed))
end)
addGMFunction("Faster",function()
print(string.format("current Secondus speed: %.1f",planetSecondus.orbit_speed))
planetSecondus.orbit_speed = planetSecondus.orbit_speed * .9
planetSecondus:setOrbit(planetSol,planetSecondus.orbit_speed)
print(string.format("new faster Secondus speed: %.1f",planetSecondus.orbit_speed))
end)
end
function adjustSecondusStationSpeed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Secondus Stn",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Secondus station speed: %.3f",secondusStationOrbitIncrement))
secondusStationOrbitIncrement = secondusStationOrbitIncrement * .9
print(string.format("new slower Secondus station speed: %.3f",secondusStationOrbitIncrement))
end)
addGMFunction("Faster",function()
print(string.format("current Secondus station speed: %.3f",secondusStationOrbitIncrement))
secondusStationOrbitIncrement = secondusStationOrbitIncrement * 1.1
print(string.format("new faster Secondus station speed: %.3f",secondusStationOrbitIncrement))
end)
end
function adjustSolBelt1Speed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Sol Belt 1",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Sol Belt 1 speed: %.3f",belt1OrbitalSpeed))
belt1OrbitalSpeed = belt1OrbitalSpeed * .9
for i=1,#beltAsteroidList do
local ta = beltAsteroidList[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "belt1" then
ta.speed = belt1OrbitalSpeed
end
end
print(string.format("new slower Sol Belt 1 speed: %.3f",belt1OrbitalSpeed))
end)
addGMFunction("Faster",function()
print(string.format("current Sol Belt 1 speed: %.3f",belt1OrbitalSpeed))
belt1OrbitalSpeed = belt1OrbitalSpeed * 1.1
for i=1,#beltAsteroidList do
local ta = beltAsteroidList[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "belt1" then
ta.speed = belt1OrbitalSpeed
end
end
print(string.format("new faster Sol Belt 1 speed: %.3f",belt1OrbitalSpeed))
end)
end
function adjustSolBelt2Speed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Sol Belt 2",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Sol Belt 2 speed: %.3f",belt2OrbitalSpeed))
belt2OrbitalSpeed = belt2OrbitalSpeed * .9
for i=1,#beltAsteroidList do
local ta = beltAsteroidList[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "belt2" then
ta.speed = belt2OrbitalSpeed
end
end
print(string.format("new slower Sol Belt 2 speed: %.3f",belt2OrbitalSpeed))
end)
addGMFunction("Faster",function()
print(string.format("current Sol Belt 2 speed: %.3f",belt2OrbitalSpeed))
belt2OrbitalSpeed = belt2OrbitalSpeed * 1.1
for i=1,#beltAsteroidList do
local ta = beltAsteroidList[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "belt2" then
ta.speed = belt2OrbitalSpeed
end
end
print(string.format("new faster Sol Belt 2 speed: %.3f",belt2OrbitalSpeed))
end)
end
function adjustTertiusSpeed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Tertius",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Tertius speed: %.1f",planetTertius.orbit_speed))
planetTertius.orbit_speed = planetTertius.orbit_speed * 1.1
planetTertius:setOrbit(planetSol,planetTertius.orbit_speed)
print(string.format("new slower Tertius speed: %.1f",planetTertius.orbit_speed))
end)
addGMFunction("Faster",function()
print(string.format("current Tertius speed: %.1f",planetTertius.orbit_speed))
planetTertius.orbit_speed = planetTertius.orbit_speed * .9
planetTertius:setOrbit(planetSol,planetTertius.orbit_speed)
print(string.format("new faster Tertius speed: %.1f",planetTertius.orbit_speed))
end)
end
function adjustTertiusMoonBeltSpeed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Tertius Moon",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement))
tertiusOrbitalBodyIncrement = tertiusOrbitalBodyIncrement * .9
for i=1,#tertiusAsteroids do
local ta = tertiusAsteroids[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "tMoonBelt" then
ta.speed = tertiusOrbitalBodyIncrement
end
end
print(string.format("new slower Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement))
end)
addGMFunction("Faster",function()
print(string.format("current Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement))
tertiusOrbitalBodyIncrement = tertiusOrbitalBodyIncrement * 1.1
for i=1,#tertiusAsteroids do
local ta = tertiusAsteroids[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "tMoonBelt" then
ta.speed = tertiusOrbitalBodyIncrement
end
end
print(string.format("new faster Tertius Moon Belt speed: %.3f",tertiusOrbitalBodyIncrement))
end)
end
function adjustTertiusBelt2Speed()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Back from Tertius Belt 2",adjustSpeedGMButtons)
addGMFunction("Slower",function()
print(string.format("current Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement))
tertiusAsteroidBeltIncrement = tertiusAsteroidBeltIncrement * .9
for i=1,#tertiusAsteroids do
local ta = tertiusAsteroids[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "tBelt2" then
ta.speed = tertiusAsteroidBeltIncrement
end
end
for i=1,#tertiusAsteroidStations do
local tbs = tertiusAsteroidStations[i]
if tbs ~= nil and tbs:isValid() then
tbs.speed = tertiusAsteroidBeltIncrement
end
end
print(string.format("new slower Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement))
end)
addGMFunction("Faster",function()
print(string.format("current Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement))
tertiusAsteroidBeltIncrement = tertiusAsteroidBeltIncrement * 1.1
for i=1,#tertiusAsteroids do
local ta = tertiusAsteroids[i]
if ta ~= nil and ta:isValid() and ta.belt_id == "tBelt2" then
ta.speed = tertiusAsteroidBeltIncrement
end
end
for i=1,#tertiusAsteroidStations do
local tbs = tertiusAsteroidStations[i]
if tbs ~= nil and tbs:isValid() then
tbs.speed = tertiusAsteroidBeltIncrement
end
end
print(string.format("new faster Tertius Belt 2 speed: %.3f",tertiusAsteroidBeltIncrement))
end)
end
-- GM end mission functions
function endMissionGMButtons()
clearGMFunctions()
addGMFunction("Back to main",mainGMButtons)
addGMFunction("Human victory",function()
showEndStats()
victory("Human Navy")
end)
addGMFunction("Exuari victory",function()
showEndStats()
victory("Exuari")
end)
end
------------------------------------------
-- Initialization and utility functions --
------------------------------------------
function setVariations()
local svs = getScenarioVariation() --scenario variation string
if string.find(svs,"Easy") then
difficulty = .5
coolant_loss = .99999
coolant_gain = .01
elseif string.find(svs,"Hard") then
difficulty = 2
coolant_loss = .9999
coolant_gain = .0001
else
difficulty = 1 --default (normal)
coolant_loss = .99995
coolant_gain = .001
end
mission_choice = "Region Selectable" --valid choices are "Random", "Region Selectable" (default) and "Selectable"
if string.find(svs,"Selectable") then
mission_choice = "Selectable"
elseif string.find(svs,"Random") then
mission_choice = "Random"
end
gameTimeLimit = 0
playWithTimeLimit = false
end
function setConstants()
repeatExitBoundary = 100
scarceResources = false
--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}
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}
-- 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}
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}
--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"}
playerShipNamesForAtlantisII = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"}
playerShipNamesForProtoAtlantis = {"Narsil", "Blade", "Decapitator", "Trisect", "Sabre"}
playerShipNamesForMaverick = {"Angel", "Thunderbird", "Roaster", "Magnifier", "Hedge"}
playerShipNamesForCrucible = {"Sling", "Stark", "Torrid", "Kicker", "Flummox"}
playerShipNamesForSurkov = {"Sting", "Sneak", "Bingo", "Thrill", "Vivisect"}
playerShipNamesForStricken = {"Blazon", "Streaker", "Pinto", "Spear", "Javelin"}
playerShipNamesForAtlantisII = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"}
playerShipNamesForRedhook = {"Headhunter", "Thud", "Troll", "Scalper", "Shark"}
playerShipNamesForLeftovers = {"Foregone","Righteous","Masher"}
if server_voices then
primusNames = {"Minos","Talos","Primus"}
secondusNames = {"Secondus","Aurora","Covenant"}
tertiusNames = {"Tertius","Megas","Tadmore"}
solNames = {"Sun","Tau Ceti","Barnard"}
else
primusNames = {"Minos","Talos","Thor","Minotaur","Thanatos","Hades","Tartarus","Erebus","Primus"}
secondusNames = {"New Terra","Gaia","Home","Secondus","Thulcandra","Territa","Garth","Aurora","Covenant"}
tertiusNames = {"Cat's Eye","Tertius","Dagoba","Pitcairn","Tl'ho","Megas","Amateru","Tadmore","Brahe"}
solNames = {"Sol","Sun","Groombridge 34","Tau Ceti","Wolf 1061","Gliese 876","Barnard"}
end
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"}
virus_status_functions = {virusStatusP1,virusStatusP2,virusStatusP3,virusStatusP4,virusStatusP5,virusStatusP6,virusStatusP7,virusStatusP8}
-- short clip name length in seconds
voice_clips = {
["Avery01"] = 0.971,
["Avery02"] = 7.187,
["Ellis01"] = 14.433,
["Ellis02"] = 2.810,
["Enrique01"] = 2.995,
["Enrique02"] = 1.741,
["Enrique03"] = 2.241,
["Enrique04"] = 4.040,
["Enrique05"] = 0.720,
["Enrique06"] = 2.345,
["Enrique07"] = 3.170,
["Enrique08"] = 2.322,
["Enrique09"] = 1.358,
["Enrique10"] = 0.441,
["Enrique11"] = 2.682,
["Enrique12"] = 1.858,
["Enrique13"] = 2.055,
["Enrique14"] = 1.544,
["Enrique15"] = 1.486,
["Enrique16"] = 2.229,
["Enrique17"] = 2.159,
["Enrique18"] = 3.413,
["Enrique19"] = 2.728,
["Enrique20"] = 3.239,
["Enrique21"] = 0.467,
["Enrique22"] = 1.405,
["Enrique23"] = 2.125,
["Hayden01"] = 5.468,
["Hayden02"] = 11.378,
["Hayden03"] = 5.027,
["Hayden04"] = 11.459,
["Hayden05"] = 0.569,
["Hayden06"] = 8.731,
["Hayden07"] = 1.463,
["Hayden08"] = 2.264,
["Jamie01"] = 7.883,
["Jamie02"] = 8.406,
["Karsyn01"] = 1.231,
["Karsyn02"] = 4.841,
["Ozzie01"] = 0.360,
["Ozzie02"] = 0.557,
["Ozzie03"] = 0.360,
["Ozzie04"] = 1.707,
["Ozzie05"] = 1.335,
["Ozzie06"] = 1.161,
["Ozzie07"] = 0.418,
["Ozzie08"] = 0.615,
["Ozzie09"] = 0.929,
["Parker01"] = 1.753,
["Parker02"] = 1.614,
["Pat01Aurora"] = 7.327,
["Pat01Covenant"] = 7.248,
["Pat01Secondus"] = 7.587,
["Pat02Minos"] = 15.140,
["Pat02Primus"] = 15.681,
["Pat02Talos"] = 15.681,
["Pat03"] = 18.429,
["Pat04"] = 5.354,
["Pat05"] = 3.179,
["Pat06"] = 6.672,
["Peyton01"] = 12.327,
["Peyton02"] = 1.792,
["Phoenix01"] = 1.815,
["Polly0110"] = 6.966,
["Polly0120"] = 7.094,
["Polly0140"] = 7.523,
["Polly02"] = 8.893,
["Polly03"] = 14.710,
["Polly04"] = 2.844,
["Polly05"] = 9.021,
["Polly06"] = 8.440,
["Polly07"] = 9.880,
["Quinn01"] = 1.033,
["Quinn02"] = 1.858,
["Reese01"] = 4.836,
["Reese02"] = 8.681,
["Rory01"] = 1.521,
["Rory02"] = 1.939,
["Rory03"] = 2.717,
["Rory04"] = 3.251,
["Skyler01"] = 2.798,
["Skyler02"] = 4.203,
["Skyler03"] = 4.923,
["Taylor01"] = 1.022,
["Taylor02"] = 8.742,
["Tracy01Megas"] = 4.098,
["Tracy01Tadmore"] = 3.796,
["Tracy01Tertius"] = 3.924,
["Tracy02"] = 2.984,
["Tracy03"] = 2.659,
["Tracy04"] = 1.591,
["Tracy05"] = 10.913,
["Tracy06InsideAurora"] = 4.934,
["Tracy06InsideCovenant"] = 4.888,
["Tracy06InsideSecondus"] = 5.457,
["Tracy06OutsideAurora"] = 4.992,
["Tracy06OutsideCovenant"] = 4.841,
["Tracy06OutsideSecondus"] = 5.039,
["Tracy07"] = 2.245,
["Tracy08"] = 2.090,
["Tracy09"] = 2.020,
["Tracy10"] = 2.229,
["Tracy11"] = 1.057,
["Tracy12"] = 1.231,
["Tracy13"] = 3.344,
["Tracy14"] = 0.775,
}
cargoInventoryList = {}
table.insert(cargoInventoryList,cargoInventory1)
table.insert(cargoInventoryList,cargoInventory2)
table.insert(cargoInventoryList,cargoInventory3)
table.insert(cargoInventoryList,cargoInventory4)
table.insert(cargoInventoryList,cargoInventory5)
table.insert(cargoInventoryList,cargoInventory6)
table.insert(cargoInventoryList,cargoInventory7)
table.insert(cargoInventoryList,cargoInventory8)
get_coolant_function = {}
table.insert(get_coolant_function,getCoolant1)
table.insert(get_coolant_function,getCoolant2)
table.insert(get_coolant_function,getCoolant3)
table.insert(get_coolant_function,getCoolant4)
table.insert(get_coolant_function,getCoolant5)
table.insert(get_coolant_function,getCoolant6)
table.insert(get_coolant_function,getCoolant7)
table.insert(get_coolant_function,getCoolant8)
end
function buildLocalSolarSystem()
stationList = {}
humanStationList = {}
humanStationStrength = 0
humanStationsRemain = true
humanStationDestroyedNameList = {}
humanStationDestroyedValue = {}
neutralStationList = {}
neutralStationStrength = 0
neutralStationsRemain = true
neutralStationDestroyedNameList = {}
neutralStationDestroyedValue = {}
clueStations = {}
exuariStationList = {}
exuariStationStrength = 0
orbitChoice = "random" --could be lo, hi or random
-- central star (Sol)
solX, solY = vectorFromAngle(random(20,70),random(100000,200000))
planetSol = Planet():setPosition(solX,solY):setPlanetRadius(1000):setDistanceFromMovementPlane(-2000):setPlanetAtmosphereTexture("planets/star-1.png"):setPlanetAtmosphereColor(1.0,1.0,1.0)
planetSol:setCallSign(solNames[math.random(1,#solNames)])
-------------------------------
-- innermost planet (Primus) --
-------------------------------
primusOrbit = random(8000,20000)
pla = random(0,360)
plx, ply = vectorFromAngle(pla,primusOrbit)
primusRadius = random(800,1200)
planetPrimus = Planet():setPosition(solX+plx,solY+ply):setPlanetRadius(primusRadius):setAxialRotationTime(random(200,250)):setDistanceFromMovementPlane(-primusRadius/2)
planetPrimus:setPlanetSurfaceTexture("planets/planet-2.png"):setPlanetAtmosphereTexture("planets/atmosphere.png"):setPlanetAtmosphereColor(0.2,0.2,0.1)
planetPrimus:setCallSign(primusNames[math.random(1,#primusNames)])
lo = 400
hi = 500
if orbitChoice == "lo" then
planetPrimus.orbit_speed = lo/difficulty
elseif orbitChoice == "hi" then
planetPrimus.orbit_speed = hi/difficulty
else
planetPrimus.orbit_speed = random(lo,hi)/difficulty
end
planetPrimus:setOrbit(planetSol,planetPrimus.orbit_speed)
-- moon orbiting Primus
primusMoonOrbit = random(3000,5000)
pla = random(0,360)
plx, ply = vectorFromAngle(pla,primusMoonOrbit)
primusX, primusY = planetPrimus:getPosition()
primusMoonRadius = random(200,400)
planetPrimusMoon = Planet():setPosition(primusX+plx,primusY+ply):setPlanetRadius(primusMoonRadius):setAxialRotationTime(random(60,100)):setDistanceFromMovementPlane(-primusMoonRadius/2)
lo = 200
hi = 300
if orbitChoice == "lo" then
planetPrimusMoonOrbitTime = lo/difficulty
elseif orbitChoice == "hi" then
planetPrimusMoonOrbitTime = hi/difficulty
else
planetPrimusMoonOrbitTime = random(lo,hi)/difficulty
end
planetPrimusMoon:setPlanetSurfaceTexture("planets/moon-1.png")
planetPrimusMoon:setOrbit(planetPrimus,planetPrimusMoonOrbitTime)
-- station orbiting Primus
plx, ply = vectorFromAngle(pla+180,primusMoonOrbit)
psx = primusX+plx
psy = primusY+ply
stationStaticAsteroids = false
stationFaction = "Human Navy" --set station faction
si = math.random(1,#placeStation) --station index
pStation = placeStation[si]() --place selected station
table.remove(placeStation,si) --remove station from placement list
humanStationStrength = humanStationStrength + setStationStrength(pStation)
pStation:onDestruction(humanStationDestroyed)
pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetPrimus:getCallSign(),primusMoonOrbit/1000)
table.insert(stationList,pStation) --save station in general station list
table.insert(humanStationList,pStation) --save station in friendly station list
table.insert(clueStations,pStation) --1
primusStation = pStation
-- player spawn band (5 units wide: 5000)
primusOuter = primusOrbit + primusMoonOrbit + primusMoonRadius + 500
playerSpawnBand = random(primusOuter, primusOuter + 50000)
--------------------------------------
-- second closest planet (Secondus) --
--------------------------------------
secondusRadius = random(2500,3500)
secondusMoonOrbit = random(6000,10000)
secondusMoonRadius = random(400,600)
if (playerSpawnBand - primusOuter) > ((secondusMoonOrbit*2) + (secondusMoonRadius*2) + 5000) then
secondusOrbit = (playerSpawnBand + primusOuter)/2 --players spawn outside Secondus
else
secondusOrbit = playerSpawnBand + secondusMoonOrbit + secondusMoonRadius + 5000 --players spawn inside Secondus
end
pla = random(0,360)
plx, ply = vectorFromAngle(pla,secondusOrbit)
planetSecondus = Planet():setPosition(solX+plx,solY+ply):setPlanetRadius(secondusRadius):setAxialRotationTime(random(250,300)):setDistanceFromMovementPlane(-secondusRadius/2)
planetSecondus:setPlanetSurfaceTexture("planets/planet-1.png"):setPlanetAtmosphereTexture("planets/atmosphere.png"):setPlanetAtmosphereColor(0.2,0.2,1.0):setPlanetCloudTexture("planets/clouds-1.png")
planetSecondus:setCallSign(secondusNames[math.random(1,#secondusNames)])
lo = 1000
hi = 2000
if orbitChoice == "lo" then
planetSecondus.orbit_speed = lo/difficulty
elseif orbitChoice == "hi" then
planetSecondus.orbit_speed = hi/difficulty
else
planetSecondus.orbit_speed = random(lo,hi)/difficulty
end
planetSecondus:setOrbit(planetSol,planetSecondus.orbit_speed)
-- moon orbiting Secondus
pla = random(0,360)
plx, ply = vectorFromAngle(pla,secondusMoonOrbit)
secondusX, secondusY = planetSecondus:getPosition()
planetSecondusMoon = Planet():setPosition(secondusX+plx,secondusY+ply):setPlanetRadius(secondusMoonRadius):setAxialRotationTime(random(120,160)):setDistanceFromMovementPlane(-secondusMoonRadius/2)
lo = 80
hi = 100
if orbitChoice == "lo" then
planetSecondusMoonOrbitTime = lo/difficulty
elseif orbitChoice == "hi" then
planetSecondusMoonOrbitTime = hi/difficulty
else
planetSecondusMoonOrbitTime = random(lo,hi)/difficulty
end
planetSecondusMoon:setPlanetSurfaceTexture("planets/moon-1.png"):setOrbit(planetSecondus,planetSecondusMoonOrbitTime)
-- stations orbiting Secondus
secondusStationOrbitIncrement = .05*difficulty
secondusStations = {}
secondusStationOrbit = (secondusRadius + secondusMoonOrbit - secondusMoonRadius)/2
stationSize = "Small Station"
--secondus station 1
plx, ply = vectorFromAngle(0,secondusStationOrbit)
psx = secondusX + plx
psy = secondusY + ply
si = math.random(1,#placeStation) --station index
pStation = placeStation[si]() --place selected station
table.remove(placeStation,si) --remove station from placement list
humanStationStrength = humanStationStrength + setStationStrength(pStation)
pStation:onDestruction(humanStationDestroyed)
pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetSecondus:getCallSign(),secondusStationOrbit/1000)
table.insert(stationList,pStation) --save station in general station list
table.insert(humanStationList,pStation) --save station in friendly station list
table.insert(secondusStations,pStation)
table.insert(clueStations,pStation) --2
pStation.angle = 0
--secondus station 2
plx, ply = vectorFromAngle(120,secondusStationOrbit)
psx = secondusX + plx
psy = secondusY + ply
si = math.random(1,#placeStation) --station index
pStation = placeStation[si]() --place selected station
table.remove(placeStation,si) --remove station from placement list
humanStationStrength = humanStationStrength + setStationStrength(pStation)
pStation:onDestruction(humanStationDestroyed)
pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetSecondus:getCallSign(),secondusStationOrbit/1000)
table.insert(stationList,pStation) --save station in general station list
table.insert(humanStationList,pStation) --save station in friendly station list
table.insert(secondusStations,pStation)
table.insert(clueStations,pStation) --3
pStation.angle = 120
--secondus station 3
plx, ply = vectorFromAngle(240,secondusStationOrbit)
psx = secondusX + plx
psy = secondusY + ply
si = math.random(1,#placeStation) --station index
pStation = placeStation[si]() --place selected station
table.remove(placeStation,si) --remove station from placement list
humanStationStrength = humanStationStrength + setStationStrength(pStation)
pStation:onDestruction(humanStationDestroyed)
pStation.comms_data.orbit = string.format("orbiting %s at a distance of %.1fU",planetSecondus:getCallSign(),secondusStationOrbit/1000)
table.insert(stationList,pStation) --save station in general station list
table.insert(humanStationList,pStation) --save station in friendly station list
table.insert(secondusStations,pStation)
table.insert(clueStations,pStation) --4
pStation.angle = 240
stationSize = nil
---------------------------------------
-- determine asteroid belt locations --
---------------------------------------
secondusOuter = secondusOrbit + secondusMoonOrbit + secondusMoonRadius
if secondusOrbit > playerSpawnBand then --players spawn inside Secondus
beltOrbit1 = playerSpawnBand + 3000
beltOrbit1Width = 1000
beltOrbit2 = secondusOuter + random(1000,10000)
beltOrbit2Width = beltOrbit2 - secondusOuter
else --players spawn outside Secondus
beltOrbit1Width = (playerSpawnBand - 2500) - secondusOuter - 500
beltOrbit1 = (secondusOuter + (playerSpawnBand - 2500))/2
beltOrbit2 = playerSpawnBand + random(3500,10000)
beltOrbit2Width = beltOrbit2 - (playerSpawnBand + 2500)
end
--------------------------------
-- populate player spawn band --
--------------------------------
--pick player spawn points within player spawn band
playerSpawnAngle = random(0,360)
plx, ply = vectorFromAngle(playerSpawnAngle,playerSpawnBand)
playerSpawn1X = solX+plx
playerSpawn1Y = solY+ply
playerSpawn2X = solX-plx
playerSpawn2Y = solY-ply
--stations in player spawn band
playerSpawnBandStations = {}
sa1 = playerSpawnAngle
sa2 = sa1 + 180
for i=1,4 do
sa1 = sa1 + random(18,36)
plx, ply = vectorFromAngle(sa1,playerSpawnBand)
psx = solX+plx
psy = solY+ply
if random(1,100) < 15 then
stationFaction = "Human Navy" --set station faction
else
stationFaction = "Independent" --set station faction
end
si = math.random(1,#placeStation) --station index
pStation = placeStation[si]() --place selected station
table.remove(placeStation,si) --remove station from placement list
if stationFaction == "Human Navy" then
humanStationStrength = humanStationStrength + setStationStrength(pStation)
pStation:onDestruction(humanStationDestroyed)
table.insert(humanStationList,pStation) --save station in friendly station list
else
neutralStationStrength = neutralStationStrength + setStationStrength(pStation)
pStation:onDestruction(neutralStationDestroyed)
table.insert(neutralStationList,pStation) --save station in friendly station list
end
table.insert(stationList,pStation) --save station in general station list
table.insert(playerSpawnBandStations,pStation)
sa2 = sa2 + random(18,36)
plx, ply = vectorFromAngle(sa2,playerSpawnBand)
psx = solX+plx
psy = solY+ply
if random(1,100) < 15 then
stationFaction = "Human Navy" --set station faction
else
stationFaction = "Independent" --set station faction
end
si = math.random(1,#placeStation) --station index
pStation = placeStation[si]() --place selected station
table.remove(placeStation,si) --remove station from placement list
if stationFaction == "Human Navy" then
humanStationStrength = humanStationStrength + setStationStrength(pStation)
pStation:onDestruction(humanStationDestroyed)
table.insert(humanStationList,pStation) --save station in friendly station list
else
neutralStationStrength = neutralStationStrength + setStationStrength(pStation)
pStation:onDestruction(neutralStationDestroyed)
table.insert(neutralStationList,pStation) --save station in friendly station list
end
table.insert(stationList,pStation) --save station in general station list
table.insert(playerSpawnBandStations,pStation)
end
--transports in player spawn band
transportsInPlayerSpawnBandList = {}
transportCheckDelayInterval = 4
transportCheckDelayTimer = transportCheckDelayInterval
local transportType = {"Personnel","Goods","Garbage","Equipment","Fuel"}
local 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 = playerSpawnBandStations[1]:getPosition()
local tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[1]:getFaction()):setCommsScript(""):setCommsFunction(commsShip)
tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[1]:getFaction()))
tempTransport.targetStart = playerSpawnBandStations[1]
tempTransport.targetEnd = playerSpawnBandStations[3]
if random(1,100) < 50 then
tempTransport:orderDock(tempTransport.targetStart)
else
tempTransport:orderDock(tempTransport.targetEnd)
end
table.insert(transportsInPlayerSpawnBandList,tempTransport)
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 = playerSpawnBandStations[3]:getPosition()
tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[3]:getFaction()):setCommsScript(""):setCommsFunction(commsShip)
tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[3]:getFaction()))
tempTransport.targetStart = playerSpawnBandStations[3]
tempTransport.targetEnd = playerSpawnBandStations[5]
if random(1,100) < 50 then
tempTransport:orderDock(tempTransport.targetStart)
else
tempTransport:orderDock(tempTransport.targetEnd)
end
table.insert(transportsInPlayerSpawnBandList,tempTransport)
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 = playerSpawnBandStations[5]:getPosition()
tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(playerSpawnBandStations[5]:getFaction()):setCommsScript(""):setCommsFunction(commsShip)
tempTransport:setCallSign(generateCallSign(nil,playerSpawnBandStations[5]:getFaction()))
tempTransport.targetStart = playerSpawnBandStations[5]
tempTransport.targetEnd = playerSpawnBandStations[7]
if random(1,100) < 50 then
tempTransport:orderDock(tempTransport.targetStart)
else
tempTransport:orderDock(tempTransport.targetEnd)
end
table.insert(transportsInPlayerSpawnBandList,tempTransport)
name = transportType[math.random(1,#transportType)]