-
Notifications
You must be signed in to change notification settings - Fork 2
/
scenario_47_scavenger.lua
executable file
·8731 lines (8729 loc) · 361 KB
/
scenario_47_scavenger.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Name: Scurvy Scavenger
-- Description: Stay alive while scavenging treasures. Length: > 2 hours
---
--- Version 0
-- Type: Single player ship mission, moderately replayable
-- Variation[Easy]: Easy goals and/or enemies
-- Variation[Hard]: Hard goals and/or enemies
require("utils.lua")
function createRandomAlongArc(object_type, amount, x, y, distance, startArc, endArcClockwise, randomize)
-- Create amount of objects of type object_type along arc
-- Center defined by x and y
-- Radius defined by distance
-- Start of arc between 0 and 360 (startArc), end arc: endArcClockwise
-- Use randomize to vary the distance from the center point. Omit to keep distance constant
-- Example:
-- createRandomAlongArc(Asteroid, 100, 500, 3000, 65, 120, 450)
local function asteroidSize()
return random(1,100) + random(1,75) + random(1,75) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20) + random(1,20)
end
local object_list = {}
if randomize == nil then randomize = 0 end
if amount == nil then amount = 1 end
local arcLen = endArcClockwise - startArc
if startArc > endArcClockwise then
endArcClockwise = endArcClockwise + 360
arcLen = arcLen + 360
end
local last_object = nil
local asteroid_size = 0
if amount > arcLen then
for ndex=1,arcLen do
local radialPoint = startArc+ndex
local pointDist = distance + random(-randomize,randomize)
last_object = object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
if last_object.typeName == "Asteroid" then
last_object:setSize(asteroidSize())
end
table.insert(object_list,last_object)
end
for ndex=1,amount-arcLen do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
last_object = object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
if last_object.typeName == "Asteroid" then
last_object:setSize(asteroidSize())
end
table.insert(object_list,last_object)
end
else
for ndex=1,amount do
radialPoint = random(startArc,endArcClockwise)
pointDist = distance + random(-randomize,randomize)
last_object = object_type():setPosition(x + math.cos(radialPoint / 180 * math.pi) * pointDist, y + math.sin(radialPoint / 180 * math.pi) * pointDist)
if last_object.typeName == "Asteroid" then
last_object:setSize(asteroidSize())
end
table.insert(object_list,last_object)
end
end
local last_x, last_y = last_object:getPosition()
return last_x, last_y, object_list
end
function angleFromVectorNorth(p1x,p1y,p2x,p2y)
TWOPI = 6.2831853071795865
RAD2DEG = 57.2957795130823209
atan2parm1 = p2x - p1x
atan2parm2 = p2y - p1y
theta = math.atan2(atan2parm1, atan2parm2)
if theta < 0 then
theta = theta + TWOPI
end
return (360 - (RAD2DEG * theta)) % 360
end
function tableRemoveRandom(array)
-- Remove random element from array and return it.
-- Returns nil if the array is empty,
-- analogous to `table.remove`.
local array_item_count = #array
if array_item_count == 0 then
return nil
end
local selected_item = math.random(array_item_count)
array[selected_item], array[array_item_count] = array[array_item_count], array[selected_item]
return table.remove(array)
end
function init()
-- print("start of init")
stationCommsDiagnostic = false
exuari_harass_diagnostic = false
spawn_enemy_diagnostic = false
efficient_battery_diagnostic = false
prefix_length = 0
suffix_index = 0
accumulated_delta = 0
contract_eligible = false --should start out as false
transition_contract_message = false --should start out as false
contract_station = {}
setVariations()
setConstants() --missle type names, template names and scores, deployment directions, player ship names, etc.
player = PlayerSpaceship():setFaction("Independent"):setTemplate("Striker"):setJumpDrive(false):setWarpDrive(false):setLongRangeRadarRange(25000)
plot_faction = "Independent"
setPlayer()
populateStationPool()
--stationCommunication could be nil (default), commsStation (embedded function) or comms_station_enhanced (external script)
stationCommunication = "commsStation"
stationStaticAsteroids = true
primaryOrders = "No primary orders"
plot1 = exuariHarassment
plot1_mission_count = 0
plotH = healthCheck --Damage to ship can kill repair crew members
healthCheckTimer = 5
healthCheckTimerInterval = 5
independent_station = {}
station_list = {}
-- print("init: place first station")
--place first station where missions start
first_station_angle = random(0,360)
local player_to_station_distance = random(8000,15000)
psx, psy = vectorFromAngle(first_station_angle,player_to_station_distance)
local pStation = placeStation(psx,psy,nil,"Independent")
table.insert(independent_station,pStation)
table.insert(station_list,pStation)
first_station = pStation
first_station.comms_data.weapon_available.Homing = true
first_station.comms_data.weapon_available.EMP = true
first_station.comms_data.weapon_available.Nuke = true
first_station.comms_data.weapon_cost = {Homing = 2, HVLI = math.random(1,3), Mine = math.random(2,5), Nuke = 12, EMP = 9}
local fsx = psx
local fsy = psy
-- print("init: place first enemy station")
--place first enemy station for first mission
exuari_station = {}
local exuari_station_angle = first_station_angle + random(-20,20)
local enemy_station_distance = random(11000,15000)
cnx, cny = vectorFromAngle(exuari_station_angle,enemy_station_distance-2500)
concealing_nebula = Nebula():setPosition(fsx+cnx,fsy+cny)
nebula_list = {}
table.insert(nebula_list,concealing_nebula)
for i=1,math.random(2,2+difficulty*2) do
local ref_x, ref_y = nebula_list[#nebula_list]:getPosition()
local far_enough = true
local expand_distance = 0
local new_x, new_y = vectorFromAngle(random(0,360),random(4000,20000+expand_distance))
repeat
new_x, new_y = vectorFromAngle(random(0,360),random(4000,20000+expand_distance))
new_x = new_x + ref_x
new_y = new_y + ref_y
for j=1,#nebula_list do
if distance(nebula_list[j],new_x,new_y) < 4000 then
far_enough = false
end
end
expand_distance = expand_distance + 1000
until(far_enough)
local new_nebula = Nebula():setPosition(new_x,new_y)
table.insert(nebula_list,new_nebula)
end
psx, psy = vectorFromAngle(exuari_station_angle,enemy_station_distance)
psx = psx + fsx
psy = psy + fsy
pStation = placeStation(psx,psy,"Sinister","Exuari","Large Station")
table.insert(exuari_station,pStation)
table.insert(station_list,pStation)
exuari_harassing_station = pStation
evx, evy = vectorFromAngle(exuari_station_angle,20000)
evx = evx + psx
evy = evy + psy
ev_angle = (exuari_station_angle + 180) % 360 --exuari vengeance attack angle
-- print("init: place research asteroids")
local arx, ary, brx, bry, asteroids = curvaceousAsteroids1(fsx, fsy, player_to_station_distance)
research_asteroids = asteroids
--place artifact near asteroids
local avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
beam_damage_artifact = Artifact():setPosition(arx+avx,ary+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
beam_damage_artifact:setDescriptions("Object of unknown origin","Object of unknown origin, advanced technology detected"):allowPickup(true):onPickUp(beamDamageArtifactPickup)
avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
burn_out_artifact = Artifact():setPosition(brx+avx,bry+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
burn_out_artifact:setDescriptions("Object of unknown origin","Object of unknown origin, advanced technology detected"):allowPickup(true):onPickUp(burnOutArtifactPickup)
if difficulty >= 1 then
avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
burn_out_artifact_2 = Artifact():setPosition(crx+avx,cry+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
burn_out_artifact_2:setDescriptions("Object of unknown origin","Object of unknown origin, advanced technology detected"):allowPickup(true):onPickUp(burnOutArtifactPickup)
end
if difficulty > 1 then
avx, avy = vectorFromAngle(random(0,360),350-(difficulty*100))
burn_out_artifact_3 = Artifact():setPosition(drx+avx,dry+avy):setModel("artifact4"):setScanningParameters(difficulty*2,difficulty*2):setRadarSignatureInfo(random(0,1),random(0,1),random(0,1))
burn_out_artifact_3:setDescriptions("Object of unknown origin","Object of unknown origin, advanced technology detected"):allowPickup(true):onPickUp(burnOutArtifactPickup)
end
-- print("init: place second and third stations")
--place second and third stations
local second_station_angle = first_station_angle + random(90,140)
if second_station_angle > 360 then
second_station_angle = second_station_angle - 360
end
player_to_station_distance = player_to_station_distance + random(1000,8000)
psx, psy = vectorFromAngle(second_station_angle,player_to_station_distance)
pStation = placeStation(psx,psy,nil,"Independent")
table.insert(independent_station,pStation)
table.insert(station_list,pStation)
setOptionalAddBeamMission(pStation)
second_station_angle = first_station_angle - random(90,140)
if second_station_angle < 0 then
second_station_angle = second_station_angle + 360
end
player_to_station_distance = player_to_station_distance + random(1000,8000)
psx, psy = vectorFromAngle(second_station_angle,player_to_station_distance)
pStation = placeStation(psx,psy,nil,"Independent")
table.insert(independent_station,pStation)
table.insert(station_list,pStation)
setOptionalEfficientBatteriesMisison(pStation)
setInitialContractDetails()
first_station:setSharesEnergyWithDocked(true)
first_station:setRepairDocked(true)
first_station.comms_data.scan_repair = true
first_station.comms_data.jump_overcharge = true
-- print("init: set work transports")
--Independent trio transports
plotT = workingTransports
transports_around_independent_trio = {}
transportCheckDelayInterval = 4
transportCheckDelayTimer = transportCheckDelayInterval
local transportType = {"Personnel","Goods","Garbage","Equipment","Fuel"}
local name = nil
local prefix = generateCallSignPrefix(1)
for i=1,3 do
j = i + 2
if j > 3 then
j = j - 3
end
name = transportType[math.random(1,#transportType)]
if random(1,100) < 30 then
name = name .. " Jump Freighter " .. math.random(3, 5)
else
name = name .. " Freighter " .. math.random(1, 5)
end
psx, psy = independent_station[i]:getPosition()
local tempTransport = CpuShip():setTemplate(name):setPosition(psx,psy):setFaction(independent_station[i]:getFaction()):setCommsScript(""):setCommsFunction(commsShip)
tempTransport.targetStart = independent_station[i]
tempTransport.targetEnd = independent_station[j]
if random(1,100) < 50 then
tempTransport:orderDock(tempTransport.targetStart)
else
tempTransport:orderDock(tempTransport.targetEnd)
end
tempTransport:setCallSign(generateCallSign(prefix))
table.insert(transports_around_independent_trio,tempTransport)
end
initialGMButtons()
-- print("end of init")
allowNewPlayerShips(false)
end
function setInitialContractDetails()
--contract details: first to second station
first_station.comms_data.contract = {}
first_station.comms_data.contract["one_to_two"] = {
type = "start",
prompt = string.format("Deliver three %s to %s. Upon delivery, they will increase your hull strength",independent_station[2].comms_data.characterGood,independent_station[2]:getCallSign()),
short_prompt = string.format("Three %s to %s",independent_station[2].comms_data.characterGood,independent_station[2]:getCallSign()),
accepted = false,
func = start1to2delivery,
}
independent_station[2].comms_data.contract = {}
independent_station[2].comms_data.contract["one_to_two"] = {
type = "fulfill",
prompt = string.format("Fulfill %s 3 %s %s contract",first_station:getCallSign(),independent_station[2].comms_data.characterGood,independent_station[2]:getCallSign()),
short_prompt = string.format("Three %s from %s",independent_station[2].comms_data.characterGood,first_station:getCallSign()),
fulfilled = false,
func = complete1to2delivery,
}
--contract details: second to third station
independent_station[2].comms_data.contract["two_to_three"] = {
type = "start",
prompt = string.format("Deliver two %s to %s. Upon delivery, they will increase your shield strength",independent_station[3].comms_data.characterGood,independent_station[3]:getCallSign()),
short_prompt = string.format("Two %s to %s",independent_station[3].comms_data.characterGood,independent_station[3]:getCallSign()),
accepted = false,
func = start2to3delivery,
}
independent_station[3].comms_data.contract = {}
independent_station[3].comms_data.contract["two_to_three"] = {
type = "fulfill",
prompt = string.format("Fulfill %s 2 %s %s contract",independent_station[2]:getCallSign(),independent_station[3].comms_data.characterGood,independent_station[3]:getCallSign()),
short_prompt = string.format("Two %s from %s",independent_station[3].comms_data.characterGood,independent_station[2]:getCallSign()),
fulfilled = false,
func = complete2to3delivery,
}
end
function initialGMButtons()
clearGMFunctions()
addGMFunction("+Missions",missionSelection)
addGMFunction("Show delta sum",function()
local gm_message = "Accumulated delta:\n" .. accumulated_delta
local seconds = math.floor(accumulated_delta % 60)
if accumulated_delta > 60 then
local minutes = math.floor(accumulated_delta / 60)
if minutes > 60 then
local hours = math.floor(minutes / 60)
gm_message = gm_message .. string.format("\n%i:%.2i:%.2i",hours,minutes,seconds)
else
gm_message = gm_message .. string.format("\n%i:%.2i",minutes,seconds)
end
end
addGMMessage(gm_message)
end)
end
function missionSelection()
clearGMFunctions()
addGMFunction("-Main from missions",initialGMButtons)
if plot1 ~= nil and plot1 ~= kraylorDiversionarySabotage then
addGMFunction("Skip Harassment",function()
player = getPlayerShip(-1)
impulseUpgrade(player)
missileTubeUpgrade(player)
doubleBeamDamageUpgrade(player)
jumpDriveUpgrade(player)
player:addReputationPoints(200)
plot1 = nil
plot1_type = nil
plot1_mission_count = plot1_mission_count + 1
plot1_timer = nil
plot1_defensive_timer = nil
plot1_danger = nil
plot1_fleet_spawned = nil
plot1_defensive_fleet_spawned = nil
exuari_harassment_upgrade = true
plot2 = contractTarget
addGMMessage("Harassment skipped")
missionSelection()
end)
end
if plot2 == contractTarget then
addGMFunction("Skip Local Contracts",function()
player = getPlayerShip(-1)
--add forward beam
local beam_index = 0
repeat
beam_index = beam_index + 1
until(player:getBeamWeaponRange(beam_index) < 1)
player:setBeamWeapon(beam_index,20,0,1200,6,5)
--add energy
player:setMaxEnergy(player:getMaxEnergy()*1.5)
player:setEnergy(player:getMaxEnergy())
--strengthen hull
player:setHullMax(player:getHullMax()*1.5)
player:setHull(player:getHullMax())
--strengthen shields
if player:getShieldCount() == 1 then
player:setShieldsMax(player:getShieldMax(0)*1.25)
else
player:setShieldsMax(player:getShieldMax(0)*1.25,player:getShieldMax(1)*1.25)
end
player:addToShipLog(string.format("A rare long range contract has been posted at station %s",first_station:getCallSign()),"Magenta")
transition_contract_message = true
plot2 = nil
addGMMessage("Local contracts skipped")
missionSelection()
end)
end
addGMFunction("Mark asteroids",function()
for _,asteroid in pairs(research_asteroids) do
if asteroid.osmium ~= nil and asteroid.iridium ~= nil then
local ax, ay = asteroid:getPosition()
local d = 250
Zone():setPoints(ax-d,ay-d,ax+d,ay-d,ax+d,ay+d,ax-d,ay+d):setColor(128,0,0)
end
end
end)
end
------------------------------------------------------
-- Contract for increased hull strength functions --
------------------------------------------------------
function start1to2delivery()
if independent_station[2] ~= nil and independent_station[2]:isValid() then
if comms_source.cargo < 3 then
setCommsMessage(string.format("Your available cargo space, %i, is insufficient for this contract. You need at least 3",comms_source.cargo))
else
comms_source.cargo = comms_source.cargo - 3
if comms_source.goods == nil then
comms_source.goods = {}
end
local good = independent_station[2].comms_data.characterGood
if comms_source.goods[good] == nil then
comms_source.goods[good] = 0
end
comms_source.goods[good] = comms_source.goods[good] + 3
setCommsMessage(string.format("Cargo of three %s has been loaded onto your ship. Deliver to %s in %s",good,independent_station[2]:getCallSign(),independent_station[2]:getSectorName()))
first_station.comms_data.contract["one_to_two"].accepted = true
table.insert(contract_station,independent_station[2])
end
else
setCommsMessage(string.format("This contract is no longer valid since the destination, %s, no longer exists. Sorry for the clerical error. Have a nice day",independent_station[2]:getCallSign()))
first_station.comms_data.contract["one_to_two"].accepted = true
end
addCommsReply("Back",commsStation)
end
function complete1to2delivery()
local good = independent_station[2].comms_data.characterGood
if comms_source.goods ~= nil and comms_source.goods[good] ~= nil and comms_source.goods[good] >= 3 then
comms_source:setHullMax(comms_source:getHullMax()*1.5)
comms_source:setHull(comms_source:getHullMax())
comms_source.goods[good] = comms_source.goods[good] - 3
comms_source.cargo = comms_source.cargo + 3
independent_station[2].comms_data.contract["one_to_two"].fulfilled = true
for i=1,#contract_station do
if contract_station[i] == comms_target then
table.remove(contract_station,i)
break
end
end
comms_source:addReputationPoints(50)
setCommsMessage(string.format("Thanks for the %s, %s. We increased your hull strength by 50%%",good,comms_source:getCallSign()))
else
setCommsMessage(string.format("The terms of the contract require the delivery of three %s. This has not been met",good))
end
addCommsReply("Back",commsStation)
end
function start2to3delivery()
if independent_station[3] ~= nil and independent_station[3]:isValid() then
if comms_source.cargo < 2 then
setCommsMessage(string.format("Your available cargo space, %i, is insufficient for this contract. You need at least 3",comms_source.cargo))
else
comms_source.cargo = comms_source.cargo - 2
if comms_source.goods == nil then
comms_source.goods = {}
end
local good = independent_station[3].comms_data.characterGood
if comms_source.goods[good] == nil then
comms_source.goods[good] = 0
end
comms_source.goods[good] = comms_source.goods[good] + 2
setCommsMessage(string.format("Cargo of two %s has been loaded onto your ship. Deliver to %s in %s",good,independent_station[3]:getCallSign(),independent_station[3]:getSectorName()))
independent_station[2].comms_data.contract["two_to_three"].accepted = true
table.insert(contract_station,independent_station[3])
end
else
setCommsMessage(string.format("This contract is no longer valid since the destination, %s, no longer exists. Sorry for the clerical error. Have a nice day",independent_station[3]:getCallSign()))
independent_station[2].comms_data.contract["two_to_three"].accepted = true
end
addCommsReply("Back",commsStation)
end
function complete2to3delivery()
local good = independent_station[3].comms_data.characterGood
if comms_source.goods ~= nil and comms_source.goods[good] ~= nil and comms_source.goods[good] >= 2 then
if comms_source:getShieldCount() == 1 then
comms_source:setShieldsMax(comms_source:getShieldMax(0)*1.25)
else
comms_source:setShieldsMax(comms_source:getShieldMax(0)*1.25,comms_source:getShieldMax(1)*1.25)
end
comms_source.goods[good] = comms_source.goods[good] - 2
comms_source.cargo = comms_source.cargo + 2
independent_station[3].comms_data.contract["two_to_three"].fulfilled = true
for i=1,#contract_station do
if contract_station[i] == comms_target then
table.remove(contract_station,i)
break
end
end
comms_source:addReputationPoints(50)
setCommsMessage(string.format("Thanks for the %s, %s. We increased your shield strength by 25%%",good,comms_source:getCallSign()))
else
setCommsMessage(string.format("The terms of the contract require the delivery of two %s. This has not been met",good))
end
addCommsReply("Back",commsStation)
end
function curvaceousAsteroids1(fsx, fsy, player_to_station_distance)
local first_station_angle_inverted = first_station_angle + 180
if first_station_angle_inverted > 360 then
first_station_angle_inverted = first_station_angle_inverted - 360
end
local min_leg = 5000
local max_leg = 100000
local arc_leg = random(min_leg,max_leg)
local min_seg = 20
local max_seg = 60
local arc_segment = random(min_seg,max_seg)
local asteroid_density = 2*difficulty
local width_divisor = 6
local arx = nil
local ary = nil
local brx = nil
local bry = nil
local asteroid_list = {}
local temp_list = nil
-- print("curvaceous asteroids: above asteroids")
if random(1,100) <= 47 then --center closer to station
local aax, aay = vectorFromAngle(first_station_angle,arc_leg)
if random(1,100) <= 47 then --right curve
arx, ary, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, first_station_angle_inverted, first_station_angle_inverted + arc_segment, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
arc_leg = random(min_leg,max_leg)
arc_segment = random(min_seg,max_seg)
if random(1,100) <= 47 then --center closer to station, left curve
aax, aay = vectorFromAngle(first_station_angle,arc_leg)
local start_arc = first_station_angle_inverted - arc_segment
if start_arc < 0 then
start_arc = start_arc + 360
first_station_angle_inverted = first_station_angle_inverted + 360
end
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, start_arc, first_station_angle_inverted, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
else --center closer to player right curve
aax, aay = vectorFromAngle(first_station_angle_inverted,arc_leg)
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, first_station_angle, first_station_angle + arc_segment, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
end
else --left curve
start_arc = first_station_angle_inverted - arc_segment
if start_arc < 0 then
start_arc = start_arc + 360
first_station_angle_inverted = first_station_angle_inverted + 360
end
arx, ary, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, start_arc, first_station_angle_inverted, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
arc_leg = random(min_leg,max_leg)
arc_segment = random(min_seg,max_seg)
if random(1,100) <= 47 then --center closer to station, right curve
aax, aay = vectorFromAngle(first_station_angle,arc_leg)
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, first_station_angle_inverted, first_station_angle_inverted + arc_segment, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
else --center closer to player, left curve
start_arc = first_station_angle - arc_segment
local arc_end = first_station_angle
if start_arc < 0 then
start_arc = start_arc + 360
arc_end = first_station_angle + 360
end
aax, aay = vectorFromAngle(first_station_angle_inverted,arc_leg)
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, start_arc, arc_end, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
end
end
else --center closer to player
aax, aay = vectorFromAngle(first_station_angle_inverted,arc_leg)
if random(1,100) <= 47 then --right curve
arx, ary, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, first_station_angle, first_station_angle + arc_segment, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
arc_leg = random(min_leg,max_leg)
arc_segment = random(min_seg,max_seg)
if random(1,100) <= 47 then --center closer to station, right curve
aax, aay = vectorFromAngle(first_station_angle,arc_leg)
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, first_station_angle_inverted, first_station_angle_inverted + arc_segment, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
else --center closer to player, left curve
start_arc = first_station_angle - arc_segment
arc_end = first_station_angle
if start_arc < 0 then
start_arc = start_arc + 360
arc_end = first_station_angle + 360
end
aax, aay = vectorFromAngle(first_station_angle_inverted,arc_leg)
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, start_arc, arc_end, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
end
else --left curve
start_arc = first_station_angle - arc_segment
arc_end = first_station_angle
if start_arc < 0 then
start_arc = start_arc + 360
arc_end = first_station_angle + 360
end
arx, ary, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, start_arc, arc_end, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
arc_leg = random(min_leg,max_leg)
arc_segment = random(min_seg,max_seg)
if random(1,100) <= 47 then --center closer to player, right curve
aax, aay = vectorFromAngle(first_station_angle_inverted,arc_leg)
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, first_station_angle, first_station_angle + arc_segment, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
else --center closer to station, left curve
start_arc = first_station_angle_inverted - arc_segment
arc_end = first_station_angle_inverted
if start_arc < 0 then
start_arc = start_arc + 360
arc_end = first_station_angle_inverted + 360
end
aax, aay = vectorFromAngle(first_station_angle,arc_leg)
brx, bry, temp_list = createRandomAlongArc(Asteroid, math.floor(asteroid_density*arc_segment), (fsx/2)+aax, (fsy/2)+aay, arc_leg, start_arc, arc_end, player_to_station_distance/width_divisor)
asteroid_list = add_to_list(temp_list,asteroid_list)
end
end
end
-- print("curvaceous asteroids: below asteroids")
local full_list = {}
for i=1,#asteroid_list do
table.insert(full_list,asteroid_list[i])
end
-- print("curvaceous asteroids: list replicated")
if difficulty >= 1 then
repeat
crx, cry = asteroid_list[math.random(1,#asteroid_list)]:getPosition()
until(crx ~= arx and cry ~= ary and crx ~= brx and cry ~= bry)
end
if difficulty > 1 then
repeat
drx, dry = asteroid_list[math.random(1,#asteroid_list)]:getPosition()
until(drx ~= arx and dry ~= ary and drx ~= brx and dry ~= bry and drx ~= crx and dry ~= cry)
end
--Composition: Rock and metal
--Iron asteroid: Iron 91%, Nickel 8.5%, Cobalt
--Stone asteroid: Oxygen, Silicon, Magnesium, Calcium
--Other components: olivine, pyroxene, nickel-iron, water-ice
-- carbon, Nitrogen, Hydrogen, Oxygen
-- nickel, iridium, palladium, platinum, gold, magnesium, osmium, ruthenium, rhodium
--Asteroid structures: most are solid, rubble, binary
--Sizes: 30 > 200km
-- 250 > 100km
-- million > 1 km
--Types: C: 75% Carbonaceous Chondrite, Carbon
-- S: 17% Nickel-iron mixed with iron and magnesium silicates
-- M: most of the rest: nickel-iron
for i=1,#asteroid_list do
local selected_asteroid_index = math.random(1,#asteroid_list)
local selected_asteroid = asteroid_list[selected_asteroid_index]
table.remove(asteroid_list,selected_asteroid_index)
local unscanned_description = ""
if random(0,100) < 65 then
unscanned_description = "Structure: solid"
elseif random(0,100) < 70 then
unscanned_description = "Structure: rubble"
else
unscanned_description = "Structure: binary"
end
local scanned_description = ""
selected_asteroid.composition = 0
if i == 1 then
selected_asteroid.osmium = math.random(1,20)/10
scanned_description = string.format("%sosmium:%.1f%% ",scanned_description,selected_asteroid.osmium)
selected_asteroid.iridium = math.random(1,70)/10
scanned_description = string.format("%siridium:%.1f%% ",scanned_description,selected_asteroid.iridium)
selected_asteroid.olivine = math.random(1,150)/10
scanned_description = string.format("%solivine:%.1f%% ",scanned_description,selected_asteroid.olivine)
selected_asteroid.nickel = math.random(1,190)/10
scanned_description = string.format("%snickel:%.1f%% ",scanned_description,selected_asteroid.nickel)
scanned_description = string.format("%s, %srock:remainder",unscanned_description, scanned_description)
target_asteroid = selected_asteroid
target_asteroid_x, target_asteroid_y = target_asteroid:getPosition()
print(string.format("Target Asteroid: Sector:%s X:%i Y:%i Osmium:%.1f, Iridium:%.1f, Olivine:%.1f, Nickel:%.1f",target_asteroid:getSectorName(),math.floor(target_asteroid_x),math.floor(target_asteroid_y),target_asteroid.osmium,target_asteroid.iridium,target_asteroid.olivine,target_asteroid.nickel))
else
if random(0,100) < 2 and selected_asteroid.composition < 100 then
selected_asteroid.osmium = math.random(1,20)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.osmium
scanned_description = string.format("%sosmium:%.1f%% ",scanned_description,selected_asteroid.osmium)
end
if random(0,100) < 3 and selected_asteroid.composition < 100 then
selected_asteroid.ruthenium = math.random(1,30)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.ruthenium
scanned_description = string.format("%sruthenium:%.1f%% ",scanned_description,selected_asteroid.ruthenium)
end
if random(0,100) < 4 and selected_asteroid.composition < 100 then
selected_asteroid.rhodium = math.random(1,40)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.rhodium
scanned_description = string.format("%srhodium:%.1f%% ",scanned_description,selected_asteroid.rhodium)
end
if random(0,100) < 5 and selected_asteroid.composition < 100 then
selected_asteroid.magnesium = math.random(1,50)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.magnesium
scanned_description = string.format("%smagnesium:%.1f%% ",scanned_description,selected_asteroid.magnesium)
end
if random(0,100) < 6 and selected_asteroid.composition < 100 then
selected_asteroid.platinum = math.random(1,60)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.platinum
scanned_description = string.format("%splatinum:%.1f%% ",scanned_description,selected_asteroid.platinum)
end
if random(0,100) < 7 and selected_asteroid.composition < 100 then
selected_asteroid.iridium = math.random(1,70)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.iridium
scanned_description = string.format("%siridium:%.1f%% ",scanned_description,selected_asteroid.iridium)
end
if random(0,100) < 8 and selected_asteroid.composition < 100 then
selected_asteroid.gold = math.random(1,80)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.gold
scanned_description = string.format("%sgold:%.1f%% ",scanned_description,selected_asteroid.gold)
end
if random(0,100) < 9 and selected_asteroid.composition < 100 then
selected_asteroid.palladium = math.random(1,90)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.palladium
scanned_description = string.format("%spalladium:%.1f%% ",scanned_description,selected_asteroid.palladium)
end
if random(0,100) < 10 and selected_asteroid.composition < 100 then
selected_asteroid.oxygen = math.random(1,100)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.oxygen
scanned_description = string.format("%soxygen:%.1f%% ",scanned_description,selected_asteroid.oxygen)
end
if random(0,100) < 11 and selected_asteroid.composition < 100 then
selected_asteroid.silicon = math.random(1,110)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.silicon
scanned_description = string.format("%ssilicon:%.1f%% ",scanned_description,selected_asteroid.silicon)
end
if random(0,100) < 12 and selected_asteroid.composition < 100 then
selected_asteroid.hydrogen = math.random(1,120)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.hydrogen
scanned_description = string.format("%shydrogen:%.1f%% ",scanned_description,selected_asteroid.hydrogen)
end
if random(0,100) < 13 and selected_asteroid.composition < 100 then
selected_asteroid.nitrogen = math.random(1,130)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.nitrogen
scanned_description = string.format("%snitrogen:%.1f%% ",scanned_description,selected_asteroid.nitrogen)
end
if random(0,100) < 14 and selected_asteroid.composition < 100 then
selected_asteroid.pyroxene = math.random(1,140)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.pyroxene
if selected_asteroid.composition >= 100 then
scanned_description = string.format("%spyroxene:remainder",scanned_description)
else
scanned_description = string.format("%spyroxene:%.1f%% ",scanned_description,selected_asteroid.pyroxene)
end
end
if random(0,100) < 15 and selected_asteroid.composition < 100 then
selected_asteroid.olivine = math.random(1,150)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.olivine
if selected_asteroid.composition >= 100 then
scanned_description = string.format("%solivine:remainder",scanned_description)
else
scanned_description = string.format("%solivine:%.1f%% ",scanned_description,selected_asteroid.olivine)
end
end
if random(0,100) < 16 and selected_asteroid.composition < 100 then
selected_asteroid.cobalt = math.random(1,160)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.cobalt
if selected_asteroid.composition >= 100 then
scanned_description = string.format("%scobalt:remainder",scanned_description)
else
scanned_description = string.format("%scobalt:%.1f%% ",scanned_description,selected_asteroid.cobalt)
end
end
if random(0,100) < 17 and selected_asteroid.composition < 100 then
selected_asteroid.dilithium = math.random(1,170)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.dilithium
if selected_asteroid.composition >= 100 then
scanned_description = string.format("%sdilithium:remainder",scanned_description)
else
scanned_description = string.format("%sdilithium:%.1f%% ",scanned_description,selected_asteroid.dilithium)
end
end
if random(0,100) < 18 and selected_asteroid.composition < 100 then
selected_asteroid.calcium = math.random(1,180)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.calcium
if selected_asteroid.composition >= 100 then
scanned_description = string.format("%scalcium:remainder",scanned_description)
else
scanned_description = string.format("%scalcium:%.1f%% ",scanned_description,selected_asteroid.calcium)
end
end
if random(0,100) < 19 and selected_asteroid.composition < 100 then
selected_asteroid.nickel = math.random(1,190)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.nickel
if selected_asteroid.composition >= 100 then
scanned_description = string.format("%snickel:remainder",scanned_description)
else
scanned_description = string.format("%snickel:%.1f%% ",scanned_description,selected_asteroid.nickel)
end
end
if random(0,100) < 20 and selected_asteroid.composition < 100 then
selected_asteroid.iron = math.random(1,200)/10
selected_asteroid.composition = selected_asteroid.composition + selected_asteroid.iron
if selected_asteroid.composition >= 100 then
scanned_description = string.format("%siron:remainder",scanned_description)
else
scanned_description = string.format("%siron:%.1f%% ",scanned_description,selected_asteroid.iron)
end
end
if selected_asteroid.composition > 0 then
if selected_asteroid.composition < 100 then
scanned_description = string.format("%s, %srock:remainder",unscanned_description, scanned_description)
end
else
scanned_description = string.format("%s, just rock",unscanned_description, scanned_description)
end
end
selected_asteroid:setDescriptions(unscanned_description,scanned_description)
local scan_parameter_tier_chance = 50
if difficulty < 1 then
scan_parameter_tier_chance = 25
elseif difficulty > 1 then
scan_parameter_tier_chance = 70
end
local scan_complexity = 1
if random(0,100) < scan_parameter_tier_chance then
if random(0,100) < scan_parameter_tier_chance then
scan_complexity = 3
else
scan_complexity = 2
end
end
local scan_depth = 1
if random(0,100) < scan_parameter_tier_chance then
if random(0,100) < scan_parameter_tier_chance then
if random(0,100) < scan_parameter_tier_chance then
scan_depth = 4
else
scan_depth = 3
end
else
scan_depth = 2
end
end
selected_asteroid:setScanningParameters(scan_complexity,scan_depth)
end
-- print("curvaceous asteroids: just before return")
--return coordinates for asteroids: one in each arc
return arx, ary, brx, bry, full_list
end
function setPlayer()
player = getPlayerShip(-1)
if not player.name_assigned then
if player:getTypeName() == "Striker" then
if #playerShipNamesForStriker > 0 then
local name_index = math.random(1,#playerShipNamesForStriker)
player:setCallSign(playerShipNamesForStriker[name_index])
table.remove(playerShipNamesForStriker,name_index)
end
player.shipScore = 8
player.maxCargo = 4
player:setFaction(plot_faction)
else
if #playerShipNamesForLeftovers > 0 then
name_index = math.random(1,#playerShipNamesForLeftovers)
player:setCallSign(playerShipNamesForLeftovers[name_index])
table.remove(playerShipNamesForLeftovers,name_index)
end
player.shipScore = 24
player.maxCargo = 5
end
player.cargo = player.maxCargo
player.maxRepairCrew = player:getRepairCrewCount()
player.healthyShield = 1.0
player.prevShield = 1.0
player.healthyReactor = 1.0
player.prevReactor = 1.0
player.healthyManeuver = 1.0
player.prevManeuver = 1.0
player.healthyImpulse = 1.0
player.prevImpulse = 1.0
if player:getBeamWeaponRange(0) > 0 then
player.healthyBeam = 1.0
player.prevBeam = 1.0
end
if player:getWeaponTubeCount() > 0 then
player.healthyMissile = 1.0
player.prevMissile = 1.0
end
if player:hasWarpDrive() then
player.healthyWarp = 1.0
player.prevWarp = 1.0
end
if player:hasJumpDrive() then
player.healthyJump = 1.0
player.prevJump = 1.0
end
player:addReputationPoints(20)
player.name_assigned = true
end
end
function setVariations()
local svs = getScenarioVariation() --scenario variation string
if string.find(svs,"Easy") then
difficulty = .5
elseif string.find(svs,"Hard") then
difficulty = 2
else
difficulty = 1 --default (normal)
end
gameTimeLimit = 0
playWithTimeLimit = false
end
function setConstants()
repeatExitBoundary = 100
scarceResources = false
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}
--stnl: Ship Template Name List, stsl: Ship Template Score List, stbl: Ship Template Boolean List, nsfl: Non Standard Function List
stnl = {"Phobos R2","Adder MK8","Adder MK7","Adder MK3","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"}
stsl = {13 ,10 ,9 ,5 ,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}
stbl = {false ,false ,false ,false ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true}
nsfl = {}
table.insert(nsfl,phobosR2)
table.insert(nsfl,adderMk8)
table.insert(nsfl,adderMk7)
table.insert(nsfl,adderMk3)
-- square grid deployment
fleetPosDelta1x = {0,1,0,-1, 0,1,-1, 1,-1,2,0,-2, 0,2,-2, 2,-2,2, 2,-2,-2,1,-1, 1,-1}
fleetPosDelta1y = {0,0,1, 0,-1,1,-1,-1, 1,0,2, 0,-2,2,-2,-2, 2,1,-1, 1,-1,2, 2,-2,-2}
-- rough hexagonal deployment
fleetPosDelta2x = {0,2,-2,1,-1, 1, 1,4,-4,0, 0,2,-2,-2, 2,3,-3, 3,-3,6,-6,1,-1, 1,-1,3,-3, 3,-3,4,-4, 4,-4,5,-5, 5,-5}
fleetPosDelta2y = {0,0, 0,1, 1,-1,-1,0, 0,2,-2,2,-2, 2,-2,1,-1,-1, 1,0, 0,3, 3,-3,-3,3,-3,-3, 3,2,-2,-2, 2,1,-1,-1, 1}
--Player ship name lists to supplant standard randomized call sign generation
playerShipNamesForMP52Hornet = {"Dragonfly","Scarab","Mantis","Yellow Jacket","Jimminy","Flik","Thorny","Buzz"}
playerShipNamesForPiranha = {"Razor","Biter","Ripper","Voracious","Carnivorous","Characid","Vulture","Predator"}
playerShipNamesForFlaviaPFalcon = {"Ladyhawke","Hunter","Seeker","Gyrefalcon","Kestrel","Magpie","Bandit","Buccaneer"}
playerShipNamesForPhobosM3P = {"Blinder","Shadow","Distortion","Diemos","Ganymede","Castillo","Thebe","Retrograde"}
playerShipNamesForAtlantis = {"Excaliber","Thrasher","Punisher","Vorpal","Protang","Drummond","Parchim","Coronado"}
playerShipNamesForCruiser = {"Excelsior","Velociraptor","Thunder","Kona","Encounter","Perth","Aspern","Panther"}
playerShipNamesForMissileCruiser = {"Projectus","Hurlmeister","Flinger","Ovod","Amatola","Nakhimov","Antigone"}
playerShipNamesForFighter = {"Buzzer","Flitter","Zippiticus","Hopper","Molt","Stinger","Stripe"}
playerShipNamesForBenedict = {"Elizabeth","Ford","Vikramaditya","Liaoning","Avenger","Naruebet","Washington","Lincoln","Garibaldi","Eisenhower"}
playerShipNamesForKiriya = {"Cavour","Reagan","Gaulle","Paulo","Truman","Stennis","Kuznetsov","Roosevelt","Vinson","Old Salt"}
playerShipNamesForStriker = {"Sparrow","Sizzle","Baza","Crow","Phoenix","Snowbird","Hawk"}
playerShipNamesForLindworm = {"Seagull","Catapult","Blowhard","Flapper","Nixie","Pixie","Tinkerbell"}
playerShipNamesForRepulse = {"Fiddler","Brinks","Loomis","Mowag","Patria","Pandur","Terrex","Komatsu","Eitan"}
playerShipNamesForEnder = {"Mongo","Godzilla","Leviathan","Kraken","Jupiter","Saturn"}
playerShipNamesForNautilus = {"October", "Abdiel", "Manxman", "Newcon", "Nusret", "Pluton", "Amiral", "Amur", "Heinkel", "Dornier"}
playerShipNamesForHathcock = {"Hayha", "Waldron", "Plunkett", "Mawhinney", "Furlong", "Zaytsev", "Pavlichenko", "Pegahmagabow", "Fett", "Hawkeye", "Hanzo"}
playerShipNamesForAtlantisII = {"Spyder", "Shelob", "Tarantula", "Aragog", "Charlotte"}
playerShipNamesForProtoAtlantis = {"Narsil", "Blade", "Decapitator", "Trisect", "Sabre"}
playerShipNamesForSurkov = {"Sting", "Sneak", "Bingo", "Thrill", "Vivisect"}
playerShipNamesForRedhook = {"Headhunter", "Thud", "Troll", "Scalper", "Shark"}
playerShipNamesForLeftovers = {"Foregone","Righteous","Masher"}
commonGoods = {"food","medicine","nickel","platinum","gold","dilithium","tritanium","luxury","cobalt","impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"}
componentGoods = {"impulse","warp","shield","tractor","repulsor","beam","optic","robotic","filament","transporter","sensor","communication","autodoc","lifter","android","nanites","software","circuit","battery"}
mineralGoods = {"nickel","platinum","gold","dilithium","tritanium","cobalt"}
characterNames = {"Frank Brown",
"Joyce Miller",
"Harry Jones",
"Emma Davis",
"Zhang Wei Chen",
"Yu Yan Li",
"Li Wei Wang",
"Li Na Zhao",
"Sai Laghari",
"Anaya Khatri",
"Vihaan Reddy",
"Trisha Varma",
"Henry Gunawan",
"Putri Febrian",
"Stanley Hartono",
"Citra Mulyadi",
"Bashir Pitafi",
"Hania Kohli",
"Gohar Lehri",
"Sohelia Lau",
"Gabriel Santos",
"Ana Melo",
"Lucas Barbosa",
"Juliana Rocha",
"Habib Oni",
"Chinara Adebayo",
"Tanimu Ali",
"Naija Bello",
"Shamim Khan",
"Barsha Tripura",
"Sumon Das",
"Farah Munsi",
"Denis Popov",
"Pasha Sokolov",
"Burian Ivanov",
"Radka Vasiliev",
"Jose Hernandez",
"Victoria Garcia",
"Miguel Lopez",
"Renata Rodriguez"}
cargoInventoryList = {}
table.insert(cargoInventoryList,cargoInventory1)
table.insert(cargoInventoryList,cargoInventory2)
table.insert(cargoInventoryList,cargoInventory3)
table.insert(cargoInventoryList,cargoInventory4)
table.insert(cargoInventoryList,cargoInventory5)
table.insert(cargoInventoryList,cargoInventory6)
table.insert(cargoInventoryList,cargoInventory7)
table.insert(cargoInventoryList,cargoInventory8)
station_pool = {
["Science"] = {
["Asimov"] = {goods = {"repulsor"}, description = "Training and Coordination", general = "We train naval cadets in routine and specialized functions aboard space vessels and coordinate naval activity throughout the sector", history = "The original station builders were fans of the late 20th century scientist and author Isaac Asimov. The station was initially named Foundation, but was later changed simply to Asimov. It started off as a stellar observatory, then became a supply stop and as it has grown has become an educational and coordination hub for the region"},
["Armstrong"] = {goods = {"warp", "impulse"}, description = "Warp and Impulse engine manufacturing", general = "We manufacture warp, impulse and jump engines for the human navy fleet as well as other independent clients on a contract basis", history = "The station is named after the late 19th century astronaut as well as the fictionlized stations that followed. The station initially constructed entire space worthy vessels. In time, it transitioned into specializeing in propulsion systems."},
["Broeck"] = {goods = {"warp"}, description = "Warp drive components", general = "We provide warp drive engines and components", history = "This station is named after Chris Van Den Broeck who did some initial research into the possibility of warp drive in the late 20th century on Earth"},
["Coulomb"] = {goods = {"circuit"}, description = "Shielded circuitry fabrication", general = "We make a large variety of circuits for numerous ship systems shielded from sensor detection and external control interference", history = "Our station is named after the law which quantifies the amount of force with which stationary electrically charged particals repel or attact each other - a fundamental principle in the design of our circuits"},
["Heyes"] = {goods = {"sensor"}, description = "Sensor components", general = "We research and manufacture sensor components and systems", history = "The station is named after Tony Heyes the inventor of some of the earliest electromagnetic sensors in the mid 20th century on Earth in the United Kingdom to assist blind human mobility"},
["Hossam"] = {goods = {"nanites"}, description = "Nanite supplier", general = "We provide nanites for various organic and non-organic systems", history = "This station is named after the nanotechnologist Hossam Haick from the early 21st century on Earth in Israel"},
["Maiman"] = {goods = {"beam"}, description = "Energy beam components", general = "We research and manufacture energy beam components and systems", history = "The station is named after Theodore Maiman who researched and built the first laser in the mid 20th century on Earth"},
["Marconi"] = {goods = {"beam"}, description = "Energy Beam Components", general = "We manufacture energy beam components", history = "Station named after Guglielmo Marconi an Italian inventor from early 20th century Earth who, along with Nicolo Tesla, claimed to have invented a death ray or particle beam weapon"},
["Miller"] = {goods = {"optic"}, description = "Exobiology research", general = "We study recently discovered life forms not native to Earth", history = "This station was named after one of the early exobiologists from mid 20th century Earth, Dr. Stanley Miller"},
["Shawyer"] = {goods = {"impulse"}, description = "Impulse engine components", general = "We research and manufacture impulse engine components and systems", history = "The station is named after Roger Shawyer who built the first prototype impulse engine in the early 21st century"},
},
["History"] = {
["Archimedes"] = {goods = {"beam"}, description = "Energy and particle beam components", general = "We fabricate general and specialized components for ship beam systems", history = "This station was named after Archimedes who, according to legend, used a series of adjustable focal length mirrors to focus sunlight on a Roman naval fleet invading Syracuse, setting fire to it"},
["Chatuchak"] = {goods = {"luxury"}, description = "Trading station", general = "Only the largest market and trading location in twenty sectors. You can find your heart's desire here", history = "Modeled after the early 21st century bazaar on Earth in Bangkok, Thailand. Designed and built with trade and commerce in mind"},
["Grasberg"] = {goods = {"luxury"}, description = "Mining", general ="We mine nearby asteroids for precious minerals and process them for sale", history = "This station's name is inspired by a large gold mine on Earth in Indonesia. The station builders hoped to have a similar amount of minerals found amongst these asteroids"},
["Hayden"] = {goods = {"nanites"}, description = "Observatory and stellar mapping", general = "We study the cosmos and map stellar phenomena. We also track moving asteroids. Look out! Just kidding", history = "Station named in honor of Charles Hayden whose philanthropy continued astrophysical research and education on Earth in the early 20th century"},
["Lipkin"] = {goods = {"autodoc"}, description = "Autodoc components", general = "", history = "The station is named after Dr. Lipkin who pioneered some of the research and application around robot assisted surgery in the area of partial nephrectomy for renal tumors in the early 21st century on Earth"},
["Madison"] = {goods = {"luxury"}, description = "Zero gravity sports and entertainment", general = "Come take in a game or two or perhaps see a show", history = "Named after Madison Square Gardens from 21st century Earth, this station was designed to serve similar purposes in space - a venue for sports and entertainment"},
["Rutherford"] = {goods = {"shield"}, description = "Shield components and research", general = "We research and fabricate components for ship shield systems", history = "This station was named after the national research institution Rutherford Appleton Laboratory in the United Kingdom which conducted some preliminary research into the feasability of generating an energy shield in the late 20th century"},
["Toohie"] = {goods = {"shield"}, description = "Shield and armor components and research", general = "We research and make general and specialized components for ship shield and ship armor systems", history = "This station was named after one of the earliest researchers in shield technology, Alexander Toohie back when it was considered impractical to construct shields due to the physics involved."},
},
["Pop Sci Fi"] = {
["Anderson"] = {goods = {"software", "battery"}, description = "Battery and software engineering", general = "We provide high quality high capacity batteries and specialized software for all shipboard systems", history = "The station is named after a fictional software engineer in a late 20th century movie depicting humanity unknowingly conquered by aliens and kept docile by software generated illusion"},
["Archer"] = {goods = {"shield"}, description = "Shield and Armor Research", general = "The finest shield and armor manufacturer in the quadrant", history = "We named this station for the pioneering spirit of the 22nd century Starfleet explorer, Captain Jonathan Archer"},
["Barclay"] = {goods = {"communication"}, description = "Communication components", general = "We provide a range of communication equipment and software for use aboard ships", history = "The station is named after Reginald Barclay who established the first transgalactic com link through the creative application of a quantum singularity. Station personnel often refer to the station as the Broccoli station"},
["Calvin"] = {goods = {"robotic"}, description = "Robotic research", general = "We research and provide robotic systems and components", history = "This station is named after Dr. Susan Calvin who pioneered robotic behavioral research and programming"},
["Cavor"] = {goods = {"filament"}, description = "Advanced Material components", general = "We fabricate several different kinds of materials critical to various space industries like ship building, station construction and mineral extraction", history = "We named our station after Dr. Cavor, the physicist that invented a barrier material for gravity waves - Cavorite"},
["Cyrus"] = {goods = {"impulse"}, description = "Impulse engine components", general = "We supply high quality impulse engines and parts for use aboard ships", history = "This station was named after the fictional engineer, Cyrus Smith created by 19th century author Jules Verne"},
["Deckard"] = {goods = {"android"}, description = "Android components", general = "Supplier of android components, programming and service", history = "Named for Richard Deckard who inspired many of the sophisticated safety security algorithms now required for all androids"},
["Erickson"] = {goods = {"transporter"}, description = "Transporter components", general = "We provide transporters used aboard ships as well as the components for repair and maintenance", history = "The station is named after the early 22nd century inventor of the transporter, Dr. Emory Erickson. This station is proud to have received the endorsement of Admiral Leonard McCoy"},
["Komov"] = {goods = {"filament"}, description = "Xenopsychology training", general = "We provide classes and simulation to help train diverse species in how to relate to each other", history = "A continuation of the research initially conducted by Dr. Gennady Komov in the early 22nd century on Venus, supported by the application of these principles"},
["Muddville"] = {goods = {"luxury"}, description = "Trading station", general = "Come to Muddvile for all your trade and commerce needs and desires", history = "Upon retirement, Harry Mudd started this commercial venture using his leftover inventory and extensive connections obtained while he traveled the stars as a salesman"},
["Nexus-6"] = {goods = {"android"}, description = "Android components", general = "Androids, their parts, maintenance and recylcling", history = "We named the station after the ground breaking android model produced by the Tyrell corporation"},
["O'Brien"] = {goods = {"transporter"}, description = "Transporter components", general = "We research and fabricate high quality transporters and transporter components for use aboard ships", history = "Miles O'Brien started this business after his experience as a transporter chief"},
["Organa"] = {goods = {"luxury"}, description = "Diplomatic training", general = "The premeire academy for leadership and diplomacy training in the region", history = "Established by the royal family so critical during the political upheaval era"},
["Owen"] = {goods = {"lifter"}, description = "Load lifters and components", general = "We provide load lifters and components for various ship systems", history = "Owens started off in the moisture vaporator business on Tattooine then branched out into load lifters based on acquisition of proprietary software and protocols. The station name recognizes the tragic loss of our founder to Imperial violence"},