@jtff/miztemplate-lib 3.4.20 → 3.5.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,113 @@
|
|
|
1
|
+
elintConfig = {
|
|
2
|
+
startupPlatformUnitNames = {},
|
|
3
|
+
onDemandPlatforms = {
|
|
4
|
+
{
|
|
5
|
+
type = "pr1",
|
|
6
|
+
enabled = true,
|
|
7
|
+
groupName = 'Prowler-1',
|
|
8
|
+
baseUnit = 'CSG-1 CVN-71-1',
|
|
9
|
+
terminalType = AIRBASE.TerminalType.OpenMedOrBig,
|
|
10
|
+
coalition = coalition.side.BLUE,
|
|
11
|
+
missionmaxduration = 240,
|
|
12
|
+
altitude = 28000,
|
|
13
|
+
speed = 400,
|
|
14
|
+
freq = 265.8,
|
|
15
|
+
fuelwarninglevel = 25,
|
|
16
|
+
modex = 11,
|
|
17
|
+
orbit = {
|
|
18
|
+
heading = 135,
|
|
19
|
+
length = 40,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type = "pr2",
|
|
24
|
+
enabled = true,
|
|
25
|
+
groupName = 'Growler-1',
|
|
26
|
+
baseUnit = 'CSG-1 CVN-71-1',
|
|
27
|
+
terminalType = AIRBASE.TerminalType.OpenMedOrBig,
|
|
28
|
+
coalition = coalition.side.BLUE,
|
|
29
|
+
missionmaxduration = 240,
|
|
30
|
+
altitude = 28000,
|
|
31
|
+
speed = 400,
|
|
32
|
+
freq = 265.8,
|
|
33
|
+
fuelwarninglevel = 25,
|
|
34
|
+
modex = 12,
|
|
35
|
+
orbit = {
|
|
36
|
+
heading = 45,
|
|
37
|
+
length = 40,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type = "pr3",
|
|
42
|
+
enabled = true,
|
|
43
|
+
groupName = 'Prowler-1',
|
|
44
|
+
baseUnit = AIRBASE.Caucasus.Kutaisi,
|
|
45
|
+
terminalType = AIRBASE.TerminalType.OpenMedOrBig,
|
|
46
|
+
coalition = coalition.side.BLUE,
|
|
47
|
+
missionmaxduration = 240,
|
|
48
|
+
altitude = 28000,
|
|
49
|
+
speed = 400,
|
|
50
|
+
freq = 265.8,
|
|
51
|
+
fuelwarninglevel = 25,
|
|
52
|
+
modex = 13,
|
|
53
|
+
orbit = {
|
|
54
|
+
heading = 90,
|
|
55
|
+
length = 40,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type = "pr4",
|
|
60
|
+
enabled = true,
|
|
61
|
+
groupName = 'Growler-1',
|
|
62
|
+
baseUnit = AIRBASE.Caucasus.Kutaisi,
|
|
63
|
+
terminalType = AIRBASE.TerminalType.OpenMedOrBig,
|
|
64
|
+
coalition = coalition.side.BLUE,
|
|
65
|
+
missionmaxduration = 240,
|
|
66
|
+
altitude = 28000,
|
|
67
|
+
speed = 400,
|
|
68
|
+
freq = 265.8,
|
|
69
|
+
fuelwarninglevel = 25,
|
|
70
|
+
modex = 14,
|
|
71
|
+
orbit = {
|
|
72
|
+
heading = 0,
|
|
73
|
+
length = 40,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
networks = {
|
|
78
|
+
{
|
|
79
|
+
enabled = true,
|
|
80
|
+
debug = false,
|
|
81
|
+
coalition = coalition.side.BLUE,
|
|
82
|
+
enableMarkers = true,
|
|
83
|
+
useSRS = true,
|
|
84
|
+
enableBDA = true,
|
|
85
|
+
reportEWR = true,
|
|
86
|
+
enableAlerts = true,
|
|
87
|
+
intervals = {},
|
|
88
|
+
controller = {
|
|
89
|
+
groupName = 'ELint-Controller-1',
|
|
90
|
+
baseUnit = AIRBASE.Caucasus.Kutaisi,
|
|
91
|
+
terminalType = AIRBASE.TerminalType.OpenMedOrBig,
|
|
92
|
+
takeOffType = SPAWN.Takeoff.Hot,
|
|
93
|
+
missionmaxduration = 180,
|
|
94
|
+
altitude = 28000,
|
|
95
|
+
speed = 350,
|
|
96
|
+
freq = 265.800,
|
|
97
|
+
controller_freq = 270.350,
|
|
98
|
+
atis_freq = 270.250,
|
|
99
|
+
notify_freq = 261.000,
|
|
100
|
+
fuelwarninglevel = 25,
|
|
101
|
+
modex = 11,
|
|
102
|
+
orbit = {
|
|
103
|
+
heading = 90,
|
|
104
|
+
length = 5,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
enabled = false,
|
|
110
|
+
coalition = coalition.side.RED,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
}
|
|
@@ -3,3 +3,4 @@
|
|
|
3
3
|
-- *********************************************************
|
|
4
4
|
MenuCoalitionBlue = MENU_COALITION:New(coalition.side.BLUE, "My Coalition resources")
|
|
5
5
|
MenuCoalitionRed = MENU_COALITION:New(coalition.side.RED, "My Coalition resources")
|
|
6
|
+
MenuCoalitionNeutral = MENU_COALITION:New(coalition.side.NEUTRAL, "My Coalition resources")
|
|
@@ -22,6 +22,18 @@ for i, v in ipairs(log_modes) do
|
|
|
22
22
|
end
|
|
23
23
|
JTFF_LOGLEVEL = 'info'
|
|
24
24
|
|
|
25
|
+
jtff_log = {}
|
|
26
|
+
for index, mode in ipairs(log_modes) do
|
|
27
|
+
local nameupper = mode.name:upper()
|
|
28
|
+
jtff_log[mode.name] = function(message, category)
|
|
29
|
+
-- Return early if we're below the log level
|
|
30
|
+
if index < log_levels[JTFF_LOGLEVEL] then
|
|
31
|
+
return
|
|
32
|
+
end
|
|
33
|
+
env.info(string.format("[JTFF-%s]--%s-- %s", mode.name, category, message))
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
25
37
|
use_jtff_sound_mod = false
|
|
26
38
|
|
|
27
39
|
if (not(FunkmanConfig)) then
|
|
@@ -46,9 +58,6 @@ spawnStandardDelay = 15
|
|
|
46
58
|
sead = SEAD:New({})
|
|
47
59
|
map_marker = {}
|
|
48
60
|
|
|
49
|
-
HoundBlue = HoundElint:create(coalition.side.BLUE)
|
|
50
|
-
HoundRed = HoundElint:create(coalition.side.RED)
|
|
51
|
-
|
|
52
61
|
AAMAxRange = {
|
|
53
62
|
MAX_RANGE = 0,
|
|
54
63
|
NEZ_RANGE = 1,
|
|
@@ -57,18 +66,6 @@ AAMAxRange = {
|
|
|
57
66
|
RANDOM_RANGE = 4,
|
|
58
67
|
}
|
|
59
68
|
|
|
60
|
-
jtff_log = {}
|
|
61
|
-
for index, mode in ipairs(log_modes) do
|
|
62
|
-
local nameupper = mode.name:upper()
|
|
63
|
-
jtff_log[mode.name] = function(message, category)
|
|
64
|
-
-- Return early if we're below the log level
|
|
65
|
-
if index < log_levels[JTFF_LOGLEVEL] then
|
|
66
|
-
return
|
|
67
|
-
end
|
|
68
|
-
env.info(string.format("[JTFF-%s]--%s-- %s", mode.name, category, message))
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
69
|
function switchGroupImmortalStatus(group)
|
|
73
70
|
status = not BASE:GetState(group, "isImmortal")
|
|
74
71
|
jtff_log.info(string.format("switch group %s to immortal status %s", group:GetName(), tostring(status)), "GENERAL")
|
|
@@ -0,0 +1,1132 @@
|
|
|
1
|
+
-- *****************************************************************************
|
|
2
|
+
-- ** OnDemand ELint **
|
|
3
|
+
-- *********************************************************
|
|
4
|
+
|
|
5
|
+
function triggerOnDemandElintPlatform(type, askedDuration, askedFL, askedSpeed, askedAnchorCoord, askedOrbitHeading, askedOrbitLeg)
|
|
6
|
+
local elintPlatformGroup = nil
|
|
7
|
+
if (elintConfig) then
|
|
8
|
+
for index, onDemandPlatformConfig in ipairs(elintConfig.onDemandPlatforms) do
|
|
9
|
+
if ((onDemandPlatformConfig.type == type) and (onDemandPlatformConfig.enabled)) then
|
|
10
|
+
jtff_log.debug(string.format('Found type %s ELINT : %s Group!', type, onDemandPlatformConfig.groupName),"ELINT")
|
|
11
|
+
if (askedSpeed and askedSpeed > 0) then
|
|
12
|
+
onDemandPlatformConfig.speed = askedSpeed
|
|
13
|
+
end
|
|
14
|
+
if (askedFL and askedFL > 0) then
|
|
15
|
+
onDemandPlatformConfig.altitude = askedFL * 100
|
|
16
|
+
end
|
|
17
|
+
if ( askedDuration == nil or askedDuration == 0 ) then
|
|
18
|
+
askedDuration = 480
|
|
19
|
+
end
|
|
20
|
+
if (askedOrbitHeading) then
|
|
21
|
+
if (askedOrbitLeg and askedOrbitLeg > 10) then
|
|
22
|
+
--heading et Leg demandés
|
|
23
|
+
onDemandPlatformConfig.orbit = {
|
|
24
|
+
heading = askedOrbitHeading % 360,
|
|
25
|
+
length = askedOrbitLeg,
|
|
26
|
+
}
|
|
27
|
+
else
|
|
28
|
+
--heading demandé et leg non demandé
|
|
29
|
+
if (onDemandPlatformConfig.orbit ) then
|
|
30
|
+
if (not(onDemandPlatformConfig.orbit.length)) then
|
|
31
|
+
onDemandPlatformConfig.orbit = {
|
|
32
|
+
heading = askedOrbitHeading % 360,
|
|
33
|
+
length = 30,
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
onDemandPlatformConfig.orbit = {
|
|
37
|
+
heading = askedOrbitHeading % 360,
|
|
38
|
+
length = math.max(5, onDemandPlatformConfig.orbit.length),
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
else
|
|
42
|
+
onDemandPlatformConfig.orbit = {
|
|
43
|
+
heading = askedOrbitHeading % 360,
|
|
44
|
+
length = 30,
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
else
|
|
49
|
+
--pas de heading demandé
|
|
50
|
+
if (onDemandPlatformConfig.orbit ) then
|
|
51
|
+
if (not(onDemandPlatformConfig.orbit.heading)) then
|
|
52
|
+
onDemandPlatformConfig.orbit.heading = 90
|
|
53
|
+
end
|
|
54
|
+
if (not(onDemandPlatformConfig.orbit.length)) then
|
|
55
|
+
onDemandPlatformConfig.orbit.length = 30
|
|
56
|
+
else
|
|
57
|
+
onDemandPlatformConfig.orbit.length = math.max(5, onDemandPlatformConfig.orbit.length)
|
|
58
|
+
end
|
|
59
|
+
else
|
|
60
|
+
onDemandPlatformConfig.orbit = {
|
|
61
|
+
heading = 90,
|
|
62
|
+
length = 30,
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
local set_group_elint = SET_GROUP:New()
|
|
67
|
+
:FilterActive()
|
|
68
|
+
:FilterPrefixes(onDemandPlatformConfig.groupName)
|
|
69
|
+
:FilterCategories("plane")
|
|
70
|
+
:FilterOnce()
|
|
71
|
+
local aliveELINTGroupList = set_group_elint:GetSetObjects()
|
|
72
|
+
|
|
73
|
+
local is_elint_spawned = false
|
|
74
|
+
jtff_log.debug(string.format('Looking for a Group corresponding to template %s', string.format("%s-%s", onDemandPlatformConfig.groupName, onDemandPlatformConfig.type)),"ELINT")
|
|
75
|
+
for index, current_group in ipairs(aliveELINTGroupList) do
|
|
76
|
+
if (
|
|
77
|
+
(not(is_elint_spawned)) and
|
|
78
|
+
(string.find(
|
|
79
|
+
current_group.GroupName,
|
|
80
|
+
string.format("%s-%s", onDemandPlatformConfig.groupName, onDemandPlatformConfig.type),
|
|
81
|
+
1,
|
|
82
|
+
true
|
|
83
|
+
) ~= nil)
|
|
84
|
+
) then
|
|
85
|
+
jtff_log.info(string.format('Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", onDemandPlatformConfig.groupName, onDemandPlatformConfig.type)),"ELINT")
|
|
86
|
+
is_elint_spawned = true
|
|
87
|
+
elintPlatformGroup = current_group
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
local RTBAirbase = nil
|
|
92
|
+
local elintRoute = {}
|
|
93
|
+
if (onDemandPlatformConfig.baseUnit) then
|
|
94
|
+
RTBAirbase = AIRBASE:FindByName(onDemandPlatformConfig.baseUnit)
|
|
95
|
+
else
|
|
96
|
+
RTBAirbase = askedAnchorCoord:GetClosestAirbase2(Airbase.Category.AIRDROME, GROUP:FindByName(onDemandPlatformConfig.groupName):GetCoalition())
|
|
97
|
+
end
|
|
98
|
+
if (is_elint_spawned) then
|
|
99
|
+
jtff_log.info(
|
|
100
|
+
string.format(
|
|
101
|
+
'onDemand Elint already in air : rerouting %s',
|
|
102
|
+
onDemandPlatformConfig.groupName
|
|
103
|
+
),
|
|
104
|
+
"ELINT"
|
|
105
|
+
)
|
|
106
|
+
elintPlatformGroup:ClearTasks()
|
|
107
|
+
table.insert(
|
|
108
|
+
elintRoute,
|
|
109
|
+
askedAnchorCoord
|
|
110
|
+
:SetAltitude(UTILS.FeetToMeters(onDemandPlatformConfig.altitude))
|
|
111
|
+
:WaypointAirTurningPoint(
|
|
112
|
+
nil,
|
|
113
|
+
UTILS.KnotsToKmph(onDemandPlatformConfig.speed),
|
|
114
|
+
{
|
|
115
|
+
{
|
|
116
|
+
id = 'ControlledTask',
|
|
117
|
+
params = {
|
|
118
|
+
task =
|
|
119
|
+
{
|
|
120
|
+
id = 'Orbit',
|
|
121
|
+
params = {
|
|
122
|
+
pattern = AI.Task.OrbitPattern.RACE_TRACK,
|
|
123
|
+
speed = UTILS.KnotsToMps(onDemandPlatformConfig.speed),
|
|
124
|
+
altitude = UTILS.FeetToMeters(onDemandPlatformConfig.altitude)
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
stopCondition = {
|
|
128
|
+
duration = askedDuration * 60
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
"ELINT Start"
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
table.insert(
|
|
137
|
+
elintRoute,
|
|
138
|
+
askedAnchorCoord
|
|
139
|
+
:Translate(UTILS.NMToMeters(onDemandPlatformConfig.orbit.length), onDemandPlatformConfig.orbit.heading, true, false)
|
|
140
|
+
:SetAltitude(UTILS.FeetToMeters(onDemandPlatformConfig.altitude))
|
|
141
|
+
:WaypointAirTurningPoint(
|
|
142
|
+
nil,
|
|
143
|
+
UTILS.KnotsToKmph(onDemandPlatformConfig.speed),
|
|
144
|
+
{},
|
|
145
|
+
"Orbit End"
|
|
146
|
+
)
|
|
147
|
+
)
|
|
148
|
+
table.insert(
|
|
149
|
+
elintRoute,
|
|
150
|
+
RTBAirbase
|
|
151
|
+
:GetCoordinate()
|
|
152
|
+
:WaypointAirLanding(
|
|
153
|
+
UTILS.KnotsToKmph(onDemandPlatformConfig.speed),
|
|
154
|
+
RTBAirbase
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
else
|
|
158
|
+
jtff_log.info(
|
|
159
|
+
string.format(
|
|
160
|
+
'onDemandElint Spawning %s',
|
|
161
|
+
onDemandPlatformConfig.groupName
|
|
162
|
+
),
|
|
163
|
+
"ELINT"
|
|
164
|
+
)
|
|
165
|
+
local spawnELINT = SPAWN:NewWithAlias(
|
|
166
|
+
onDemandPlatformConfig.groupName,
|
|
167
|
+
string.format("%s-%s", onDemandPlatformConfig.groupName, onDemandPlatformConfig.type)
|
|
168
|
+
)
|
|
169
|
+
if (onDemandPlatformConfig.freq) then
|
|
170
|
+
spawnELINT:InitRadioFrequency(onDemandPlatformConfig.freq)
|
|
171
|
+
spawnELINT:InitRadioModulation("AM")
|
|
172
|
+
end
|
|
173
|
+
if (onDemandPlatformConfig.modex) then
|
|
174
|
+
spawnELINT:InitModex(onDemandPlatformConfig.modex)
|
|
175
|
+
end
|
|
176
|
+
if (onDemandPlatformConfig.baseUnit) then
|
|
177
|
+
elintPlatformGroup = spawnELINT:SpawnAtAirbase(
|
|
178
|
+
AIRBASE:FindByName(onDemandPlatformConfig.baseUnit),
|
|
179
|
+
SPAWN.Takeoff.Hot,
|
|
180
|
+
nil,
|
|
181
|
+
onDemandPlatformConfig.terminalType
|
|
182
|
+
)
|
|
183
|
+
table.insert(elintRoute,
|
|
184
|
+
AIRBASE
|
|
185
|
+
:FindByName(onDemandPlatformConfig.baseUnit)
|
|
186
|
+
:GetCoordinate()
|
|
187
|
+
:WaypointAirTakeOffParkingHot()
|
|
188
|
+
)
|
|
189
|
+
else
|
|
190
|
+
elintPlatformGroup = spawnELINT:SpawnFromCoordinate(
|
|
191
|
+
askedAnchorCoord
|
|
192
|
+
:GetRandomCoordinateInRadius(
|
|
193
|
+
UTILS.NMToMeters(30),
|
|
194
|
+
UTILS.NMToMeters(20)
|
|
195
|
+
)
|
|
196
|
+
:SetAltitude(
|
|
197
|
+
UTILS.FeetToMeters(onDemandPlatformConfig.altitude)
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
end
|
|
201
|
+
local networkIndex = 0
|
|
202
|
+
for index, networkElement in ipairs(elintNetworksArray) do
|
|
203
|
+
if (networkElement.customconfig.coalition == elintPlatformGroup:GetCoalition()) then
|
|
204
|
+
networkIndex = index
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
if (networkIndex > 0) then
|
|
208
|
+
elintNetworksArray[networkIndex].networkObject:addPlatform(elintPlatformGroup:GetFirstUnit():GetName())
|
|
209
|
+
elintPlatformGroup.elintNetworkIndex = networkIndex
|
|
210
|
+
end
|
|
211
|
+
elintPlatformGroup.customconfig = onDemandPlatformConfig
|
|
212
|
+
elintPlatformGroup.spawnAbsTime = timer.getAbsTime()
|
|
213
|
+
elintPlatformGroup.missionmaxduration = askedDuration
|
|
214
|
+
table.insert(elintRoute,
|
|
215
|
+
askedAnchorCoord
|
|
216
|
+
:SetAltitude(UTILS.FeetToMeters(onDemandPlatformConfig.altitude))
|
|
217
|
+
:WaypointAirTurningPoint(
|
|
218
|
+
nil,
|
|
219
|
+
UTILS.KnotsToKmph(onDemandPlatformConfig.speed),
|
|
220
|
+
{
|
|
221
|
+
{
|
|
222
|
+
id = 'ControlledTask',
|
|
223
|
+
params = {
|
|
224
|
+
task =
|
|
225
|
+
{
|
|
226
|
+
id = 'Orbit',
|
|
227
|
+
params = {
|
|
228
|
+
pattern = AI.Task.OrbitPattern.RACE_TRACK,
|
|
229
|
+
speed = UTILS.KnotsToMps(onDemandPlatformConfig.speed),
|
|
230
|
+
altitude = UTILS.FeetToMeters(onDemandPlatformConfig.altitude)
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
stopCondition = {
|
|
234
|
+
duration = askedDuration * 60
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
"ELINT Start"
|
|
240
|
+
)
|
|
241
|
+
)
|
|
242
|
+
table.insert(elintRoute,
|
|
243
|
+
askedAnchorCoord
|
|
244
|
+
:Translate(UTILS.NMToMeters(onDemandPlatformConfig.orbit.length), onDemandPlatformConfig.orbit.heading, true, false)
|
|
245
|
+
:SetAltitude(UTILS.FeetToMeters(onDemandPlatformConfig.altitude))
|
|
246
|
+
:WaypointAirTurningPoint(
|
|
247
|
+
nil,
|
|
248
|
+
UTILS.KnotsToKmph(onDemandPlatformConfig.speed),
|
|
249
|
+
{},
|
|
250
|
+
"Orbit End"
|
|
251
|
+
)
|
|
252
|
+
)
|
|
253
|
+
table.insert(elintRoute,
|
|
254
|
+
RTBAirbase
|
|
255
|
+
:GetCoordinate()
|
|
256
|
+
:WaypointAirLanding(
|
|
257
|
+
UTILS.KnotsToKmph(onDemandPlatformConfig.speed),
|
|
258
|
+
RTBAirbase,
|
|
259
|
+
{},
|
|
260
|
+
'RTB'
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
end
|
|
264
|
+
elintPlatformGroup:Route(elintRoute)
|
|
265
|
+
elintPlatformGroup:CommandEPLRS(true, 4)
|
|
266
|
+
if onDemandPlatformConfig.escortgroupname then
|
|
267
|
+
elintPlatformGroup.escortSpawnObject = SPAWN:NewWithAlias(onDemandPlatformConfig.escortgroupname,'escort-'.. onDemandPlatformConfig.groupName)
|
|
268
|
+
:InitSkill("Excellent")
|
|
269
|
+
:OnSpawnGroup(function(SpawnGroup)
|
|
270
|
+
taskGroupEscort({ elintPlatformGroup, SpawnGroup})
|
|
271
|
+
end)
|
|
272
|
+
elintPlatformGroup.escortGroupObject = spawnRecoveryTankerEscort(elintPlatformGroup.escortSpawnObject, onDemandPlatformConfig)
|
|
273
|
+
if onDemandPlatformConfig.missionmaxduration then
|
|
274
|
+
elintPlatformGroup.escortGroupObject:ScheduleOnce(onDemandPlatformConfig.missionmaxduration*60,
|
|
275
|
+
function(SpawnGroup, airBaseName)
|
|
276
|
+
--trigger.action.outText('RTB schedule trigger Tanker-escort group : '..(SpawnGroup.GroupName)..' airbase'..(airBaseName)..'...', 45)
|
|
277
|
+
SpawnGroup:RouteRTB(AIRBASE:FindByName(airBaseName))
|
|
278
|
+
end,
|
|
279
|
+
elintPlatformGroup.escortGroupObject,
|
|
280
|
+
onDemandPlatformConfig.baseUnit
|
|
281
|
+
)
|
|
282
|
+
--trigger.action.outText('Tanker-escort configured to RTB in : '..(onDemandElint.missionmaxduration)..' minutes max...', 45)
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
if (map_marker[elintPlatformGroup:GetName()]) then
|
|
286
|
+
COORDINATE:RemoveMark(map_marker[elintPlatformGroup:GetName()])
|
|
287
|
+
end
|
|
288
|
+
map_marker[elintPlatformGroup:GetName()] = askedAnchorCoord:MarkToCoalition(
|
|
289
|
+
string.format(
|
|
290
|
+
'OnDemand ELINT %s\nFL %i at %i knots\nOn station for %i minutes\nRacetrack : %i ° for %i nm',
|
|
291
|
+
onDemandPlatformConfig.type,
|
|
292
|
+
UTILS.Round(onDemandPlatformConfig.altitude / 100 , 0),
|
|
293
|
+
onDemandPlatformConfig.speed,
|
|
294
|
+
askedDuration,
|
|
295
|
+
onDemandPlatformConfig.orbit.heading,
|
|
296
|
+
onDemandPlatformConfig.orbit.length
|
|
297
|
+
),
|
|
298
|
+
elintPlatformGroup:GetCoalition(),
|
|
299
|
+
true,
|
|
300
|
+
'OnDemand ELINT %s is Activated'
|
|
301
|
+
)
|
|
302
|
+
elintPlatformGroup:HandleEvent(EVENTS.Land)
|
|
303
|
+
elintPlatformGroup:HandleEvent(EVENTS.Crash)
|
|
304
|
+
elintPlatformGroup:HandleEvent(EVENTS.Dead)
|
|
305
|
+
function elintPlatformGroup:OnEventLand(EventData)
|
|
306
|
+
COORDINATE:RemoveMark(map_marker[self:GetName()])
|
|
307
|
+
elintNetworksArray[findElintNetworkIndexByCoalition(self:GetCoalition())].networkObject:removePlatform(self:GetFirstUnit():GetName())
|
|
308
|
+
if self.customconfig.escortgroupname then
|
|
309
|
+
jtff_log.info('RTB: '..self.GroupName..'...',"ELINT")
|
|
310
|
+
if self.escortGroupObject:IsAirborne(false) == true then
|
|
311
|
+
jtff_log.info('escort RTB : '.. self.escortGroupObject.GroupName..' ELINT : '..self.GroupName..'...',"ELINT")
|
|
312
|
+
self.escortGroupObject:RouteRTB()
|
|
313
|
+
else
|
|
314
|
+
--self.escortGroupObject:Destroy(nil, 5)
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
function elintPlatformGroup:OnEventCrash(EventData)
|
|
319
|
+
COORDINATE:RemoveMark(map_marker[self:GetName()])
|
|
320
|
+
elintNetworksArray[findElintNetworkIndexByCoalition(self:GetCoalition())].networkObject:removePlatform(self:GetFirstUnit():GetName())
|
|
321
|
+
if self.customconfig.escortgroupname then
|
|
322
|
+
jtff_log.info('RTB: '..self.GroupName..'...',"ELINT")
|
|
323
|
+
if self.escortGroupObject:IsAirborne(false) == true then
|
|
324
|
+
jtff_log.info('escort RTB : '.. self.escortGroupObject.GroupName..' ELINT : '..self.GroupName..'...',"ELINT")
|
|
325
|
+
self.escortGroupObject:RouteRTB()
|
|
326
|
+
else
|
|
327
|
+
--self.escortGroupObject:Destroy(nil, 5)
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
function elintPlatformGroup:OnEventDead(EventData)
|
|
332
|
+
COORDINATE:RemoveMark(map_marker[self:GetName()])
|
|
333
|
+
elintNetworksArray[findElintNetworkIndexByCoalition(self:GetCoalition())].networkObject:removePlatform(self:GetFirstUnit():GetName())
|
|
334
|
+
if self.customconfig.escortgroupname then
|
|
335
|
+
jtff_log.info('RTB: '..self.GroupName..'...',"ELINT")
|
|
336
|
+
if self.escortGroupObject:IsAirborne(false) == true then
|
|
337
|
+
jtff_log.info('escort RTB : '.. self.escortGroupObject.GroupName..' ELINT : '..self.GroupName..'...',"ELINT")
|
|
338
|
+
self.escortGroupObject:RouteRTB()
|
|
339
|
+
else
|
|
340
|
+
--self.escortGroupObject:Destroy(nil, 5)
|
|
341
|
+
end
|
|
342
|
+
end
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
return elintPlatformGroup;
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
function findElintNetworkIndexByCoalition(coalition)
|
|
351
|
+
local foundIndex = 0
|
|
352
|
+
for indexNetwork, networkObject in ipairs(elintNetworksArray) do
|
|
353
|
+
if (networkObject.customconfig.coalition == coalition) then
|
|
354
|
+
foundIndex = indexNetwork
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
if foundIndex > 0 then
|
|
358
|
+
return foundIndex
|
|
359
|
+
end
|
|
360
|
+
return nil
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
function createElintAirborneControllerSpawnObject(networkIndex)
|
|
364
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
365
|
+
local spawnObject = SPAWN:NewWithAlias(
|
|
366
|
+
elintnetworkconfig.controller.groupName,
|
|
367
|
+
string.format(
|
|
368
|
+
"ELINT-%s-controller",
|
|
369
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
370
|
+
)
|
|
371
|
+
)
|
|
372
|
+
if (type(spawnObject) == "nil") then
|
|
373
|
+
jtff_log.error(
|
|
374
|
+
string.format(
|
|
375
|
+
'Controller SPAWN Object: The ELINT controller template %s not found...',
|
|
376
|
+
elintnetworkconfig.controller.groupName
|
|
377
|
+
),
|
|
378
|
+
"ELINT"
|
|
379
|
+
)
|
|
380
|
+
return spawnObject
|
|
381
|
+
end
|
|
382
|
+
spawnObject:InitCoalition(elintnetworkconfig.coalition)
|
|
383
|
+
--:InitLimit(1,0)
|
|
384
|
+
:InitSkill("Random")
|
|
385
|
+
if (elintnetworkconfig.coalition == coalition.side.BLUE) then
|
|
386
|
+
spawnObject:InitCountry(
|
|
387
|
+
country.id.CJTF_BLUE
|
|
388
|
+
)
|
|
389
|
+
elseif (elintnetworkconfig.coalition == coalition.side.RED) then
|
|
390
|
+
spawnObject:InitCountry(
|
|
391
|
+
country.id.CJTF_RED
|
|
392
|
+
)
|
|
393
|
+
else
|
|
394
|
+
spawnObject:InitCountry(
|
|
395
|
+
country.id.UN_PEACEKEEPERS
|
|
396
|
+
)
|
|
397
|
+
end
|
|
398
|
+
if (type(elintnetworkconfig.controller.modex) == "number") then
|
|
399
|
+
spawnObject:InitModex(
|
|
400
|
+
elintnetworkconfig.controller.modex
|
|
401
|
+
)
|
|
402
|
+
end
|
|
403
|
+
if (type(elintnetworkconfig.controller.freq) == "number") then
|
|
404
|
+
spawnObject:InitRadioCommsOnOff(true)
|
|
405
|
+
spawnObject:InitRadioFrequency(
|
|
406
|
+
elintnetworkconfig.controller.freq
|
|
407
|
+
)
|
|
408
|
+
spawnObject:InitRadioModulation("AM")
|
|
409
|
+
else
|
|
410
|
+
spawnObject:InitRadioCommsOnOff(false)
|
|
411
|
+
end
|
|
412
|
+
jtff_log.info(
|
|
413
|
+
string.format(
|
|
414
|
+
'Controller SPAWN Object: The SpawnObject is created. Template group is %s ...',
|
|
415
|
+
elintnetworkconfig.controller.groupName
|
|
416
|
+
),
|
|
417
|
+
"ELINT"
|
|
418
|
+
)
|
|
419
|
+
spawnObject:OnSpawnGroup(airborneControllerOnSpawnGroup,networkIndex)
|
|
420
|
+
--spawnObject:InitRepeatOnEngineShutDown()
|
|
421
|
+
--spawnObject:InitCleanUp(60)
|
|
422
|
+
return spawnObject
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
function airborneControllerOnSpawnGroup(spawnedGroup,networkIndex)
|
|
426
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
427
|
+
local controllerConfig = elintnetworkconfig.controller
|
|
428
|
+
spawnedGroup.elintnetworkindex = networkIndex
|
|
429
|
+
spawnedGroup:OptionROE(ENUMS.ROE.ReturnFire)
|
|
430
|
+
spawnedGroup:OptionROT(ENUMS.ROT.EvadeFire)
|
|
431
|
+
spawnedGroup:OptionRTBBingoFuel(true)
|
|
432
|
+
spawnedGroup:OptionRestrictBurner(true)
|
|
433
|
+
spawnedGroup:OptionECM_OnlyLockByRadar()
|
|
434
|
+
spawnedGroup:EnableEmission(true)
|
|
435
|
+
spawnedGroup:OptionAlarmStateRed()
|
|
436
|
+
routeElintController(
|
|
437
|
+
spawnedGroup,
|
|
438
|
+
networkIndex
|
|
439
|
+
)
|
|
440
|
+
if (type(elintNetworksArray[networkIndex].controllerMark) == "nil") then
|
|
441
|
+
elintNetworksArray[networkIndex].controllerMark = MARKER:New(
|
|
442
|
+
COORDINATE:NewFromVec2(
|
|
443
|
+
AIRBASE:FindByName(controllerConfig.baseUnit):GetCoordinate():GetRandomVec2InRadius(
|
|
444
|
+
UTILS.NMToMeters(2),
|
|
445
|
+
UTILS.NMToMeters(0.5)
|
|
446
|
+
)
|
|
447
|
+
),
|
|
448
|
+
string.format(
|
|
449
|
+
"ELINT-%s-airborne-controller\nFL%i at %i knots GS\nControl: %.2f MHz ATIS: %.2f MHz\nOn station for %i minutes",
|
|
450
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition),
|
|
451
|
+
UTILS.Round(controllerConfig.altitude / 100 , 0),
|
|
452
|
+
controllerConfig.speed,
|
|
453
|
+
controllerConfig.controller_freq or 270.350,
|
|
454
|
+
controllerConfig.atis_freq or 270.250,
|
|
455
|
+
controllerConfig.missionmaxduration
|
|
456
|
+
)
|
|
457
|
+
):ToCoalition(elintnetworkconfig.coalition)
|
|
458
|
+
else
|
|
459
|
+
elintNetworksArray[networkIndex].controllerMark:UpdateCoordinate(
|
|
460
|
+
AIRBASE:FindByName(controllerConfig.baseUnit):GetCoordinate()
|
|
461
|
+
)
|
|
462
|
+
end
|
|
463
|
+
setupElintNetworkwithController(networkIndex, spawnedGroup:GetFirstUnit():GetName())
|
|
464
|
+
elintNetworksArray[networkIndex].networkObject:addPlatform(spawnedGroup:GetFirstUnit():GetName())
|
|
465
|
+
spawnedGroup:HandleEvent(EVENTS.Land)
|
|
466
|
+
spawnedGroup:HandleEvent(EVENTS.Crash)
|
|
467
|
+
spawnedGroup:HandleEvent(EVENTS.Dead)
|
|
468
|
+
function spawnedGroup:OnEventLand(EventData)
|
|
469
|
+
elintNetworksArray[self.elintnetworkindex].networkObject:removePlatform(spawnedGroup:GetFirstUnit():GetName())
|
|
470
|
+
stopElintNetwork(self.elintnetworkindex)
|
|
471
|
+
end
|
|
472
|
+
function spawnedGroup:OnEventCrash(EventData)
|
|
473
|
+
elintNetworksArray[self.elintnetworkindex].networkObject:removePlatform(spawnedGroup:GetFirstUnit():GetName())
|
|
474
|
+
stopElintNetwork(self.elintnetworkindex)
|
|
475
|
+
end
|
|
476
|
+
function spawnedGroup:OnEventDead(EventData)
|
|
477
|
+
elintNetworksArray[self.elintnetworkindex].networkObject:removePlatform(spawnedGroup:GetFirstUnit():GetName())
|
|
478
|
+
stopElintNetwork(self.elintnetworkindex)
|
|
479
|
+
end
|
|
480
|
+
jtff_log.debug(
|
|
481
|
+
string.format(
|
|
482
|
+
'airborne Controller Group: AirController group %s is spawned and setup...',
|
|
483
|
+
spawnedGroup:GetName()
|
|
484
|
+
),
|
|
485
|
+
"ELINT"
|
|
486
|
+
)
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
function spawnElintAirborneControllerFromSpawn(spawnObject,networkIndex)
|
|
490
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
491
|
+
local controllerGroup = nil
|
|
492
|
+
local controllerConfig = elintnetworkconfig.controller
|
|
493
|
+
if (type(elintNetworksArray[networkIndex].customconfig.controller) == "nil") then
|
|
494
|
+
jtff_log.error(
|
|
495
|
+
string.format(
|
|
496
|
+
'Airborne Controller: No controller paragraph in the network %i config...',
|
|
497
|
+
networkIndex
|
|
498
|
+
),
|
|
499
|
+
"ELINT"
|
|
500
|
+
)
|
|
501
|
+
return nil
|
|
502
|
+
end
|
|
503
|
+
local groupNameToSearch = string.format(
|
|
504
|
+
"ELINT-%s-controller",
|
|
505
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
506
|
+
)
|
|
507
|
+
if (type(GROUP:FindByName(groupNameToSearch)) == "nil") then
|
|
508
|
+
controllerGroup = spawnObject:SpawnAtAirbase(
|
|
509
|
+
AIRBASE:FindByName(controllerConfig.baseUnit),
|
|
510
|
+
controllerConfig.takeOffType or SPAWN.Takeoff.Cold,
|
|
511
|
+
nil,
|
|
512
|
+
controllerConfig.terminalType or AIRBASE.TerminalType.OpenMedOrBig,
|
|
513
|
+
true)
|
|
514
|
+
else
|
|
515
|
+
controllerGroup = spawnObject:GetLastAliveGroup()
|
|
516
|
+
if (type(elintNetworksArray[networkIndex].controllerMark) == "nil") then
|
|
517
|
+
elintNetworksArray[networkIndex].controllerMark = MARKER:New(
|
|
518
|
+
COORDINATE:NewFromVec2(
|
|
519
|
+
AIRBASE:FindByName(controllerConfig.baseUnit):GetCoordinate():GetRandomVec2InRadius(
|
|
520
|
+
UTILS.NMToMeters(2),
|
|
521
|
+
UTILS.NMToMeters(0.5)
|
|
522
|
+
)
|
|
523
|
+
),
|
|
524
|
+
string.format(
|
|
525
|
+
"ELINT-%s-airborne-controller\nFL%i at %i knots GS\nControl: %.2f MHz ATIS: %.2f MHz\nOn station for %i minutes",
|
|
526
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition),
|
|
527
|
+
UTILS.Round(controllerConfig.altitude / 100 , 0),
|
|
528
|
+
controllerConfig.speed,
|
|
529
|
+
controllerConfig.controller_freq or 270.350,
|
|
530
|
+
controllerConfig.atis_freq or 270.250,
|
|
531
|
+
controllerConfig.missionmaxduration
|
|
532
|
+
)
|
|
533
|
+
):ToCoalition(elintnetworkconfig.coalition)
|
|
534
|
+
else
|
|
535
|
+
elintNetworksArray[networkIndex].controllerMark:UpdateCoordinate(
|
|
536
|
+
AIRBASE:FindByName(controllerConfig.baseUnit):GetCoordinate()
|
|
537
|
+
)
|
|
538
|
+
end
|
|
539
|
+
end
|
|
540
|
+
if (type(controllerGroup) == "nil") then
|
|
541
|
+
jtff_log.error(
|
|
542
|
+
string.format(
|
|
543
|
+
'Airborne Controller: impossible to spawn airborne ELINT controller based on template %s...',
|
|
544
|
+
controllerConfig.groupName
|
|
545
|
+
),
|
|
546
|
+
"ELINT"
|
|
547
|
+
)
|
|
548
|
+
return nil
|
|
549
|
+
end
|
|
550
|
+
return controllerGroup
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
function setupElintNetworkwithController(networkIndex, controllerUnitName)
|
|
554
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
555
|
+
elintNetworksArray[networkIndex].networkObject:setTransmitter(controllerUnitName)
|
|
556
|
+
jtff_log.info(
|
|
557
|
+
string.format(
|
|
558
|
+
'Controller setup ELINT: Transmitter added for network %s.',
|
|
559
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
560
|
+
),
|
|
561
|
+
"ELINT"
|
|
562
|
+
)
|
|
563
|
+
if (type(elintnetworkconfig.controller.atis_freq) == "number") then
|
|
564
|
+
elintNetworksArray[networkIndex].networkObject:configureAtis({
|
|
565
|
+
freq = elintnetworkconfig.controller.atis_freq or 270.250,
|
|
566
|
+
modulation = "AM",
|
|
567
|
+
volume = 1.0,
|
|
568
|
+
gender = "male",
|
|
569
|
+
})
|
|
570
|
+
elintNetworksArray[networkIndex].networkObject:setAtisUpdateInterval(15*60)
|
|
571
|
+
elintNetworksArray[networkIndex].networkObject:enableAtis()
|
|
572
|
+
jtff_log.info(
|
|
573
|
+
string.format(
|
|
574
|
+
'Controller setup ELINT: Atis enabled for network %s.',
|
|
575
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
576
|
+
),
|
|
577
|
+
"ELINT"
|
|
578
|
+
)
|
|
579
|
+
else
|
|
580
|
+
elintNetworksArray[networkIndex].networkObject:disableAtis()
|
|
581
|
+
jtff_log.debug(
|
|
582
|
+
string.format(
|
|
583
|
+
'Controller setup ELINT: Atis disabled for network %s.',
|
|
584
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
585
|
+
),
|
|
586
|
+
"ELINT"
|
|
587
|
+
)
|
|
588
|
+
end
|
|
589
|
+
if (type(elintnetworkconfig.controller.notify_freq) == "number") then
|
|
590
|
+
elintNetworksArray[networkIndex].networkObject:configureNotifier({
|
|
591
|
+
freq = elintnetworkconfig.controller.notify_freq or 261.000,
|
|
592
|
+
modulation = "AM",
|
|
593
|
+
volume = 1.0,
|
|
594
|
+
gender = "male",
|
|
595
|
+
})
|
|
596
|
+
elintNetworksArray[networkIndex].networkObject:enableNotifier()
|
|
597
|
+
jtff_log.info(
|
|
598
|
+
string.format(
|
|
599
|
+
'Controller setup ELINT: Notifyer enabled for network %s.',
|
|
600
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
601
|
+
),
|
|
602
|
+
"ELINT"
|
|
603
|
+
)
|
|
604
|
+
else
|
|
605
|
+
elintNetworksArray[networkIndex].networkObject:disableNotifier()
|
|
606
|
+
jtff_log.debug(
|
|
607
|
+
string.format(
|
|
608
|
+
'Controller setup ELINT: Notifyer disabled for network %s.',
|
|
609
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
610
|
+
),
|
|
611
|
+
"ELINT"
|
|
612
|
+
)
|
|
613
|
+
end
|
|
614
|
+
if (type(elintnetworkconfig.controller.controller_freq) == "number") then
|
|
615
|
+
elintNetworksArray[networkIndex].networkObject:configureController({
|
|
616
|
+
freq = elintnetworkconfig.controller.controller_freq or 270.350,
|
|
617
|
+
modulation = "AM",
|
|
618
|
+
volume = 1.0,
|
|
619
|
+
gender = "female",
|
|
620
|
+
})
|
|
621
|
+
elintNetworksArray[networkIndex].networkObject:enableController()
|
|
622
|
+
jtff_log.info(
|
|
623
|
+
string.format(
|
|
624
|
+
'Controller setup ELINT: Controller enabled for network %s.',
|
|
625
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
626
|
+
),
|
|
627
|
+
"ELINT"
|
|
628
|
+
)
|
|
629
|
+
if (elintnetworkconfig.enableAlerts == false) then
|
|
630
|
+
elintNetworksArray[networkIndex].networkObject:disableAlerts()
|
|
631
|
+
jtff_log.debug(
|
|
632
|
+
string.format(
|
|
633
|
+
'Controller setup ELINT: Alerting disabled for network %s.',
|
|
634
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
635
|
+
),
|
|
636
|
+
"ELINT"
|
|
637
|
+
)
|
|
638
|
+
else
|
|
639
|
+
elintNetworksArray[networkIndex].networkObject:enableAlerts()
|
|
640
|
+
jtff_log.info(
|
|
641
|
+
string.format(
|
|
642
|
+
'Controller setup ELINT: Alerting enabled for network %s.',
|
|
643
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
644
|
+
),
|
|
645
|
+
"ELINT"
|
|
646
|
+
)
|
|
647
|
+
end
|
|
648
|
+
else
|
|
649
|
+
elintNetworksArray[networkIndex].networkObject:disableController()
|
|
650
|
+
jtff_log.debug(
|
|
651
|
+
string.format(
|
|
652
|
+
'Controller setup ELINT: Controller disabled for network %s.',
|
|
653
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
654
|
+
),
|
|
655
|
+
"ELINT"
|
|
656
|
+
)
|
|
657
|
+
end
|
|
658
|
+
elintNetworksArray[networkIndex].networkObject:systemOn(elintnetworkconfig.debug)
|
|
659
|
+
jtff_log.info(
|
|
660
|
+
string.format(
|
|
661
|
+
'Controller setup ELINT: Network %s is started !',
|
|
662
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
663
|
+
),
|
|
664
|
+
"ELINT"
|
|
665
|
+
)
|
|
666
|
+
return elintNetworksArray[networkIndex].networkObject
|
|
667
|
+
end
|
|
668
|
+
|
|
669
|
+
function initializeElintNetwork(networkIndex)
|
|
670
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
671
|
+
--create the network
|
|
672
|
+
elintNetworksArray[networkIndex].networkObject = createHoundElintObject(networkIndex)
|
|
673
|
+
jtff_log.info('init ELINT : '.. UTILS.GetCoalitionName(elintnetworkconfig.coalition) ..'...',"ELINT")
|
|
674
|
+
if (type(elintNetworksArray[networkIndex].rootMenu) == "nil") then
|
|
675
|
+
elintNetworksArray[networkIndex].rootMenu = createELintRootMenu(networkIndex)
|
|
676
|
+
end
|
|
677
|
+
if (type(elintNetworksArray[networkIndex].startNetworkCommandMenu) == "nil") then
|
|
678
|
+
elintNetworksArray[networkIndex].startNetworkCommandMenu = MENU_COALITION_COMMAND:New(
|
|
679
|
+
elintnetworkconfig.coalition,
|
|
680
|
+
"Start newtork",
|
|
681
|
+
elintNetworksArray[networkIndex].rootMenu,
|
|
682
|
+
initializeElintNetwork,
|
|
683
|
+
networkIndex
|
|
684
|
+
)
|
|
685
|
+
jtff_log.info('init ELINT : Start menu created for coalition '.. UTILS.GetCoalitionName(elintnetworkconfig.coalition) ..'...',"ELINT")
|
|
686
|
+
end
|
|
687
|
+
--Manage the menus
|
|
688
|
+
elintNetworksArray[networkIndex].networkObject:setRadioMenuParent(elintNetworksArray[networkIndex].rootMenu.MenuPath)
|
|
689
|
+
--Manage debugging
|
|
690
|
+
elintNetworksArray[networkIndex].networkObject:onScreenDebug(elintnetworkconfig.debug or false)
|
|
691
|
+
--Manage markers for radars detected
|
|
692
|
+
if (elintnetworkconfig.enableMarkers == true) then
|
|
693
|
+
elintNetworksArray[networkIndex].networkObject:enableMarkers()
|
|
694
|
+
elintNetworksArray[networkIndex].networkObject:setMarkerType(HOUND.MARKER.POLYGON)
|
|
695
|
+
else
|
|
696
|
+
elintNetworksArray[networkIndex].networkObject:disableMarkers()
|
|
697
|
+
end
|
|
698
|
+
--Manage BDA
|
|
699
|
+
if (elintnetworkconfig.enableBDA == true) then
|
|
700
|
+
elintNetworksArray[networkIndex].networkObject:enableBDA()
|
|
701
|
+
else
|
|
702
|
+
elintNetworksArray[networkIndex].networkObject:disableBDA()
|
|
703
|
+
end
|
|
704
|
+
--Manage namings standards
|
|
705
|
+
elintNetworksArray[networkIndex].networkObject:enableNATO()
|
|
706
|
+
elintNetworksArray[networkIndex].networkObject:useNATOCallsignes(true)
|
|
707
|
+
--Add startup platforms
|
|
708
|
+
for indexPlatform, startupPlatformName in ipairs(elintConfig.startupPlatformUnitNames) do
|
|
709
|
+
local platformUnitObject = UNIT:FindByName(startupPlatformName)
|
|
710
|
+
if ((platformUnitObject ~= nil) and (platformUnitObject:GetCoalition() == elintnetworkconfig.coalition)) then
|
|
711
|
+
elintNetworksArray[networkIndex].networkObject:addPlatform(startupPlatformName)
|
|
712
|
+
end
|
|
713
|
+
end
|
|
714
|
+
--Manage SRS settings
|
|
715
|
+
if (elintnetworkconfig.useSRS == false) then
|
|
716
|
+
elintNetworksArray[networkIndex].networkObject:disableTTS()
|
|
717
|
+
end
|
|
718
|
+
--Manage EWR reporting
|
|
719
|
+
elintNetworksArray[networkIndex].networkObject:reportEWR(elintnetworkconfig.reportEWR or true)
|
|
720
|
+
startElintController(networkIndex)
|
|
721
|
+
jtff_log.info('init ELINT : Elint network '.. UTILS.GetCoalitionName(elintnetworkconfig.coalition) ..' initialized...',"ELINT")
|
|
722
|
+
return elintNetworksArray[networkIndex]
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
function startElintAirborneController(networkIndex)
|
|
726
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
727
|
+
--need a plane controller to be spawned
|
|
728
|
+
if (type(elintNetworksArray[networkIndex].controllerSpawnObject) == "nil") then
|
|
729
|
+
--no SpawnObject created ==> let's create the spawnobject
|
|
730
|
+
elintNetworksArray[networkIndex].controllerSpawnObject = createElintAirborneControllerSpawnObject(networkIndex)
|
|
731
|
+
end
|
|
732
|
+
if (type(elintNetworksArray[networkIndex].controllerSpawnObject) == "nil") then
|
|
733
|
+
-- still no spawnObject present ==> error and return nil
|
|
734
|
+
jtff_log.error(
|
|
735
|
+
string.format(
|
|
736
|
+
'Airborne ControllerUnit: impossible to create a spawn object based on template %s...',
|
|
737
|
+
elintnetworkconfig.controller.groupName
|
|
738
|
+
),
|
|
739
|
+
"ELINT"
|
|
740
|
+
)
|
|
741
|
+
return nil
|
|
742
|
+
end
|
|
743
|
+
if (type(elintNetworksArray[networkIndex].controllerGroup) == "nil") then
|
|
744
|
+
--controller has to be spawned
|
|
745
|
+
elintNetworksArray[networkIndex].controllerGroup = spawnElintAirborneControllerFromSpawn(
|
|
746
|
+
elintNetworksArray[networkIndex].controllerSpawnObject,
|
|
747
|
+
networkIndex
|
|
748
|
+
)
|
|
749
|
+
if (type(elintNetworksArray[networkIndex].controllerGroup) == "nil") then
|
|
750
|
+
-- still no controllerGroup present ==> error and return nil
|
|
751
|
+
jtff_log.error(
|
|
752
|
+
string.format(
|
|
753
|
+
'Airborne ControllerUnit: impossible to create a spawn object based on template %s...',
|
|
754
|
+
elintnetworkconfig.controller.groupName
|
|
755
|
+
),
|
|
756
|
+
"ELINT"
|
|
757
|
+
)
|
|
758
|
+
return nil
|
|
759
|
+
end
|
|
760
|
+
end
|
|
761
|
+
jtff_log.info(
|
|
762
|
+
string.format(
|
|
763
|
+
'Airborne ControllerUnit: Group %s is created and routed properly...',
|
|
764
|
+
elintNetworksArray[networkIndex].controllerGroup:GetFirstUnit():GetName()
|
|
765
|
+
),
|
|
766
|
+
"ELINT"
|
|
767
|
+
)
|
|
768
|
+
return elintNetworksArray[networkIndex].controllerGroup:GetFirstUnit():GetName()
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
function startElintStaticController(networkIndex)
|
|
772
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
773
|
+
local controllerUnitName = string.format(
|
|
774
|
+
"ELINT-%s-ground-controller",
|
|
775
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
776
|
+
)
|
|
777
|
+
local alreadySpawnedStaticController = STATIC:FindByName(controllerUnitName)
|
|
778
|
+
if (type(alreadySpawnedStaticController) == "nil") then
|
|
779
|
+
local spawnStatic
|
|
780
|
+
if (elintnetworkconfig.coalition == coalition.side.BLUE) then
|
|
781
|
+
spawnStatic = SPAWNSTATIC:NewFromType("ERO_Radio_Tower", "Fortifications", country.id.CJTF_BLUE)
|
|
782
|
+
elseif (elintnetworkconfig.coalition == coalition.side.RED) then
|
|
783
|
+
spawnStatic = SPAWNSTATIC:NewFromType("ERO_Radio_Tower", "Fortifications", country.id.CJTF_RED)
|
|
784
|
+
else
|
|
785
|
+
spawnStatic = SPAWNSTATIC:NewFromType("ERO_Radio_Tower", "Fortifications", country.id.UN_PEACEKEEPERS)
|
|
786
|
+
end
|
|
787
|
+
local controllerStatic = spawnStatic:SpawnFromCoordinate(
|
|
788
|
+
AIRBASE:FindByName(elintnetworkconfig.controller.baseUnit):GetCoordinate():GetRandomCoordinateInRadius(
|
|
789
|
+
UTILS.NMToMeters(5),
|
|
790
|
+
UTILS.NMToMeters(3)
|
|
791
|
+
),
|
|
792
|
+
math.random(0,360),
|
|
793
|
+
controllerUnitName
|
|
794
|
+
)
|
|
795
|
+
elintNetworksArray[networkIndex].controllerMark = MARKER:New(
|
|
796
|
+
controllerStatic:GetCoordinate(),
|
|
797
|
+
string.format(
|
|
798
|
+
"ELINT-%s-ground-controller",
|
|
799
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
800
|
+
)
|
|
801
|
+
):ToCoalition(elintnetworkconfig.coalition)
|
|
802
|
+
return controllerStatic:GetName()
|
|
803
|
+
else
|
|
804
|
+
elintNetworksArray[networkIndex].controllerMark:UpdateCoordinate(
|
|
805
|
+
alreadySpawnedStaticController:GetCoordinate()
|
|
806
|
+
)
|
|
807
|
+
return alreadySpawnedStaticController:GetName()
|
|
808
|
+
end
|
|
809
|
+
end
|
|
810
|
+
|
|
811
|
+
function startElintController(networkIndex)
|
|
812
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
813
|
+
if (type(elintnetworkconfig.controller) == "table") then
|
|
814
|
+
if (type(elintnetworkconfig.controller.groupName) == "string") then
|
|
815
|
+
startElintAirborneController(networkIndex)
|
|
816
|
+
else
|
|
817
|
+
setupElintNetworkwithController(networkIndex, startElintStaticController(networkIndex))
|
|
818
|
+
end
|
|
819
|
+
jtff_log.info(
|
|
820
|
+
string.format(
|
|
821
|
+
'Controller start ELINT: Controller unit for %s network started !',
|
|
822
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
823
|
+
),
|
|
824
|
+
"ELINT"
|
|
825
|
+
)
|
|
826
|
+
elintNetworksArray[networkIndex].startNetworkCommandMenu:Remove()
|
|
827
|
+
elintNetworksArray[networkIndex].startNetworkCommandMenu = nil
|
|
828
|
+
elintNetworksArray[networkIndex].stopNetworkCommandMenu = MENU_COALITION_COMMAND:New(
|
|
829
|
+
elintnetworkconfig.coalition,
|
|
830
|
+
"Stop newtork",
|
|
831
|
+
elintNetworksArray[networkIndex].rootMenu,
|
|
832
|
+
stopElintNetwork,
|
|
833
|
+
networkIndex
|
|
834
|
+
)
|
|
835
|
+
jtff_log.info(
|
|
836
|
+
string.format(
|
|
837
|
+
'Controller start ELINT: network menu %s is updated !',
|
|
838
|
+
UTILS.GetCoalitionName(elintnetworkconfig.coalition)
|
|
839
|
+
),
|
|
840
|
+
"ELINT"
|
|
841
|
+
)
|
|
842
|
+
return elintNetworksArray[networkIndex].networkObject
|
|
843
|
+
else
|
|
844
|
+
jtff_log.error(
|
|
845
|
+
string.format(
|
|
846
|
+
'controller config: No controller paragraph in the network %i config...',
|
|
847
|
+
networkIndex
|
|
848
|
+
),
|
|
849
|
+
"ELINT"
|
|
850
|
+
)
|
|
851
|
+
return nil
|
|
852
|
+
end
|
|
853
|
+
end
|
|
854
|
+
|
|
855
|
+
function stopElintNetwork(networkIndex)
|
|
856
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
857
|
+
if (type(elintNetworksArray[networkIndex].controllerSpawnObject) == "table") then
|
|
858
|
+
if (type(elintNetworksArray[networkIndex].controllerGroup) == "table") then
|
|
859
|
+
local controllerRoute = {}
|
|
860
|
+
local controllerGroup = elintNetworksArray[networkIndex].controllerGroup
|
|
861
|
+
controllerGroup:ClearTasks()
|
|
862
|
+
table.insert(
|
|
863
|
+
controllerRoute,
|
|
864
|
+
AIRBASE:FindByName(elintnetworkconfig.controller.baseUnit)
|
|
865
|
+
:GetCoordinate()
|
|
866
|
+
:WaypointAirLanding(
|
|
867
|
+
UTILS.KnotsToKmph(elintnetworkconfig.controller.speed),
|
|
868
|
+
AIRBASE:FindByName(elintnetworkconfig.controller.baseUnit)
|
|
869
|
+
)
|
|
870
|
+
)
|
|
871
|
+
controllerGroup:Route(controllerRoute)
|
|
872
|
+
end
|
|
873
|
+
--elintNetworksArray[networkIndex].controllerSpawnObject:StopRepeat()
|
|
874
|
+
end
|
|
875
|
+
if (type(elintNetworksArray[networkIndex].controllerMark) ~= "nil") then
|
|
876
|
+
elintNetworksArray[networkIndex].controllerMark:Remove()
|
|
877
|
+
end
|
|
878
|
+
for indexPlatform, platformName in ipairs(elintNetworksArray[networkIndex].networkObject:listPlatforms()) do
|
|
879
|
+
elintNetworksArray[networkIndex].networkObject:removePlatform(platformName)
|
|
880
|
+
local platformUnitObject = UNIT:FindByName(platformName)
|
|
881
|
+
if (type(platformUnitObject) ~= "nil") then
|
|
882
|
+
platformUnitObject:GetGroup():RouteRTB(
|
|
883
|
+
AIRBASE:FindByName(elintNetworksArray[networkIndex].customconfig.controller.baseUnit)
|
|
884
|
+
)
|
|
885
|
+
end
|
|
886
|
+
end
|
|
887
|
+
elintNetworksArray[networkIndex].stopNetworkCommandMenu:Remove()
|
|
888
|
+
elintNetworksArray[networkIndex].stopNetworkCommandMenu = nil
|
|
889
|
+
elintNetworksArray[networkIndex].networkObject:removeController()
|
|
890
|
+
elintNetworksArray[networkIndex].networkObject:destroy()
|
|
891
|
+
elintNetworksArray[networkIndex].networkObject = nil
|
|
892
|
+
elintNetworksArray[networkIndex].rootMenu:Remove()
|
|
893
|
+
elintNetworksArray[networkIndex].rootMenu = nil
|
|
894
|
+
elintNetworksArray[networkIndex].controllerMark = nil
|
|
895
|
+
elintNetworksArray[networkIndex].controllerGroup = nil
|
|
896
|
+
elintNetworksArray[networkIndex].rootMenu = createELintRootMenu(networkIndex)
|
|
897
|
+
elintNetworksArray[networkIndex].networkObject = createHoundElintObject(networkIndex)
|
|
898
|
+
elintNetworksArray[networkIndex].startNetworkCommandMenu = MENU_COALITION_COMMAND:New(
|
|
899
|
+
elintnetworkconfig.coalition,
|
|
900
|
+
"Start newtork",
|
|
901
|
+
elintNetworksArray[networkIndex].rootMenu,
|
|
902
|
+
initializeElintNetwork,
|
|
903
|
+
networkIndex
|
|
904
|
+
)
|
|
905
|
+
end
|
|
906
|
+
|
|
907
|
+
function routeElintController(controllerGroup, configIndex)
|
|
908
|
+
local controllerRoute = {}
|
|
909
|
+
local networkConfig = elintNetworksArray[configIndex].customconfig
|
|
910
|
+
jtff_log.debug(
|
|
911
|
+
string.format(
|
|
912
|
+
'Airborne Controller routing : controller popped %s based on template %s',
|
|
913
|
+
controllerGroup:GetName(),
|
|
914
|
+
networkConfig.controller.groupName
|
|
915
|
+
),
|
|
916
|
+
"ELINT"
|
|
917
|
+
)
|
|
918
|
+
controllerGroup:ClearTasks()
|
|
919
|
+
table.insert(
|
|
920
|
+
controllerRoute,
|
|
921
|
+
AIRBASE:FindByName(networkConfig.controller.baseUnit)
|
|
922
|
+
:GetCoordinate()
|
|
923
|
+
:SetAltitude(UTILS.FeetToMeters(networkConfig.controller.altitude))
|
|
924
|
+
:WaypointAirTurningPoint(
|
|
925
|
+
nil,
|
|
926
|
+
UTILS.KnotsToKmph(networkConfig.controller.speed),
|
|
927
|
+
{
|
|
928
|
+
{
|
|
929
|
+
id = 'ControlledTask',
|
|
930
|
+
params = {
|
|
931
|
+
task =
|
|
932
|
+
{
|
|
933
|
+
id = 'Orbit',
|
|
934
|
+
params = {
|
|
935
|
+
pattern = AI.Task.OrbitPattern.RACE_TRACK,
|
|
936
|
+
speed = UTILS.KnotsToMps(networkConfig.controller.speed),
|
|
937
|
+
altitude = UTILS.FeetToMeters(networkConfig.controller.altitude)
|
|
938
|
+
}
|
|
939
|
+
},
|
|
940
|
+
stopCondition = {
|
|
941
|
+
duration = networkConfig.controller.missionmaxduration * 60
|
|
942
|
+
}
|
|
943
|
+
},
|
|
944
|
+
},
|
|
945
|
+
},
|
|
946
|
+
"Control Start"
|
|
947
|
+
)
|
|
948
|
+
)
|
|
949
|
+
table.insert(
|
|
950
|
+
controllerRoute,
|
|
951
|
+
AIRBASE:FindByName(networkConfig.controller.baseUnit)
|
|
952
|
+
:GetCoordinate()
|
|
953
|
+
:Translate(UTILS.NMToMeters(networkConfig.controller.orbit.length), networkConfig.controller.orbit.heading, true, false)
|
|
954
|
+
:SetAltitude(UTILS.FeetToMeters(networkConfig.controller.altitude))
|
|
955
|
+
:WaypointAirTurningPoint(
|
|
956
|
+
nil,
|
|
957
|
+
UTILS.KnotsToKmph(networkConfig.controller.speed),
|
|
958
|
+
{},
|
|
959
|
+
"Orbit End"
|
|
960
|
+
)
|
|
961
|
+
)
|
|
962
|
+
table.insert(
|
|
963
|
+
controllerRoute,
|
|
964
|
+
AIRBASE:FindByName(networkConfig.controller.baseUnit)
|
|
965
|
+
:GetCoordinate()
|
|
966
|
+
:WaypointAirLanding(
|
|
967
|
+
UTILS.KnotsToKmph(networkConfig.controller.speed),
|
|
968
|
+
AIRBASE:FindByName(networkConfig.controller.baseUnit)
|
|
969
|
+
)
|
|
970
|
+
)
|
|
971
|
+
controllerGroup:Route(controllerRoute)
|
|
972
|
+
jtff_log.debug(
|
|
973
|
+
string.format(
|
|
974
|
+
'Airborne Controller routing : controller %s routed',
|
|
975
|
+
controllerGroup:GetName()
|
|
976
|
+
),
|
|
977
|
+
"ELINT"
|
|
978
|
+
)
|
|
979
|
+
end
|
|
980
|
+
|
|
981
|
+
function createELintRootMenu(networkIndex)
|
|
982
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
983
|
+
jtff_log.info('ELINT RootMenu: creating for coalition '.. UTILS.GetCoalitionName(elintnetworkconfig.coalition) ..'...',"ELINT")
|
|
984
|
+
if (elintnetworkconfig.coalition == coalition.side.BLUE) then
|
|
985
|
+
return MENU_COALITION:New(coalition.side.BLUE, "OnDemand ELint", MenuCoalitionBlue)
|
|
986
|
+
elseif (elintnetworkconfig.coalition == coalition.side.RED) then
|
|
987
|
+
return MENU_COALITION:New(coalition.side.RED, "OnDemand ELint", MenuCoalitionRed)
|
|
988
|
+
elseif (elintnetworkconfig.coalition == coalition.side.NEUTRAL) then
|
|
989
|
+
return MENU_COALITION:New(coalition.side.NEUTRAL, "OnDemand ELint", MenuCoalitionNeutral)
|
|
990
|
+
else
|
|
991
|
+
jtff_log.error('ELINT RootMenu: error in the coalition config...',"ELINT")
|
|
992
|
+
return nil
|
|
993
|
+
end
|
|
994
|
+
end
|
|
995
|
+
|
|
996
|
+
function createHoundElintObject(networkIndex)
|
|
997
|
+
local elintnetworkconfig = elintNetworksArray[networkIndex].customconfig
|
|
998
|
+
return HoundElint:create(elintnetworkconfig.coalition)
|
|
999
|
+
end
|
|
1000
|
+
|
|
1001
|
+
--local RestrToCoal = nil
|
|
1002
|
+
elintNetworksArray = {}
|
|
1003
|
+
local compteur = 0
|
|
1004
|
+
|
|
1005
|
+
for indexElintNetwork, elintnetworkconfig in ipairs(elintConfig.networks) do
|
|
1006
|
+
if elintnetworkconfig.enabled == true then
|
|
1007
|
+
compteur = compteur + 1
|
|
1008
|
+
jtff_log.info('configuration ELINT : '.. UTILS.GetCoalitionName(elintnetworkconfig.coalition) ..'...',"ELINT")
|
|
1009
|
+
elintNetworksArray[compteur] = {
|
|
1010
|
+
customconfig = elintnetworkconfig,
|
|
1011
|
+
networkObject = nil,
|
|
1012
|
+
rootMenu = nil,
|
|
1013
|
+
controllerMark = nil,
|
|
1014
|
+
controllerSpawnObject = nil,
|
|
1015
|
+
controllerGroup = nil,
|
|
1016
|
+
startNetworkCommandMenu = nil,
|
|
1017
|
+
}
|
|
1018
|
+
elintNetworksArray[compteur].rootMenu = createELintRootMenu(compteur)
|
|
1019
|
+
elintNetworksArray[compteur].startNetworkCommandMenu = MENU_COALITION_COMMAND:New(
|
|
1020
|
+
elintnetworkconfig.coalition,
|
|
1021
|
+
"Start newtork",
|
|
1022
|
+
elintNetworksArray[compteur].rootMenu,
|
|
1023
|
+
initializeElintNetwork,
|
|
1024
|
+
compteur
|
|
1025
|
+
)
|
|
1026
|
+
end
|
|
1027
|
+
end
|
|
1028
|
+
|
|
1029
|
+
local elintMarkHandler = {}
|
|
1030
|
+
|
|
1031
|
+
function elintMarkHandler:onEvent(event)
|
|
1032
|
+
local elintCmdSymbol = "-"
|
|
1033
|
+
|
|
1034
|
+
if event.id == 25 then
|
|
1035
|
+
--trigger.action.outText(" ", 0, true)
|
|
1036
|
+
elseif (event.id == 27 and string.find(event.text, elintCmdSymbol)) then
|
|
1037
|
+
--if (event.coalition == RestrToCoal or RestrToCoal == nil) then
|
|
1038
|
+
local full = nil
|
|
1039
|
+
local remString = nil
|
|
1040
|
+
local cmd = nil
|
|
1041
|
+
local param1 = nil
|
|
1042
|
+
local param1Start = nil
|
|
1043
|
+
local param2 = nil
|
|
1044
|
+
local param2Start = nil
|
|
1045
|
+
local param3 = nil
|
|
1046
|
+
local param3Start = nil
|
|
1047
|
+
local param4 = nil
|
|
1048
|
+
local param4Start = nil
|
|
1049
|
+
local param5 = nil
|
|
1050
|
+
local param5Start = nil
|
|
1051
|
+
local param6 = nil
|
|
1052
|
+
local param6Start = nil
|
|
1053
|
+
local mcoord = COORDINATE:New(event.pos.x, event.pos.y, event.pos.z)
|
|
1054
|
+
local mvec3 = event.pos
|
|
1055
|
+
|
|
1056
|
+
full = string.sub(event.text, 2)
|
|
1057
|
+
|
|
1058
|
+
if (string.find(full, elintCmdSymbol)) then
|
|
1059
|
+
param1Start = string.find(full, elintCmdSymbol)
|
|
1060
|
+
cmd = string.sub(full, 0, param1Start-1)
|
|
1061
|
+
remString = string.sub(full, param1Start+1)
|
|
1062
|
+
if (string.find(remString, elintCmdSymbol)) then
|
|
1063
|
+
param2Start = string.find(remString, elintCmdSymbol)
|
|
1064
|
+
param1 = string.sub(remString, 0, param2Start-1)
|
|
1065
|
+
remString = string.sub(remString, param2Start+1)
|
|
1066
|
+
if string.find(remString, elintCmdSymbol) then
|
|
1067
|
+
param3Start = string.find(remString, elintCmdSymbol)
|
|
1068
|
+
param2 = string.sub(remString, 0, param3Start-1)
|
|
1069
|
+
remString = string.sub(remString, param3Start+1)
|
|
1070
|
+
if string.find(remString, elintCmdSymbol) then
|
|
1071
|
+
param4Start = string.find(remString, elintCmdSymbol)
|
|
1072
|
+
param3 = string.sub(remString, 0, param4Start-1)
|
|
1073
|
+
remString = string.sub(remString, param4Start+1)
|
|
1074
|
+
|
|
1075
|
+
if string.find(remString, elintCmdSymbol) then
|
|
1076
|
+
param5Start = string.find(remString, elintCmdSymbol)
|
|
1077
|
+
param4 = string.sub(remString, 0, param5Start-1)
|
|
1078
|
+
remString = string.sub(remString, param5Start+1)
|
|
1079
|
+
|
|
1080
|
+
if string.find(remString, elintCmdSymbol) then
|
|
1081
|
+
param6Start = string.find(remString, elintCmdSymbol)
|
|
1082
|
+
param5 = string.sub(remString, 0, param6Start-1)
|
|
1083
|
+
param6 = string.sub(remString, param6Start+1)
|
|
1084
|
+
else
|
|
1085
|
+
param5 = remString
|
|
1086
|
+
end
|
|
1087
|
+
else
|
|
1088
|
+
param4 = remString
|
|
1089
|
+
end
|
|
1090
|
+
else
|
|
1091
|
+
param3 = remString
|
|
1092
|
+
end
|
|
1093
|
+
else
|
|
1094
|
+
param2 = remString
|
|
1095
|
+
end
|
|
1096
|
+
else
|
|
1097
|
+
param1 = remString
|
|
1098
|
+
end
|
|
1099
|
+
else
|
|
1100
|
+
cmd = full
|
|
1101
|
+
end
|
|
1102
|
+
if log_levels[JTFF_LOGLEVEL] <= log_levels['debug'] then
|
|
1103
|
+
trigger.action.outText("Full Text = " .. full, 10)
|
|
1104
|
+
trigger.action.outText("Command = " .. cmd, 10)
|
|
1105
|
+
if param1 ~= nil then trigger.action.outText("type = " .. param1, 10) end
|
|
1106
|
+
if param2 ~= nil then trigger.action.outText("Duration = " .. param2, 10) end
|
|
1107
|
+
if param3 ~= nil then trigger.action.outText("FlightLevel = " .. param3, 10) end
|
|
1108
|
+
if param4 ~= nil then trigger.action.outText("Speed = " .. param4, 10) end
|
|
1109
|
+
if param5 ~= nil then trigger.action.outText("OrbitHeading = " .. param5, 10) end
|
|
1110
|
+
if param6 ~= nil then trigger.action.outText("OrbitLeg = " .. param6, 10) end
|
|
1111
|
+
end
|
|
1112
|
+
|
|
1113
|
+
if string.find(cmd, "elint") then
|
|
1114
|
+
if log_levels[JTFF_LOGLEVEL] <= log_levels['debug'] then
|
|
1115
|
+
trigger.action.outText("DEBUG: On Demand ELint Started!", 10)
|
|
1116
|
+
end
|
|
1117
|
+
triggerOnDemandElintPlatform(
|
|
1118
|
+
param1,
|
|
1119
|
+
tonumber(param2),
|
|
1120
|
+
tonumber(param3),
|
|
1121
|
+
tonumber(param4),
|
|
1122
|
+
mcoord,
|
|
1123
|
+
tonumber(param5),
|
|
1124
|
+
tonumber(param6)
|
|
1125
|
+
)
|
|
1126
|
+
end
|
|
1127
|
+
--end
|
|
1128
|
+
end
|
|
1129
|
+
|
|
1130
|
+
end
|
|
1131
|
+
|
|
1132
|
+
world.addEventHandler(elintMarkHandler)
|
package/package.json
CHANGED
|
@@ -451,6 +451,10 @@ async function doInject(ciObject, sourceMizFileName, workspacePath,destinationMi
|
|
|
451
451
|
file: "settings-fac_ranges.lua",
|
|
452
452
|
objectName: "FACRangeConfig"
|
|
453
453
|
},
|
|
454
|
+
{
|
|
455
|
+
file: "settings-elint.lua",
|
|
456
|
+
objectName: "elintConfig"
|
|
457
|
+
},
|
|
454
458
|
{
|
|
455
459
|
file: "settings-skynet.lua",
|
|
456
460
|
objectName: "SkynetConfig"
|
|
@@ -459,7 +463,7 @@ async function doInject(ciObject, sourceMizFileName, workspacePath,destinationMi
|
|
|
459
463
|
scriptsArray.push({
|
|
460
464
|
folder: 'src',
|
|
461
465
|
scriptTitle: 'Air To Ground',
|
|
462
|
-
scripts: ['190-ranges.lua', '191-sams.lua', '193-training_ranges.lua', '195-reaper-ondemand.lua', '196-fac_ranges.lua', '199-skynet.lua'],
|
|
466
|
+
scripts: ['190-ranges.lua', '191-sams.lua', '193-training_ranges.lua', '195-reaper-ondemand.lua', '196-fac_ranges.lua', '197-elint-ondemand.lua', '199-skynet.lua'],
|
|
463
467
|
timing: 29,
|
|
464
468
|
color: '0xff0000ff',
|
|
465
469
|
fromLibrary: true
|