-
Notifications
You must be signed in to change notification settings - Fork 6
/
scenario_58_race.lua
3631 lines (3628 loc) · 143 KB
/
scenario_58_race.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: Fermi 500
-- Description: Race three laps of four waypoints (1 to 2 to 3 to 4 to 1 = 1 lap) in the shortest time. Play for time by yourself, but have more fun with multiple player ships.
---
--- Placement points depend on the number of racers present at the starting point when the race starts. Precise values are given to Relay at that time. Each target drone of yours shot earns one point. Shoot an opponent's drone and they get the point.
---
--- Before the race starts, scope out the course, visit some stations, maybe improve your ship for the race. But, watch your time carefully. If you are not at waypoint 1 at the start of the race, your ship will be destroyed. Your competitors may also try to destroy you despite being your nominal allies, so beware
-- Type: Race
-- Setting[Shoot Back]: Configures whether the targets along the race course shoot back or not
-- Shoot Back[No|Default]: Targets along the course do not shoot back
-- Shoot Back[Yes]: Targets along the course shoot back
-- Setting[Chase]: Configures whether or not random enemies will chase the racers
-- Chase[No|Default]: Random enemies will not appear to chase the racers
-- Chase[Yes]: Random enemies will appear to chase the racers
-- Setting[Hazards]: Configures whether or not hazards will appear at the race point markers to impede the race
-- Hazards[No|Default]: No hazards will appear at the race point markers to impede the race
-- Hazards[Yes]: Hazards will appear at the race point markers to impeded the race
-- Setting[Ship Name]: Configures whether player ship names and control codes will be predefined or random. See Game master screen to get control codes
-- Ship Name[Predefined|Default]: Player ship names and control codes will be predefined as scripted. See Game master screen to get control codes
-- Ship Name[Random]: Player ship names will be selected at random from a list of names and player ship control codes will be randomly generated. See Game master screen to get control codes
require("utils.lua")
----------------------
-- Initialization --
----------------------
function init()
scenario_version = "2.1.3"
print(string.format(" ----- Scenario: Fermi 500 ----- Version %s -----",scenario_version))
print(_VERSION)
-- 27 types of goods so far
goodsList = { {"food",0},
{"medicine",0},
{"nickel",0},
{"platinum",0},
{"gold",0},
{"dilithium",0},
{"tritanium",0},
{"luxury",0},
{"cobalt",0},
{"impulse",0},
{"warp",0},
{"shield",0},
{"tractor",0},
{"repulsor",0},
{"beam",0},
{"optic",0},
{"robotic",0},
{"filament",0},
{"transporter",0},
{"sensor",0},
{"communication",0},
{"autodoc",0},
{"lifter",0},
{"android",0},
{"nanites",0},
{"software",0},
{"battery",0} }
diagnostic = true
player_count = 0
player_start_list = {}
player_ship_stats = {
["MP52 Hornet"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 4000, probes = 10, },
["Piranha"] = { strength = 16, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 6000, probes = 15, },
["Flavia P.Falcon"] = { strength = 13, cargo = 15, distance = 200, long_range_radar = 40000, short_range_radar = 5000, probes = 27 , },
["Phobos M3P"] = { strength = 19, cargo = 10, distance = 200, long_range_radar = 25000, short_range_radar = 5000, probes = 15, },
["Atlantis"] = { strength = 52, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, probes = 25, },
["Player Cruiser"] = { strength = 40, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, probes = 22, },
["Player Missile Cr."] = { strength = 45, cargo = 8, distance = 200, long_range_radar = 35000, short_range_radar = 6000, probes = 26, },
["Player Fighter"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 15000, short_range_radar = 4500, probes = 11, },
["Benedict"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 30000, short_range_radar = 5000, probes = 20, },
["Kiriya"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 35000, short_range_radar = 5000, probes = 20, },
["Striker"] = { strength = 8, cargo = 4, distance = 200, long_range_radar = 35000, short_range_radar = 5000, probes = 17, },
["ZX-Lindworm"] = { strength = 8, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 5500, probes = 12, },
["Repulse"] = { strength = 14, cargo = 12, distance = 200, long_range_radar = 38000, short_range_radar = 5000, probes = 35, },
["Ender"] = { strength = 100, cargo = 20, distance = 2000,long_range_radar = 45000, short_range_radar = 7000, probes = 24, },
["Nautilus"] = { strength = 12, cargo = 7, distance = 200, long_range_radar = 22000, short_range_radar = 4000, probes = 23, },
["Hathcock"] = { strength = 30, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, probes = 20, },
["Maverick"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 4000, probes = 18, },
["Crucible"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 6000, probes = 20, },
}
--Player ship name lists to supplant standard randomized call sign generation
playerShipNamesFor = {}
playerShipNamesFor["MP52 Hornet"] = {"Dragonfly","Scarab","Mantis","Yellow Jacket","Jimminy","Flik","Thorny","Buzz"}
playerShipNamesFor["Piranha"] = {"Razor","Biter","Ripper","Voracious","Carnivorous","Characid","Vulture","Predator"}
playerShipNamesFor["Flavia P.Falcon"] = {"Ladyhawke","Hunter","Seeker","Gyrefalcon","Kestrel","Magpie","Bandit","Buccaneer"}
playerShipNamesFor["Phobos M3P"] = {"Blinder","Shadow","Distortion","Diemos","Ganymede","Castillo","Thebe","Retrograde"}
playerShipNamesFor["Atlantis"] = {"Excalibur","Thrasher","Punisher","Vorpal","Protang","Drummond","Parchim","Coronado"}
playerShipNamesFor["Player Cruiser"] = {"Excelsior","Velociraptor","Thunder","Kona","Encounter","Perth","Aspern","Panther"}
playerShipNamesFor["Player Missile Cr."] = {"Projectus","Hurlmeister","Flinger","Ovod","Amatola","Nakhimov","Antigone"}
playerShipNamesFor["Player Fighter"] = {"Buzzer","Flitter","Zippiticus","Hopper","Molt","Stinger","Stripe"}
playerShipNamesFor["Benedict"] = {"Elizabeth","Ford","Vikramaditya","Liaoning","Avenger","Naruebet","Washington","Lincoln","Garibaldi","Eisenhower"}
playerShipNamesFor["Kiriya"] = {"Cavour","Reagan","Gaulle","Paulo","Truman","Stennis","Kuznetsov","Roosevelt","Vinson","Old Salt"}
playerShipNamesFor["Striker"] = {"Sparrow","Sizzle","Squawk","Crow","Snowbird","Hawk"}
playerShipNamesFor["ZX-Lindworm"] = {"Seagull","Catapult","Blowhard","Flapper","Nixie","Pixie","Tinkerbell"}
playerShipNamesFor["Repulse"] = {"Fiddler","Brinks","Loomis","Mowag","Patria","Pandur","Terrex","Komatsu","Eitan"}
playerShipNamesFor["Ender"] = {"Mongo","Godzilla","Leviathan","Kraken","Jupiter","Saturn"}
playerShipNamesFor["Nautilus"] = {"October", "Abdiel", "Manxman", "Newcon", "Nusret", "Pluton", "Amiral", "Amur", "Heinkel", "Dornier"}
playerShipNamesFor["Hathcock"] = {"Hayha", "Waldron", "Plunkett", "Mawhinney", "Furlong", "Zaytsev", "Pavlichenko", "Fett", "Hawkeye", "Hanzo"}
playerShipNamesFor["Maverick"] = {"Angel", "Thunderbird", "Roaster", "Magnifier", "Hedge"}
playerShipNamesFor["Crucible"] = {"Sling", "Stark", "Torrid", "Kicker", "Flummox"}
playerShipNamesFor["Leftovers"] = {
"Adelphi",
"Ahwahnee",
"Akagi",
"Akira",
"Al-Batani",
"Ambassador",
"Andromeda",
"Antares",
"Apollo",
"Appalachia",
"Arcos",
"Aries",
"Athena",
"Beethoven",
"Bellerophon",
"Biko",
"Bonchune",
"Bozeman",
"Bradbury",
"Brattain",
"Budapest",
"Buran",
"Cairo",
"Calypso",
"Capricorn",
"Carolina",
"Centaur",
"Challenger",
"Charleston",
"Chekov",
"Cheyenne",
"Clement",
"Cochraine",
"Columbia",
"Concorde",
"Constantinople",
"Constellation",
"Constitution",
"Copernicus",
"Cousteau",
"Crazy Horse",
"Crockett",
"Daedalus",
"Danube",
"Defiant",
"Deneva",
"Denver",
"Discovery",
"Drake",
"Endeavor",
"Endurance",
"Equinox",
"Essex",
"Exeter",
"Farragut",
"Fearless",
"Fleming",
"Foregone",
"Fredrickson",
"Freedom",
"Gage",
"Galaxy",
"Galileo",
"Gander",
"Ganges",
"Gettysburg",
"Ghandi",
"Goddard",
"Grissom",
"Hathaway",
"Helin",
"Hera",
"Heracles",
"Hokule'a",
"Honshu",
"Hood",
"Hope",
"Horatio",
"Horizon",
"Interceptor",
"Intrepid",
"Istanbul",
"Jenolen",
"Kearsarge",
"Kongo",
"Korolev",
"Kyushu",
"Lakota",
"Lalo",
"Lancer",
"Lantree",
"LaSalle",
"Leeds",
"Lexington",
"Luna",
"Magellan",
"Majestic",
"Malinche",
"Maryland",
"Masher",
"Mediterranean",
"Mekong",
"Melbourne",
"Merced",
"Merrimac",
"Miranda",
"Nash",
"New Orleans",
"Newton",
"Niagra",
"Nobel",
"Norway",
"Nova",
"Oberth",
"Odyssey",
"Orinoco",
"Osiris",
"Pasteur",
"Pegasus",
"Peregrine",
"Poseidon",
"Potempkin",
"Princeton",
"Prokofiev",
"Prometheus",
"Proxima",
"Rabin",
"Raman",
"Relativity",
"Reliant",
"Renaissance",
"Renegade",
"Republic",
"Rhode Island",
"Rigel",
"Righteous",
"Rubicon",
"Rutledge",
"Sarajevo",
"Saratoga",
"Scimitar",
"Sequoia",
"Shenandoah",
"ShirKahr",
"Sitak",
"Socrates",
"Sovereign",
"Spector",
"Springfield",
"Stargazer",
"Steamrunner",
"Surak",
"Sutherland",
"Sydney",
"T'Kumbra",
"Thomas Paine",
"Thunderchild",
"Tian An Men",
"Titan",
"Tolstoy",
"Trial",
"Trieste",
"Trinculo",
"Tripoli",
"Ulysses",
"Valdemar",
"Valiant",
"Volga",
"Voyager",
"Wambundu",
"Waverider",
"Wellington",
"Wells",
"Wyoming",
"Yamaguchi",
"Yamato",
"Yangtzee Kiang",
"Yeager",
"Yorkshire",
"Yorktown",
"Yosemite",
"Yukon",
"Zapata",
"Zhukov",
"Zodiac",
}
control_code_stem = { --All control codes must use capital letters or they will not work.
"ALWAYS",
"ASTRO",
"BLACK",
"BLANK",
"BLUE",
"BRIGHT",
"BROWN",
"CHAIN",
"CHURCH",
"CORNER",
"DARK",
"DOORWAY",
"DOUBLE",
"DULL",
"ELBOW",
"EMPTY",
"EPSILON",
"FAST",
"FLOWER",
"FLY",
"FROZEN",
"GIG",
"GREEN",
"GLOW",
"HAND",
"HAMMER",
"INK",
"INTEL",
"JOUST",
"JUMP",
"KEY",
"KINDLE",
"LAP",
"LETTER",
"LIST",
"MORNING",
"NEXT",
"OPEN",
"ORANGE",
"OUTSIDE",
"PURPLE",
"QUARTER",
"QUIET",
"RED",
"SHINE",
"SIGMA",
"STAR",
"STREET",
"TOKEN",
"THIRSTY",
"UNDER",
"VANISH",
"WHITE",
"WRENCH",
"YELLOW",
}
reward_grid = {
{10}, --1
{10,5}, --2
{10,5,1}, --3
{10,5,1,0}, --4
{10,5,1,0,0}, --5
{10,5,3,1,0,0}, --6
{10,5,3,1,0,0,0}, --7
{10,7,4,2,1,0,0,0}, --8
{10,7,4,2,1,0,0,0,0}, --9
{10,7,4,2,1,0,0,0,0,0}, --10
{10,7,5,3,2,1,0,0,0,0,0}, --11
{10,7,5,3,2,1,0,0,0,0,0,0}, --12
{10,7,5,3,2,1,0,0,0,0,0,0,0}, --13
{10,8,6,4,3,2,1,0,0,0,0,0,0,0}, --14
{10,8,6,4,3,2,1,0,0,0,0,0,0,0,0}, --15
{10,8,6,5,4,3,2,1,0,0,0,0,0,0,0,0}, --16
{10,8,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0}, --17
{10,8,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0}, --18
{10,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0}, --19
{10,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0}, --20
{10,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0}, --21
{10,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0}, --22
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0}, --23
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --24
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --25
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --26
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --27
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --28
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --29
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --30
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --31
{10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, --32
}
goods = {}
raceStartDelay = 600 -- should be 600 for a 10 minute prep period
racePoint1x = -4000
racePoint1y = -4000
raceAxis = random(0,360)+360
leg1length = random(40000,60000)
racePoint2x, racePoint2y = vectorFromAngle(raceAxis,leg1length)
racePoint2x = racePoint2x + racePoint1x
racePoint2y = racePoint2y + racePoint1y
leg4length = random(20000,40000)
lastAngle = raceAxis + random(30,90)
racePoint4x, racePoint4y = vectorFromAngle(lastAngle,leg4length)
racePoint4x = racePoint4x + racePoint1x
racePoint4y = racePoint4y + racePoint1y
firstAngle = raceAxis - 180 + random(30,90)
leg2length = 1000
repeat
leg2length = leg2length + 10
racePoint3x, racePoint3y = vectorFromAngle(firstAngle,leg2length)
racePoint3x = racePoint3x + racePoint2x
racePoint3y = racePoint3y + racePoint2y
leg3length = distance(racePoint3x,racePoint3y,racePoint4x,racePoint4y)
raceLength = (leg1length + leg2length + leg3length + leg4length)/1000 * 3
until(raceLength >= 500)
Zone():setPoints(
racePoint1x + 500, racePoint1y + 500,
racePoint1x - 500, racePoint1y + 500,
racePoint1x - 500, racePoint1y - 500,
racePoint1x + 500, racePoint1y - 500
):setLabel("WP1"):setColor(0,64,0)
Zone():setPoints(
racePoint2x + 500, racePoint2y + 500,
racePoint2x - 500, racePoint2y + 500,
racePoint2x - 500, racePoint2y - 500,
racePoint2x + 500, racePoint2y - 500
):setLabel("WP2"):setColor(0,64,0)
Zone():setPoints(
racePoint3x + 500, racePoint3y + 500,
racePoint3x - 500, racePoint3y + 500,
racePoint3x - 500, racePoint3y - 500,
racePoint3x + 500, racePoint3y - 500
):setLabel("WP3"):setColor(0,64,0)
Zone():setPoints(
racePoint4x + 500, racePoint4y + 500,
racePoint4x - 500, racePoint4y + 500,
racePoint4x - 500, racePoint4y - 500,
racePoint4x + 500, racePoint4y - 500
):setLabel("WP4"):setColor(0,64,0)
setVariations()
patienceTimeLimit = 1800
original_patience_time_limit = patienceTimeLimit
raceTimer = 0
unfinishedRacers = 0
impulseBump = random(10,50)
setGMButtons()
storage = getScriptStorage()
storage.gatherStats = gatherStats
end
function setVariations()
if getScenarioSetting == nil then
shootBack = false
chasers = false
hazards = false
predefined_player_ships = getPredefinedPlayerShipNames()
else
shootBack = false
if getScenarioSetting("Shoot Back") == "Yes" then
shootBack = true
end
chasers = false
if getScenarioSetting("Chase") == "Yes" then
chasers = true
end
hazards = false
if getScenarioSetting("Hazards") == "Yes" then
hazards = true
end
if getScenarioSetting("Ship Name") == "Predefined" then
predefined_player_ships = getPredefinedPlayerShipNames()
else
predefined_player_ships = nil
end
end
end
function getPredefinedPlayerShipNames()
local predefined_player_ships = {
{name = "Phoenix", control_code = "BURN265"},
{name = "Callisto", control_code = "MOON558"},
{name = "Charybdis", control_code = "JACKPOT777"},
{name = "Sentinel", control_code = "FERENGI432"},
{name = "Omnivore", control_code = "EQUILATERAL180"},
{name = "Tarquin", control_code = "TIME909"},
}
return predefined_player_ships
end
-- GM Buttons
function setGMButtons()
mainGMButtons = mainGMButtonsDuringPause
mainGMButtons()
end
function showControlCodes(faction_filter)
local code_list = {}
for pidx=1,32 do
local p = getPlayerShip(pidx)
if p ~= nil and p:isValid() then
if faction_filter == "Kraylor" then
if p:getFaction() == "Kraylor" then
code_list[p:getCallSign()] = {code = p.control_code, faction = p:getFaction()}
end
elseif faction_filter == "Human Navy" then
if p:getFaction() == "Human Navy" then
code_list[p:getCallSign()] = {code = p.control_code, faction = p:getFaction()}
end
elseif faction_filter == "Ktlitans" then
if p:getFaction() == "Ktlitans" then
code_list[p:getCallSign()] = {code = p.control_code, faction = p:getFaction()}
end
else
code_list[p:getCallSign()] = {code = p.control_code, faction = p:getFaction()}
end
end
end
local sorted_names = {}
for name in pairs(code_list) do
table.insert(sorted_names,name)
end
table.sort(sorted_names)
local output = ""
for i, name in ipairs(sorted_names) do
local faction = ""
if code_list[name].faction == "Kraylor" then
faction = _("msgGM", " (Kraylor)")
elseif code_list[name].faction == "Ktlitans" then
faction = _("msgGM", " (Ktlitan)")
end
output = output .. string.format(_("msgGM", "%s: %s %s\n"),name,code_list[name].code,faction)
end
addGMMessage(output)
end
-- GM buttons while paused
function mainGMButtonsDuringPause()
clearGMFunctions()
addGMFunction(string.format(_("buttonGM", "Version %s"),scenario_version),function()
local version_message = string.format(_("msgGM", "Scenario version %s\n LUA version %s"),scenario_version,_VERSION)
addGMMessage(version_message)
print(version_message)
end)
addGMFunction(_("buttonGM", "Show control codes"),showControlCodes)
addGMFunction(string.format(_("buttonGM", "+Start Delay: %i"),raceStartDelay/60),setStartDelay)
addGMFunction(string.format(_("buttonGM", "+Patience: %i"),patienceTimeLimit/60),setPatienceTimeLimit)
if predefined_player_ships ~= nil then
addGMFunction(_("buttonGM", "Random PShip Names"),function()
addGMMessage(_("msgGM", "Player ship names will be selected at random.\nControl codes will be randomly generated"))
predefined_player_ships = nil
mainGMButtons()
end)
end
local button_label = _("buttonGM", "+Shoot Back: ")
if shootBack then
button_label = string.format("%s%s",button_label,_("buttonGM", "Yes"))
else
button_label = string.format("%s%s",button_label,_("buttonGM", "No"))
end
addGMFunction(button_label,setShootBack)
button_label = _("buttonGM", "+Chase: ")
if chasers then
button_label = string.format("%s%s",button_label,_("buttonGM", "Yes"))
else
button_label = string.format("%s%s",button_label,_("buttonGM", "No"))
end
addGMFunction(button_label,setChasers)
button_label = _("buttonGM", "+Hazards: ")
if hazards then
button_label = string.format("%s%s",button_label,_("buttonGM", "Yes"))
else
button_label = string.format("%s%s",button_label,_("buttonGM", "No"))
end
addGMFunction(button_label,setHazards)
addGMFunction(_("buttonGM","Show Statistics"),function()
local out = _("msgGM","Not much to show since the game is still paused")
print(out)
local player_list = getActivePlayerShips()
local player_count = string.format(_("msgGM","Total player ships: %i"),#player_list)
print(player_count)
out = string.format("%s\n%s",out,player_count)
for index, p in ipairs(player_list) do
local player_line = string.format(_("msgGM","%2i Name:%s, Type:%s"),index,p:getCallSign(),p:getTypeName())
print(player_line)
out = string.format("%s\n%s",out,player_line)
end
addGMMessage(out)
end)
end
function setShootBack()
clearGMFunctions()
addGMFunction(_("buttonGM", "-From Shoot Back"),mainGMButtons)
local button_label = _("buttonGM", "Shoot Back Yes")
if shootBack then
button_label = button_label .. _("buttonGM", "*")
end
addGMFunction(button_label,function()
shootBack = true
setShootBack()
end)
button_label = _("buttonGM", "Shoot Back No")
if not shootBack then
button_label = button_label .. _("buttonGM", "*")
end
addGMFunction(button_label,function()
shootBack = false
setShootBack()
end)
end
function setChasers()
clearGMFunctions()
addGMFunction(_("buttonGM", "-From Chase"),mainGMButtons)
local button_label = _("buttonGM", "Chase Yes")
if chasers then
button_label = button_label .. _("buttonGM", "*")
end
addGMFunction(button_label,function()
chasers = true
setChasers()
end)
button_label = _("buttonGM", "Chase No")
if not chasers then
button_label = button_label .. _("buttonGM", "*")
end
addGMFunction(button_label,function()
chasers = false
setChasers()
end)
end
function setHazards()
clearGMFunctions()
addGMFunction(_("buttonGM", "-From Hazards"),mainGMButtons)
local button_label = _("buttonGM", "Hazards Yes")
if hazards then
button_label = button_label .. _("buttonGM", "*")
end
addGMFunction(button_label,function()
hazards = true
setHazards()
end)
button_label = _("buttonGM", "Hazards No")
if not hazards then
button_label = button_label .. _("buttonGM", "*")
end
addGMFunction(button_label,function()
hazards = false
setHazards()
end)
end
function setPatienceTimeLimit()
clearGMFunctions()
addGMFunction(_("buttonGM", "-Main"),mainGMButtons)
if patienceTimeLimit < 3000 then
addGMFunction(string.format(_("buttonGM", "%i Patience + -> %i"),patienceTimeLimit/60,(patienceTimeLimit + 300)/60),function()
patienceTimeLimit = patienceTimeLimit + 300
original_patience_time_limit = patienceTimeLimit
setPatienceTimeLimit()
end)
end
if patienceTimeLimit > 600 then
addGMFunction(string.format(_("buttonGM", "%i Patience - -> %i"),patienceTimeLimit/60,(patienceTimeLimit - 300)/60),function()
patienceTimeLimit = patienceTimeLimit - 300
original_patience_time_limit = patienceTimeLimit
setPatienceTimeLimit()
end)
end
end
function setStartDelay()
clearGMFunctions()
addGMFunction(_("buttonGM", "-Main"),mainGMButtons)
if raceStartDelay < 1200 then
addGMFunction(string.format(_("buttonGM", "%i Delay + -> %i"),raceStartDelay/60,(raceStartDelay + 60)/60),function()
raceStartDelay = raceStartDelay + 60
setStartDelay()
end)
end
if raceStartDelay > 60 then
addGMFunction(string.format(_("buttonGM", "%i Delay - -> %i"),raceStartDelay/60,(raceStartDelay - 60)/60),function()
raceStartDelay = raceStartDelay - 60
setStartDelay()
end)
end
end
-- GM buttons after pause
function mainGMButtonsAfterPause()
clearGMFunctions()
addGMFunction(string.format(_("buttonGM", "Version %s"),scenario_version),function()
local version_message = string.format(_("msgGM", "Scenario version %s\n LUA version %s"),scenario_version,_VERSION)
addGMMessage(version_message)
print(version_message)
end)
addGMFunction(_("buttonGM", "Show control codes"),showControlCodes)
addGMFunction(_("buttonGM", "Show statistics"),function()
local stats = gatherStats()
local out = _("msgGM", "Current Statistics:\nShip: state, laps, waypoint goal, drone pts")
for name, details in pairs(stats.ship) do
out = out .. "\n" .. name .. ": "
if details.is_alive then
out = out .. _("msgGM", "alive, ")
else
out = out .. _("msgGM", "dead, ")
end
if details.participant ~= nil then
out = out .. details.participant .. _("msgGM", ", ")
end
-- if details.participant == "participant" then
-- out = out .. "participant, "
-- else
-- out = out .. "forfeit, "
-- end
out = string.format(_("msgGM", "%s%i, %i, %i"),out,details.lap_count,details.waypoint_goal,details.drone_points)
end
if raceStartDelay < 0 then
if player_count == original_player_count then
out = string.format(_("msgGM","%s\n\nWith %i racers, we have the following points awarded for final race place:"),out,player_count)
else
out = string.format(_("msgGM","%s\n\nWith %i racers remaining from the original %i registrants, we have the following points awarded for final race place:"),out,player_count,original_player_count)
end
local place_name = {
_("msgGM","First"),
_("msgGM","Second"),
_("msgGM","Third"),
_("msgGM","Fourth"),
_("msgGM","Fifth"),
_("msgGM","Sixth"),
_("msgGM","Seventh"),
_("msgGM","Eighth"),
_("msgGM","Ninth"),
_("msgGM","Tenth"),
}
for i=1,#reward_grid[player_count] do
if reward_grid[player_count][i] > 0 then
out = string.format("%s\n %s:%s",out,place_name[i],reward_grid[player_count][i])
else
break
end
end
end
addGMMessage(out)
end)
addGMFunction(_("buttonGM","Show final results"),function()
gMsg = _("msgGM","Final results:\nNote: this data appears on the main screen after the race is complete. If the race is not complete, what you see here may not be accurate.")
competeResults()
addGMMessage(gMsg)
end)
end
function setStations()
afd = 30 -- asteroid field density
stationList = {}
totalStations = 0
friendlyStations = 0
neutralStations = 0
--Timer
stationTimer = SpaceStation():setTemplate("Small Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationTimer:setPosition(-5000,-5000):setDescription(_("scienceDescription-station", "Race Timing Facility")):setCallSign("Timer")
table.insert(stationList,stationTimer)
friendlyStations = friendlyStations + 1
--Vaiken
stationVaiken = SpaceStation():setTemplate("Huge Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationVaiken:setPosition(random(-10000,5000),random(5000,9000)):setCallSign("Vaiken"):setDescription(_("scienceDescription-station", "Ship building and maintenance facility"))
table.insert(stationList,stationVaiken)
friendlyStations = friendlyStations + 1
goods[stationVaiken] = {{"food",10,1},{"medicine",5,5}}
--Zefram
stationZefram = SpaceStation():setTemplate("Medium Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationZefram:setPosition(random(5000,8000),random(-8000,9000)):setCallSign("Zefram"):setDescription(_("scienceDescription-station", "Warp Engine Components"))
table.insert(stationList,stationZefram)
friendlyStations = friendlyStations + 1
goods[stationZefram] = {{"warp",5,140},{"food",5,1}}
--Marconi
marconiAngle = random(0,360)
xMarconi, yMarconi = vectorFromAngle(marconiAngle,random(12500,15000))
stationMarconi = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationMarconi:setPosition(xMarconi,yMarconi):setCallSign("Marconi"):setDescription(_("scienceDescription-station", "Energy Beam Components"))
table.insert(stationList,stationMarconi)
neutralStations = neutralStations + 1
goods[stationMarconi] = {{"beam",5,80}}
--Muddville
muddAngle = marconiAngle + random(60,180)
xMudd, yMudd = vectorFromAngle(muddAngle,random(12500,15000))
stationMudd = SpaceStation():setTemplate("Medium Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationMudd:setPosition(xMudd,yMudd):setCallSign("Muddville"):setDescription(_("scienceDescription-station", "Trading station"))
table.insert(stationList,stationMudd)
neutralStations = neutralStations + 1
goods[stationMudd] = {{"luxury",10,60}}
--Alcaleica
alcaleicaAngle = muddAngle + random(60,120)
xAlcaleica, yAlcaleica = vectorFromAngle(alcaleicaAngle,random(12500,15000))
stationAlcaleica = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationAlcaleica:setPosition(xAlcaleica,yAlcaleica):setCallSign("Alcaleica"):setDescription(_("scienceDescription-station", "Optical Components"))
table.insert(stationList,stationAlcaleica)
neutralStations = neutralStations + 1
goods[stationAlcaleica] = {{"optic",5,66}}
--California
stationCalifornia = SpaceStation():setTemplate("Small Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationCalifornia:setPosition(random(-90000,-70000),random(-15000,25000)):setCallSign("California"):setDescription(_("scienceDescription-station", "Mining station"))
table.insert(stationList,stationCalifornia)
friendlyStations = friendlyStations + 1
goods[stationCalifornia] = {{"food",2,1},{"gold",5,25},{"dilithium",2,25}}
--Outpost-15
stationOutpost15 = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationOutpost15:setPosition(random(35000,50000),random(52000,79000)):setCallSign("Outpost-15"):setDescription(_("scienceDescription-station", "Mining and trade"))
table.insert(stationList,stationOutpost15)
neutralStations = neutralStations + 1
placeRandomAroundPoint(Asteroid,25,1,15000,60000,75000)
--Outpost-21
stationOutpost21 = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationOutpost21:setPosition(random(50000,75000),random(52000,61250)):setCallSign("Outpost-21"):setDescription(_("scienceDescription-station", "Mining and gambling"))
table.insert(stationList,stationOutpost21)
neutralStations = neutralStations + 1
if random(1,100) < 50 then
goods[stationOutpost15] = {{"luxury",5,70},{"gold",5,25}}
goods[stationOutpost21] = {{"cobalt",4,50}}
else
goods[stationOutpost21] = {{"luxury",5,70},{"gold",5,25}}
goods[stationOutpost15] = {{"cobalt",4,50}}
end
--Valero
stationValero = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationValero:setPosition(random(-88000,-65000),random(36250,40000)):setCallSign("Valero"):setDescription(_("scienceDescription-station", "Resupply"))
table.insert(stationList,stationValero)
neutralStations = neutralStations + 1
goods[stationValero] = {{"luxury",5,77}}
--Vactel
vactelAngle = random(0,360)
xVactel, yVactel = vectorFromAngle(vactelAngle,random(50000,61250))
stationVactel = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationVactel:setPosition(xVactel,yVactel):setCallSign("Vactel"):setDescription(_("scienceDescription-station", "Shielded Circuitry Fabrication"))
table.insert(stationList,stationVactel)
neutralStations = neutralStations + 1
goods[stationVactel] = {{"circuit",5,50}}
--Archer
archerAngle = vactelAngle + random(60,120)
xArcher, yArcher = vectorFromAngle(archerAngle,random(50000,61250))
stationArcher = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationArcher:setPosition(xArcher,yArcher):setCallSign("Archer"):setDescription(_("scienceDescription-station", "Shield and Armor Research"))
table.insert(stationList,stationArcher)
neutralStations = neutralStations + 1
goods[stationArcher] = {{"shield",5,90}}
--Deer
deerAngle = archerAngle + random(60,120)
xDeer, yDeer = vectorFromAngle(deerAngle,random(50000,61250))
stationDeer = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationDeer:setPosition(xDeer,yDeer):setCallSign("Deer"):setDescription(_("scienceDescription-station", "Repulsor and Tractor Beam Components"))
table.insert(stationList,stationDeer)
neutralStations = neutralStations + 1
goods[stationDeer] = {{"tractor",5,90},{"repulsor",5,95}}
--Cavor
cavorAngle = deerAngle + random(60,90)
xCavor, yCavor = vectorFromAngle(cavorAngle,random(50000,61250))
stationCavor = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationCavor:setPosition(xCavor,yCavor):setCallSign("Cavor"):setDescription(_("scienceDescription-station", "Advanced Material components"))
table.insert(stationList,stationCavor)
neutralStations = neutralStations + 1
goods[stationCavor] = {{"filament",5,42}}
--Emory
stationEmory = SpaceStation():setTemplate("Small Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationEmory:setPosition(random(72000,85000),random(-50000,-26000)):setCallSign("Emory"):setDescription(_("scienceDescription-station", "Transporter Components"))
table.insert(stationList,stationEmory)
friendlyStations = friendlyStations + 1
goods[stationEmory] = {{"transporter",5,63},{"food",2,1}}
--Veloquan
stationVeloquan = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationVeloquan:setPosition(random(-25000,15000),random(27000,40000)):setCallSign("Veloquan"):setDescription(_("scienceDescription-station", "Sensor components"))
table.insert(stationList,stationVeloquan)
neutralStations = neutralStations + 1
goods[stationVeloquan] = {{"sensor",5,68}}
--Barclay
stationBarclay = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationBarclay:setPosition(random(-20000,0),random(-45000,-25000)):setCallSign("Barclay"):setDescription(_("scienceDescription-station", "Communications components"))
table.insert(stationList,stationBarclay)
neutralStations = neutralStations + 1
goods[stationBarclay] = {{"communication",5,58}}
--Lipkin
stationLipkin = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationLipkin:setPosition(random(20000,45000),random(-25000,-15000)):setCallSign("Lipkin"):setDescription(_("scienceDescription-station", "Autodoc components"))
table.insert(stationList,stationLipkin)
neutralStations = neutralStations + 1
goods[stationLipkin] = {{"autodoc",5,76}}
--Ripley
stationRipley = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationRipley:setPosition(random(-75000,-30000),random(55000,62150)):setCallSign("Ripley"):setDescription(_("scienceDescription-station", "Load Lifters and components"))
table.insert(stationList,stationRipley)
neutralStations = neutralStations + 1
goods[stationRipley] = {{"lifter",5,61}}
--Deckard
stationDeckard = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationDeckard:setPosition(random(-45000,-25000),random(-25000,-14000)):setCallSign("Deckard"):setDescription(_("scienceDescription-station", "Android components"))
table.insert(stationList,stationDeckard)
neutralStations = neutralStations + 1
goods[stationDeckard] = {{"android",5,73}}
--Conner
stationConnor = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationConnor:setPosition(random(-10000,15000),random(15000,27000)):setCallSign("Connor"):setDescription(_("scienceDescription-station", "Weapons Automation components"))
table.insert(stationList,stationConnor)
neutralStations = neutralStations + 1
--Anderson
stationAnderson = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationAnderson:setPosition(random(15000,20000),random(-25000,48000)):setCallSign("Anderson"):setDescription(_("scienceDescription-station", "Battery and Software Engineering"))
table.insert(stationList,stationAnderson)
neutralStations = neutralStations + 1
goods[stationAnderson] = {{"battery",5,65},{"software",5,115}}
--Feynman
stationFeynman = SpaceStation():setTemplate("Small Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationFeynman:setPosition(random(-90000,-55000),random(25000,36250)):setCallSign("Feynman"):setDescription(_("scienceDescription-station", "Nanotechnology Research"))
table.insert(stationList,stationFeynman)
friendlyStations = friendlyStations + 1
goods[stationFeynman] = {{"nanites",5,79},{"software",5,115},{"food",2,1}}
--Mayo
stationMayo = SpaceStation():setTemplate("Large Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationMayo:setPosition(random(-45000,-30000),random(-14000,12500)):setCallSign("Mayo"):setDescription(_("scienceDescription-station", "Medical Research"))
table.insert(stationList,stationMayo)
friendlyStations = friendlyStations + 1
goods[stationMayo] = {{"food",5,1},{"medicine",5,5}}
--Nefatha
stationNefatha = SpaceStation():setTemplate("Medium Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationNefatha:setPosition(random(-10000,12500),random(-96000,-80000)):setCallSign("Nefatha"):setDescription(_("scienceDescription-station", "Commerce and recreation"))
table.insert(stationList,stationNefatha)
neutralStations = neutralStations + 1
goods[stationNefatha] = {{"luxury",5,70}}
--Science-4
stationScience4 = SpaceStation():setTemplate("Medium Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationScience4:setPosition(random(-60000,-40000),random(47000,55000)):setCallSign("Science-4"):setDescription(_("scienceDescription-station", "Biotech research"))
table.insert(stationList,stationScience4)
neutralStations = neutralStations + 1
--Speculation-4
stationSpeculation4 = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationSpeculation4:setPosition(random(-26000,-15000),random(-10000,27000)):setCallSign("Speculation-4"):setDescription(_("scienceDescription-station", "Trading post"))
table.insert(stationList,stationSpeculation4)
neutralStations = neutralStations + 1
goods[stationSpeculation4] = {{"luxury",5,65}}
--Tiberius
stationTiberius = SpaceStation():setTemplate("Medium Station"):setFaction("Human Navy"):setCommsScript(""):setCommsFunction(commsStation)
stationTiberius:setPosition(random(-30000,-26000),random(-14000,35000)):setCallSign("Tiberius"):setDescription(_("scienceDescription-station", "Logistics coordination"))
table.insert(stationList,stationTiberius)
friendlyStations = friendlyStations + 1
goods[stationTiberius] = {{"food",5,1}}
--Research-1
stationResearch11 = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationResearch11:setPosition(random(-75000,-55000),random(-50000,-25000)):setCallSign("Research-11"):setDescription(_("scienceDescription-station", "Low Gravity Research"))
table.insert(stationList,stationResearch11)
neutralStations = neutralStations + 1
--Freena
stationFreena = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationFreena:setPosition(random(0,15000),irandom(-37500,-15000)):setCallSign("Freena"):setDescription(_("scienceDescription-station", "Zero gravity sports"))
table.insert(stationList,stationFreena)
neutralStations = neutralStations + 1
--Outpost-33
stationOutpost33 = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationOutpost33:setPosition(random(15000,65000),random(-65000,-25000)):setCallSign("Outpost-33"):setDescription(_("scienceDescription-station", "Resupply"))
table.insert(stationList,stationOutpost33)
neutralStations = neutralStations + 1
goods[stationOutpost33] = {{"luxury",5,75}}
--Lando
stationLando = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationLando:setPosition(random(-60000,-30000),random(612500,70000)):setCallSign("Lando"):setDescription(_("scienceDescription-station", "Casino and Gambling"))
table.insert(stationList,stationLando)
neutralStations = neutralStations + 1
--Komov
stationKomov = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationKomov:setPosition(random(-55000,-30000),random(70000,80000)):setCallSign("Komov"):setDescription(_("scienceDescription-station", "Xenopsychology research"))
table.insert(stationList,stationKomov)
neutralStations = neutralStations + 1
--Science-2
stationScience2 = SpaceStation():setTemplate("Medium Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationScience2:setPosition(random(20000,35000),random(55000,70000)):setCallSign("Science-2"):setDescription(_("scienceDescription-station", "Research Lab and Observatory"))
table.insert(stationList,stationScience2)
neutralStations = neutralStations + 1
--Prefect
stationPrefect = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationPrefect:setPosition(random(-65000,-60000),random(36250,55000)):setCallSign("Prefect"):setDescription(_("scienceDescription-station", "Textile and Fashion Creation"))
table.insert(stationList,stationPrefect)
neutralStations = neutralStations + 1
goods[stationPrefect] = {{"luxury",5,45}}
--Outpost-7
stationOutpost7 = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationOutpost7:setPosition(random(35000,45000),random(-15000,25000)):setCallSign("Outpost-7"):setDescription(_("scienceDescription-station", "Resupply"))
table.insert(stationList,stationOutpost7)
neutralStations = neutralStations + 1
goods[stationOutpost7] = {{"luxury",5,80}}
--Organa
stationOrgana = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
stationOrgana:setPosition(irandom(55000,62000),random(20000,45000)):setCallSign("Organa"):setDescription(_("scienceDescription-station", "Diplomatic training"))
table.insert(stationList,stationOrgana)
neutralStations = neutralStations + 1
--Grap
stationGrap = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
xGrap = random(-20000,0)
yGrap = random(-25000,-20000)
stationGrap:setPosition(xGrap,yGrap):setCallSign("Grap"):setDescription(_("scienceDescription-station", "Mining station"))
posAxisGrap = random(0,360)
posGrap = random(10000,60000)
negGrap = random(10000,60000)
spreadGrap = random(4000,8000)
negAxisGrap = posAxisGrap + 180
xPosAngleGrap, yPosAngleGrap = vectorFromAngle(posAxisGrap, posGrap)
posEnd = random(40,90)
createRandomAlongArc(Asteroid, afd+posEnd, xGrap+xPosAngleGrap, yGrap+yPosAngleGrap, posGrap, negAxisGrap, negAxisGrap+posEnd, spreadGrap)
xNegAngleGrap, yNegAngleGrap = vectorFromAngle(negAxisGrap, negGrap)
negEnd = random(20,60)
createRandomAlongArc(Asteroid, afd+negEnd, xGrap+xNegAngleGrap, yGrap+yNegAngleGrap, negGrap, posAxisGrap, posAxisGrap+negEnd, spreadGrap)
table.insert(stationList,stationGrap)
neutralStations = neutralStations + 1
--Grup
stationGrup = SpaceStation():setTemplate("Small Station"):setFaction("Independent"):setCommsScript(""):setCommsFunction(commsStation)
xGrup = random(-20000,-10000)
yGrup = random(15000,30000)
stationGrup:setPosition(xGrup,yGrup):setCallSign("Grup"):setDescription(_("scienceDescription-station", "Mining station"))
axisGrup = random(0,360)
longGrup = random(30000,60000)
shortGrup = random(10000,30000)
spreadGrup = random(5000,8000)
negAxisGrup = axisGrup + 180
xLongAngleGrup, yLongAngleGrup = vectorFromAngle(axisGrup, longGrup)
longGrupEnd = random(30,70)
createRandomAlongArc(Asteroid, afd+longGrupEnd, xGrup+xLongAngleGrup, yGrup+yLongAngleGrup, longGrup, negAxisGrup, negAxisGrup+longGrupEnd, spreadGrup)
xShortAngleGrup, yShortAngleGrup = vectorFromAngle(axisGrup, shortGrup)