@jtff/miztemplate-lib 3.10.14 → 4.0.1
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.
- package/lua/lib/HoundElint.lua +11378 -11415
- package/lua/lib/Moose_.lua +35746 -44020
- package/lua/src/010-root_menus.lua +4 -3
- package/lua/src/020-mission_functions.lua +905 -217
- package/lua/src/110-set_clients.lua +53 -43
- package/lua/src/115-airbases.lua +191 -0
- package/lua/src/120-tankers.lua +590 -461
- package/lua/src/130-airboss.lua +1982 -440
- package/lua/src/150-awacs.lua +551 -445
- package/lua/src/160-atis.lua +136 -73
- package/lua/src/170-cap_zone_training.lua +176 -73
- package/lua/src/172-cap_zone_war.lua +383 -226
- package/lua/src/173-fox_zone_training.lua +142 -67
- package/lua/src/174-qra-scenario.lua +417 -362
- package/lua/src/176-random_air_traffic.lua +101 -12
- package/lua/src/178-training-intercept.lua +312 -261
- package/lua/src/180-logistics.lua +2 -2
- package/lua/src/190-ranges.lua +104 -37
- package/lua/src/191-sams.lua +4 -4
- package/lua/src/193-training_ranges.lua +2 -2
- package/lua/src/195-reaper-ondemand.lua +29 -29
- package/lua/src/196-fac_ranges.lua +2 -2
- package/lua/src/197-elint-ondemand.lua +53 -53
- package/lua/src/199-skynet.lua +55 -55
- package/package.json +1 -1
- package/scripts/inject-scripts.js +3 -31
- package/lua/src/135-pedro.lua +0 -21
- package/lua/src/140-beacons.lua +0 -19
|
@@ -1,273 +1,324 @@
|
|
|
1
|
-
--
|
|
2
|
-
-- ** Interception Training **
|
|
3
|
-
-- *********************************************************
|
|
4
|
-
function clearIntercept(param)
|
|
5
|
-
local objInterceptIndex = param[1]
|
|
6
|
-
local objIntercept = InterceptArray[objInterceptIndex]
|
|
7
|
-
jtff_log.debug(string.format("objIntercept.objSpawn is %s", net.lua2json(objIntercept.objSpawn)),"INTERCEPT")
|
|
8
|
-
local GroupPlane, Index = objIntercept.objSpawn:GetFirstAliveGroup()
|
|
9
|
-
while GroupPlane ~= nil do
|
|
10
|
-
GroupPlane:ScheduleStop()
|
|
11
|
-
GroupPlane:Destroy(true,0)
|
|
12
|
-
GroupPlane, Index = objIntercept.objSpawn:GetNextAliveGroup( Index )
|
|
13
|
-
end
|
|
14
|
-
collectgarbage()
|
|
15
|
-
end
|
|
1
|
+
-- region InterceptConfigFunctions
|
|
16
2
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
targetGroup:OptionECM_DetectedLockByRadar()
|
|
25
|
-
targetGroup:CommandEPLRS(true)
|
|
26
|
-
end
|
|
3
|
+
-- @type InterceptConfig
|
|
4
|
+
-- @field #string name Name of the intercept scenario.
|
|
5
|
+
-- @field #boolean enable Enable the intercept scenario.
|
|
6
|
+
-- @field #coalition.side benefitCoalition Benefit coalition.
|
|
7
|
+
-- @field #JTFF_INTERCEPT.Type type Type of intercept.
|
|
8
|
+
-- @field #string skill Skill of the intercept.
|
|
9
|
+
-- @field #string[] templates Templates of the intercept (string or table of strings).
|
|
27
10
|
|
|
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
|
-
|
|
11
|
+
--- Parse a RAT config Object.
|
|
12
|
+
-- @param #JsonObject config Config object to parse
|
|
13
|
+
-- @return #InterceptConfig interceptConfigJson Parsed INTERCEPT config object
|
|
14
|
+
function ParseInterceptConfigJson(config)
|
|
15
|
+
local json = require('Scripts/json')
|
|
16
|
+
local parser_name = "INTERCEPT"
|
|
17
|
+
-- **************************************************************************
|
|
18
|
+
-- enable
|
|
19
|
+
-- **************************************************************************
|
|
20
|
+
local interceptConfigJson = {}
|
|
21
|
+
if config.enable == true then
|
|
22
|
+
interceptConfigJson = config
|
|
23
|
+
else
|
|
24
|
+
interceptConfigJson = {
|
|
25
|
+
enable = false,
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
Jtff_log.debug(
|
|
29
|
+
string.format(
|
|
30
|
+
"parsed INTERCEPT config for %s, resulting config :\n%s",
|
|
31
|
+
config.name or "",
|
|
32
|
+
json:encode(
|
|
33
|
+
interceptConfigJson,
|
|
34
|
+
{ indent = true }
|
|
35
|
+
)
|
|
36
|
+
),
|
|
37
|
+
parser_name
|
|
38
|
+
)
|
|
39
|
+
return interceptConfigJson
|
|
56
40
|
end
|
|
57
41
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
--jtff_log.debug(string.format("interceptorUnitName is %s", net.lua2json(interceptorUnitName)),"INTERCEPT")
|
|
62
|
-
if ( objIntercept.bubbleInvaded == false ) then
|
|
63
|
-
jtff_log.trace(string.format("%s has not yet been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
|
|
64
|
-
--jtff_log.debug(string.format("interceptDetectionZone is %s", net.lua2json(interceptDetectionZone)),"INTERCEPT")
|
|
65
|
-
if (SET_CLIENT:New():FilterZones({objIntercept.interceptDetectionZone}):FilterOnce():CountAlive() > 0) then
|
|
66
|
-
objIntercept.bubbleInvaded = true
|
|
67
|
-
jtff_log.info(string.format("%s has been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
|
|
68
|
-
if (objIntercept.knowIsIntercepted == false) then
|
|
69
|
-
if (math.random(1,100) >= 75) then
|
|
70
|
-
local delay = math.random(15,120)
|
|
71
|
-
jtff_log.info(string.format("%s has detected it has been intercepted : he will react accordingly in %i seconds !", objIntercept.interceptTarget:GetName(), delay),"INTERCEPT")
|
|
72
|
-
objIntercept.knowIsIntercepted = true
|
|
73
|
-
if objIntercept.customconfig.type == 'fastbomber' then
|
|
74
|
-
SCHEDULER:New(
|
|
75
|
-
objIntercept.interceptTarget,
|
|
76
|
-
interceptDefendFastBomber,
|
|
77
|
-
{},
|
|
78
|
-
delay
|
|
79
|
-
)
|
|
80
|
-
elseif objIntercept.customconfig.type == 'fighter' then
|
|
81
|
-
SCHEDULER:New(
|
|
82
|
-
objIntercept.interceptTarget,
|
|
83
|
-
interceptDefendFicghter,
|
|
84
|
-
{},
|
|
85
|
-
delay
|
|
86
|
-
)
|
|
87
|
-
end
|
|
88
|
-
else
|
|
89
|
-
jtff_log.info(string.format("%s has not detected soon enough it has been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
42
|
+
-- endregion InterceptConfigFunctions
|
|
43
|
+
|
|
44
|
+
-- region InterceptFunctions
|
|
95
45
|
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
jtff_log.debug(string.format("fighterCoord is x=%d y=%d z=%d", fighterCoord.x, fighterCoord.y, fighterCoord.z),"INTERCEPT")
|
|
108
|
-
local fighterHeading = fighterUnit:GetHeading()
|
|
109
|
-
jtff_log.debug(string.format("fighterHeading is %i", fighterHeading),"INTERCEPT")
|
|
110
|
-
local fighterAltitude = fighterUnit:GetAltitude(false)
|
|
111
|
-
local deltaAltMax = nil
|
|
112
|
-
local targetGroup = nil
|
|
113
|
-
local targetRange = nil
|
|
114
|
-
local targetGroundSpeed = 450
|
|
115
|
-
local targetAngle = math.mod(minTA + math.random(0,maxTA-minTA),360)
|
|
116
|
-
if (math.abs(math.mod(targetAngle,180)) > 50) then
|
|
117
|
-
targetRange = 40
|
|
118
|
-
deltaAltMax = 7000
|
|
119
|
-
elseif (math.abs(math.mod(targetAngle,180)) > 20) then
|
|
120
|
-
targetRange = 60
|
|
121
|
-
deltaAltMax = 10000
|
|
122
|
-
else
|
|
123
|
-
targetRange = 90
|
|
124
|
-
deltaAltMax = 15000
|
|
46
|
+
function clearIntercept(param)
|
|
47
|
+
local objInterceptIndex = param[1]
|
|
48
|
+
local objIntercept = InterceptArray[objInterceptIndex]
|
|
49
|
+
Jtff_log.debug(string.format("objIntercept.objSpawn is %s", net.lua2json(objIntercept.objSpawn)),"INTERCEPT")
|
|
50
|
+
local GroupPlane, Index = objIntercept.objSpawn:GetFirstAliveGroup()
|
|
51
|
+
while GroupPlane ~= nil do
|
|
52
|
+
GroupPlane:ScheduleStop()
|
|
53
|
+
GroupPlane:Destroy(true,0)
|
|
54
|
+
GroupPlane, Index = objIntercept.objSpawn:GetNextAliveGroup( Index )
|
|
55
|
+
end
|
|
56
|
+
collectgarbage()
|
|
125
57
|
end
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
fighterCoord.y + UTILS.FeetToMeters(deltaAltMax)
|
|
137
|
-
),
|
|
138
|
-
UTILS.FeetToMeters(32000)
|
|
139
|
-
),
|
|
140
|
-
UTILS.FeetToMeters(8000)
|
|
141
|
-
),
|
|
142
|
-
z = fighterCoord.z + math.floor(UTILS.NMToMeters(targetRange) * math.sin(math.rad(fighterHeading))),
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
jtff_log.info(string.format("Spawning target based on %s with TargetAngle of %i degrees", targetSpawnObj.SpawnTemplatePrefix, targetAngle),"INTERCEPT")
|
|
146
|
-
targetGroup = targetSpawnObj:InitHeading(math.mod(fighterHeading + 180 + targetAngle,360)):SpawnFromVec3(targetCoord:GetVec3())
|
|
147
|
-
targetGroup:OptionROE(ENUMS.ROE.WeaponHold)
|
|
148
|
-
targetGroup:OptionROT(ENUMS.ROT.NoReaction)
|
|
149
|
-
targetGroup:OptionRTBBingoFuel(true)
|
|
150
|
-
targetGroup:OptionRestrictBurner(false)
|
|
151
|
-
targetGroup:EnableEmission(false)
|
|
152
|
-
targetGroup:OptionAlarmStateGreen()
|
|
153
|
-
targetGroup:OptionECM_Never()
|
|
154
|
-
targetGroup:CommandEPLRS(true)
|
|
155
|
-
InterceptArray[objInterceptIndex].interceptTarget = targetGroup
|
|
156
|
-
InterceptArray[objInterceptIndex].knowIsIntercepted = false
|
|
157
|
-
InterceptArray[objInterceptIndex].bubbleInvaded = false
|
|
158
|
-
local targetDetectionRange = 1.5
|
|
159
|
-
--targetDetectionRange = 70
|
|
160
|
-
InterceptArray[objInterceptIndex].interceptDetectionZone = ZONE_GROUP:New(
|
|
161
|
-
"intercept-" .. targetGroup:GetName(),
|
|
162
|
-
targetGroup,
|
|
163
|
-
UTILS.NMToMeters(targetDetectionRange)
|
|
164
|
-
)
|
|
165
|
-
InterceptArray[objInterceptIndex].interceptTarget:ScheduleRepeat(
|
|
166
|
-
0,
|
|
167
|
-
5,
|
|
168
|
-
nil,
|
|
169
|
-
nil,
|
|
170
|
-
interceptDetection,
|
|
171
|
-
{
|
|
172
|
-
InterceptArray[objInterceptIndex]
|
|
173
|
-
}
|
|
174
|
-
)
|
|
175
|
-
local targetDestinationCoord = targetGroup:GetCoordinate():Translate(
|
|
176
|
-
UTILS.NMToMeters(200),
|
|
177
|
-
math.mod(fighterHeading+180+ targetAngle,360),
|
|
178
|
-
true,
|
|
179
|
-
false
|
|
180
|
-
)
|
|
181
|
-
jtff_log.debug(string.format("targetDestinationCoord is %s", targetDestinationCoord:ToStringMGRS()),"INTERCEPT")
|
|
182
|
-
local targetDestinationAirbase = targetDestinationCoord:GetClosestAirbase(
|
|
183
|
-
targetGroup:GetCategory(),
|
|
184
|
-
targetGroup:GetCoalition()
|
|
185
|
-
)
|
|
186
|
-
if type(targetDestinationAirbase) == 'nil' then
|
|
187
|
-
targetDestinationAirbase = targetDestinationCoord:GetClosestAirbase(
|
|
188
|
-
targetGroup:GetCategory(),
|
|
189
|
-
coalition.side.NEUTRAL
|
|
190
|
-
)
|
|
191
|
-
jtff_log.info(string.format("no airbase in target coalition, choosing neutral coalition Airbase %s", targetDestinationAirbase:GetName()),"INTERCEPT")
|
|
58
|
+
|
|
59
|
+
function interceptDefendFicghter(targetGroup)
|
|
60
|
+
targetGroup:OptionROEWeaponFree()
|
|
61
|
+
targetGroup:OptionROTVertical()
|
|
62
|
+
targetGroup:OptionRTBBingoFuel(true)
|
|
63
|
+
targetGroup:OptionRestrictBurner(false)
|
|
64
|
+
targetGroup:EnableEmission(true)
|
|
65
|
+
targetGroup:OptionAlarmStateRed()
|
|
66
|
+
targetGroup:OptionECM_DetectedLockByRadar()
|
|
67
|
+
targetGroup:CommandEPLRS(true)
|
|
192
68
|
end
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
69
|
+
|
|
70
|
+
function interceptDefendFastBomber(targetGroup)
|
|
71
|
+
targetGroup:OptionRestrictBurner(false)
|
|
72
|
+
local targetDestinationCoord = targetGroup:GetCoordinate():Translate(
|
|
73
|
+
UTILS.NMToMeters(150),
|
|
74
|
+
targetGroup:GetHeading(),
|
|
75
|
+
true,
|
|
76
|
+
false
|
|
77
|
+
):SetAltitude(UTILS.FeetToMeters(55000), true)
|
|
78
|
+
targetGroup:Route(
|
|
79
|
+
{
|
|
80
|
+
targetDestinationCoord:WaypointAirTurningPoint(
|
|
81
|
+
COORDINATE.WaypointAltType.BARO,
|
|
82
|
+
UTILS.KnotsToKmph(5000),
|
|
83
|
+
nil,
|
|
84
|
+
"End interception"
|
|
85
|
+
),
|
|
86
|
+
targetDestinationCoord:GetClosestAirbase(
|
|
87
|
+
targetGroup:GetCategory(),
|
|
88
|
+
targetGroup:GetCoalition()
|
|
89
|
+
):GetCoordinate():WaypointAirLanding(
|
|
90
|
+
UTILS.KnotsToKmph(250),
|
|
91
|
+
targetDestinationCoord:GetClosestAirbase(
|
|
92
|
+
targetGroup:GetCategory(),
|
|
93
|
+
targetGroup:GetCoalition()
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
function interceptDetection(param)
|
|
101
|
+
local objIntercept = param[1]
|
|
102
|
+
Jtff_log.debug(string.format("objIntercept.interceptDetectionZone is %s", net.lua2json(objIntercept.interceptDetectionZone)),"INTERCEPT")
|
|
103
|
+
--Jtff_log.debug(string.format("interceptorUnitName is %s", net.lua2json(interceptorUnitName)),"INTERCEPT")
|
|
104
|
+
if ( objIntercept.bubbleInvaded == false ) then
|
|
105
|
+
Jtff_log.trace(string.format("%s has not yet been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
|
|
106
|
+
--Jtff_log.debug(string.format("interceptDetectionZone is %s", net.lua2json(interceptDetectionZone)),"INTERCEPT")
|
|
107
|
+
if (SET_CLIENT:New():FilterZones({objIntercept.interceptDetectionZone}):FilterOnce():CountAlive() > 0) then
|
|
108
|
+
objIntercept.bubbleInvaded = true
|
|
109
|
+
Jtff_log.info(string.format("%s has been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
|
|
110
|
+
if (objIntercept.knowIsIntercepted == false) then
|
|
111
|
+
if (math.random(1,100) >= 75) then
|
|
112
|
+
local delay = math.random(15,120)
|
|
113
|
+
Jtff_log.info(string.format("%s has detected it has been intercepted : he will react accordingly in %i seconds !", objIntercept.interceptTarget:GetName(), delay),"INTERCEPT")
|
|
114
|
+
objIntercept.knowIsIntercepted = true
|
|
115
|
+
if objIntercept.customconfig.type == 'fastbomber' then
|
|
116
|
+
SCHEDULER:New(
|
|
117
|
+
objIntercept.interceptTarget,
|
|
118
|
+
interceptDefendFastBomber,
|
|
119
|
+
{},
|
|
120
|
+
delay
|
|
121
|
+
)
|
|
122
|
+
elseif objIntercept.customconfig.type == 'fighter' then
|
|
123
|
+
SCHEDULER:New(
|
|
124
|
+
objIntercept.interceptTarget,
|
|
125
|
+
interceptDefendFicghter,
|
|
126
|
+
{},
|
|
127
|
+
delay
|
|
128
|
+
)
|
|
129
|
+
end
|
|
130
|
+
else
|
|
131
|
+
Jtff_log.info(string.format("%s has not detected soon enough it has been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
function StartInterceptTraining(param)
|
|
139
|
+
local fighterUnitName = param[1]
|
|
140
|
+
local objInterceptIndex = param[2]
|
|
141
|
+
Jtff_log.debug(string.format("fighterUnitName is %s", fighterUnitName),"INTERCEPT")
|
|
142
|
+
Jtff_log.debug(string.format("objInterceptIndex is %i", objInterceptIndex),"INTERCEPT")
|
|
143
|
+
local minTA = param[3]
|
|
144
|
+
local maxTA = param[4]
|
|
145
|
+
local fighterUnit = UNIT:FindByName(fighterUnitName)
|
|
146
|
+
Jtff_log.debug(string.format("fighterUnit is %s", net.lua2json(fighterUnit)),"INTERCEPT")
|
|
147
|
+
local fighterGroup = fighterUnit:GetGroup()
|
|
148
|
+
local fighterCoord = fighterUnit:GetCoordinate()
|
|
149
|
+
Jtff_log.debug(string.format("fighterCoord is x=%d y=%d z=%d", fighterCoord.x, fighterCoord.y, fighterCoord.z),"INTERCEPT")
|
|
150
|
+
local fighterHeading = fighterUnit:GetHeading()
|
|
151
|
+
Jtff_log.debug(string.format("fighterHeading is %i", fighterHeading),"INTERCEPT")
|
|
152
|
+
local fighterAltitude = fighterUnit:GetAltitude(false)
|
|
153
|
+
local deltaAltMax = nil
|
|
154
|
+
local targetGroup = nil
|
|
155
|
+
local targetRange = nil
|
|
156
|
+
local targetGroundSpeed = 450
|
|
157
|
+
local targetAngle = math.mod(minTA + math.random(0,maxTA-minTA),360)
|
|
158
|
+
if (math.abs(math.mod(targetAngle,180)) > 50) then
|
|
159
|
+
targetRange = 40
|
|
160
|
+
deltaAltMax = 7000
|
|
161
|
+
elseif (math.abs(math.mod(targetAngle,180)) > 20) then
|
|
162
|
+
targetRange = 60
|
|
163
|
+
deltaAltMax = 10000
|
|
164
|
+
else
|
|
165
|
+
targetRange = 90
|
|
166
|
+
deltaAltMax = 15000
|
|
167
|
+
end
|
|
168
|
+
Jtff_log.info(string.format("Launching exercise TargetAngle %i degrees", targetAngle),"INTERCEPT")
|
|
169
|
+
Jtff_log.debug(string.format("Index is : %i", objInterceptIndex),"INTERCEPT")
|
|
170
|
+
local targetSpawnObj = InterceptArray[objInterceptIndex].objSpawn
|
|
171
|
+
local targetCoord = COORDINATE:NewFromVec3(
|
|
172
|
+
{
|
|
173
|
+
x = fighterCoord.x + math.floor(UTILS.NMToMeters(targetRange) * math.cos(math.rad(fighterHeading))),
|
|
174
|
+
y = math.max(
|
|
175
|
+
math.min(
|
|
176
|
+
math.random(
|
|
177
|
+
fighterCoord.y - UTILS.FeetToMeters(deltaAltMax),
|
|
178
|
+
fighterCoord.y + UTILS.FeetToMeters(deltaAltMax)
|
|
179
|
+
),
|
|
180
|
+
UTILS.FeetToMeters(32000)
|
|
181
|
+
),
|
|
182
|
+
UTILS.FeetToMeters(8000)
|
|
183
|
+
),
|
|
184
|
+
z = fighterCoord.z + math.floor(UTILS.NMToMeters(targetRange) * math.sin(math.rad(fighterHeading))),
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
Jtff_log.info(string.format("Spawning target based on %s with TargetAngle of %i degrees", targetSpawnObj.SpawnTemplatePrefix, targetAngle),"INTERCEPT")
|
|
188
|
+
targetGroup = targetSpawnObj:InitHeading(math.mod(fighterHeading + 180 + targetAngle,360)):SpawnFromVec3(targetCoord:GetVec3())
|
|
189
|
+
targetGroup:OptionROE(ENUMS.ROE.WeaponHold)
|
|
190
|
+
targetGroup:OptionROT(ENUMS.ROT.NoReaction)
|
|
191
|
+
targetGroup:OptionRTBBingoFuel(true)
|
|
192
|
+
targetGroup:OptionRestrictBurner(false)
|
|
193
|
+
targetGroup:EnableEmission(false)
|
|
194
|
+
targetGroup:OptionAlarmStateGreen()
|
|
195
|
+
targetGroup:OptionECM_Never()
|
|
196
|
+
targetGroup:CommandEPLRS(true)
|
|
197
|
+
InterceptArray[objInterceptIndex].interceptTarget = targetGroup
|
|
198
|
+
InterceptArray[objInterceptIndex].knowIsIntercepted = false
|
|
199
|
+
InterceptArray[objInterceptIndex].bubbleInvaded = false
|
|
200
|
+
local targetDetectionRange = 1.5
|
|
201
|
+
--targetDetectionRange = 70
|
|
202
|
+
InterceptArray[objInterceptIndex].interceptDetectionZone = ZONE_GROUP:New(
|
|
203
|
+
"intercept-" .. targetGroup:GetName(),
|
|
204
|
+
targetGroup,
|
|
205
|
+
UTILS.NMToMeters(targetDetectionRange)
|
|
206
|
+
)
|
|
207
|
+
InterceptArray[objInterceptIndex].interceptTarget:ScheduleRepeat(
|
|
208
|
+
0,
|
|
209
|
+
5,
|
|
210
|
+
nil,
|
|
211
|
+
nil,
|
|
212
|
+
interceptDetection,
|
|
213
|
+
{
|
|
214
|
+
InterceptArray[objInterceptIndex]
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
local targetDestinationCoord = targetGroup:GetCoordinate():Translate(
|
|
218
|
+
UTILS.NMToMeters(200),
|
|
219
|
+
math.mod(fighterHeading+180+ targetAngle,360),
|
|
220
|
+
true,
|
|
221
|
+
false
|
|
222
|
+
)
|
|
223
|
+
Jtff_log.debug(string.format("targetDestinationCoord is %s", targetDestinationCoord:ToStringMGRS()),"INTERCEPT")
|
|
224
|
+
local targetDestinationAirbase = targetDestinationCoord:GetClosestAirbase(
|
|
225
|
+
targetGroup:GetCategory(),
|
|
226
|
+
targetGroup:GetCoalition()
|
|
227
|
+
)
|
|
228
|
+
if type(targetDestinationAirbase) == 'nil' then
|
|
229
|
+
targetDestinationAirbase = targetDestinationCoord:GetClosestAirbase(
|
|
230
|
+
targetGroup:GetCategory(),
|
|
231
|
+
coalition.side.NEUTRAL
|
|
232
|
+
)
|
|
233
|
+
Jtff_log.info(string.format("no airbase in target coalition, choosing neutral coalition Airbase %s", targetDestinationAirbase:GetName()),"INTERCEPT")
|
|
234
|
+
end
|
|
235
|
+
Jtff_log.debug(string.format("targetDestinationAirbase is %s", targetDestinationAirbase:GetName()),"INTERCEPT")
|
|
236
|
+
local targetRoute = {}
|
|
237
|
+
targetRoute[1] = targetDestinationCoord:WaypointAirTurningPoint(
|
|
238
|
+
COORDINATE.WaypointAltType.BARO,
|
|
239
|
+
UTILS.KnotsToKmph(targetGroundSpeed),
|
|
240
|
+
nil,
|
|
241
|
+
"End interception"
|
|
242
|
+
)
|
|
243
|
+
targetRoute[2] = targetDestinationAirbase:GetCoordinate():WaypointAirLanding(
|
|
244
|
+
UTILS.KnotsToKmph(targetGroundSpeed),
|
|
245
|
+
targetDestinationAirbase
|
|
246
|
+
)
|
|
247
|
+
targetGroup:Route(targetRoute)
|
|
248
|
+
return targetGroup
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
-- endregion InterceptFunctions
|
|
252
|
+
|
|
253
|
+
-- *****************************************************************************
|
|
254
|
+
-- ** Interception Training **
|
|
255
|
+
-- *********************************************************
|
|
256
|
+
|
|
208
257
|
|
|
209
258
|
InterceptArray = {}
|
|
210
|
-
compteur =
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
for
|
|
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
|
-
|
|
259
|
+
local compteur = #InterceptArray
|
|
260
|
+
|
|
261
|
+
MenuCoalitionIntercept = {}
|
|
262
|
+
for _k, _coalition in pairs(coalition.side) do
|
|
263
|
+
MenuCoalitionIntercept[UTILS.GetCoalitionName(_coalition)] = MENU_COALITION:New(_coalition, "Intercept Training", MenuCoalition[UTILS.GetCoalitionName(_coalition)])
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
for index, currentInterceptConfigObject in ipairs(InterceptConfig) do
|
|
267
|
+
local intconfig = ParseInterceptConfigJson(currentInterceptConfigObject)
|
|
268
|
+
if intconfig.enable == true then
|
|
269
|
+
Jtff_log.info(
|
|
270
|
+
string.format(
|
|
271
|
+
"Enable %s with %s behavior",
|
|
272
|
+
intconfig.name,
|
|
273
|
+
intconfig.type
|
|
274
|
+
),
|
|
275
|
+
"INTERCEPT"
|
|
276
|
+
)
|
|
277
|
+
compteur = compteur +1
|
|
278
|
+
local objIntercept = {
|
|
279
|
+
customconfig = {},
|
|
280
|
+
objSpawn = nil,
|
|
281
|
+
menus = {},
|
|
282
|
+
menu_finex = {},
|
|
283
|
+
knowIsIntercepted = false,
|
|
284
|
+
bubbleInvaded = false,
|
|
285
|
+
}
|
|
286
|
+
objIntercept.objSpawn = SPAWN:New(intconfig.templates[1])
|
|
287
|
+
:InitSkill(intconfig.skill)
|
|
288
|
+
:InitRandomizeTemplatePrefixes(intconfig.templates)
|
|
289
|
+
if (intconfig.type == JTFF_INTERCEPT.Type.Civilian) then
|
|
290
|
+
for _k, _coalition in pairs(coalition.side) do
|
|
291
|
+
objIntercept.menus[_coalition] = MENU_COALITION:New(_coalition, intconfig.name, MenuCoalitionIntercept[UTILS.GetCoalitionName(_coalition)])
|
|
292
|
+
objIntercept.menu_finex[_coalition] = MENU_COALITION_COMMAND:New(
|
|
293
|
+
_coalition,
|
|
294
|
+
"Knock it off, FinEx !!",
|
|
295
|
+
objIntercept.menus[_coalition],
|
|
296
|
+
clearIntercept,
|
|
297
|
+
{
|
|
298
|
+
compteur
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
end
|
|
302
|
+
else
|
|
303
|
+
objIntercept.menus[intconfig.benefitCoalition] = MENU_COALITION:New(intconfig.benefitCoalition, intconfig.name, MenuCoalitionIntercept[UTILS.GetCoalitionName(intconfig.benefitCoalition)])
|
|
304
|
+
objIntercept.menu_finex[intconfig.benefitCoalition] = MENU_COALITION_COMMAND:New(
|
|
305
|
+
intconfig.benefitCoalition,
|
|
306
|
+
"Knock it off, FinEx !!",
|
|
307
|
+
objIntercept.menus[intconfig.benefitCoalition],
|
|
308
|
+
clearIntercept,
|
|
309
|
+
{
|
|
310
|
+
compteur
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
end
|
|
314
|
+
objIntercept.customconfig = intconfig
|
|
315
|
+
InterceptArray[compteur] = objIntercept
|
|
316
|
+
end
|
|
268
317
|
end
|
|
269
318
|
|
|
270
|
-
if
|
|
271
|
-
|
|
272
|
-
|
|
319
|
+
if #InterceptArray == 0 then
|
|
320
|
+
for _k, _coalition in pairs(coalition.side) do
|
|
321
|
+
MenuCoalitionIntercept[UTILS.GetCoalitionName(_coalition)]:Remove()
|
|
322
|
+
end
|
|
323
|
+
MenuCoalitionIntercept = {}
|
|
273
324
|
end
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
CTLDArray = {}
|
|
6
6
|
compteur = 0
|
|
7
|
-
mainRadioMenuForLogisticsBlue = MENU_COALITION:New( coalition.side.BLUE , "Logistics",
|
|
8
|
-
mainRadioMenuForLogisticsRed = MENU_COALITION:New( coalition.side.RED , "Logistics",
|
|
7
|
+
mainRadioMenuForLogisticsBlue = MENU_COALITION:New( coalition.side.BLUE , "Logistics", MenuCoalition[coalition.side.BLUE] )
|
|
8
|
+
mainRadioMenuForLogisticsRed = MENU_COALITION:New( coalition.side.RED , "Logistics", MenuCoalition[coalition.side.RED] )
|
|
9
9
|
for index, ctldconfig in ipairs(CTLDConfig) do
|
|
10
10
|
if ctldconfig.enable == true then
|
|
11
11
|
compteur = compteur + 1
|