@jtff/miztemplate-lib 3.5.8 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ QRAConfig = {
2
+ {
3
+ enable = false,
4
+ name = "QRA Training AutoSpawn",
5
+ type = JTFF_QRA.Type.TangoAuto,
6
+ benefit_coalition = coalition.side.BLUE,
7
+ templates = {
8
+ 'qra_armed',
9
+ 'qra_safe',
10
+ },
11
+ skill = 'Excellent'
12
+ },
13
+ {
14
+ enable = false,
15
+ name = "QRA Training ManualSpawn",
16
+ type = JTFF_QRA.Type.TangoManual,
17
+ benefit_coalition = coalition.side.BLUE,
18
+ },
19
+ {
20
+ enable = false,
21
+ name = "QRA Alpha",
22
+ type = JTFF_QRA.Type.Alpha,
23
+ benefit_coalition = coalition.side.BLUE,
24
+ },
25
+ }
@@ -1135,13 +1135,31 @@ function spawnStaticListWithUnitLink(layoutData, namePrefix, unitID, countryID)
1135
1135
  end
1136
1136
  end
1137
1137
 
1138
+ function ClientIsOnGround(client)
1139
+ jtff_log.trace(string.format("Client %s is tested if alive and OnGround", client:GetPlayer() or ""),"QRA")
1140
+ return UNIT:Find(client:GetDCSObject()):IsAlive() and not(UNIT:Find(client:GetDCSObject()):InAir(true))
1141
+ end
1142
+
1143
+ -- @field #JTFF_QRA JTFF_QRA
1144
+ JTFF_QRA = {
1145
+ ClassName = "JTFF_QRA",
1146
+ }
1147
+
1148
+ --- QRA Types
1149
+ -- @type JTFF_QRA.Type
1150
+ JTFF_QRA.Type = {
1151
+ TangoAuto = "Tango Scramble Auto Spawn",
1152
+ TangoManual = "Tango Scramble Manual Spawn",
1153
+ Alpha = "Alpha Scramble",
1154
+ }
1155
+
1138
1156
  env.info('JTFF-SHAREDLIB: shared library loaded succesfully')
1139
1157
 
1140
1158
  soundFilesPrefix = getSoundFilesPrefix()
1141
1159
 
1142
-
1143
1160
  sound2Bip = USERSOUND:New( soundFilesPrefix .. "Misc/2_Bips.ogg" )
1144
1161
  sound1Bip = USERSOUND:New( soundFilesPrefix .. "Misc/Bip.ogg" )
1145
1162
  soundCrashWood = USERSOUND:New( soundFilesPrefix .. "Misc/crash_wood.ogg" )
1163
+ soundQRA = USERSOUND:New( soundFilesPrefix .. "Misc/SCRAMBLE QRA.ogg" )
1146
1164
 
1147
1165
  sound1Bip:ToAll()
@@ -11,7 +11,6 @@ function Set_CLIENT:OnEventPlayerEnterAircraft(EventData)
11
11
  clientSetting:SetImperial()
12
12
  clientSetting:SetA2G_MGRS()
13
13
  clientSetting:SetMenutextShort(true)
14
- jtff_log.debug(string.format("Add Tanker Menu for group [%s], player name [%s]",EventData.IniGroupName , EventData.IniPlayerName),"TANKER")
15
14
  if type(InterceptArray) == 'table' then
16
15
  for index, objIntercept in ipairs(InterceptArray) do
17
16
  if (objIntercept.menus[EventData.IniUnit:GetCoalition()]) then
@@ -23,6 +22,25 @@ function Set_CLIENT:OnEventPlayerEnterAircraft(EventData)
23
22
  end
24
23
  end
25
24
  end
25
+ jtff_log.debug(string.format("Add QRA Menu for group [%s], player name [%s]",EventData.IniGroupName , EventData.IniPlayerName),"QRA")
26
+ if type(QRAArray) == 'table' then
27
+ for index, objQRA in ipairs(QRAArray) do
28
+ if (MenuCoalitionQRA[EventData.IniUnit:GetCoalition()]) and (objQRA.customconfig.type == JTFF_QRA.Type.TangoAuto) then
29
+ objQRA.menu[EventData.IniUnit:GetCoalition()] = MENU_GROUP_COMMAND:New(
30
+ EventData.IniGroup,
31
+ "Trigger " .. objQRA.customconfig.name,
32
+ MenuCoalitionQRA[EventData.IniUnit:GetCoalition()],
33
+ QRATrigger,
34
+ {
35
+ objQRA,
36
+ EventData.IniUnit:GetName(),
37
+ index,
38
+ }
39
+ )
40
+ end
41
+ end
42
+ end
43
+ jtff_log.debug(string.format("Add Tanker Menu for group [%s], player name [%s]",EventData.IniGroupName , EventData.IniPlayerName),"TANKER")
26
44
  if EventData.IniUnit:GetCoalition() == coalition.side.BLUE then
27
45
  MENU_GROUP_COMMAND:New( EventData.IniGroup, "Nearest Tanker Info", MenuCoalitionTankerBlue, NearestTankerInfo, { EventData.IniUnit, EventData.IniGroup} )
28
46
  MENU_GROUP_COMMAND:New( EventData.IniGroup, "All Tankers Info", MenuCoalitionTankerBlue, AllTankersInfo, {EventData.IniUnit,EventData.IniGroup} )
@@ -84,4 +102,4 @@ end
84
102
  Set_CLIENT_Bleu = SET_CLIENT:New():FilterCoalitions(coalition.side.BLUE):FilterOnce()
85
103
  jtff_log.debug(string.format("Nbre Blue Client : %i", Set_CLIENT_Bleu:Count()),"GENERAL")
86
104
  Set_CLIENT_Red = SET_CLIENT:New():FilterCoalitions(coalition.side.RED):FilterOnce()
87
- jtff_log.debug(string.format("Nbre Red Client : %i", Set_CLIENT_Red:Count()),"GENERAL")
105
+ jtff_log.debug(string.format("Nbre Red Client : %i", Set_CLIENT_Red:Count()),"GENERAL")
@@ -20,7 +20,7 @@ function detectShitHotBreak(objAirboss)
20
20
  local player_alt_feet = UTILS.MetersToFeet(MooseClient:GetAltitude())
21
21
  --trigger.action.outText('ForEachClientInZone: MooseClient name is '..player_name , 5)
22
22
 
23
- --local Play_SH_Sound = USERSOUND:New( soundFilesPrefix .. "AIRBOSS/Airboss Soundfiles/GreatBallsOfFire.ogg" )
23
+ local Play_SH_Sound = USERSOUND:New( soundFilesPrefix .. "AIRBOSS/Airboss Soundfiles/GreatBallsOfFire.ogg" )
24
24
  --trigger.action.outText(player_name..' altitude is '..player_alt_feet..' feet', 5)
25
25
  --trigger.action.outText(player_name..' speed is '..player_velocity, 5)
26
26
  local client_in_zone_flag = USERFLAG:New(MooseClient:GetUCID())
@@ -35,10 +35,10 @@ function detectShitHotBreak(objAirboss)
35
35
  text=sh_message_to_discord,
36
36
  msg_type='lso'
37
37
  })
38
- Play_SH_Sound:ToAll()
38
+ Play_SH_Sound:ToClient(MooseClient)
39
39
  client_in_zone_flag:Set(1)
40
40
  client_performing_sh:Set(1)
41
- timer.scheduleFunction(resetFlag, {client_in_zone_flag}, timer.getTime() + 10)
41
+ timer.scheduleFunction(resetFlag, {client_in_zone_flag}, timer.getTime() + 5 * 60)
42
42
  else
43
43
  end
44
44
 
@@ -306,17 +306,6 @@ function cleanDeckLayout(objAirboss)
306
306
  }, -- end of ["offsets"]
307
307
  ["type"] = "S_70B_Seahawk",
308
308
  },
309
- {
310
- ["livery_id"] = "VAW-116_165648 - Used",
311
- ["category"] = "Planes",
312
- ["offsets"] =
313
- {
314
- ["y"] = 15.873907469023,
315
- ["angle"] = 117.7922712171,
316
- ["x"] = -44.726758369739,
317
- }, -- end of ["offsets"]
318
- ["type"] = "E-2C",
319
- },
320
309
  {
321
310
  ["livery_id"] = "vaw-124_161781 - used",
322
311
  ["category"] = "Planes",
@@ -479,42 +468,42 @@ end
479
468
 
480
469
  function flexDeck3SpawnLayout(objAirboss)
481
470
  flexDeck7SpawnLayout(objAirboss)
482
- local elev1Layout = {
471
+ local elev2Layout = {
483
472
  {
484
- ["livery_id"] = "vmfa-314-12-gaspo",
473
+ ["livery_id"] = "vaq-137 co 158805",
485
474
  ["category"] = "Planes",
486
475
  ["offsets"] =
487
476
  {
488
- ["y"] = 31.562717287402,
489
- ["angle"] = 117.80972450962,
490
- ["x"] = 35.545373177252,
477
+ ["y"] = 33.621846629802,
478
+ ["angle"] = 4.7080880359424,
479
+ ["x"] = -13.423541233483,
491
480
  }, -- end of ["offsets"]
492
- ["type"] = "FA-18C_hornet",
481
+ ["type"] = "EA_6B",
493
482
  },
494
483
  {
495
- ["livery_id"] = "vmfa-314-07-max",
484
+ ["livery_id"] = "vfa-87",
496
485
  ["category"] = "Planes",
497
486
  ["offsets"] =
498
487
  {
499
- ["y"] = 31.631930277644,
500
- ["angle"] = 117.80972450962,
501
- ["x"] = 26.732753925417,
488
+ ["y"] = 32.375666919525,
489
+ ["angle"] = 4.7080880359424,
490
+ ["x"] = -25.647526329967,
502
491
  }, -- end of ["offsets"]
503
492
  ["type"] = "FA-18C_hornet",
504
493
  },
505
494
  {
506
- ["livery_id"] = "vmfa-314-prospect",
495
+ ["livery_id"] = "vfa-87",
507
496
  ["category"] = "Planes",
508
497
  ["offsets"] =
509
498
  {
510
- ["y"] = 31.755826137288,
511
- ["angle"] = 117.80972450962,
512
- ["x"] = 17.845507060166,
499
+ ["y"] = 30.99658128452,
500
+ ["angle"] = 1.5490420898326,
501
+ ["x"] = -19.557373659788,
513
502
  }, -- end of ["offsets"]
514
503
  ["type"] = "FA-18C_hornet",
515
504
  },
516
505
  }
517
- spawnDeckLayout_Zone(objAirboss, "Elev1", elev1Layout)
506
+ spawnDeckLayout_Zone(objAirboss, "Elev2", elev2Layout)
518
507
  local elev4Layout = {
519
508
  {
520
509
  ["livery_id"] = "jtff_vf-84_91_200",
@@ -567,65 +556,64 @@ function flexDeck7SpawnLayout(objAirboss)
567
556
  cleanDeckLayout(objAirboss)
568
557
  local pointLayout = {
569
558
  {
570
- ["livery_id"] = "vfa-131",
571
- ["category"] = "Planes",
559
+ ["category"] = "ADEquipment",
572
560
  ["offsets"] =
573
561
  {
574
- ["y"] = 24.669901019671,
575
- ["angle"] = 116.53563415567,
576
- ["x"] = 76.218478186123,
562
+ ["y"] = 28.099036062225,
563
+ ["angle"] = 4.5335551107429,
564
+ ["x"] = 73.682386210606,
577
565
  }, -- end of ["offsets"]
578
- ["type"] = "FA-18C_hornet",
566
+ ["type"] = "AS32-32A",
579
567
  },
580
568
  {
581
- ["livery_id"] = "vfa-131",
569
+ ["livery_id"] = "marines 06 cb 161352",
582
570
  ["category"] = "Planes",
583
571
  ["offsets"] =
584
572
  {
585
- ["y"] = 31.548333323636,
586
- ["angle"] = 117.60028499938,
587
- ["x"] = 66.983044465331,
573
+ ["y"] = 33.012193853945,
574
+ ["angle"] = 4.7080880359424,
575
+ ["x"] = 48.207851738378,
588
576
  }, -- end of ["offsets"]
589
- ["type"] = "FA-18C_hornet",
577
+ ["type"] = "EA_6B",
590
578
  },
591
579
  {
592
- ["livery_id"] = "vmfa-314-11-fenrir",
580
+ ["livery_id"] = "vaq-132 ae 605",
593
581
  ["category"] = "Planes",
594
582
  ["offsets"] =
595
583
  {
596
- ["y"] = 31.887484174597,
597
- ["angle"] = 117.82717780214,
598
- ["x"] = 58.718151586128,
584
+ ["y"] = 32.037151622558,
585
+ ["angle"] = 4.2368491379039,
586
+ ["x"] = 65.674634840866,
599
587
  }, -- end of ["offsets"]
600
- ["type"] = "FA-18C_hornet",
588
+ ["type"] = "EA_6B",
601
589
  },
602
590
  {
603
- ["livery_id"] = "vmfa-314-04-nico",
591
+ ["livery_id"] = "vaq-132 ae 604",
604
592
  ["category"] = "Planes",
605
593
  ["offsets"] =
606
594
  {
607
- ["y"] = 31.687484165357,
608
- ["angle"] = 117.82717780214,
609
- ["x"] = 49.946723022861,
595
+ ["y"] = 33.063487980478,
596
+ ["angle"] = 4.7080880359424,
597
+ ["x"] = 56.912418720699,
610
598
  }, -- end of ["offsets"]
611
- ["type"] = "FA-18C_hornet",
599
+ ["type"] = "EA_6B",
612
600
  },
613
601
  {
614
- ["livery_id"] = "vmfa-314-03-dan",
602
+ ["livery_id"] = "vaq-132 ae 605",
615
603
  ["category"] = "Planes",
616
604
  ["offsets"] =
617
605
  {
618
- ["y"] = 22.89707058953,
619
- ["angle"] = 117.80972450962,
620
- ["x"] = 44.552326879982,
606
+ ["y"] = 24.590838184328,
607
+ ["angle"] = 4.0623162127045,
608
+ ["x"] = 78.22761285087,
621
609
  }, -- end of ["offsets"]
622
- ["type"] = "FA-18C_hornet",
610
+ ["type"] = "EA_6B",
623
611
  },
624
612
  }
625
613
  spawnDeckLayout_Zone(objAirboss, "Point", pointLayout)
626
614
  local cat1Layout = {
627
615
  {
628
- ["livery_id"] = "VFA-31 Line NH",
616
+ ["livery_id"] = "VFA-87",
629
617
  ["category"] = "Planes",
630
618
  ["offsets"] =
631
619
  {
@@ -636,7 +624,7 @@ function flexDeck7SpawnLayout(objAirboss)
636
624
  ["type"] = "FA-18C_hornet",
637
625
  },
638
626
  {
639
- ["livery_id"] = "VFA-31 Line NH",
627
+ ["livery_id"] = "VFA-87",
640
628
  ["category"] = "Planes",
641
629
  ["offsets"] =
642
630
  {
@@ -647,7 +635,7 @@ function flexDeck7SpawnLayout(objAirboss)
647
635
  ["type"] = "FA-18C_hornet",
648
636
  },
649
637
  {
650
- ["livery_id"] = "VFA-31 Line NH",
638
+ ["livery_id"] = "VFA-87",
651
639
  ["category"] = "Planes",
652
640
  ["offsets"] =
653
641
  {
@@ -658,7 +646,7 @@ function flexDeck7SpawnLayout(objAirboss)
658
646
  ["type"] = "FA-18C_hornet",
659
647
  },
660
648
  {
661
- ["livery_id"] = "VFA-31 Line NH",
649
+ ["livery_id"] = "VFA-87",
662
650
  ["category"] = "Planes",
663
651
  ["offsets"] =
664
652
  {
@@ -669,7 +657,7 @@ function flexDeck7SpawnLayout(objAirboss)
669
657
  ["type"] = "FA-18C_hornet",
670
658
  },
671
659
  {
672
- ["livery_id"] = "VFA-31 CAG",
660
+ ["livery_id"] = "VFA-87",
673
661
  ["category"] = "Planes",
674
662
  ["offsets"] =
675
663
  {
@@ -680,7 +668,7 @@ function flexDeck7SpawnLayout(objAirboss)
680
668
  ["type"] = "FA-18C_hornet",
681
669
  },
682
670
  {
683
- ["livery_id"] = "vfa-131",
671
+ ["livery_id"] = "VFA-87",
684
672
  ["category"] = "Planes",
685
673
  ["offsets"] =
686
674
  {
@@ -728,109 +716,67 @@ function flexDeck7SpawnLayout(objAirboss)
728
716
  },
729
717
  }
730
718
  spawnDeckLayout_Zone(objAirboss, "Patio", patioLayout)
731
- local elev2Layout = {
732
- {
733
- ["livery_id"] = "usaf - vs-24 - line 06",
734
- ["category"] = "Planes",
735
- ["offsets"] =
736
- {
737
- ["y"] = 32.539954023092,
738
- ["angle"] = 117.80972450962,
739
- ["x"] = -11.175267363564,
740
- }, -- end of ["offsets"]
741
- ["type"] = "S-3B",
742
- },
743
- {
744
- ["livery_id"] = "usaf - vs-24 - cag",
745
- ["category"] = "Planes",
746
- ["offsets"] =
747
- {
748
- ["y"] = 32.365491326017,
749
- ["angle"] = 117.80972450962,
750
- ["x"] = -20.127247546956,
751
- }, -- end of ["offsets"]
752
- ["type"] = "S-3B Tanker",
753
- },
719
+ local elev1Layout = {
754
720
  {
755
- ["livery_id"] = "usn vrc-40",
721
+ ["livery_id"] = "VFA-87",
756
722
  ["category"] = "Planes",
757
723
  ["offsets"] =
758
724
  {
759
- ["y"] = 28.124813741543,
725
+ ["y"] = 31.562717287402,
760
726
  ["angle"] = 117.80972450962,
761
- ["x"] = -29.525058026088,
727
+ ["x"] = 35.545373177252,
762
728
  }, -- end of ["offsets"]
763
- ["type"] = "C2A_Greyhound",
764
- },
765
- {
766
- },
767
- {
768
- },
769
- {
729
+ ["type"] = "FA-18C_hornet",
770
730
  },
771
- }
772
- spawnDeckLayout_Zone(objAirboss, "Elev2", elev2Layout)
773
- local coralLayout = {
774
731
  {
775
- ["livery_id"] = "vmfa-314-17-bbr",
732
+ ["livery_id"] = "VFA-87",
776
733
  ["category"] = "Planes",
777
734
  ["offsets"] =
778
735
  {
779
- ["y"] = 31.823972928083,
736
+ ["y"] = 31.631930277644,
780
737
  ["angle"] = 117.80972450962,
781
- ["x"] = 9.0184519872365,
738
+ ["x"] = 26.732753925417,
782
739
  }, -- end of ["offsets"]
783
740
  ["type"] = "FA-18C_hornet",
784
741
  },
785
742
  {
786
- ["livery_id"] = "vmfa-314-high-visibility",
743
+ ["livery_id"] = "VFA-87",
787
744
  ["category"] = "Planes",
788
745
  ["offsets"] =
789
746
  {
790
- ["y"] = 31.892119718495,
747
+ ["y"] = 31.755826137288,
791
748
  ["angle"] = 117.80972450962,
792
- ["x"] = 0.19139690430253,
749
+ ["x"] = 17.845507060166,
793
750
  }, -- end of ["offsets"]
794
751
  ["type"] = "FA-18C_hornet",
795
752
  },
796
753
  }
797
- spawnDeckLayout_Zone(objAirboss, "Coral", coralLayout)
798
- local sixPackLayout = {
799
- {
800
- ["livery_id"] = "marines 06 cb 161352",
801
- ["category"] = "Planes",
802
- ["offsets"] =
803
- {
804
- ["y"] = 9.5058075472028,
805
- ["angle"] = 116.6578072033,
806
- ["x"] = -24.69799568041,
807
- }, -- end of ["offsets"]
808
- ["type"] = "EA_6B",
809
- },
754
+ spawnDeckLayout_Zone(objAirboss, "Elev1", elev1Layout)
755
+ local coralLayout = {
810
756
  {
811
- ["livery_id"] = "vmaq-2 cy 159909",
757
+ ["livery_id"] = "usn vrc-40",
812
758
  ["category"] = "Planes",
813
759
  ["offsets"] =
814
760
  {
815
- ["y"] = 6.7954604627145,
816
- ["angle"] = 116.6578072033,
817
- ["x"] = -13.397800604079,
761
+ ["y"] = 32.194100140318,
762
+ ["angle"] = 4.6906347434224,
763
+ ["x"] = 8.026960843163,
818
764
  }, -- end of ["offsets"]
819
- ["type"] = "EA_6B",
765
+ ["type"] = "C2A_Greyhound",
820
766
  },
821
767
  {
822
- ["livery_id"] = "vmaq-2 cy 160432",
768
+ ["livery_id"] = "usaf - vs-24 - cag",
823
769
  ["category"] = "Planes",
824
770
  ["offsets"] =
825
771
  {
826
- ["y"] = 4.2081211078727,
827
- ["angle"] = 116.6578072033,
828
- ["x"] = -2.0125088320917,
772
+ ["y"] = 29.785585834077,
773
+ ["angle"] = 4.6906347434224,
774
+ ["x"] = -1.16631697175602,
829
775
  }, -- end of ["offsets"]
830
- ["type"] = "EA_6B",
776
+ ["type"] = "S-3B Tanker",
831
777
  },
832
778
  }
833
- spawnDeckLayout_Zone(objAirboss, "SixPack", sixPackLayout)
779
+ spawnDeckLayout_Zone(objAirboss, "Coral", coralLayout)
834
780
  end
835
781
 
836
782
  function launchDeck7SpawnLayout(objAirboss)
@@ -999,7 +945,7 @@ function launchDeck1SpawnLayout(objAirboss)
999
945
  spawnDeckLayout_Zone(objAirboss, "Elev3", elev3Layout)
1000
946
  local sternLayout = {
1001
947
  {
1002
- ["livery_id"] = "VF-41 AJ111 1981 base Reflected",
948
+ ["livery_id"] = "VF-41 AJ101 1981 base Reflected",
1003
949
  ["category"] = "Planes",
1004
950
  ["offsets"] =
1005
951
  {
@@ -1010,7 +956,7 @@ function launchDeck1SpawnLayout(objAirboss)
1010
956
  ["type"] = "F-14B",
1011
957
  },
1012
958
  {
1013
- ["livery_id"] = "VF-41 AJ112 1981 base Reflected",
959
+ ["livery_id"] = "jtff_vf-84_91_205",
1014
960
  ["category"] = "Planes",
1015
961
  ["offsets"] =
1016
962
  {
@@ -1021,7 +967,7 @@ function launchDeck1SpawnLayout(objAirboss)
1021
967
  ["type"] = "F-14B",
1022
968
  },
1023
969
  {
1024
- ["livery_id"] = "VF-41 AJ104 1981 base Reflected",
970
+ ["livery_id"] = "VF-41 AJ103 1981 base Reflected",
1025
971
  ["category"] = "Planes",
1026
972
  ["offsets"] =
1027
973
  {
@@ -1032,7 +978,7 @@ function launchDeck1SpawnLayout(objAirboss)
1032
978
  ["type"] = "F-14B",
1033
979
  },
1034
980
  {
1035
- ["livery_id"] = "VF-31 Tomcatters AJ100",
981
+ ["livery_id"] = "VF-41 AJ106 1981 base Reflected",
1036
982
  ["category"] = "Planes",
1037
983
  ["offsets"] =
1038
984
  {
@@ -1043,7 +989,7 @@ function launchDeck1SpawnLayout(objAirboss)
1043
989
  ["type"] = "F-14B",
1044
990
  },
1045
991
  {
1046
- ["livery_id"] = "VF-31 Tomcatters AJ101",
992
+ ["livery_id"] = "VF-41 AJ110 1981 base Reflected",
1047
993
  ["category"] = "Planes",
1048
994
  ["offsets"] =
1049
995
  {
@@ -1054,7 +1000,7 @@ function launchDeck1SpawnLayout(objAirboss)
1054
1000
  ["type"] = "F-14B",
1055
1001
  },
1056
1002
  {
1057
- ["livery_id"] = "jtff_vf-84_91_204",
1003
+ ["livery_id"] = "jtff_vf-84_91_203",
1058
1004
  ["category"] = "Planes",
1059
1005
  ["offsets"] =
1060
1006
  {
@@ -0,0 +1,349 @@
1
+ function playQRASoundToClient(client, time)
2
+ soundQRA:ToClient(client)
3
+ return nil
4
+ end
5
+
6
+ function QRALaunchBogey(params)
7
+ local objQRA = params[1]
8
+ local trigerringUnitName = params[2]
9
+ local QRAIndex = params[3]
10
+ local playerClient = CLIENT:FindByName(trigerringUnitName)
11
+ local playerCoord = playerClient:GetCoordinate()
12
+ local bogeyGroup = nil
13
+ local bogeyRouteLengthNM = 200
14
+ local bogeyRangeMin = 100
15
+ local bogeyRangeMax = 300
16
+ local bogeyFLMin = 5
17
+ local bogeyFLMax = 250
18
+ local bogeyAzimuthMin = 0
19
+ local bogeyAzimuthMax = 359
20
+ local bogeyGroundSpeedKnots = 600
21
+ local bogeyAzimuth = math.floor(
22
+ math.random(
23
+ UTILS.FeetToMeters(bogeyAzimuthMin),
24
+ UTILS.FeetToMeters(bogeyAzimuthMax)
25
+ )
26
+ )
27
+ local bogeyFL = math.floor(
28
+ math.random(
29
+ UTILS.FeetToMeters(bogeyFLMin * 100),
30
+ UTILS.FeetToMeters(bogeyFLMax * 100)
31
+ )
32
+ )
33
+ local bogeyRangeMeters = math.floor(
34
+ math.random(
35
+ UTILS.NMToMeters(bogeyRangeMin),
36
+ UTILS.NMToMeters(bogeyRangeMax)
37
+ )
38
+ )
39
+ local bogeySpawnObj = QRAArray[QRAIndex].objSpawn
40
+ local bogeyCoord = POINT_VEC3:NewFromVec3(
41
+ {
42
+ x = playerCoord.x + math.floor(bogeyRangeMeters * math.cos(math.rad(bogeyAzimuth))),
43
+ y = math.max(
44
+ math.min(
45
+ bogeyFL,
46
+ UTILS.FeetToMeters(32000)
47
+ ),
48
+ UTILS.FeetToMeters(500)
49
+ ),
50
+ z = playerCoord.z + math.floor(bogeyRangeMeters * math.sin(math.rad(bogeyAzimuth))),
51
+ }
52
+ )
53
+ local bogeyDestination = playerCoord:GetRandomCoordinateInRadius(
54
+ UTILS.NMToMeters(10),
55
+ UTILS.NMToMeters(60)
56
+ )
57
+ local bogeyHeading = bogeyCoord:HeadingTo(bogeyDestination)
58
+ jtff_log.info(
59
+ string.format(
60
+ "Spawning bogey based on %s with Heading of %i degrees",
61
+ bogeySpawnObj.SpawnTemplatePrefix,
62
+ bogeyHeading
63
+ ),
64
+ "QRA"
65
+ )
66
+ bogeyGroup = bogeySpawnObj:InitHeading(bogeyHeading):SpawnFromVec3(bogeyCoord)
67
+ bogeyGroup:OptionROE(ENUMS.ROE.WeaponHold)
68
+ bogeyGroup:OptionROT(ENUMS.ROT.NoReaction)
69
+ bogeyGroup:OptionRTBBingoFuel(true)
70
+ bogeyGroup:OptionRestrictBurner(false)
71
+ bogeyGroup:EnableEmission(false)
72
+ bogeyGroup:OptionAlarmStateGreen()
73
+ bogeyGroup:OptionECM_Never()
74
+ bogeyGroup:CommandEPLRS(true)
75
+ local bogeyDestinationCoord = bogeyGroup:GetCoordinate():Translate(
76
+ UTILS.NMToMeters(bogeyRouteLengthNM),
77
+ bogeyHeading,
78
+ true,
79
+ false
80
+ )
81
+ bogeyGroup:Route(
82
+ {
83
+ bogeyDestinationCoord:WaypointAirTurningPoint(
84
+ COORDINATE.WaypointAltType.BARO,
85
+ UTILS.KnotsToKmph(bogeyGroundSpeedKnots),
86
+ nil,
87
+ "End QRA"
88
+ ),
89
+ bogeyDestinationCoord:GetClosestAirbase(
90
+ --bogeyGroup:GetCategory(),
91
+ --bogeyGroup:GetCoalition()
92
+ ):GetCoordinate():WaypointAirLanding(
93
+ UTILS.KnotsToKmph(bogeyGroundSpeedKnots),
94
+ bogeyDestinationCoord:GetClosestAirbase(
95
+ --bogeyGroup:GetCategory(),
96
+ --bogeyGroup:GetCoalition()
97
+ )
98
+ )
99
+ }
100
+ )
101
+ return bogeyGroup
102
+ end
103
+
104
+ function QRATrigger(params)
105
+ local objQRA = params[1]
106
+ local trigerringUnitName = params[2]
107
+ local QRAIndex = params[3]
108
+ local msgTriggeredGround = ""
109
+ local msgTriggeredOthers = ""
110
+ if (objQRA.customconfig.type == JTFF_QRA.Type.TangoAuto) then
111
+ local playerClient = CLIENT:FindByName(trigerringUnitName)
112
+ local playerName = playerClient:GetPlayer()
113
+ local playerCoord = playerClient:GetCoordinate()
114
+ QRAArray[QRAIndex].objBogeyGroup = QRALaunchBogey(params)
115
+ local bullsCoord = COORDINATE.GetBullseyeCoordinate(objQRA.customconfig.benefit_coalition)
116
+ local bogeyCoord = QRAArray[QRAIndex].objBogeyGroup:GetCoordinate()
117
+ local bullsBearing = math.floor(bullsCoord:HeadingTo(bogeyCoord))
118
+ local bullsRange = math.floor(UTILS.MetersToNM(bullsCoord:Get2DDistance(bogeyCoord)))
119
+ local bogeyAngel = math.floor(UTILS.MetersToFeet(QRAArray[QRAIndex].objBogeyGroup:GetAltitude(false))/1000)
120
+ local bogeyApproxDestination = playerCoord:GetClosestAirbase():GetName()
121
+ jtff_log.info(
122
+ string.format(
123
+ "Bogey Spawned based on %s",
124
+ QRAArray[QRAIndex].objSpawn.SpawnTemplatePrefix
125
+ ),
126
+ "QRA"
127
+ )
128
+ jtff_log.info(
129
+ string.format("Bogey is Bulls %i for %i Angel %i, tracking to %s",
130
+ bullsBearing,
131
+ bullsRange,
132
+ bogeyAngel,
133
+ bogeyApproxDestination
134
+ ),
135
+ "QRA"
136
+ )
137
+ local formatString = "QRA %s has been triggered by %s!\n" ..
138
+ "Type is : %s\n" ..
139
+ "Bogey is Bulls %i for %i Angel %i, tracking %s\n" ..
140
+ "If you're on Alert," ..
141
+ " you have 10 minutes to take-off and intercept the bogey.\n" ..
142
+ "If you're not, please give %s priority on the taxiway.\n"
143
+ msgTriggeredGround = string.format(
144
+ formatString,
145
+ objQRA.customconfig.name,
146
+ playerName,
147
+ objQRA.customconfig.type,
148
+ bullsBearing,
149
+ bullsRange,
150
+ bogeyAngel,
151
+ bogeyApproxDestination,
152
+ playerName
153
+ )
154
+ formatString = "<WARNING> : QRA Triggered by %s!\n" ..
155
+ "A Bogey is approaching %s, " ..
156
+ "stay away from the interception area\n" ..
157
+ "...\n" ..
158
+ "Bogey last position : Bulls %i for %i Angel %i, tracking to %s"
159
+ msgTriggeredOthers = string.format(formatString,
160
+ playerName,
161
+ playerCoord:GetClosestAirbase():GetName(),
162
+ bullsBearing,
163
+ bullsRange,
164
+ bogeyAngel,
165
+ bogeyApproxDestination
166
+ )
167
+ elseif (objQRA.customconfig.type == JTFF_QRA.Type.TangoManual) then
168
+ local playerClient
169
+ local playerName
170
+ local playerCoord
171
+ if type(trigerringUnitName) == 'nil' then
172
+ playerName = "GameMaster"
173
+ playerClient = nil
174
+ playerCoord = COORDINATE.GetBullseyeCoordinate(objQRA.customconfig.benefit_coalition)
175
+ else
176
+ playerClient = CLIENT:FindByName(trigerringUnitName)
177
+ playerName = playerClient:GetPlayer()
178
+ playerCoord = playerClient:GetCoordinate()
179
+ end
180
+ local formatString = "QRA %s has been triggered by %s !\n" ..
181
+ "Type is : %s\n" ..
182
+ "If you're on Alert," ..
183
+ " you have 10 minutes to take-off and start intercepting the the bogey.\n" ..
184
+ "You are cleared to start and wait your AIC for scramble information\n\n\n" ..
185
+ "If you're not on alert, please monitor the ground frequency" ..
186
+ " and let the scramble flight taxi in highest priority..."
187
+ msgTriggeredGround = string.format(
188
+ formatString,
189
+ objQRA.customconfig.name,
190
+ playerName,
191
+ objQRA.customconfig.type
192
+ )
193
+ formatString = "<WARNING> : QRA Training triggered by %s!\n" ..
194
+ "Stay away from the interception area (%s)\n" ..
195
+ "...\n" ..
196
+ "Keep monitoring your tactical frequency" ..
197
+ " for information about the Scramble procedure"
198
+ msgTriggeredOthers = string.format(formatString,
199
+ playerName,
200
+ type(playerClient) ~= 'nil' and playerCoord:ToStringMGRS() or ""
201
+ )
202
+ elseif (objQRA.customconfig.type == JTFF_QRA.Type.Alpha) then
203
+ local playerClient
204
+ local playerName
205
+ local playerCoord
206
+ if type(trigerringUnitName) == 'nil' then
207
+ playerName = "GameMaster"
208
+ playerClient = nil
209
+ playerCoord = COORDINATE.GetBullseyeCoordinate(objQRA.customconfig.benefit_coalition)
210
+ else
211
+ playerClient = CLIENT:FindByName(trigerringUnitName)
212
+ playerName = playerClient:GetPlayer()
213
+ playerCoord = playerClient:GetCoordinate()
214
+ end
215
+ local formatString = "QRA %s has been triggered by %s !\n" ..
216
+ "Type is : %s\n" ..
217
+ "If you're on Alert," ..
218
+ " you have 10 minutes to take-off and start intercepting the the bogey.\n" ..
219
+ "You are cleared to start and wait your AIC for scramble information\n\n\n" ..
220
+ "If you're not on alert, please monitor the ground frequency" ..
221
+ " and let the scramble flight taxi in highest priority..."
222
+ msgTriggeredGround = string.format(
223
+ formatString,
224
+ objQRA.customconfig.name,
225
+ playerName,
226
+ objQRA.customconfig.type
227
+ )
228
+ formatString = "<WARNING> : QRA Triggered by %s!\n" ..
229
+ "Stay away from the interception area (%s)\n" ..
230
+ "...\n" ..
231
+ "Keep monitoring your tactical frequency" ..
232
+ " for information about the Scramble procedure"
233
+ msgTriggeredOthers = string.format(formatString,
234
+ playerName,
235
+ type(playerClient) ~= 'nil' and playerCoord:ToStringMGRS() or ""
236
+ )
237
+ else
238
+ end
239
+ objQRA.clientSet:ForEachClient(
240
+ function(clientObject)
241
+ if ClientIsOnGround(clientObject) then
242
+ playQRASoundToClient(clientObject)
243
+ timer.scheduleFunction(
244
+ playQRASoundToClient,
245
+ clientObject,
246
+ timer.getTime() + 17
247
+ )
248
+ MESSAGE:New(msgTriggeredGround,60):ToClient(clientObject)
249
+ end
250
+ end
251
+ )
252
+ MESSAGE:New(msgTriggeredOthers,30):ToCoalition(objQRA.customconfig.benefit_coalition)
253
+ QRAArray[QRAIndex].menu_finex[QRAArray[QRAIndex].customconfig.benefit_coalition] = MENU_COALITION_COMMAND:New(
254
+ QRAArray[QRAIndex].customconfig.benefit_coalition,
255
+ "FinEx - " .. QRAArray[QRAIndex].customconfig.name .. " !!",
256
+ MenuCoalitionQRA[QRAArray[QRAIndex].customconfig.benefit_coalition],
257
+ QRAFinex,
258
+ QRAIndex
259
+ )
260
+ end
261
+
262
+ function QRAFinex(objQRAIndex)
263
+ local objQRA = QRAArray[objQRAIndex]
264
+ if objQRA.customconfig.type == JTFF_QRA.Type.TangoAuto then
265
+ jtff_log.trace(string.format("objQRA.objSpawn is %s", net.lua2json(objQRA.objSpawn)),"QRA")
266
+ local GroupPlane, Index = objQRA.objSpawn:GetFirstAliveGroup()
267
+ while GroupPlane ~= nil do
268
+ GroupPlane:ScheduleStop()
269
+ GroupPlane:Destroy(true,0)
270
+ GroupPlane, Index = objQRA.objSpawn:GetNextAliveGroup( Index )
271
+ end
272
+ collectgarbage()
273
+ end
274
+ QRAArray[objQRAIndex].menu_finex[QRAArray[objQRAIndex].customconfig.benefit_coalition]:Remove()
275
+ QRAArray[objQRAIndex].menu_finex[QRAArray[objQRAIndex].customconfig.benefit_coalition] = nil
276
+ end
277
+
278
+
279
+
280
+ JTFF_LOGLEVEL = 'debug'
281
+
282
+ -- *****************************************************************************
283
+ -- ** QRA **
284
+ -- *********************************************************
285
+ QRAArray = {}
286
+ compteur = 0
287
+ MenuCoalitionQRA = {}
288
+ MenuCoalitionQRA[coalition.side.BLUE] = MENU_COALITION:New(coalition.side.BLUE, "QRA", MenuCoalitionBlue)
289
+ MenuCoalitionQRA[coalition.side.RED] = MENU_COALITION:New(coalition.side.RED, "QRA", MenuCoalitionRed)
290
+ for index, qraconfig in ipairs(QRAConfig) do
291
+ if qraconfig.enable == true then
292
+ compteur = compteur + 1
293
+ jtff_log.info('creation QRA : '.. qraconfig.name..'...',"QRA")
294
+ local objQRA = {
295
+ customconfig = {},
296
+ clientSet = nil,
297
+ objSpawn = nil,
298
+ objBogeyGroup = nil,
299
+ menu = {},
300
+ menu_finex = {},
301
+ }
302
+ if ( qraconfig.type == JTFF_QRA.Type.TangoAuto) then
303
+ objQRA.objSpawn = SPAWN:New(qraconfig.templates[1])
304
+ :InitSkill(qraconfig.skill)
305
+ :InitRandomizeTemplate(qraconfig.templates or {})
306
+ end
307
+ objQRA.clientSet = SET_CLIENT:New()
308
+ :FilterCoalitions(string.lower(UTILS.GetCoalitionName(qraconfig.benefit_coalition)))
309
+ :FilterCategories("plane")
310
+ :FilterActive(true)
311
+ :FilterFunction(ClientIsOnGround)
312
+ :FilterStart()
313
+ objQRA.clientSet:HandleEvent(EVENTS.PlayerEnterAircraft)
314
+ jtff_log.debug(string.format("Nbr Clients getting QRA Calls : %i", objQRA.clientSet:Count()),"QRA")
315
+
316
+ function objQRA.clientSet:OnEventPlayerEnterAircraft(EventData)
317
+ local clientObject = CLIENT:Find(EventData.IniUnit:GetDCSObject())
318
+ if ClientIsOnGround(clientObject) then
319
+ --self:Add(clientObject:GetPlayer(), clientObject)
320
+ jtff_log.debug(string.format("Added %s to QRA receivers", clientObject:GetPlayer() or ""),"QRA")
321
+ jtff_log.debug(string.format("Nbr Clients getting QRA Calls : %i", objQRA.clientSet:Count()),"QRA")
322
+ end
323
+ end
324
+
325
+ if ( qraconfig.type ~= JTFF_QRA.Type.TangoAuto) then
326
+ objQRA.menu[qraconfig.benefit_coalition] = MENU_COALITION_COMMAND:New(
327
+ qraconfig.benefit_coalition,
328
+ "Trigger " .. qraconfig.name,
329
+ MenuCoalitionQRA[qraconfig.benefit_coalition],
330
+ QRATrigger,
331
+ {
332
+ objQRA,
333
+ nil,
334
+ index,
335
+ }
336
+ )
337
+ end
338
+
339
+ objQRA.customconfig = qraconfig
340
+
341
+ QRAArray[compteur] = objQRA
342
+ end
343
+ end
344
+
345
+ if compteur == 0 then
346
+ MenuCoalitionQRA[coalition.side.BLUE]:Remove()
347
+ MenuCoalitionQRA[coalition.side.RED]:Remove()
348
+ MenuCoalitionQRA = {}
349
+ end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "3.5.8",
3
+ "version": "3.6.0",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -399,7 +399,7 @@ async function doInject(ciObject, sourceMizFileName, workspacePath,destinationMi
399
399
  scriptsArray.push({
400
400
  folder: 'src',
401
401
  scriptTitle: 'Air To Air',
402
- scripts: ['170-cap_zone_training.lua', '172-cap_zone_war.lua', '173-fox_zone_training.lua', '176-random_air_traffic.lua', '178-training-intercept.lua'],
402
+ scripts: ['170-cap_zone_training.lua', '172-cap_zone_war.lua', '173-fox_zone_training.lua', '174-qra-scenario.lua', '176-random_air_traffic.lua', '178-training-intercept.lua'],
403
403
  timing: 27,
404
404
  color: '0xff0000ff',
405
405
  fromLibrary: true