-
Notifications
You must be signed in to change notification settings - Fork 6
/
scenario_59_border.lua
executable file
·15310 lines (15294 loc) · 717 KB
/
scenario_59_border.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: Borderline Fever
-- Description: War temperature rises along the border between Human Navy space and Kraylor space. The treaty holds for now, but the diplomats and intelligence operatives fear the Kraylors are about to break the treaty. We must maintain the treaty despite provocation until war is formally declared.
---
--- Version 5
-- Type: Replayable Mission
-- Setting[Enemies]: Configures strength and/or number of enemies in this scenario
-- Enemies[Easy]: Fewer or weaker enemies
-- Enemies[Normal|Default]: Normal number or strength of enemies
-- Enemies[Hard]: More or stronger enemies
-- Enemies[Extreme]: Much stronger, many more enemies
-- Enemies[Quixotic]: Insanely strong and/or inordinately large numbers of enemies
-- Setting[Murphy]: Configures the perversity of the universe according to Murphy's law
-- Murphy[Easy]: Random factors are more in your favor
-- Murphy[Normal|Default]: Random factors are normal
-- Murphy[Hard]: Random factors are more against you
-- Murphy[Quixotic]: No need for paranoia, the universe *is* out to get you
-- Setting[Ending]: Sets the conditions for ending the war: absolute strength % when friendly and Kraylor give up, relative strength % difference when friendly and Kraylor give up
-- Ending[Easy]: Cutoffs 10% easier than normal
-- Ending[Normal|Default]: Kraylor surrender if < 70% of their original strength, friendly surrender if < 50% of their original strength, either will surrender if < 20% relative strength difference
-- Ending[Hard]: Cutoffs 10% harder than normal
-- Ending[Quixotic]: Cutoffs 20% harder than normal
-- Setting[Timed]: Sets whether or not the scenario has a time limit. Default is no time limit
-- Timed[None|Default]: No time limit
-- Timed[15]: Scenario ends in 15 minutes
-- Timed[20]: Scenario ends in 20 minutes
-- Timed[25]: Scenario ends in 25 minutes
-- Timed[30]: Scenario ends in 30 minutes
-- Timed[35]: Scenario ends in 35 minutes
-- Timed[40]: Scenario ends in 40 minutes
-- Timed[45]: Scenario ends in 45 minutes
-- Timed[50]: Scenario ends in 50 minutes
-- Timed[55]: Scenario ends in 55 minutes
-- Setting[Reputation]: Starting reputation per player ship. The more initial reputation, the easier the scenario. Default: Hero = 400 reputation
-- Reputation[Unknown]: Nobody knows you. Zero reputation
-- Reputation[Nice]: 200 reputation - you've helped a few people
-- Reputation[Hero|Default]: 400 reputation - you've helped important people or lots of people
-- Reputation[Major Hero"]: 700 reputation - you're well known by nearly everyone as a force for good
-- Reputation[Super Hero"]: 1000 reputation - everyone knows you and relies on you for help
-- Setting[Unique Ship]: Choose player ship outside of standard player ship list
-- Unique Ship[None|Default]: None: just use standard player ship list on spawn screen
-- Unique Ship[Spinstar]: Based on Atlantis, has spinal beam: narrow, long range, rapid firing, 5 second duration, 30 second recharge, fewer tubes, weaker shields and hull, warp, faster maneuver
-- Unique Ship[Narsil]: Based on Atlantis, slower impulse, faster maneuver, warp, weaker hull and shields, add forward HVLI tube and side beam turrets
-- Unique Ship[Blazon]: Based on Striker, faster impulse and maneuver, stronger shields, narrower beams, add beam, add missiles
-- Unique Ship[Headhunter]: Based on Piranha, shorter jump, stronger hull and shields, add beam, one fewer mining tube, fewer mines and nukes, more EMPs
-- Unique Ship[Simian]: Based on missile cruiser, 20k jump, add beam, weaker hull, fewer tubes and missiles
-- Unique Ship[Spyder]: Based on Atlantis, slower impulse, extra tube, angled tubes
-- Unique Ship[Sting]: Based on Hathcock, faster impulse, warp, add mining tube, no nukes or EMPs
-- to do items:
-- Station warning of enemies in area (helpful warnings - shuffle stations)
require("utils.lua")
require("generate_call_sign_scenario_utility.lua")
require("place_station_scenario_utility.lua")
require("cpu_ship_diversification_scenario_utility.lua")
--------------------
-- Initialization --
--------------------
function init()
popupGMDebug = "once"
scenario_version = "5.6.1"
print(string.format(" ----- Scenario: Borderline Fever ----- Version %s -----",scenario_version))
print(_VERSION)
print("Example of calling a function via http API, assuming you start EE with parameter httpserver=8080 (or it's in options.ini):")
print('curl --data "getScriptStorage().scenario.createPlayerShipSting()" http://localhost:8080/exec.lua')
setGlobals()
setVariations()
setConstants()
constructEnvironment()
----------------------------------------------------------------------------------------------
-- Plot functions that swap in and out of the update loop either in a line or in a circle --
----------------------------------------------------------------------------------------------
-- Main plot
plot1 = treatyHolds --start main plot with the treaty in place
treaty = true
initialAssetsEvaluated = false
-- Ship health plot
healthCheckTimer = 5
healthCheckTimerInterval = 5
plotPB = playerBorderCheck --monitor players positions relative to neutral border zone
plotMF = muckAndFlies
-- Enemy border check plot
enemyEverDetected = false
enemyBorderCheckInterval = 3
enemyBorderCheckTimer = enemyBorderCheckInterval
plotVT = kraylorTransportPlot --start of kraylor, independent and friendly transport plots
kraylorTransportList = {}
independentTransportList = {}
friendlyTransportList = {}
-- End war plot
endWarTimerInterval = 3
endWarTimer = endWarTimerInterval
plotPA = personalAmbush
-- Enemy reversion
enemy_reverts = {}
revert_timer_interval = 7
revert_timer = revert_timer_interval
plotRevert = revertWait
mainGMButtons()
end
function setGlobals()
game_state = "paused"
-- Make the createPlayerShip... functions accessible from other scripts (including exec.lua)
local scenario = {}
scenario.createPlayerShipBlazon = createPlayerShipBlazon
scenario.createPlayerShipHeadhunter = createPlayerShipHeadhunter
scenario.createPlayerShipNarsil = createPlayerShipNarsil
scenario.createPlayerShipSimian = createPlayerShipSimian
scenario.createPlayerShipSpinstar = createPlayerShipSpinstar
scenario.createPlayerShipSpyder = createPlayerShipSpyder
scenario.createPlayerShipSting = createPlayerShipSting
scenario.gatherStats = gatherStats
local storage = getScriptStorage()
storage.scenario = scenario
-- starryUtil v2
starryUtil={
math={
-- linear interpolation
-- mostly intended as an aid to make code more readable
lerp=function(a,b,t)
assert(type(a)=="number")
assert(type(b)=="number")
assert(type(t)=="number")
return a + t * (b - a);
end
},
debug={
-- get a multi-line string for the number of objects at the current time
-- intended to be used via addGMMessage or print, but there may be other uses
-- it may be worth considering adding a function which would return an array rather than a string
getNumberOfObjectsString=function()
local all_objects=getAllObjects()
local object_counts={}
--first up we accumulate the number of each type of object
for i=1,#all_objects do
local object_type=all_objects[i].typeName
local current_count=object_counts[object_type]
if current_count==nil then
current_count=0
end
object_counts[object_type]=current_count+1
end
-- we want the ordering to be stable so we build a key list
local sorted_counts={}
for type in pairs(object_counts) do
table.insert(sorted_counts, type)
end
table.sort(sorted_counts)
--lastly we build the output
local output=""
for i,object_type in ipairs(sorted_counts) do
output=output..string.format("%s: %i\n",object_type,object_counts[object_type])
end
return output..string.format("\nTotal: %i",#all_objects)
end
},
}
stored_fixed_names = { --change table name to predefined_player_ships to default to fixed names
{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"},
}
banner = {}
banner["number_of_players"] = 0
banner["player_strength"] = 0
banner["player"] = {}
banner["Human Navy"] = {}
banner["Kraylor"] = {}
defaultGameTimeLimitInMinutes = 30 --final: 30 (lowered for test)
rawKraylorShipStrength = 0
rawHumanShipStrength = 0
primaryOrders = ""
secondaryOrders = ""
optionalOrders = ""
-- Ship type selection
pool_selectivity = "full"
template_pool_size = 5
-- Tracking ships and stations
enemyVesselDestroyedNameList = {}
enemyVesselDestroyedType = {}
enemyVesselDestroyedValue = {}
friendlyVesselDestroyedNameList = {}
friendlyVesselDestroyedType = {}
friendlyVesselDestroyedValue = {}
friendlyStationDestroyedNameList = {}
friendlyStationDestroyedValue = {}
enemyStationDestroyedNameList = {}
enemyStationDestroyedValue = {}
neutralStationDestroyedNameList = {}
neutralStationDestroyedValue = {}
show_player_info = true
show_only_player_name = true
info_choice = 0
info_choice_max = 5
wreck_debris_label_count = 1
end
function setVariations()
--default or initial end of game victory/defeat values
enemyDestructionVictoryCondition = 70 --final: 70
friendlyDestructionDefeatCondition = 50 --final: 50
destructionDifferenceEndCondition = 20 --final: 20
if getScenarioSetting == nil or getScenarioSetting("Enemies") == "" then
enemy_power = 1
difficulty = 1
adverseEffect = .995
coolant_loss = .99995
coolant_gain = .001
ersAdj = 0
starting_reputation = 400
else
local enemy_config = {
["Easy"] = {number = .5},
["Normal"] = {number = 1},
["Hard"] = {number = 2},
["Quixotic"] = {number = 5},
}
enemy_power = enemy_config[getScenarioSetting("Enemies")].number
local murphy_config = {
["Easy"] = {number = .5, adverse = .999, lose_coolant = .99999, gain_coolant = .01, ers_adj = 10},
["Normal"] = {number = 1, adverse = .995, lose_coolant = .99995, gain_coolant = .001, ers_adj = 0},
["Hard"] = {number = 2, adverse = .99, lose_coolant = .9999, gain_coolant = .0001, ers_adj = -5},
["Quixotic"] = {number = 5, adverse = .9, lose_coolant = .999, gain_coolant = .0001, ers_adj = -10},
}
difficulty = murphy_config[getScenarioSetting("Murphy")].number
-- difficulty impacts several things including:
-- mining drain on power
-- benefit or detriment chance of items dropped by destroyed enemies
-- degree of effect of scanning items dropped by destroyed enemies as to their benefit or detriment
-- whether warnings about enemies include ship type
-- the chance of retrieving minerals when mining asteroids
-- the amount of heat generated when mining
-- the amount of damage given when attacking armored warp jammers
-- the delay before a sleeper awakes and attacks
-- the type of missile a sleeper is armed with
-- delay between muck and fly attacks
-- the number of flies in a muck and fly attack
-- strength of muck armor in muck and fly attack
-- size of jammer fleet
-- speed of station defense deployment
-- speed of station defense orbiting defense platform or warp jammer
-- strength of station defense drone fleet or fighter fleet
-- chance of repair crew recovering when zero repair crew remain
-- degree of damage when space time continuum disrupted
-- chance of space time continuum disruption
-- chance of getting information about upgrade characters
-- chance of coolant and repair crew availability
-- when upgrades are free
-- reputation cost of ordnance
-- scanning difficulty for intel artifacts
adverseEffect = murphy_config[getScenarioSetting("Murphy")].adverse
coolant_loss = murphy_config[getScenarioSetting("Murphy")].lose_coolant
coolant_gain = murphy_config[getScenarioSetting("Murphy")].gain_coolant
ersAdj = murphy_config[getScenarioSetting("Murphy")].ers_adj
mining_drain = .00025 * difficulty
local completion_conditions = {
["Easy"] = {enemy_destruction = enemyDestructionVictoryCondition*1.1, friendly_destruction = friendlyDestructionDefeatCondition*.9, destruction_difference = destructionDifferenceEndCondition*1.1},
["Normal"] = {enemy_destruction = enemyDestructionVictoryCondition, friendly_destruction = friendlyDestructionDefeatCondition, destruction_difference = destructionDifferenceEndCondition},
["Hard"] = {enemy_destruction = enemyDestructionVictoryCondition*.9, friendly_destruction = friendlyDestructionDefeatCondition*1.1, destruction_difference = destructionDifferenceEndCondition*.9},
["Quixotic"] = {enemy_destruction = enemyDestructionVictoryCondition*.8, friendly_destruction = friendlyDestructionDefeatCondition*1.2, destruction_difference = destructionDifferenceEndCondition*.8},
}
enemyDestructionVictoryCondition = completion_conditions[getScenarioSetting("Ending")].enemy_destruction
friendlyDestructionDefeatCondition = completion_conditions[getScenarioSetting("Ending")].friendly_destruction
destructionDifferenceEndCondition = completion_conditions[getScenarioSetting("Ending")].destruction_difference
local timed_config = {
["None"] = {limit = 0, limited = false, plot = nil},
["15"] = {limit = 15,limited = true, plot = timedGame},
["20"] = {limit = 20,limited = true, plot = timedGame},
["25"] = {limit = 25,limited = true, plot = timedGame},
["30"] = {limit = 30,limited = true, plot = timedGame},
["35"] = {limit = 35,limited = true, plot = timedGame},
["40"] = {limit = 40,limited = true, plot = timedGame},
["45"] = {limit = 45,limited = true, plot = timedGame},
["50"] = {limit = 50,limited = true, plot = timedGame},
["55"] = {limit = 55,limited = true, plot = timedGame},
}
playWithTimeLimit = timed_config[getScenarioSetting("Timed")].limited
defaultGameTimeLimitInMinutes = timed_config[getScenarioSetting("Timed")].limit
gameTimeLimit = defaultGameTimeLimitInMinutes*60
plot2 = timed_config[getScenarioSetting("Timed")].plot
local reputation_config = {
["Unknown"] = 0,
["Nice"] = 200,
["Hero"] = 400,
["Major Hero"] =700,
["Super Hero"] =1000,
}
starting_reputation = reputation_config[getScenarioSetting("Reputation")]
local player_ship_config = {
["Spinstar"] = createPlayerShipSpinstar,
["Narsil"] = createPlayerShipNarsil,
["Blazon"] = createPlayerShipBlazon,
["Simian"] = createPlayerShipSimian,
["Spyder"] = createPlayerShipSpyder,
["Sting"] = createPlayerShipSting,
["Headhunter"] = createPlayerShipHeadhunter,
}
if getScenarioSetting("Unique Ship") ~= "None" then
player_ship_config[getScenarioSetting("Unique Ship")]()
end
end
end
function setConstants()
-- various testing diagnostics
initDiagnostic = false
diagnostic = false
mf_diagnostic = false
stationCommsDiagnostic = false
shipCommsDiagnostic = false
optionalMissionDiagnostic = false
paDiagnostic = false
plot3diagnostic = false
plot1Diagnostic = false
updateDiagnostic = false
station_warning_diagnostic = false
healthDiagnostic = false
plot2diagnostic = false
endStatDiagnostic = false
change_enemy_order_diagnostic = false
distance_diagnostic = false
repair_system_diagnostic = false
--These random range values are in seconds, not minutes
--Place in variables to facilitate testing and tinkering
--random range 1 final: 120, 300 (lowered for test) initial attack, pincer attack, vengence
lrr1 = 120 --lower random range
urr1 = 300 --upper random range
--random range 2 final: 120, 500 (lowered for test) initial attack, pincer attack, vengence
lrr2 = 120 --lower random range
urr2 = 500 --upper random range
--random range 3 final: 120, 180 (lowered for test) initial attack, pincer attack, vengence
lrr3 = 120 --lower random range
urr3 = 180 --upper random range
--random range 4 final: 30, 300 (lowered for test) treaty for timed game
lrr4 = 30
urr4 = 300
--random range 4 final: 240, 540 (lowered for test) treaty for game with no time limit
lrr5 = 240
urr5 = 540
--station placement setup values
station_sizes = {
["Huge Station"] = {strength = 10, short_lo = 150, short_hi = 500},
["Large Station"] = {strength = 5, short_lo = 90, short_hi = 300},
["Medium Station"] = {strength = 3, short_lo = 60, short_hi = 200},
["Small Station"] = {strength = 1, short_lo = 35, short_hi = 100},
}
--enemy strength evaluation; ratio of stations to ships. Must add up to 1
enemyStationComponentWeight = .65
enemyShipComponentWeight = .35
--friendly strength evaluation; ratio of friendly stations, neutral stations and friendly ships. Must add up to 1
friendlyStationComponentWeight = .5
neutralStationComponentWeight = .1
friendlyShipComponentWeight = .4
repeatExitBoundary = 100
printDetailedStats = true
missile_types = {'Homing', 'Nuke', 'Mine', 'EMP', 'HVLI'}
system_list = {"reactor","beamweapons","missilesystem","maneuver","impulse","warp","jumpdrive","frontshield","rearshield"}
ship_template = { --ordered by relative strength
["Gnat"] = {strength = 2, create = gnat},
["Lite Drone"] = {strength = 3, create = droneLite},
["Jacket Drone"] = {strength = 4, create = droneJacket},
["Ktlitan Drone"] = {strength = 4, create = stockTemplate},
["Heavy Drone"] = {strength = 5, create = droneHeavy},
["MT52 Hornet"] = {strength = 5, create = stockTemplate},
["MU52 Hornet"] = {strength = 5, create = stockTemplate},
["MV52 Hornet"] = {strength = 6, create = hornetMV52},
["Adder MK4"] = {strength = 6, create = stockTemplate},
["Fighter"] = {strength = 6, create = stockTemplate},
["Ktlitan Fighter"] = {strength = 6, create = stockTemplate},
["K2 Fighter"] = {strength = 7, create = k2fighter},
["Adder MK5"] = {strength = 7, create = stockTemplate},
["WX-Lindworm"] = {strength = 7, create = stockTemplate},
["K3 Fighter"] = {strength = 8, create = k3fighter},
["Adder MK6"] = {strength = 8, create = stockTemplate},
["Ktlitan Scout"] = {strength = 8, create = stockTemplate},
["WZ-Lindworm"] = {strength = 9, create = wzLindworm},
["Phobos R2"] = {strength = 13, create = phobosR2},
["Missile Cruiser"] = {strength = 14, create = stockTemplate},
["Waddle 5"] = {strength = 15, create = waddle5},
["Jade 5"] = {strength = 15, create = jade5},
["Phobos T3"] = {strength = 15, create = stockTemplate},
["Piranha F8"] = {strength = 15, create = stockTemplate},
["Piranha F12"] = {strength = 15, create = stockTemplate},
["Farco 3"] = {strength = 16, create = farco3},
["Farco 5"] = {strength = 16, create = farco5},
["Piranha F12.M"] = {strength = 16, create = stockTemplate},
["Phobos M3"] = {strength = 16, create = stockTemplate},
["Karnack"] = {strength = 17, create = stockTemplate},
["Gunship"] = {strength = 17, create = stockTemplate},
["Cruiser"] = {strength = 18, create = stockTemplate},
["Phobos T4"] = {strength = 18, create = phobosT4},
["Farco 8"] = {strength = 19, create = farco8},
["Nirvana R5"] = {strength = 19, create = stockTemplate},
["Nirvana R5A"] = {strength = 20, create = stockTemplate},
["Adv. Gunship"] = {strength = 20, create = stockTemplate},
["Farco 11"] = {strength = 21, create = farco11},
["Ktlitan Worker"] = {strength = 21, create = stockTemplate},
["Storm"] = {strength = 22, create = stockTemplate},
["Farco 13"] = {strength = 24, create = farco13},
["Ranus U"] = {strength = 25, create = stockTemplate},
["Stalker Q7"] = {strength = 25, create = stockTemplate},
["Stalker R7"] = {strength = 25, create = stockTemplate},
["Whirlwind"] = {strength = 26, create = whirlwind},
["Adv. Striker"] = {strength = 27, create = stockTemplate},
["Tempest"] = {strength = 30, create = tempest},
["Strikeship"] = {strength = 30, create = stockTemplate},
["Maniapak"] = {strength = 34, create = maniapak},
["Cucaracha"] = {strength = 36, create = cucaracha},
["Predator"] = {strength = 42, create = predator},
["Ktlitan Breaker"] = {strength = 45, create = stockTemplate},
["Hurricane"] = {strength = 46, create = hurricane},
["Ktlitan Feeder"] = {strength = 48, create = stockTemplate},
["Atlantis X23"] = {strength = 50, create = stockTemplate},
["K2 Breaker"] = {strength = 55, create = k2breaker},
["Ktlitan Destroyer"] = {strength = 50, create = stockTemplate},
["Atlantis Y42"] = {strength = 60, create = atlantisY42},
["Blockade Runner"] = {strength = 65, create = stockTemplate},
["Starhammer II"] = {strength = 70, create = stockTemplate},
["Enforcer"] = {strength = 75, create = enforcer},
["Dreadnought"] = {strength = 80, create = stockTemplate},
["Starhammer III"] = {strength = 85, create = starhammerIII},
["Starhammer V"] = {strength = 90, create = starhammerV},
["Battlestation"] = {strength = 100, create = stockTemplate},
["Tyr"] = {strength = 150, create = tyr},
["Odin"] = {strength = 250, create = stockTemplate},
}
formation_delta = {
["square"] = {
x = {0,1,0,-1, 0,1,-1, 1,-1,2,0,-2, 0,2,-2, 2,-2,2, 2,-2,-2,1,-1, 1,-1,0, 0,3,-3,1, 1,3,-3,-1,-1, 3,-3,2, 2,3,-3,-2,-2, 3,-3,3, 3,-3,-3,4,0,-4, 0,4,-4, 4,-4,-4,-4,-4,-4,-4,-4,4, 4,4, 4,4, 4, 1,-1, 2,-2, 3,-3,1,-1,2,-2,3,-3,5,-5,0, 0,5, 5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,5, 5,5, 5,5, 5,5, 5, 1,-1, 2,-2, 3,-3, 4,-4,1,-1,2,-2,3,-3,4,-4},
y = {0,0,1, 0,-1,1,-1,-1, 1,0,2, 0,-2,2,-2,-2, 2,1,-1, 1,-1,2, 2,-2,-2,3,-3,0, 0,3,-3,1, 1, 3,-3,-1,-1,3,-3,2, 2, 3,-3,-2,-2,3,-3, 3,-3,0,4, 0,-4,4,-4,-4, 4, 1,-1, 2,-2, 3,-3,1,-1,2,-2,3,-3,-4,-4,-4,-4,-4,-4,4, 4,4, 4,4, 4,0, 0,5,-5,5,-5, 5,-5, 1,-1, 2,-2, 3,-3, 4,-4,1,-1,2,-2,3,-3,4,-4,-5,-5,-5,-5,-5,-5,-5,-5,5, 5,5, 5,5, 5,5, 5},
},
["hexagonal"] = {
x = {0,2,-2,1,-1, 1,-1,4,-4,0, 0,2,-2,-2, 2,3,-3, 3,-3,6,-6,1,-1, 1,-1,3,-3, 3,-3,4,-4, 4,-4,5,-5, 5,-5,8,-8,4,-4, 4,-4,5,5 ,-5,-5,2, 2,-2,-2,0, 0,6, 6,-6,-6,7, 7,-7,-7,10,-10,5, 5,-5,-5,6, 6,-6,-6,7, 7,-7,-7,8, 8,-8,-8,9, 9,-9,-9,3, 3,-3,-3,1, 1,-1,-1,12,-12,6,-6, 6,-6,7,-7, 7,-7,8,-8, 8,-8,9,-9, 9,-9,10,-10,10,-10,11,-11,11,-11,4,-4, 4,-4,2,-2, 2,-2,0, 0},
y = {0,0, 0,1, 1,-1,-1,0, 0,2,-2,2,-2, 2,-2,1,-1,-1, 1,0, 0,3, 3,-3,-3,3,-3,-3, 3,2,-2,-2, 2,1,-1,-1, 1,0, 0,4,-4,-4, 4,3,-3, 3,-3,4,-4, 4,-4,4,-4,2,-2, 2,-2,1,-1, 1,-1, 0, 0,5,-5, 5,-5,4,-4, 4,-4,3,-3, 3,-7,2,-2, 2,-2,1,-1, 1,-1,5,-5, 5,-5,5,-5, 5,-5, 0, 0,6, 6,-6,-6,5, 5,-5,-5,4, 4,-4,-4,3, 3,-3,-3, 2, 2,-2, -2, 1, 1,-1, -1,6, 6,-6,-6,6, 6,-6,-6,6,-6},
},
["pyramid"] = {
[1] = {
{angle = 0, distance = 0},
},
[2] = {
{angle = -1, distance = 1},
{angle = 1, distance = 1},
},
[3] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
},
[4] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = 0, distance = 2},
},
[5] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
},
[6] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
},
[7] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
},
[8] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
},
[9] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -4, distance = 4},
{angle = 4, distance = 4},
},
[10] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -2, distance = 3},
{angle = 2, distance = 3},
},
[11] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -4, distance = 4},
{angle = 4, distance = 4},
{angle = -3, distance = 4},
{angle = 3, distance = 4},
},
[12] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = -2, distance = 3},
{angle = 2, distance = 3},
{angle = -1, distance = 3},
{angle = 1, distance = 3},
},
[13] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = 0, distance = 3},
{angle = -2, distance = 4},
{angle = 2, distance = 4},
{angle = -1, distance = 5},
{angle = 1, distance = 5},
{angle = 0, distance = 6},
},
[14] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = 0, distance = 4},
{angle = -2, distance = 4},
{angle = 2, distance = 4},
{angle = -1, distance = 5},
{angle = 1, distance = 5},
{angle = 0, distance = 6},
},
[15] = {
{angle = 0, distance = 0},
{angle = -1, distance = 1},
{angle = 1, distance = 1},
{angle = -2, distance = 2},
{angle = 2, distance = 2},
{angle = 0, distance = 2},
{angle = -3, distance = 3},
{angle = 3, distance = 3},
{angle = 0, distance = 3},
{angle = 0, distance = 4},
{angle = -2, distance = 4},
{angle = 2, distance = 4},
{angle = -1, distance = 5},
{angle = 1, distance = 5},
{angle = 0, distance = 6},
},
},
}
max_pyramid_tier = 15
playerShipStats = { ["MP52 Hornet"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 600, cm_strafe = 0, },
["Piranha"] = { strength = 16, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, },
["Flavia P.Falcon"] = { strength = 13, cargo = 15, distance = 200, long_range_radar = 40000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 250, cm_strafe = 150, },
["Phobos M3P"] = { strength = 19, cargo = 10, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, },
["Atlantis"] = { strength = 52, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, },
["Player Cruiser"] = { strength = 40, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 400, cm_strafe = 250, },
["Player Missile Cr."] = { strength = 45, cargo = 8, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 450, cm_strafe = 150, },
["Player Fighter"] = { strength = 7, cargo = 3, distance = 100, long_range_radar = 15000, short_range_radar = 4500, tractor = false, mining = false, cm_boost = 600, cm_strafe = 0, },
["Benedict"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, },
["Kiriya"] = { strength = 10, cargo = 9, distance = 400, long_range_radar = 35000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, },
["Striker"] = { strength = 8, cargo = 4, distance = 200, long_range_radar = 35000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, },
["ZX-Lindworm"] = { strength = 8, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 5500, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, },
["Repulse"] = { strength = 14, cargo = 12, distance = 200, long_range_radar = 38000, short_range_radar = 5000, tractor = true, mining = false, cm_boost = 250, cm_strafe = 150, },
["Ender"] = { strength = 100, cargo = 20, distance = 2000,long_range_radar = 45000, short_range_radar = 7000, tractor = true, mining = false, cm_boost = 800, cm_strafe = 500, },
["Nautilus"] = { strength = 12, cargo = 7, distance = 200, long_range_radar = 22000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, },
["Hathcock"] = { strength = 30, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = true, cm_boost = 200, cm_strafe = 150, },
["Maverick"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = true, cm_boost = 400, cm_strafe = 250, },
["Crucible"] = { strength = 45, cargo = 5, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 400, cm_strafe = 250, },
["Proto-Atlantis"] = { strength = 40, cargo = 4, distance = 400, long_range_radar = 30000, short_range_radar = 4500, tractor = false, mining = true, cm_boost = 400, cm_strafe = 250, },
["Stricken"] = { strength = 40, cargo = 4, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, },
["Surkov"] = { strength = 35, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, },
["Redhook"] = { strength = 11, cargo = 8, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, },
["Pacu"] = { strength = 18, cargo = 7, distance = 200, long_range_radar = 20000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, },
["Phobos T2"] = { strength = 19, cargo = 9, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, },
["Wombat"] = { strength = 13, cargo = 3, distance = 100, long_range_radar = 18000, short_range_radar = 6000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, },
["Holmes"] = { strength = 35, cargo = 6, distance = 200, long_range_radar = 35000, short_range_radar = 4000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, },
["Focus"] = { strength = 35, cargo = 4, distance = 200, long_range_radar = 32000, short_range_radar = 5000, tractor = false, mining = true, cm_boost = 400, cm_strafe = 250, },
["Flavia 2C"] = { strength = 25, cargo = 12, distance = 200, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = true, cm_boost = 250, cm_strafe = 150, },
["Destroyer IV"] = { strength = 25, cargo = 5, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 400, cm_strafe = 250, },
["Destroyer III"] = { strength = 25, cargo = 7, distance = 200, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 450, cm_strafe = 150, },
["MX-Lindworm"] = { strength = 10, cargo = 3, distance = 100, long_range_radar = 30000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, },
["Striker LX"] = { strength = 16, cargo = 4, distance = 200, long_range_radar = 20000, short_range_radar = 4000, tractor = false, mining = false, cm_boost = 250, cm_strafe = 150, },
["Maverick XP"] = { strength = 23, cargo = 5, distance = 200, long_range_radar = 25000, short_range_radar = 7000, tractor = true, mining = false, cm_boost = 400, cm_strafe = 250, },
["Era"] = { strength = 14, cargo = 14, distance = 200, long_range_radar = 50000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 250, cm_strafe = 150, },
["Squid"] = { strength = 14, cargo = 8, distance = 200, long_range_radar = 25000, short_range_radar = 5000, tractor = false, mining = false, cm_boost = 200, cm_strafe = 150, },
["Atlantis II"] = { strength = 60, cargo = 6, distance = 400, long_range_radar = 30000, short_range_radar = 5000, tractor = true, mining = true, cm_boost = 400, cm_strafe = 250, },
}
--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"] = {"Excaliber","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","Phoenix","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", "Pegahmagabow", "Fett", "Hawkeye", "Hanzo"}
playerShipNamesFor["Proto-Atlantis"] = {"Narsil", "Blade", "Decapitator", "Trisect", "Sabre"}
playerShipNamesFor["Maverick"] = {"Angel", "Thunderbird", "Roaster", "Magnifier", "Hedge"}
playerShipNamesFor["Crucible"] = {"Sling", "Stark", "Torrid", "Kicker", "Flummox"}
playerShipNamesFor["Surkov"] = {"Sting", "Sneak", "Bingo", "Thrill", "Vivisect"}
playerShipNamesFor["Stricken"] = {"Blazon", "Streaker", "Pinto", "Spear", "Javelin"}
playerShipNamesFor["Atlantis II"] = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"}
playerShipNamesFor["Redhook"] = {"Headhunter", "Thud", "Troll", "Scalper", "Shark"}
playerShipNamesFor["Destroyer III"] = {"Trebuchet", "Pitcher", "Mutant", "Gronk", "Methuselah"}
playerShipNamesFor["Leftovers"] = {"Foregone","Righteous","Masher"}
commonGoods = {"food","medicine","nickel","platinum","gold","dilithium","tritanium","luxury","cobalt","impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"}
componentGoods = {"impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"}
mineralGoods = {"nickel","platinum","gold","dilithium","tritanium","cobalt"}
vapor_goods = {"gold pressed latinum","unobtanium","eludium","impossibrium"}
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"}
hitZonePermutations = {
{"warp","beamweapons","reactor"},
{"jumpdrive","beamweapons","reactor"},
{"impulse","beamweapons","reactor"},
{"warp","missilesystem","reactor"},
{"jumpdrive","missilesystem","reactor"},
{"impulse","missilesystem","reactor"},
{"warp","beamweapons","maneuver"},
{"jumpdrive","beamweapons","maneuver"},
{"impulse","beamweapons","maneuver"},
{"warp","missilesystem","maneuver"},
{"jumpdrive","missilesystem","maneuver"},
{"impulse","missilesystem","maneuver"},
{"warp","beamweapons","frontshield"},
{"jumpdrive","beamweapons","frontshield"},
{"impulse","beamweapons","frontshield"},
{"warp","missilesystem","frontshield"},
{"jumpdrive","missilesystem","frontshield"},
{"impulse","missilesystem","frontshield"},
{"warp","beamweapons","rearshield"},
{"jumpdrive","beamweapons","rearshield"},
{"impulse","beamweapons","rearshield"},
{"warp","missilesystem","rearshield"},
{"jumpdrive","missilesystem","rearshield"},
{"impulse","missilesystem","rearshield"},
{"warp","reactor","maneuver"},
{"jumpdrive","reactor","maneuver"},
{"impulse","reactor","maneuver"},
{"warp","reactor","frontshield"},
{"jumpdrive","reactor","frontshield"},
{"impulse","reactor","frontshield"},
{"warp","reactor","rearshield"},
{"jumpdrive","reactor","rearshield"},
{"impulse","reactor","rearshield"},
{"warp","maneuver","frontshield"},
{"jumpdrive","maneuver","frontshield"},
{"impulse","maneuver","frontshield"},
{"warp","maneuver","rearshield"},
{"jumpdrive","maneuver","rearshield"},
{"impulse","maneuver","rearshield"},
{"beamweapons","beamweapons","maneuver"},
{"missilesystem","beamweapons","maneuver"},
{"beamweapons","beamweapons","frontshield"},
{"missilesystem","beamweapons","frontshield"},
{"beamweapons","beamweapons","rearshield"},
{"missilesystem","beamweapons","rearshield"},
{"beamweapons","maneuver","frontshield"},
{"missilesystem","maneuver","frontshield"},
{"beamweapons","maneuver","rearshield"},
{"missilesystem","maneuver","rearshield"},
{"reactor","maneuver","frontshield"},
{"reactor","maneuver","rearshield"}
}
--minutes and danger
enemyReinforcementSchedule = {
{30, 1},
{20, 1},
{15, 2},
{12, 2},
{15, 3},
{15, 3},
{20, 4}
}
mining_beam_string = {
"beam_orange.png",
"beam_yellow.png",
"fire_sphere_texture.png"
}
wreck_mod_debris = {}
base_wreck_mod_positive = 80
wreck_mod_interval = 20
wreck_mod_type = {
{func=wreckModHealthBeam, desc="Primary ship system component", scan_desc="Beam system component"}, --1
{func=wreckModHealthMissile, desc="Primary ship system component", scan_desc="Missile system component"}, --2
{func=wreckModHealthImpulse, desc="Primary ship system component", scan_desc="Impulse engine component"}, --3
{func=wreckModHealthWarp, desc="Primary ship system component", scan_desc="Warp engine component"}, --4
{func=wreckModHealthJump, desc="Primary ship system component", scan_desc="Jump drive component"}, --5
{func=wreckModHealthShield, desc="Primary ship system component", scan_desc="Shield component"}, --6
{func=wreckModHealthSpin, desc="Primary ship system component", scan_desc="Maneuver system component"}, --7
{func=wreckModHealthReactor, desc="Primary ship system component", scan_desc="Reactor system component"}, --8
{func=wreckModBoolScan, desc="Secondary ship system component", scan_desc="Scanner system component"}, --9
{func=wreckModBoolCombat, desc="Secondary ship system component", scan_desc="Combat maneuver system component"}, --10
{func=wreckModBoolProbe, desc="Secondary ship system component", scan_desc="Probe launch system component"}, --11
{func=wreckModBoolHack, desc="Secondary ship system component", scan_desc="Hacking system component"}, --12
{func=wreckModChangeScan, desc="Secondary ship system component", scan_desc="Scan range system component"}, --13
{func=wreckModChangeCoolant, desc="Secondary ship system component", scan_desc="System coolant container"}, --14
{func=wreckModChangeRepair, desc="Secondary ship system component", scan_desc="Robotic repair crew"}, --15
{func=wreckModChangeHull, desc="Secondary ship system component", scan_desc="Modular hull plating"}, --16
{func=wreckModChangeShield, desc="Secondary ship system component", scan_desc="Shield charging component"}, --17 can overcharge
{func=wreckModChangePower, desc="Secondary ship system component", scan_desc="Power source"}, --18
{func=wreckModCombatBoost, desc="Secondary ship system component", scan_desc="Maneuver boost thruster"}, --19 timed
{func=wreckModCombatStrafe, desc="Secondary ship system component", scan_desc="Maneuver strafe thruster"}, --20 timed
{func=wreckModProbeStock, desc="Secondary ship system component", scan_desc="Probe container"}, --21
{func=wreckModBeamDamage, desc="Primary ship system component", scan_desc="Beam system optics"}, --22 timed
{func=wreckModBeamCycle, desc="Primary ship system component", scan_desc="Beam system power capacitors"}, --23 timed
{func=wreckModMissileStock, desc="Primary ship system component", scan_desc="Missile container"}, --24
{func=wreckModImpulseSpeed, desc="Primary ship system component", scan_desc="Impulse engine regulator"}, --25 timed
{func=wreckModWarpSpeed, desc="Primary ship system component", scan_desc="Alternate warp drive envelope shape"}, --26 timed
{func=wreckModJumpRange, desc="Primary ship system component", scan_desc="Jump drive range ringer"}, --27 timed
{func=wreckModShieldMax, desc="Primary ship system component", scan_desc="Shield capacitor"}, --28 timed
{func=wreckModSpinSpeed, desc="Primary ship system component", scan_desc="Maneuvering thrusters"}, --29 timed
{func=wreckModBatteryMax, desc="Primary ship system component", scan_desc="Main power battery"}, --30 timed
{func=wreckCargo, desc="Cargo", scan_desc="Cargo"}, --31
{func=wreckModCoolantPump, desc="Primary ship system component", scan_desc="Coolant pump component"}, --32
-- {func=wreckModPowerRegulator, desc="Primary ship system component", scan_desc="Power Regulator component"}, --33
}
end
-- Terrain and environment creation functions
function constructEnvironment()
local rpt_counter = 0
local spawnInInnerZone = false
repeat
rpt_counter = rpt_counter + 1
setGossipSnippets()
populateStationPool()
setBorderZones() --establish neutral border zone and other zones
buildStationsPlus() --put stations and other things in and out of the neutral border zone
if initDiagnostic then print("weird zone adjustment count: " .. wzac) end
--be sure initial spawn point (0,0) is inside the inner zone defining human territory
spawnInInnerZone = false
local spawnMarker = VisualAsteroid():setPosition(0,0)
spawnInInnerZone = innerZone:isInside(spawnMarker)
spawnMarker:destroy()
--be sure each side has at least a minimal number of stations
if wzac > 0 or #kraylorStationList < 5 or #humanStationList < 5 or not spawnInInnerZone then
print("resetting stations, counter:",rpt_counter)
resetStationsPlus()
end
until(wzac < 1 and #kraylorStationList >= 5 and #humanStationList >= 5 and spawnInInnerZone)
if not diagnostic then --get rid of temporary set up zones
for i=1,#innerZoneList do
innerZoneList[i]:destroy()
end
for i=1,#outerZoneList do
outerZoneList[i]:destroy()
end
end
setFleets() --give each side some ships
setEnemyStationDefenses() --give enemy stations defensive mechanisms
setOptionalMissions() --scatter upgrade missions around the stations
setCharacterNames() --add decoy character names to stations
end
function setGossipSnippets()
gossipSnippets = {}
table.insert(gossipSnippets,"I hear the head of operations has a thing for his administrative assistant") --1
table.insert(gossipSnippets,"My mining friends tell me Krak or Kruk is about to strike it rich") --2
table.insert(gossipSnippets,"Did you know you can usually hire replacement repair crew cheaper at friendly stations?") --3
table.insert(gossipSnippets,"Under their uniforms, the Kraylors have an extra appendage. I wonder what they use it for") --4
table.insert(gossipSnippets,"The Kraylors may be human navy enemies, but they make some mighty fine BBQ Mynock") --5
table.insert(gossipSnippets,"The Kraylors and the Ktlitans may be nearing a cease fire from what I hear. That'd be bad news for us") --6
table.insert(gossipSnippets,"Docking bay 7 has interesting mind altering substances for sale, but they're monitored between 1900 and 2300") --7
table.insert(gossipSnippets,"Watch the sky tonight in quadrant J around 2243. It should be spectacular") --8
table.insert(gossipSnippets,"I think the shuttle pilot has a tame miniature Ktlitan caged in his quarters. Sometimes I hear it at night") --9
table.insert(gossipSnippets,"Did you hear the screaming chase in the corridors on level 4 last night? Three Kraylors were captured and put in the brig") --10
table.insert(gossipSnippets,"Rumor has it that the two Lichten brothers are on the verge of a new discovery. And it's not another wine flavor either") --11
end
function setCharacterNames()
for i=1,#humanStationList do
curStation = humanStationList[i]
if curStation.comms_data.character == nil then
if #characterNames > 0 then
nameChoice = math.random(1,#characterNames)
curStation.comms_data.character = characterNames[nameChoice]
table.remove(characterNames,nameChoice)
end
end
end
end
function setBorderZones()
local borderStartAngle = random(0,360) --gross orientation of default spawn point to neutral border zone
local borderStartX, borderStartY = vectorFromAngle(borderStartAngle,random(3500,4900))
local halfLength = random(8000,15000)
local zoneLimit = 150000
borderZone = {}
innerZoneList = {}
outerZoneList = {}
local bzi = 1 --border zone index
--Note: "left" and "right" refer to someone standing on the 2D board at the spawn point (0,0) looking at the zones being added;
-- "inner" means closer to the spawn point, "outer" means further away from the spawn point
local borderZoneLeftInnerX = {}
local borderZoneLeftInnerY = {}
local borderZoneRightInnerX = {}
local borderZoneRightInnerY = {}
local borderZoneLeftOuterX = {}
local borderZoneLeftOuterY = {}
local borderZoneRightOuterX = {}
local borderZoneRightOuterY = {}
local bzsx, bzsy = vectorFromAngle(borderStartAngle+270,halfLength) --border zone start x and y coordinates
table.insert(borderZoneLeftInnerX, borderStartX+bzsx)
table.insert(borderZoneLeftInnerY, borderStartY+bzsy)
bzsx, bzsy = vectorFromAngle(borderStartAngle+90,halfLength) --border sone start x and y coordinates
table.insert(borderZoneRightInnerX, borderStartX+bzsx)
table.insert(borderZoneRightInnerY, borderStartY+bzsy)
local bendAngle = random(1,30) --inner and outer edges are parallel, connecting edges are bent
local negativeBendCount = 0
local positiveBendCount = 0
if random(1,100) < 50 then
negativeBendCount = negativeBendCount + bendAngle
bendAngle = -1*bendAngle
else
positiveBendCount = positiveBendCount + bendAngle
end
bendAngle = borderStartAngle + bendAngle
if bendAngle < 0 then
bendAngle = bendAngle + 360
end
local borderZoneWidth = random(10000,15000)
bzsx, bzsy = vectorFromAngle(bendAngle,borderZoneWidth) --border zone start x and y coordinates
table.insert(borderZoneLeftOuterX,borderZoneLeftInnerX[bzi]+bzsx)
table.insert(borderZoneLeftOuterY,borderZoneLeftInnerY[bzi]+bzsy)
table.insert(borderZoneRightOuterX,borderZoneRightInnerX[bzi]+bzsx)
table.insert(borderZoneRightOuterY,borderZoneRightInnerY[bzi]+bzsy)
local cbz = Zone():setPoints(borderZoneLeftInnerX[bzi],borderZoneLeftInnerY[bzi], --current border zone
borderZoneLeftOuterX[bzi],borderZoneLeftOuterY[bzi],
borderZoneRightOuterX[bzi],borderZoneRightOuterY[bzi],
borderZoneRightInnerX[bzi],borderZoneRightInnerY[bzi])
cbz:setColor(0,0,255)
cbz.detect = 0
table.insert(borderZone,cbz)
intelGatherArtifacts = {}
local igax, igay = vectorFromAngle(borderStartAngle+180,borderZoneWidth*2+random(1,30000))
local iga = Artifact():setPosition(borderStartX+igax,borderStartY+igay):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1)):setModel("SensorBuoyMKIII"):setCallSign("Sensor Buoy"):setFaction("Human Navy")
table.insert(intelGatherArtifacts,iga)
local ilx, ily = vectorFromAngle(borderStartAngle+210,zoneLimit) --inner left x and y coordinates
local irx, iry = vectorFromAngle(borderStartAngle+150,zoneLimit) --inner right x and y coordinates
local ciz = Zone():setPoints(borderZoneLeftInnerX[bzi],borderZoneLeftInnerY[bzi], --current inner zone
borderZoneRightInnerX[bzi],borderZoneRightInnerY[bzi],
borderZoneRightInnerX[bzi]+irx,borderZoneRightInnerY[bzi]+iry,
borderZoneLeftInnerX[bzi]+ilx,borderZoneLeftInnerY[bzi]+ily)
if initDiagnostic then ciz:setColor(50,50,50) end
table.insert(innerZoneList,ciz)
local olx, oly = vectorFromAngle(borderStartAngle+330,zoneLimit) --outer left x and y coordinates
local orx, ory = vectorFromAngle(borderStartAngle+30,zoneLimit) --outer right x and y coordinates
local coz = Zone():setPoints(borderZoneRightOuterX[bzi],borderZoneRightOuterY[bzi], --current outer zone
borderZoneLeftOuterX[bzi],borderZoneLeftOuterY[bzi],
borderZoneLeftOuterX[bzi]+olx,borderZoneLeftOuterY[bzi]+oly,
borderZoneRightOuterX[bzi]+orx,borderZoneRightOuterY[bzi]+ory)
if initDiagnostic then coz:setColor(0,128,0) end
table.insert(outerZoneList,coz)
--new zone on the left
bzi = bzi + 1
table.insert(borderZoneRightInnerX,borderZoneLeftInnerX[bzi-1])
table.insert(borderZoneRightInnerY,borderZoneLeftInnerY[bzi-1])
table.insert(borderZoneRightOuterX,borderZoneLeftOuterX[bzi-1])
table.insert(borderZoneRightOuterY,borderZoneLeftOuterY[bzi-1])
local bzx, bzy = vectorFromAngle(bendAngle+270,random(20000,30000)) --border zone x and y corrdinates
table.insert(borderZoneLeftInnerX,borderZoneRightInnerX[bzi]+bzx)
table.insert(borderZoneLeftInnerY,borderZoneRightInnerY[bzi]+bzy)
local upBound = 2 + negativeBendCount + positiveBendCount
local cutOff = math.min(positiveBendCount,negativeBendCount)
local newBend = random(1,30)
if negativeBendCount < positiveBendCount then
if random(1,upBound) <= cutOff then
negativeBendCount = negativeBendCount + newBend
newBend = -1*newBend
else
positiveBendCount = positiveBendCount + newBend
end
else
if random(1,upBound) <= cutOff then
positiveBendCount = positiveBendCount + newBend
else
newBend = -1*newBend
negativeBendCount = negativeBendCount + newBend
end
end
newBend = bendAngle + newBend
if newBend < 0 then
newBend = newBend + 360
end
bzx, bzy = vectorFromAngle(newBend,borderZoneWidth)
table.insert(borderZoneLeftOuterX,borderZoneLeftInnerX[bzi]+bzx)
table.insert(borderZoneLeftOuterY,borderZoneLeftInnerY[bzi]+bzy)
--new zone on the right
table.insert(borderZoneLeftInnerX,borderZoneRightInnerX[bzi-1])
table.insert(borderZoneLeftInnerY,borderZoneRightInnerY[bzi-1])
table.insert(borderZoneLeftOuterX,borderZoneRightOuterX[bzi-1])
table.insert(borderZoneLeftOuterY,borderZoneRightOuterY[bzi-1])
bzx, bzy = vectorFromAngle(bendAngle+90,random(20000,30000))
table.insert(borderZoneRightInnerX,borderZoneRightInnerX[bzi-1]+bzx)
table.insert(borderZoneRightInnerY,borderZoneRightInnerY[bzi-1]+bzy)
bzx, bzy = vectorFromAngle(newBend,borderZoneWidth)
table.insert(borderZoneRightOuterX,borderZoneRightInnerX[bzi+1]+bzx)
table.insert(borderZoneRightOuterY,borderZoneRightInnerY[bzi+1]+bzy)
--establish current border zone (cbz)
cbz = Zone():setPoints(borderZoneLeftInnerX[bzi],borderZoneLeftInnerY[bzi],
borderZoneLeftOuterX[bzi],borderZoneLeftOuterY[bzi],
borderZoneRightOuterX[bzi],borderZoneRightOuterY[bzi],
borderZoneRightInnerX[bzi],borderZoneRightInnerY[bzi])
cbz:setColor(0,0,255)
cbz.detect = 0