-
Notifications
You must be signed in to change notification settings - Fork 2
/
scenario_53_escape.lua
executable file
·5979 lines (5975 loc) · 285 KB
/
scenario_53_escape.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: Escape
-- Description: Escape imprisonment and return home.
---
--- Mission consists of one ship with a full crew. Engineer and Science will be the most busy initially
---
--- Version 5 Provides additional information while on the initial fighter (13Jul2020)
-- Type: Mission, somewhat replayable
-- Variation[Easy]: Easy goals and/or enemies
-- Variation[Hard]: Hard goals and/or enemies
require("utils.lua")
-------------------------------
-- Initialization routines --
-------------------------------
function init()
wfv = "nowhere" --wolf fence value - used for debugging
setVariations()
missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'}
--Ship Template Name List
stnl = {"MT52 Hornet","MU52 Hornet","Adder MK5","Adder MK4","WX-Lindworm","Adder MK6","Phobos T3","Phobos M3","Piranha F8","Piranha F12","Ranus U","Nirvana R5A","Stalker Q7","Stalker R7","Atlantis X23","Starhammer II","Odin","Fighter","Cruiser","Missile Cruiser","Strikeship","Adv. Striker","Dreadnought","Battlestation","Blockade Runner","Ktlitan Fighter","Ktlitan Breaker","Ktlitan Worker","Ktlitan Drone","Ktlitan Feeder","Ktlitan Scout","Ktlitan Destroyer","Storm"}
--Ship Template Score List
stsl = {5 ,5 ,7 ,6 ,7 ,8 ,15 ,16 ,15 ,15 ,25 ,20 ,25 ,25 ,50 ,70 ,250 ,6 ,18 ,14 ,30 ,27 ,80 ,100 ,65 ,6 ,45 ,40 ,4 ,48 ,8 ,50 ,22}
-- square grid deployment
fleetPosDelta1x = {0,1,0,-1, 0,1,-1, 1,-1,2,0,-2, 0,2,-2, 2,-2,2, 2,-2,-2,1,-1, 1,-1}
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}
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"}
diagnostic = false
GMDiagnosticOn = "Turn On Diagnostic"
addGMFunction(GMDiagnosticOn,turnOnDiagnostic)
independentTransportSpawnDelay = 20
independentTransportList = {}
plotIT = independentTransportPlot
kraylorTransportSpawnDelay = 40
kraylorTransportList = {}
plotKT = kraylorTransportPlot
kraylorPatrolSpawnDelay = 60
kraylorPatrolList = {}
kGroup = 0
kraylorPatrolGroupList = {}
goods = {} --overall tracking of goods
stationList = {} --friendly and neutral stations
friendlyStationList = {}
enemyStationList = {}
tradeFood = {} --stations that will trade food for other goods
tradeLuxury = {} --stations that will trade luxury for other goods
tradeMedicine = {} --stations that will trade medicine for other goods
totalStations = 0
friendlyStations = 0
neutralStations = 0
setListOfStations()
brigStation = SpaceStation():setTemplate("Small Station"):setFaction("Kraylor"):setCallSign("DS23"):setPosition(912787, 148301)
table.insert(enemyStationList,brigStation)
buildNearbyStations()
--build headquarters
local vx, vy = vectorFromAngle(random(0,90),random(300000,400000))
psx = brigx + vx
psy = brigy + vy
si = math.random(1,#placeStation) --station index
stationFaction = "Human Navy"
pStation = placeStation[si]()
table.remove(placeStation,si)
table.insert(stationList,pStation)
stationHeadquarters = pStation
stationHeadquarters:setTemplate("Huge Station")
--Player ship name lists to supplant standard randomized call sign generation
playerShipNamesForMP52Hornet = {"Dragonfly","Scarab","Mantis","Yellow Jacket","Jimminy","Flik","Thorny","Buzz"}
playerShipNamesForPiranha = {"Razor","Biter","Ripper","Voracious","Carnivorous","Characid","Vulture","Predator"}
playerShipNamesForFlaviaPFalcon = {"Ladyhawke","Hunter","Seeker","Gyrefalcon","Kestrel","Magpie","Bandit","Buccaneer"}
playerShipNamesForPhobosM3P = {"Blinder","Shadow","Distortion","Diemos","Ganymede","Castillo","Thebe","Retrograde"}
playerShipNamesForAtlantis = {"Excaliber","Thrasher","Punisher","Vorpal","Protang","Drummond","Parchim","Coronado"}
playerShipNamesForCruiser = {"Excelsior","Velociraptor","Thunder","Kona","Encounter","Perth","Aspern","Panther"}
playerShipNamesForMissileCruiser = {"Projectus","Hurlmeister","Flinger","Ovod","Amatola","Nakhimov","Antigone"}
playerShipNamesForFighter = {"Buzzer","Flitter","Zippiticus","Hopper","Molt","Stinger","Stripe"}
playerShipNamesForBenedict = {"Elizabeth","Ford","Vikramaditya","Liaoning","Avenger","Naruebet","Washington","Lincoln","Garibaldi","Eisenhower"}
playerShipNamesForKiriya = {"Cavour","Reagan","Gaulle","Paulo","Truman","Stennis","Kuznetsov","Roosevelt","Vinson","Old Salt"}
playerShipNamesForStriker = {"Sparrow","Sizzle","Squawk","Crow","Phoenix","Snowbird","Hawk"}
playerShipNamesForLindworm = {"Seagull","Catapult","Blowhard","Flapper","Nixie","Pixie","Tinkerbell"}
playerShipNamesForRepulse = {"Fiddler","Brinks","Loomis","Mowag","Patria","Pandur","Terrex","Komatsu","Eitan"}
playerShipNamesForEnder = {"Mongo","Godzilla","Leviathan","Kraken","Jupiter","Saturn"}
playerShipNamesForNautilus = {"October", "Abdiel", "Manxman", "Newcon", "Nusret", "Pluton", "Amiral", "Amur", "Heinkel", "Dornier"}
playerShipNamesForHathcock = {"Hayha", "Waldron", "Plunkett", "Mawhinney", "Furlong", "Zaytsev", "Pavlichenko", "Pegahmagabow", "Fett", "Hawkeye", "Hanzo"}
playerShipNamesForLeftovers = {"Foregone","Righteous","Masher"}
placeRandomAroundPoint(Nebula,math.random(10,30),1,120000,brigx,brigy)
--Junk Yard M50 area
Asteroid():setPosition(909643, 152314)
Asteroid():setPosition(908697, 151087)
Asteroid():setPosition(911713, 153208)
Asteroid():setPosition(911918, 150729)
Asteroid():setPosition(912046, 149758)
Asteroid():setPosition(913036, 152491)
Asteroid():setPosition(913696, 151396)
Asteroid():setPosition(908036, 151340)
Asteroid():setPosition(906375, 149283)
Asteroid():setPosition(905979, 148528)
Asteroid():setPosition(906281, 147698)
Asteroid():setPosition(911413, 148623)
Asteroid():setPosition(910262, 147944)
Asteroid():setPosition(909903, 147302)
Asteroid():setPosition(906130, 150170)
Asteroid():setPosition(907961, 148916)
Asteroid():setPosition(908696, 148182)
Asteroid():setPosition(910870, 151302)
--Debris
junkYardDebrisX = {908020, 910705, 907503}
junkYardDebrisY = {150504, 150317, 148005}
debrisx, debrisy = pickCoordinate(junkYardDebrisX,junkYardDebrisY)
debris1 = Artifact():setPosition(debrisx, debrisy):setModel("ammo_box"):allowPickup(true):setScanningParameters(2,1):onPickUp(function(debris, pGrab) string.format("");pGrab.debris1 = true end)
debris1:setDescriptions("Debris","Debris: Various broken ship components. Possibly useful for engine or weapons systems repair")
debrisx, debrisy = pickCoordinate(junkYardDebrisX,junkYardDebrisY)
debris2 = Artifact():setPosition(debrisx, debrisy):setModel("ammo_box"):allowPickup(true):setScanningParameters(1,3):onPickUp(function(debris, pGrab) string.format("");pGrab.debris2 = true end)
debris2:setDescriptions("Debris","Debris: Various broken ship components. Possibly useful for shield or beam systems repair")
debrisx, debrisy = pickCoordinate(junkYardDebrisX,junkYardDebrisY)
debris3 = Artifact():setPosition(debrisx, debrisy):setModel("ammo_box"):allowPickup(true):setScanningParameters(2,1):onPickUp(function(debris, pGrab) string.format("");pGrab.debris3 = true end)
debris3:setDescriptions("Debris","Debris: Various broken ship components. Possibly useful for hull or reactor systems repair")
--Signs
junkYardSignX = {914126, 905479, 910303}
junkYardSignY = {151100, 148728, 147102}
junkZone = Zone():setPoints(905479, 148728, 906490, 146843, 910303, 147102, 914126, 151100, 912635, 154012, 905801, 151274)
signx, signy = pickCoordinate(junkYardSignX, junkYardSignY)
Sign1 = Artifact():setPosition(signx, signy):setModel("SensorBuoyMKI"):allowPickup(false):setScanningParameters(1,1)
Sign1:setDescriptions("Space Message Buoy","Space Message Buoy reading 'Welcome to the Boris Junk Yard and Emporium' in the Kraylor language")
signx, signy = pickCoordinate(junkYardSignX, junkYardSignY)
Sign2 = Artifact():setPosition(signx, signy):setModel("SensorBuoyMKI"):allowPickup(false):setScanningParameters(1,1)
Sign2:setDescriptions("Space Message Buoy","Space Message Buoy reading 'Boris Junk Yard: Browse for parts, take home an asteroid for the kids' in the Kraylor language")
signx, signy = pickCoordinate(junkYardSignX, junkYardSignY)
Sign3 = Artifact():setPosition(signx, signy):setModel("SensorBuoyMKI"):allowPickup(false):setScanningParameters(1,1)
Sign3:setDescriptions("Space Message Buoy","Space Message Buoy reading 'Boris Junk Yard: Best prices in 20 sectors' in the Kraylor language")
plotSign = billboardUpdate
--Initial player ship
playerFighter = PlayerSpaceship():setFaction("Human Navy"):setTemplate("MP52 Hornet"):setCallSign("Scrag"):setPosition(912035, 152062)
playerFighter:setSystemHealth("reactor", 0.01):setSystemHealth("beamweapons",-1):setSystemHealth("maneuver",0.05):setSystemHealth("missilesystem",-1):setSystemHealth("impulse",-0.5):setSystemHealth("warp",-1):setSystemHealth("jumpdrive",-1):setSystemHealth("frontshield",.1):setSystemHealth("rearshield",.1):setHull(5):setShields(5)
playerFighter:setScanProbeCount(0):setEnergy(50)
playerFighter.maxCargo = 3
playerFighter.cargo = playerFighter.maxCargo
playerFighter.shipScore = 5
playerFighter.maxReactor = .5
playerFighter.maxBeam = random(-.2,-.7)
playerFighter.maxManeuver = .5
playerFighter.maxImpulse = .2
playerFighter.maxFrontShield = .25
player = playerFighter
junkShips = {}
--junkyard ship index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
junkYardShipX = {909594, 910129, 909490, 910461, 910716, 911023, 913356, 906866, 911356, 910998, 907356, 913243, 908569, 912413, 907149}
junkYardShipY = {148578, 150090, 149528, 151061, 149068, 151854, 151717, 148094, 150167, 153234, 150170, 150698, 149988, 152981, 149132}
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkRepulse = CpuShip():setFaction("Independent"):setTemplate("Repulse"):setPosition(shipx, shipy):orderIdle():setHull(14):setShields(0.00,2.00):setWeaponStorage("HVLI",0):setWeaponStorage("Homing",1)
table.insert(junkShips,junkRepulse)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkAdder = CpuShip():setFaction("Kraylor"):setTemplate("Adder MK4"):setPosition(shipx, shipy):orderIdle():setHull(9):setShields(0.00):setWeaponStorage("HVLI", 1)
table.insert(junkShips,junkAdder)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkFreighter1 = CpuShip():setFaction("Kraylor"):setTemplate("Fuel Freighter 1"):setPosition(shipx, shipy):orderIdle():setHull(6):setShields(1.00, 0.00)
table.insert(junkShips,junkFreighter1)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkFreighter2 = CpuShip():setFaction("Independent"):setTemplate("Goods Freighter 3"):setPosition(shipx, shipy):orderIdle():setHull(7):setShields(14.00, 0.00)
table.insert(junkShips,junkFreighter2)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkDrone1 = CpuShip():setFaction("Ktlitans"):setTemplate("Ktlitan Drone"):setPosition(shipx, shipy):orderIdle():setHull(2)
table.insert(junkShips,junkDrone1)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkDrone2 = CpuShip():setFaction("Ktlitans"):setTemplate("Ktlitan Drone"):setPosition(shipx, shipy):orderIdle():setHull(6)
table.insert(junkShips,junkDrone2)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkDrone3 = CpuShip():setFaction("Kraylor"):setTemplate("Ktlitan Drone"):setPosition(shipx, shipy):orderIdle():setHull(2)
table.insert(junkShips,junkDrone3)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkDrone4 = CpuShip():setFaction("Ktlitans"):setTemplate("Ktlitan Drone"):setPosition(shipx, shipy):orderIdle():setHull(7)
table.insert(junkShips,junkDrone4)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkHornet1 = CpuShip():setFaction("Exuari"):setTemplate("MT52 Hornet"):setPosition(shipx, shipy):orderIdle():setHull(2):setShields(0.00)
table.insert(junkShips,junkHornet1)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkHornet2 = CpuShip():setFaction("Ghosts"):setTemplate("MT52 Hornet"):setPosition(shipx, shipy):orderIdle():setHull(2):setShields(0.00)
table.insert(junkShips,junkHornet2)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkHornet3 = CpuShip():setFaction("Arlenians"):setTemplate("MT52 Hornet"):setPosition(shipx, shipy):orderIdle():setHull(1):setShields(1.00)
table.insert(junkShips,junkHornet3)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkHornet4 = CpuShip():setFaction("Kraylor"):setTemplate("MU52 Hornet"):setPosition(shipx, shipy):orderIdle():setHull(2):setShields(0.00)
table.insert(junkShips,junkHornet4)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkPhobos = CpuShip():setFaction("Kraylor"):setTemplate("Phobos M3"):setPosition(shipx, shipy):orderIdle():setHull(4):setShields(2.00, 1.00):setWeaponStorage("Homing", 1)
table.insert(junkShips,junkPhobos)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkStrikeship = CpuShip():setFaction("Kraylor"):setTemplate("Strikeship"):setPosition(shipx, shipy):orderIdle():setHull(0):setShields(4.00, 0.00, 30.00, 30.00)
table.insert(junkShips,junkStrikeship)
shipx, shipy = pickCoordinate(junkYardShipX, junkYardShipY)
junkScout = CpuShip():setFaction("Ktlitans"):setTemplate("Ktlitan Scout"):setPosition(shipx, shipy):orderIdle():setHull(4)
table.insert(junkShips,junkScout)
for i=1,#junkShips do
junkShips[i]:setSystemHealth("reactor", random(-.9,-.1)):setSystemHealth("beamweapons",random(-.9,-.1)):setSystemHealth("maneuver",random(-.9,-.1)):setSystemHealth("missilesystem",random(-.9,-.1)):setSystemHealth("impulse",random(-.9,-.1)):setSystemHealth("warp",random(-.9,-.1)):setSystemHealth("jumpdrive",random(-.9,-.1)):setSystemHealth("frontshield",random(-.9,-.1)):setSystemHealth("rearshield",random(-.9,-.1))
junkShips[i].maxReactor = junkShips[i]:getSystemHealth("reactor")
junkShips[i].maxBeam = junkShips[i]:getSystemHealth("beamweapons")
junkShips[i].maxManeuver = junkShips[i]:getSystemHealth("maneuver")
junkShips[i].maxMissile = junkShips[i]:getSystemHealth("missilesystem")
junkShips[i].maxImpulse = junkShips[i]:getSystemHealth("impulse")
junkShips[i].maxWarp = junkShips[i]:getSystemHealth("warp")
junkShips[i].maxJump = junkShips[i]:getSystemHealth("jumpdrive")
junkShips[i].maxFrontShield = junkShips[i]:getSystemHealth("frontshield")
junkShips[i].maxRearShield = junkShips[i]:getSystemHealth("rearshield")
end
junkRepulse:setSystemHealth("jumpdrive",-1):setBeamWeapon(1,0,0,0,0,0)
junkRepulse.maxJump = .5
junkSupply = SupplyDrop():setFaction("Independent"):setPosition(909362, 151445):setEnergy(500):setWeaponStorage("Homing", 1):setWeaponStorage("Nuke", 0):setWeaponStorage("Mine", 0):setWeaponStorage("EMP", 0)
plotH = shipHealth --enable ship health check plot
playerShipHealth = scragHealth --set function to constrain player ship health
playerFighter:addToShipLog(string.format("You escaped the brig of station %s and transported yourselves onto one of the spaceship hulks in a nearby holding area for junked spacecraft. You carry critical information for the Human Navy regarding Kraylor activity in this area. You need to make good your escape and dock with a Human Navy space station",brigStation:getCallSign()),"Magenta")
plot1 = scanRepulse --enable first plot mission goal
--print("end of init")
end
function pickCoordinate(coordinateArrayX,coordinateArrayY)
--pick a coordinate at random from the passed table
--remove selected coordinates and return selected coordinates
if #coordinateArrayX > 1 then
choice = math.random(1,#coordinateArrayX)
rx = coordinateArrayX[choice]
ry = coordinateArrayY[choice]
table.remove(coordinateArrayX,choice)
table.remove(coordinateArrayY,choice)
else
rx = coordinateArrayX[1]
ry = coordinateArrayY[1]
table.remove(coordinateArrayX,1)
table.remove(coordinateArrayY,1)
end
return rx, ry
end
function setVariations()
--translate variations into a numeric difficulty value
if string.find(getScenarioVariation(),"Easy") then
difficulty = .5
elseif string.find(getScenarioVariation(),"Hard") then
difficulty = 2
else
difficulty = 1 --default (normal)
end
end
function createRandomAlongArc(object_type, amount, x, y, distance, startArc, endArcClockwise, randomize)
-- Create amount of objects of type object_type along arc
-- Center defined by x and y
-- Radius defined by distance
-- Start of arc between 0 and 360 (startArc), end arc: endArcClockwise
-- Use randomize to vary the distance from the center point. Omit to keep distance constant
-- Example:
-- createRandomAlongArc(Asteroid, 100, 500, 3000, 65, 120, 450)
if randomize == nil then randomize = 0 end
if amount == nil then amount = 1 end
arcLen = endArcClockwise - startArc
if startArc > endArcClockwise then
endArcClockwise = endArcClockwise + 360
arcLen = arcLen + 360
end
if amount > arcLen then
for ndex=1,arcLen do
radialPoint = startArc+ndex
pointDist = distance + random(-randomize,randomize)
object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
end
for ndex=1,amount-arcLen do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
end
else
for ndex=1,amount do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
end
end
end
function placeRandomAsteroidsAroundPoint(amount, dist_min, dist_max, x0, y0)
-- create amount of asteroid, at a distance between dist_min and dist_max around the point (x0, y0)
for n=1,amount do
local r = random(0, 360)
local distance = random(dist_min, dist_max)
x = x0 + math.cos(r / 180 * math.pi) * distance
y = y0 + math.sin(r / 180 * math.pi) * distance
local asteroid_size = random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20)
Asteroid():setPosition(x, y):setSize(asteroid_size)
end
end
function createRandomAsteroidAlongArc(amount, x, y, distance, startArc, endArcClockwise, randomize)
-- Create amount of asteroids along arc
-- Center defined by x and y
-- Radius defined by distance
-- Start of arc between 0 and 360 (startArc), end arc: endArcClockwise
-- Use randomize to vary the distance from the center point. Omit to keep distance constant
-- Example:
-- createRandomAsteroidAlongArc(100, 500, 3000, 65, 120, 450)
if randomize == nil then randomize = 0 end
if amount == nil then amount = 1 end
local arcLen = endArcClockwise - startArc
if startArc > endArcClockwise then
endArcClockwise = endArcClockwise + 360
arcLen = arcLen + 360
end
local asteroid_size = random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20)
if amount > arcLen then
for ndex=1,arcLen do
local radialPoint = startArc+ndex
local pointDist = distance + random(-randomize,randomize)
asteroid_size = random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20)
Asteroid():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist):setSize(asteroid_size)
end
for ndex=1,amount-arcLen do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
asteroid_size = random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20)
Asteroid():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist):setSize(asteroid_size)
end
else
for ndex=1,amount do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
asteroid_size = random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20)
Asteroid():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist):setSize(asteroid_size)
end
end
end
function buildNearbyStations()
-- Organically (simulated asymetrically) grow stations from a central grid location
-- Order of creation: enemy stations, planet, enemy stations, planet,
-- independent stations, black hole, independent stations, black hole
-- Human Navy stations (friendly stations) come later in the game after the communications get repaired.
brigx, brigy = brigStation:getPosition()
gbLow = 1 --grid boundary low
gbHigh = 500 --grid boundary high
grid = {} --grid - positional model
for i=gbLow,gbHigh do
grid[i] = {}
end
gx = gbHigh/2 --grid coordinate x
gy = gbHigh/2 --grid coordinate y
gp = 1 --grid position list index
gSize = random(6000,8000) --grid cell size in positional units
adjList = {} --adjacent space on grid location list
--place enemy stations
stationFaction = "Kraylor"
for i=gx-2,gx+1 do --reserve space for the junk yard
for j=gy-1,gy+2 do
grid[i][j] = gp
end
end
adjList = getAdjacentGridLocations(gx,gy)
ral = math.random(1,#adjList) --random adjacent location
gx = adjList[ral][1]
gy = adjList[ral][2]
gp = 2
for j=1,5 do --add enemy bases nearby
addEnemyStations()
end
--insert a planet
tSize = 11
grid[gx][gy] = gp
gRegion = {}
table.insert(gRegion,{gx,gy})
for i=1,tSize do
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
break
end
rd = math.random(1,#adjList)
grid[adjList[rd][1]][adjList[rd][2]] = gp
table.insert(gRegion,{adjList[rd][1],adjList[rd][2]})
end
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
adjList = getAllAdjacentGridLocations(gx,gy)
end
sri = math.random(1,#gRegion)
bwx = brigx + (gRegion[sri][1] - (gbHigh/2))*gSize
bwy = brigy + (gRegion[sri][2] - (gbHigh/2))*gSize
planetBaldwin = Planet():setPosition(bwx,bwy):setPlanetRadius(3000):setDistanceFromMovementPlane(-2000):setCallSign("Baldwin")
planetBaldwin:setPlanetSurfaceTexture("planets/gas-1.png"):setAxialRotationTime(300):setDescription("Mining and heavy industry")
stationWig = SpaceStation():setTemplate("Small Station"):setFaction("Kraylor")
stationWig:setPosition(bwx, bwy+3000):setCallSign("BOBS"):setDescription("Baldwin Observatory")
stationWig.angle = 90
gp = gp + 1
rn = math.random(1,#adjList)
gx = adjList[rn][1]
gy = adjList[rn][2]
for j=1,6 do --add more enemy bases nearby
addEnemyStations()
end
--insert a planet
tSize = 11
grid[gx][gy] = gp
gRegion = {}
table.insert(gRegion,{gx,gy})
for i=1,tSize do
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
break
end
rd = math.random(1,#adjList)
grid[adjList[rd][1]][adjList[rd][2]] = gp
table.insert(gRegion,{adjList[rd][1],adjList[rd][2]})
end
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
adjList = getAllAdjacentGridLocations(gx,gy)
end
sri = math.random(1,#gRegion)
msx = brigx + (gRegion[sri][1] - (gbHigh/2))*gSize
msy = brigy + (gRegion[sri][2] - (gbHigh/2))*gSize
planetMal = Planet():setPosition(msx,msy):setPlanetRadius(3000):setDistanceFromMovementPlane(-2000):setCallSign("Malastare")
planetMal:setPlanetSurfaceTexture("planets/planet-1.png"):setPlanetCloudTexture("planets/clouds-1.png")
planetMal:setPlanetAtmosphereTexture("planets/atmosphere.png"):setPlanetAtmosphereColor(0.2,0.2,1.0)
planetMal:setAxialRotationTime(400.0):setDescription("M class planet")
stationMal = SpaceStation():setTemplate("Small Station"):setFaction("Independent")
stationMal:setPosition(msx,msy+3000):setCallSign("MalNet"):setDescription("Malastare communications network hub")
stationMal.angle = 90
gp = gp + 1
rn = math.random(1,#adjList)
gx = adjList[rn][1]
gy = adjList[rn][2]
--place independent stations
stationFaction = "Independent"
fb = gp --set faction boundary (between enemy and neutral)
for j=1,15 do
addIndependentStations()
end
addBlackHole()
for j=1,15 do
addIndependentStations()
end
addBlackHole()
end
function addEnemyStations()
tSize = math.random(2,5) --tack on to region size (3-6 since first is outside loop)
grid[gx][gy] = gp --set current grid location to grid position list index
gRegion = {} --grow region
table.insert(gRegion,{gx,gy})
for i=1,tSize do
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then --exit loop if there are no more adjacent spaces available
break
end
rd = math.random(1,#adjList) --random direction to grow from adjacent list
grid[adjList[rd][1]][adjList[rd][2]] = gp
table.insert(gRegion,{adjList[rd][1],adjList[rd][2]})
end
--get adjacent list after done growing region
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
adjList = getAllAdjacentGridLocations(gx,gy)
else
if random(1,100) >= 17 then
adjList = getAllAdjacentGridLocations(gx,gy)
end
end
sri = math.random(1,#gRegion) --select station random region index
psx = brigx + (gRegion[sri][1] - (gbHigh/2))*gSize + random(-gSize/2*.95,gSize/2*.95) --place station x coordinate
psy = brigy + (gRegion[sri][2] - (gbHigh/2))*gSize + random(-gSize/2*.95,gSize/2*.95) --place station y coordinate
if math.random(1,100) < 50 then
si = math.random(1,#placeEnemyStation) --station index
pStation = placeEnemyStation[si]() --place selected station
table.remove(placeEnemyStation,si) --remove station from placement list
else
si = math.random(1,#placeGenericStation)
pStation = placeGenericStation[si]()
table.remove(placeGenericStation,si)
end
table.insert(enemyStationList,pStation) --save station in general station list
gp = gp + 1 --set next station number
rn = math.random(1,#adjList) --random next station start location
gx = adjList[rn][1]
gy = adjList[rn][2]
end
function addIndependentStations()
tSize = math.random(2,5) --tack on to region size
grid[gx][gy] = gp
gRegion = {} --grow region
table.insert(gRegion,{gx,gy})
for i=1,tSize do
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
break
end
rd = math.random(1,#adjList) --random direction to grow from adjacent list
grid[adjList[rd][1]][adjList[rd][2]] = gp
table.insert(gRegion,{adjList[rd][1],adjList[rd][2]})
end
--get list after done growing region
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
adjList = getFactionAdjacentGridLocations(gx,gy)
if #adjList < 1 then
adjList = getAllAdjacentGridLocations(gx,gy)
end
else
nextStationChoice = random(1,100)
if nextStationChoice >= 56 then
adjList = getFactionAdjacentGridLocations(gx,gy)
if #adjList < 1 then
adjList = getAllAdjacentGridLocations(gx,gy)
end
elseif nextStationChoice <= 22 then
adjList = getAllAdjacentGridLocations(gx,gy)
end
end
sri = math.random(1,#gRegion) --select station random region index
psx = brigx + (gRegion[sri][1] - (gbHigh/2))*gSize + random(-gSize/2*.95,gSize/2*.95) --place station x coordinate
psy = brigy + (gRegion[sri][2] - (gbHigh/2))*gSize + random(-gSize/2*.95,gSize/2*.95) --place station y coordinate
si = math.random(1,#placeStation) --station index
pStation = placeStation[si]()
table.remove(placeStation,si)
table.insert(stationList,pStation)
gp = gp + 1 --set next station number
rn = math.random(1,#adjList) --random next station start location
gx = adjList[rn][1]
gy = adjList[rn][2]
end
function addBlackHole()
--insert a black hole
tSize = 15
grid[gx][gy] = gp
gRegion = {}
table.insert(gRegion,{gx,gy})
for i=1,tSize do
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
break
end
rd = math.random(1,#adjList)
grid[adjList[rd][1]][adjList[rd][2]] = gp
table.insert(gRegion,{adjList[rd][1],adjList[rd][2]})
end
adjList = getAdjacentGridLocations(gx,gy)
if #adjList < 1 then
adjList = getAllAdjacentGridLocations(gx,gy)
else
if random(1,100) >= 35 then
adjList = getAllAdjacentGridLocations(gx,gy)
end
end
sri = math.random(1,#gRegion)
bhx = brigx + (gRegion[sri][1] - (gbHigh/2))*gSize
bhy = brigy + (gRegion[sri][2] - (gbHigh/2))*gSize
BlackHole():setPosition(bhx,bhy)
gp = gp + 1
rn = math.random(1,#adjList)
gx = adjList[rn][1]
gy = adjList[rn][2]
end
function getAdjacentGridLocations(lx,ly)
--adjacent empty grid locations around the most recently placed item
tempGrid = {}
for i=gbLow,gbHigh do
tempGrid[i] = {}
end
tempGrid[lx][ly] = 1
ol = {}
-- check left
if lx-1 >= gbLow then
if tempGrid[lx-1][ly] == nil then
tempGrid[lx-1][ly] = 1
if grid[lx-1][ly] == nil then
table.insert(ol,{lx-1,ly})
elseif grid[lx-1][ly] == gp then
--case 1: traveling left, skip right check
getAdjacentGridLocationsSkip(1,lx-1,ly)
end
end
end
--check up
if ly-1 >= gbLow then
if tempGrid[lx][ly-1] == nil then
tempGrid[lx][ly-1] = 1
if grid[lx][ly-1] == nil then
table.insert(ol,{lx,ly-1})
elseif grid[lx][ly-1] == gp then
--case 2: traveling up, skip down check
getAdjacentGridLocationsSkip(2,lx,ly-1)
end
end
end
--check right
if lx+1 <= gbHigh then
if tempGrid[lx+1][ly] == nil then
tempGrid[lx+1][ly] = 1
if grid[lx+1][ly] == nil then
table.insert(ol,{lx+1,ly})
elseif grid[lx+1][ly] == gp then
--case 3: traveling right, skip left check
getAdjacentGridLocationsSkip(3,lx+1,ly)
end
end
end
--check down
if ly+1 <= gbHigh then
if tempGrid[lx][ly+1] == nil then
tempGrid[lx][ly+1] = 1
if grid[lx][ly+1] == nil then
table.insert(ol,{lx,ly+1})
elseif grid[lx][ly+1] == gp then
--case 4: traveling down, skip up check
getAdjacentGridLocationsSkip(4,lx,ly+1)
end
end
end
return ol
end
function getAdjacentGridLocationsSkip(dSkip,lx,ly)
--adjacent empty grid locations around the most recently placed item, skip as requested
tempGrid[lx][ly] = 1
if dSkip ~= 3 then
--check left
if lx-1 >= gbLow then
if tempGrid[lx-1][ly] == nil then
tempGrid[lx-1][ly] = 1
if grid[lx-1][ly] == nil then
table.insert(ol,{lx-1,ly})
elseif grid[lx-1][ly] == gp then
--case 1: traveling left, skip right check
getAdjacentGridLocationsSkip(1,lx-1,ly)
end
end
end
end
if dSkip ~= 4 then
--check up
if ly-1 >= gbLow then
if tempGrid[lx][ly-1] == nil then
tempGrid[lx][ly-1] = 1
if grid[lx][ly-1] == nil then
table.insert(ol,{lx,ly-1})
elseif grid[lx][ly-1] == gp then
--case 2: traveling up, skip down check
getAdjacentGridLocationsSkip(2,lx,ly-1)
end
end
end
end
if dSkip ~= 1 then
--check right
if lx+1 <= gbHigh then
if tempGrid[lx+1][ly] == nil then
tempGrid[lx+1][ly] = 1
if grid[lx+1][ly] == nil then
table.insert(ol,{lx+1,ly})
elseif grid[lx+1][ly] == gp then
--case 3: traveling right, skip left check
getAdjacentGridLocationsSkip(3,lx+1,ly)
end
end
end
end
if dSkip ~= 2 then
--check down
if ly+1 <= gbHigh then
if tempGrid[lx][ly+1] == nil then
tempGrid[lx][ly+1] = 1
if grid[lx][ly+1] == nil then
table.insert(ol,{lx,ly+1})
elseif grid[lx][ly+1] == gp then
--case 4: traveling down, skip up check
getAdjacentGridLocationsSkip(4,lx,ly+1)
end
end
end
end
end
function getAllAdjacentGridLocations(lx,ly)
--adjacent empty grid locations around all occupied locations
tempGrid = {}
for i=gbLow,gbHigh do
tempGrid[i] = {}
end
tempGrid[lx][ly] = 1
ol = {}
-- check left
if lx-1 >= gbLow then
if tempGrid[lx-1][ly] == nil then
tempGrid[lx-1][ly] = 1
if grid[lx-1][ly] == nil then
table.insert(ol,{lx-1,ly})
else
--case 1: traveling left, skip right check
getAllAdjacentGridLocationsSkip(1,lx-1,ly)
end
end
end
--check up
if ly-1 >= gbLow then
if tempGrid[lx][ly-1] == nil then
tempGrid[lx][ly-1] = 1
if grid[lx][ly-1] == nil then
table.insert(ol,{lx,ly-1})
else
--case 2: traveling up, skip down check
getAllAdjacentGridLocationsSkip(2,lx,ly-1)
end
end
end
--check right
if lx+1 <= gbHigh then
if tempGrid[lx+1][ly] == nil then
tempGrid[lx+1][ly] = 1
if grid[lx+1][ly] == nil then
table.insert(ol,{lx+1,ly})
else
--case 3: traveling right, skip left check
getAllAdjacentGridLocationsSkip(3,lx+1,ly)
end
end
end
--check down
if ly+1 <= gbHigh then
if tempGrid[lx][ly+1] == nil then
tempGrid[lx][ly+1] = 1
if grid[lx][ly+1] == nil then
table.insert(ol,{lx,ly+1})
else
--case 4: traveling down, skip up check
getAllAdjacentGridLocationsSkip(4,lx,ly+1)
end
end
end
return ol
end
function getAllAdjacentGridLocationsSkip(dSkip,lx,ly)
--adjacent empty grid locations around all occupied locations, skip as requested
tempGrid[lx][ly] = 1
if dSkip ~= 3 then
--check left
if lx-1 >= gbLow then
if tempGrid[lx-1][ly] == nil then
tempGrid[lx-1][ly] = 1
if grid[lx-1][ly] == nil then
table.insert(ol,{lx-1,ly})
else
--case 1: traveling left, skip right check
getAllAdjacentGridLocationsSkip(1,lx-1,ly)
end
end
end
end
if dSkip ~= 4 then
--check up
if ly-1 >= gbLow then
if tempGrid[lx][ly-1] == nil then
tempGrid[lx][ly-1] = 1
if grid[lx][ly-1] == nil then
table.insert(ol,{lx,ly-1})
else
--case 2: traveling up, skip down check
getAllAdjacentGridLocationsSkip(2,lx,ly-1)
end
end
end
end
if dSkip ~= 1 then
--check right
if lx+1 <= gbHigh then
if tempGrid[lx+1][ly] == nil then
tempGrid[lx+1][ly] = 1
if grid[lx+1][ly] == nil then
table.insert(ol,{lx+1,ly})
else
--case 3: traveling right, skip left check
getAllAdjacentGridLocationsSkip(3,lx+1,ly)
end
end
end
end
if dSkip ~= 2 then
--check down
if ly+1 <= gbHigh then
if tempGrid[lx][ly+1] == nil then
tempGrid[lx][ly+1] = 1
if grid[lx][ly+1] == nil then
table.insert(ol,{lx,ly+1})
else
--case 4: traveling down, skip up check
getAllAdjacentGridLocationsSkip(4,lx,ly+1)
end
end
end
end
end
function getFactionAdjacentGridLocations(lx,ly)
--adjacent empty grid locations around the grid locations of the currently building faction
tempGrid = {}
for i=gbLow,gbHigh do
tempGrid[i] = {}
end
tempGrid[lx][ly] = 1
ol = {}
-- check left
if lx-1 >= gbLow then
if tempGrid[lx-1][ly] == nil then
tempGrid[lx-1][ly] = 1
if grid[lx-1][ly] == nil then
table.insert(ol,{lx-1,ly})
elseif grid[lx-1][ly] >= fb then
--case 1: traveling left, skip right check
getFactionAdjacentGridLocationsSkip(1,lx-1,ly)
end
end
end
--check up
if ly-1 >= gbLow then
if tempGrid[lx][ly-1] == nil then
tempGrid[lx][ly-1] = 1
if grid[lx][ly-1] == nil then
table.insert(ol,{lx,ly-1})
elseif grid[lx][ly-1] >= fb then
--case 2: traveling up, skip down check
getFactionAdjacentGridLocationsSkip(2,lx,ly-1)
end
end
end
--check right
if lx+1 <= gbHigh then
if tempGrid[lx+1][ly] == nil then
tempGrid[lx+1][ly] = 1
if grid[lx+1][ly] == nil then
table.insert(ol,{lx+1,ly})
elseif grid[lx+1][ly] >= fb then
--case 3: traveling right, skip left check
getFactionAdjacentGridLocationsSkip(3,lx+1,ly)
end
end
end
--check down
if ly+1 <= gbHigh then
if tempGrid[lx][ly+1] == nil then
tempGrid[lx][ly+1] = 1
if grid[lx][ly+1] == nil then
table.insert(ol,{lx,ly+1})
elseif grid[lx][ly+1] >= fb then
--case 4: traveling down, skip up check
getFactionAdjacentGridLocationsSkip(4,lx,ly+1)
end
end
end
return ol
end
function getFactionAdjacentGridLocationsSkip(dSkip,lx,ly)
--adjacent empty grid locations around the grid locations of the currently building faction, skip check as requested
tempGrid[lx][ly] = 1
if dSkip ~= 3 then
--check left
if lx-1 >= gbLow then
if tempGrid[lx-1][ly] == nil then
tempGrid[lx-1][ly] = 1
if grid[lx-1][ly] == nil then
table.insert(ol,{lx-1,ly})
elseif grid[lx-1][ly] >= fb then
--case 1: traveling left, skip right check
getFactionAdjacentGridLocationsSkip(1,lx-1,ly)
end
end
end
end
if dSkip ~= 4 then
--check up
if ly-1 >= gbLow then
if tempGrid[lx][ly-1] == nil then
tempGrid[lx][ly-1] = 1
if grid[lx][ly-1] == nil then
table.insert(ol,{lx,ly-1})
elseif grid[lx][ly-1] >= gp then
--case 2: traveling up, skip down check
getFactionAdjacentGridLocationsSkip(2,lx,ly-1)
end
end
end
end
if dSkip ~= 1 then
--check right
if lx+1 <= gbHigh then
if tempGrid[lx+1][ly] == nil then
tempGrid[lx+1][ly] = 1
if grid[lx+1][ly] == nil then
table.insert(ol,{lx+1,ly})
elseif grid[lx+1][ly] >= fb then
--case 3: traveling right, skip left check
getFactionAdjacentGridLocationsSkip(3,lx+1,ly)
end
end
end
end
if dSkip ~= 2 then
--check down
if ly+1 <= gbHigh then
if tempGrid[lx][ly+1] == nil then
tempGrid[lx][ly+1] = 1
if grid[lx][ly+1] == nil then
table.insert(ol,{lx,ly+1})
elseif grid[lx][ly+1] >= fb then
--case 4: traveling down, skip up check
getFactionAdjacentGridLocationsSkip(4,lx,ly+1)
end
end
end
end
end
--------------------------------
-- Station creation functions --
--------------------------------
function setListOfStations()
--array of functions to facilitate randomized station placement (friendly and neutral)
placeStation = {placeAlcaleica, -- 1
placeAnderson, -- 2
placeArcher, -- 3
placeArchimedes, -- 4
placeArmstrong, -- 5
placeAsimov, -- 6
placeBarclay, -- 7
placeBethesda, -- 8
placeBroeck, -- 9
placeCalifornia, --10
placeCalvin, --11
placeCavor, --12
placeChatuchak, --13
placeCoulomb, --14
placeCyrus, --15
placeDeckard, --16
placeDeer, --17
placeErickson, --18
placeEvondos, --19
placeFeynman, --20
placeGrasberg, --21
placeHayden, --22
placeHeyes, --23
placeHossam, --24
placeImpala, --25
placeKomov, --26
placeKrak, --27
placeKruk, --28
placeLipkin, --29
placeMadison, --30
placeMaiman, --31
placeMarconi, --32
placeMayo, --33
placeMiller, --34
placeMuddville, --35
placeNexus6, --36
placeOBrien, --37
placeOlympus, --38
placeOrgana, --39
placeOutpost15, --40
placeOutpost21, --41
placeOwen, --42
placePanduit, --43
placeRipley, --44
placeRutherford, --45
placeScience7, --46
placeShawyer, --47
placeShree, --48
placeSoong, --49
placeTiberius, --50
placeTokra, --51
placeToohie, --52
placeUtopiaPlanitia, --53
placeVactel, --54
placeVeloquan, --55
placeZefram} --56
--array of functions to facilitate randomized station placement (friendly, neutral or enemy)
placeGenericStation = {placeJabba, -- 1
placeKrik, -- 2
placeLando, -- 3
placeMaverick, -- 4
placeNefatha, -- 5
placeOkun, -- 6
placeOutpost7, -- 7
placeOutpost8, -- 8
placeOutpost33, -- 9
placePrada, --10
placeResearch11, --11
placeResearch19, --12
placeRubis, --13
placeScience2, --14
placeScience4, --15
placeSkandar, --16
placeSpot, --17
placeStarnet, --18
placeTandon, --19
placeVaiken, --20
placeValero} --21
--array of functions to facilitate randomized station placement (enemy)
placeEnemyStation = {placeAramanth, -- 1
placeEmpok, -- 2
placeGandala, -- 3
placeHassenstadt, -- 4
placeKaldor, -- 5
placeMagMesra, -- 6
placeMosEisley, -- 7
placeQuestaVerde, -- 8
placeRlyeh, -- 9