@jtff/miztemplate-lib 3.1.9 → 3.1.10

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.
@@ -21,15 +21,15 @@ function attachSAMSiteToSkynet(site, samGroupName, IADSObjectIndex, connectionNo
21
21
  local skynetSam = IADSArray[IADSObjectIndex].IADSObject:getSAMSiteByGroupName(samGroupName)
22
22
  skynetSam:addConnectionNode(StaticObject.getByName(connectionNode))
23
23
  if (type(site.actAsEW) == "boolean") then
24
- debug_msg(string.format("IADS - actAsEW %s", tostring(site.actAsEW)))
24
+ jtff_log.info(string.format("actAsEW %s", tostring(site.actAsEW)),"IADS")
25
25
  skynetSam:setActAsEW(site.actAsEW)
26
26
  end
27
27
  if (type(site.harmDetectionChance) == "number") then
28
- debug_msg(string.format("IADS - HARM detection chance : %i", site.harmDetectionChance))
28
+ jtff_log.info(string.format("HARM detection chance : %i", site.harmDetectionChance),"IADS")
29
29
  skynetSam:setHARMDetectionChance(site.harmDetectionChance)
30
30
  end
31
31
  if (type(site.goLiveRangePercent) == "number") then
32
- debug_msg(string.format("IADS - Go Live Range : %i perc", site.goLiveRangePercent))
32
+ jtff_log.info(string.format("Go Live Range : %i perc", site.goLiveRangePercent),"IADS")
33
33
  skynetSam
34
34
  :setEngagementZone(SkynetIADSAbstractRadarElement.GO_LIVE_WHEN_IN_SEARCH_RANGE)
35
35
  :setGoLiveRangeInPercent(site.goLiveRangePercent)
@@ -47,15 +47,15 @@ function attachPdSiteToSkynet(site, pdGroupName, samGroupName, IADSObjectIndex,
47
47
  local skynetPdSam = IADSArray[IADSObjectIndex].IADSObject:getSAMSiteByGroupName(pdGroupName)
48
48
  skynetPdSam:addConnectionNode(StaticObject.getByName(connectionNode))
49
49
  if (type(site.pdactAsEw) == "boolean") then
50
- debug_msg(string.format("IADS - actAsEW %s", tostring(site.pdactAsEw)))
50
+ jtff_log.info(string.format("actAsEW %s", tostring(site.pdactAsEw)),"IADS")
51
51
  skynetPdSam:setActAsEW(site.pdactAsEw)
52
52
  end
53
53
  if (type(site.pdharmDetectionChance) == "number") then
54
- debug_msg(string.format("IADS - HARM detection chance : %i", site.pdharmDetectionChance))
54
+ jtff_log.info(string.format("HARM detection chance : %i", site.pdharmDetectionChance),"IADS")
55
55
  skynetPdSam:setHARMDetectionChance(site.pdharmDetectionChance)
56
56
  end
57
57
  if (type(site.pdgoLiveRangePercent) == "number") then
58
- debug_msg(string.format("IADS - Go Live Range : %i perc", site.pdgoLiveRangePercent))
58
+ jtff_log.info(string.format("Go Live Range : %i perc", site.pdgoLiveRangePercent),"IADS")
59
59
  skynetPdSam
60
60
  :setEngagementZone(SkynetIADSAbstractRadarElement.GO_LIVE_WHEN_IN_SEARCH_RANGE)
61
61
  :setGoLiveRangeInPercent(site.pdgoLiveRangePercent)
@@ -63,22 +63,22 @@ function attachPdSiteToSkynet(site, pdGroupName, samGroupName, IADSObjectIndex,
63
63
  skynetPdSam
64
64
  :setEngagementZone(SkynetIADSAbstractRadarElement.GO_LIVE_WHEN_IN_SEARCH_RANGE)
65
65
  end
66
- debug_msg(string.format("IADS - Point Defense Sam Group %s Defending SAM %s", pdGroupName, samGroupName))
66
+ jtff_log.info(string.format("Point Defense Sam Group %s Defending SAM %s", pdGroupName, samGroupName),"IADS")
67
67
  skynetSam:addPointDefence(skynetPdSam)
68
68
  elseif (type(site.pointDefenses) == "table") then
69
69
  IADSArray[IADSObjectIndex].IADSObject:addSAMSite(pdGroupName)
70
70
  local skynetPdSam = IADSArray[IADSObjectIndex].IADSObject:getSAMSiteByGroupName(pdGroupName)
71
71
  skynetPdSam:addConnectionNode(StaticObject.getByName(connectionNode))
72
72
  if (type(site.pdactAsEw) == "boolean") then
73
- debug_msg(string.format("IADS - actAsEW %s", tostring(site.pdactAsEw)))
73
+ jtff_log.info(string.format("actAsEW %s", tostring(site.pdactAsEw)),"IADS")
74
74
  skynetPdSam:setActAsEW(site.pdactAsEw)
75
75
  end
76
76
  if (type(site.pdharmDetectionChance) == "number") then
77
- debug_msg(string.format("IADS - HARM detection chance : %i", site.pdharmDetectionChance))
77
+ jtff_log.info(string.format("HARM detection chance : %i", site.pdharmDetectionChance),"IADS")
78
78
  skynetPdSam:setHARMDetectionChance(site.pdharmDetectionChance)
79
79
  end
80
80
  if (type(site.pdgoLiveRangePercent) == "number") then
81
- debug_msg(string.format("IADS - Go Live Range : %i perc", site.pdgoLiveRangePercent))
81
+ jtff_log.info(string.format("Go Live Range : %i perc", site.pdgoLiveRangePercent),"IADS")
82
82
  skynetPdSam
83
83
  :setEngagementZone(SkynetIADSAbstractRadarElement.GO_LIVE_WHEN_IN_SEARCH_RANGE)
84
84
  :setGoLiveRangeInPercent(site.pdgoLiveRangePercent)
@@ -86,7 +86,7 @@ function attachPdSiteToSkynet(site, pdGroupName, samGroupName, IADSObjectIndex,
86
86
  skynetPdSam
87
87
  :setEngagementZone(SkynetIADSAbstractRadarElement.GO_LIVE_WHEN_IN_SEARCH_RANGE)
88
88
  end
89
- debug_msg(string.format("IADS - Point Defense Sam Group %s Defending SAM %s", pdGroupName, samGroupName))
89
+ jtff_log.info(string.format("Point Defense Sam Group %s Defending SAM %s", pdGroupName, samGroupName),"IADS")
90
90
  skynetSam:addPointDefence(skynetPdSam)
91
91
  end
92
92
  end
@@ -109,29 +109,24 @@ function SpawnIADSUnits(param)
109
109
  local connection = nodeConfig.connection
110
110
  if (type(connection) == "table") then
111
111
  if ( connection.type ~= nil and connection.category ~= nil and connection.name ~= nil ) then
112
- local staticTypeToSpawn = string.format("%s", connection.type)
113
- local staticCategoryToSpawn = string.format("%s", connection.category)
114
- local spawnStatic = SPAWNSTATIC:NewFromType(staticTypeToSpawn, staticCategoryToSpawn)
112
+ local spawnStatic
113
+ spawnStatic = SPAWNSTATIC:NewFromType(connection.type, connection.category)
115
114
  if (connection.coalition ~= nil) then
116
115
  if (connection.coalition == coalition.side.BLUE) then
117
- spawnStatic = SPAWNSTATIC:NewFromType(staticTypeToSpawn, staticCategoryToSpawn,
118
- country.id.CJTF_BLUE)
116
+ spawnStatic = SPAWNSTATIC:NewFromType(connection.type, connection.category,
117
+ country.id.CJTF_BLUE)
119
118
  elseif (connection.coalition == coalition.side.RED) then
120
- spawnStatic = SPAWNSTATIC:NewFromType(staticTypeToSpawn, staticCategoryToSpawn,
121
- country.id.CJTF_RED)
119
+ spawnStatic = SPAWNSTATIC:NewFromType(connection.type, connection.category,
120
+ country.id.CJTF_RED)
122
121
  else
123
- spawnStatic = SPAWNSTATIC:NewFromType(staticTypeToSpawn, staticCategoryToSpawn,
124
- country.id.UN_PEACEKEEPERS)
122
+ spawnStatic = SPAWNSTATIC:NewFromType(connection.type, connection.category,
123
+ country.id.UN_PEACEKEEPERS)
125
124
  end
126
125
  end
127
- local x = connection.x
128
- local y = connection.y
129
- local heading = connection.heading
130
- local name = string.format("%s", connection.name)
131
- debug_msg(string.format("Static type to spawn %s at %i,%i -> %s", staticTypeToSpawn, x, y, name))
132
- local static = spawnStatic:SpawnFromPointVec2(POINT_VEC2:New(x, y), heading, name)
126
+ jtff_log.info(string.format("Static type to spawn %s at %i,%i -> %s", connection.type, connection.x, connection.y, connection.name),"IADS")
127
+ spawnStatic:SpawnFromPointVec2(POINT_VEC2:New(connection.x, connection.y), connection.heading, connection.name)
133
128
  else
134
- debug_msg(string.format("Static to spawn has no type, category, name or position!"))
129
+ jtff_log.error(string.format("Static to spawn has no type, category, name or position!"),"IADS")
135
130
  end
136
131
  end
137
132
  local ewrList = nodeConfig.ewrs
@@ -141,10 +136,10 @@ function SpawnIADSUnits(param)
141
136
  local groupNameToSpawn = string.format("%s", ewrGroup)
142
137
  if (GROUP:FindByName(groupNameToSpawn) ~= nil) then
143
138
  local spawnGroup = SPAWN:New(groupNameToSpawn)
144
- debug_msg(string.format("IADS - SPAWN EWR : %s", groupNameToSpawn))
139
+ jtff_log.info(string.format("SPAWN EWR : %s", groupNameToSpawn),"IADS")
145
140
  local groupSpawning = spawnGroup:Spawn():OptionAlarmStateRed()
146
141
  else
147
- debug_msg(string.format("IADS - EWR GROUP to spawn %s not found in mission", groupNameToSpawn))
142
+ jtff_log.error(string.format("EWR GROUP to spawn %s not found in mission", groupNameToSpawn),"IADS")
148
143
  end
149
144
  end
150
145
  end
@@ -154,16 +149,16 @@ function SpawnIADSUnits(param)
154
149
  local groupNameToSpawn = string.format("%s", site)
155
150
  if (GROUP:FindByName(groupNameToSpawn) ~= nil) then
156
151
  local spawnGroup = SPAWN:New(groupNameToSpawn)
157
- debug_msg(string.format("IADS - SPAWN SAM : %s", groupNameToSpawn))
152
+ jtff_log.info(string.format("SPAWN SAM : %s", groupNameToSpawn),"IADS")
158
153
  samGroupsSpawned[siteIndex] = spawnGroup:Spawn():OptionAlarmStateRed()
159
154
  --if (IADSArray[IADSObjectIndex].IADSNetworkRunning) then
160
155
  -- attachSAMSiteToSkynet(site, samGroupsSpawned[siteIndex]:GetName(), IADSObjectIndex, nodeConfig.connection)
161
156
  --end
162
157
  else
163
- debug_msg(string.format("IADS - SAM GROUP to spawn %s not found in mission", groupNameToSpawn))
158
+ jtff_log.error(string.format("SAM GROUP to spawn %s not found in mission", groupNameToSpawn),"IADS")
164
159
  end
165
160
  elseif (type(site) == "table") then
166
- debug_msg(string.format("IADS - SAM in config file is table"))
161
+ jtff_log.debug(string.format("SAM in config file is table"),"IADS")
167
162
  if (site.staticsToSpawn ~= nil) then
168
163
  for index, staticToSpawn in ipairs(site.staticsToSpawn) do
169
164
  local spawnStatic = nil
@@ -184,7 +179,7 @@ function SpawnIADSUnits(param)
184
179
  local heading = staticToSpawn.heading
185
180
  local name = string.format("%s_%s_%i", site.sam, staticNameToSpawn,index)
186
181
  local static = spawnStatic:SpawnFromPointVec2( POINT_VEC2:New( x, y ), heading, name )
187
- debug_msg(string.format("IADS - Static %s to spawn at %i,%i -> %s", static:GetDCSObject():getTypeName(), x, y, static:GetDCSObject():getName()))
182
+ jtff_log.info(string.format("Static %s to spawn at %i,%i -> %s", static:GetDCSObject():getTypeName(), x, y, static:GetDCSObject():getName()),"IADS")
188
183
  elseif (staticToSpawn.type ~= nil and staticToSpawn.category ~= nil) then
189
184
  local staticTypeToSpawn = string.format("%s", staticToSpawn.type)
190
185
  local staticCategoryToSpawn = string.format("%s", staticToSpawn.category)
@@ -203,9 +198,9 @@ function SpawnIADSUnits(param)
203
198
  local heading = staticToSpawn.heading
204
199
  local name = string.format("%s_%s_%i", site.sam, staticTypeToSpawn, index)
205
200
  local static = spawnStatic:SpawnFromPointVec2( POINT_VEC2:New( x, y ), heading, name )
206
- debug_msg(string.format("IADS - Static %s to spawn at %i,%i -> %s", static:GetDCSObject():getTypeName(), x, y, static:GetDCSObject():getName()))
201
+ jtff_log.info(string.format("Static %s to spawn at %i,%i -> %s", static:GetDCSObject():getTypeName(), x, y, static:GetDCSObject():getName()),"IADS")
207
202
  else
208
- debug_msg(string.format("IADS - Static to spawn has no name or type!"))
203
+ jtff_log.error(string.format("Static to spawn has no name or type!"),"IADS")
209
204
  end
210
205
  end
211
206
  end
@@ -213,25 +208,25 @@ function SpawnIADSUnits(param)
213
208
  local groupNameToSpawn = string.format("%s", site.sam)
214
209
  if (GROUP:FindByName(groupNameToSpawn) ~= nil) then
215
210
  local spawnGroup = SPAWN:New(groupNameToSpawn)
216
- debug_msg(string.format("IADS - SPAWN SAM : %s", groupNameToSpawn))
211
+ jtff_log.info(string.format("SPAWN SAM : %s", groupNameToSpawn),"IADS")
217
212
  samGroupsSpawned[siteIndex] = spawnGroup:Spawn():OptionAlarmStateRed()
218
213
  --if (IADSArray[IADSObjectIndex].IADSNetworkRunning) then
219
214
  -- attachSAMSiteToSkynet(site, samGroupsSpawned[siteIndex]:GetName(), IADSObjectIndex, nodeConfig.connection)
220
215
  --end
221
216
  else
222
- debug_msg(string.format("IADS - SAM GROUP to spawn %s not found in mission", groupNameToSpawn))
217
+ jtff_log.error(string.format("SAM GROUP to spawn %s not found in mission", groupNameToSpawn),"IADS")
223
218
  end
224
219
  if (type(site.pointDefenses) == "string") then
225
220
  local pdGroupNameToSpawn = string.format("%s", site.pointDefenses)
226
221
  if (GROUP:FindByName(pdGroupNameToSpawn) ~= nil) then
227
222
  local spawnGroup = SPAWN:New(pdGroupNameToSpawn)
228
- debug_msg(string.format("IADS - SPAWN SAM-PointDefense : %s", pdGroupNameToSpawn))
223
+ jtff_log.info(string.format("SPAWN SAM-PointDefense : %s", pdGroupNameToSpawn),"IADS")
229
224
  local pdSamGroupsSpawned = spawnGroup:Spawn():OptionAlarmStateRed()
230
225
  --if (IADSArray[IADSObjectIndex].IADSNetworkRunning) then
231
226
  -- attachPdSiteToSkynet(site, pdSamGroupsSpawned:GetName(), samGroupsSpawned[siteIndex]:GetName(), IADSObjectIndex, nodeConfig.connection)
232
227
  --end
233
228
  else
234
- debug_msg(string.format("IADS - SAM-PointDefense GROUP to spawn %s not found in mission", pdGroupNameToSpawn))
229
+ jtff_log.error(string.format("SAM-PointDefense GROUP to spawn %s not found in mission", pdGroupNameToSpawn),"IADS")
235
230
  end
236
231
  elseif (type(site.pointDefenses) == "table") then
237
232
  local pdSamGroupsSpawned = {}
@@ -239,13 +234,13 @@ function SpawnIADSUnits(param)
239
234
  local pdGroupNameToSpawn = string.format("%s", pdSamGroup)
240
235
  if (GROUP:FindByName(pdGroupNameToSpawn) ~= nil) then
241
236
  local spawnGroup = SPAWN:New(pdGroupNameToSpawn)
242
- debug_msg(string.format("IADS - SPAWN SAM-PointDefense : %s", pdGroupNameToSpawn))
237
+ jtff_log.info(string.format("SPAWN SAM-PointDefense : %s", pdGroupNameToSpawn),"IADS")
243
238
  pdSamGroupsSpawned[pdindex] = spawnGroup:Spawn():OptionAlarmStateRed()
244
239
  --if (IADSArray[IADSObjectIndex].IADSNetworkRunning) then
245
240
  -- attachPdSiteToSkynet(site, pdSamGroupsSpawned[pdindex]:GetName(), samGroupsSpawned[siteIndex]:GetName(), IADSObjectIndex, nodeConfig.connection)
246
241
  --end
247
242
  else
248
- debug_msg(string.format("IADS - SAM-PointDefense GROUP to spawn %s not found in mission", pdGroupNameToSpawn))
243
+ jtff_log.error(string.format("SAM-PointDefense GROUP to spawn %s not found in mission", pdGroupNameToSpawn),"IADS")
249
244
  end
250
245
  end
251
246
  end
@@ -265,7 +260,7 @@ function SpawnIADSUnits(param)
265
260
  skynetUpdateDisplay({ IADSObjectIndex,'contacts',showContactsOption })
266
261
  skynetUpdateDisplay({ IADSObjectIndex,'IADSStatus',showStatusOption })
267
262
  end
268
- debug_msg(string.format("IADS - Spawn IADS : %s-[%s] DONE", iadsName, difficulty))
263
+ jtff_log.info(string.format("Spawn IADS : %s-[%s] DONE", iadsName, difficulty),"IADS")
269
264
  manageIADSNetworkMenu(parentMenu,iadsConfig,IADSObjectIndex)
270
265
  MESSAGE:NewType(string.format("IADS - IADS Units %s-[%s] in place", iadsName, difficulty), MESSAGE.Type.Information):ToCoalition(iadsConfig.benefit_coalition)
271
266
  end
@@ -277,16 +272,21 @@ function deleteIADSNetwork(param)
277
272
  local iadsName = iadsConfig.name
278
273
  local nodesConfig = iadsConfig.nodes
279
274
  local skynetIADSObject = IADSArray[IADSObjectIndex].IADSObject
275
+ local gciDispatcherObject = IADSArray[IADSObjectIndex].GCIDispatcherObject
280
276
  local difficultyArray = {"easy","medium","hard","extreme"}
281
277
 
282
- if (skynetIADSObject ~= nil) then
278
+ if (skynetIADSObject ~= nil and IADSArray[IADSObjectIndex].IADSNetworkRunning == true) then
283
279
  deactivateSkynet({ iadsConfig, IADSObjectIndex, networkRootMenu })
284
280
  end
281
+ if (gciDispatcherObject ~= nil and IADSArray[IADSObjectIndex].GCIRunning == true) then
282
+ deactivateGCI({ iadsConfig, IADSObjectIndex, networkRootMenu })
283
+ end
285
284
  for index, difficulty in ipairs(difficultyArray) do
286
285
  param[4] = difficulty
287
286
  deleteIADSUnits(param)
288
287
  end
289
288
  IADSArray[IADSObjectIndex].IADSNetworkRunning = false
289
+ IADSArray[IADSObjectIndex].GCIRunning = false
290
290
  MESSAGE:NewType(string.format("IADS - Remove IADS : %s", iadsName), MESSAGE.Type.Information):ToCoalition(iadsConfig.benefit_coalition)
291
291
  manageIADSNetworkMenu(networkRootMenu, iadsConfig, IADSObjectIndex)
292
292
  end
@@ -315,34 +315,49 @@ function skynetUpdateDisplay(param)
315
315
  })
316
316
  end
317
317
 
318
+ function deactivateGCI(param)
319
+ local iadsConfig = param[1]
320
+ local IADSObjectIndex = param[2]
321
+ local parentMenu = param[3]
322
+ jtff_log.info(string.format("GCI De-activation for %s", iadsConfig.name),"IADS")
323
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:Stop()
324
+ IADSArray[IADSObjectIndex].GCIRunning = false
325
+ manageIADSNetworkMenu(parentMenu, iadsConfig, IADSObjectIndex)
326
+ end
327
+
318
328
  function activateGCI(param)
319
329
  local iadsConfig = param[1]
320
330
  local IADSObjectIndex = param[2]
321
331
  local parentMenu = param[3]
322
- debug_msg(string.format("IADS - GCI activation for %s", iadsConfig.name))
323
-
324
- DetectionSetGroup = SET_GROUP:New()
325
- IADSArray[IADSObjectIndex].IADSObject:addMooseSetGroup(DetectionSetGroup)
326
- Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 )
327
- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
328
- A2ADispatcher:SetEngageRadius() -- 100000 is the default value.
329
- if (iadsConfig.gci_engage_radius) then
330
- A2ADispatcher:SetGciRadius(iadsConfig.gci_engage_radius)
332
+ jtff_log.info(string.format("GCI activation for %s", iadsConfig.name),"IADS")
333
+ if (IADSArray[IADSObjectIndex].GCIDispatcherObject ~= nil) then
334
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:Start()
331
335
  else
332
- A2ADispatcher:SetGciRadius()
333
- end
334
- CCCPBorderZone = ZONE_POLYGON:New( iadsConfig.gci_border , GROUP:FindByName( iadsConfig.gci_border ) )
335
- A2ADispatcher:SetBorderZone( CCCPBorderZone )
336
+ DetectionSetGroup = SET_GROUP:New()
337
+ IADSArray[IADSObjectIndex].IADSObject:addMooseSetGroup(DetectionSetGroup)
338
+ IADSArray[IADSObjectIndex].GCIDetectionArea = DETECTION_AREAS:New( DetectionSetGroup, 30000 )
339
+ IADSArray[IADSObjectIndex].GCIDispatcherObject = AI_A2A_DISPATCHER:New( IADSArray[IADSObjectIndex].GCIDetectionArea )
340
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetEngageRadius() -- 100000 is the default value.
341
+ if (iadsConfig.gci_engage_radius) then
342
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetGciRadius(iadsConfig.gci_engage_radius)
343
+ else
344
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetGciRadius()
345
+ end
346
+ CCCPBorderZone = ZONE_POLYGON:New( iadsConfig.gci_border , GROUP:FindByName( iadsConfig.gci_border ) )
347
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetBorderZone( CCCPBorderZone )
336
348
 
337
- A2ADispatcher:SetDefaultTakeoffFromRunway()
338
- A2ADispatcher:SetDefaultLandingAtRunway()
349
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetDefaultTakeoffFromRunway()
350
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetDefaultLandingAtRunway()
339
351
 
340
- for index, gci_group in ipairs(iadsConfig.gci) do
341
- gci_group_name = string.format("GCI_%s", gci_group.airport)
342
- debug_msg(string.format("IADS - GCI - Group %s", gci_group_name))
343
- A2ADispatcher:SetSquadron( gci_group_name, gci_group.airport, gci_group.templatePrefixes, gci_group.numberOfAircraftAvailable )
344
- A2ADispatcher:SetSquadronGci( gci_group_name, 1000, 3000 )
352
+ for index, gci_group in ipairs(iadsConfig.gci) do
353
+ gci_group_name = string.format("GCI_%s", gci_group.airport)
354
+ jtff_log.info(string.format("GCI - Group %s", gci_group_name),"IADS")
355
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetSquadron( gci_group_name, gci_group.airport, gci_group.templatePrefixes, gci_group.numberOfAircraftAvailable )
356
+ IADSArray[IADSObjectIndex].GCIDispatcherObject:SetSquadronGci( gci_group_name, 1000, 3000 )
357
+ end
345
358
  end
359
+ IADSArray[IADSObjectIndex].GCIRunning = true
360
+ manageIADSNetworkMenu(parentMenu, iadsConfig, IADSObjectIndex)
346
361
  MESSAGE:NewType(string.format("IADS - GCI of %s is activated", iadsConfig.name), MESSAGE.Type.Information):ToCoalition(iadsConfig.benefit_coalition)
347
362
  end
348
363
 
@@ -351,26 +366,32 @@ function activateSkynet(param)
351
366
  local IADSObjectIndex = param[2]
352
367
  local parentMenu = param[3]
353
368
  local difficultyArray = {"easy","medium","hard","extreme"}
354
- debug_msg(string.format("IADS - Skynet activation for %s", iadsConfig.name))
369
+ jtff_log.info(string.format("Skynet activation for %s", iadsConfig.name),"IADS")
355
370
  -- create an instance of the IADS
356
371
  IADSArray[IADSObjectIndex].IADSObject = SkynetIADS:create(iadsConfig.name)
357
372
 
358
373
  ---debug settings remove from here on if you do not wan't any output on what the IADS is doing by default
359
374
  local iadsDebug = IADSArray[IADSObjectIndex].IADSObject:getDebugSettings()
360
- iadsDebug.IADSStatus = DEBUG_MSG
361
- iadsDebug.radarWentDark = DEBUG_MSG
362
- iadsDebug.contacts = DEBUG_MSG
363
- iadsDebug.radarWentLive = DEBUG_MSG
364
- iadsDebug.noWorkingCommmandCenter = DEBUG_MSG
365
- iadsDebug.ewRadarNoConnection = DEBUG_MSG
366
- iadsDebug.samNoConnection = DEBUG_MSG
367
- iadsDebug.jammerProbability = DEBUG_MSG
368
- iadsDebug.addedEWRadar = DEBUG_MSG
369
- iadsDebug.hasNoPower = DEBUG_MSG
370
- iadsDebug.harmDefence = DEBUG_MSG
371
- iadsDebug.samSiteStatusEnvOutput = DEBUG_MSG
372
- iadsDebug.earlyWarningRadarStatusEnvOutput = DEBUG_MSG
373
- iadsDebug.commandCenterStatusEnvOutput = DEBUG_MSG
375
+ local DEBUG_IADS
376
+ if log_levels[JTFF_LOGLEVEL] <= log_levels['debug'] then
377
+ DEBUG_IADS=true
378
+ else
379
+ DEBUG_IADS=false
380
+ end
381
+ iadsDebug.IADSStatus = DEBUG_IADS
382
+ iadsDebug.radarWentDark = DEBUG_IADS
383
+ iadsDebug.contacts = DEBUG_IADS
384
+ iadsDebug.radarWentLive = DEBUG_IADS
385
+ iadsDebug.noWorkingCommmandCenter = DEBUG_IADS
386
+ iadsDebug.ewRadarNoConnection = DEBUG_IADS
387
+ iadsDebug.samNoConnection = DEBUG_IADS
388
+ iadsDebug.jammerProbability = DEBUG_IADS
389
+ iadsDebug.addedEWRadar = DEBUG_IADS
390
+ iadsDebug.hasNoPower = DEBUG_IADS
391
+ iadsDebug.harmDefence = DEBUG_IADS
392
+ iadsDebug.samSiteStatusEnvOutput = DEBUG_IADS
393
+ iadsDebug.earlyWarningRadarStatusEnvOutput = DEBUG_IADS
394
+ iadsDebug.commandCenterStatusEnvOutput = DEBUG_IADS
374
395
  ---end remove debug ---
375
396
 
376
397
  -- add a command center:
@@ -386,15 +407,15 @@ function activateSkynet(param)
386
407
  else
387
408
  connectionName = node.connection.name
388
409
  end
389
- debug_msg(string.format("IADS - Connection Node %s", connectionName))
410
+ jtff_log.info(string.format("Connection Node %s", connectionName),"IADS")
390
411
  local connectionNode = StaticObject.getByName(connectionName)
391
412
  for index, ewr in ipairs(node.ewrs) do
392
413
  if (ewr ~= nil and connectionNode ~= nil) then
393
- debug_msg(string.format("IADS - EWR Unit name in config file : %s", ewr))
414
+ jtff_log.info(string.format("EWR Unit name in config file : %s", ewr),"IADS")
394
415
  local set_ewr_units = SET_UNIT:New():FilterPrefixes(ewr):FilterOnce()
395
416
  set_ewr_units:ForEachUnit(function(ewr_alive)
396
417
  if ewr_alive:IsAlive() then
397
- debug_msg(string.format("IADS - Alive EWR Unit name found %s", ewr_alive:Name()))
418
+ jtff_log.info(string.format("Alive EWR Unit name found %s", ewr_alive:Name()),"IADS")
398
419
  IADSArray[IADSObjectIndex].IADSObject:addEarlyWarningRadar(ewr_alive:Name())
399
420
  IADSArray[IADSObjectIndex].IADSObject:getEarlyWarningRadarByUnitName(ewr_alive:Name()):addConnectionNode(connectionNode)
400
421
  end
@@ -406,30 +427,30 @@ function activateSkynet(param)
406
427
  for siteIndex, site in ipairs(node.sites[difficulty]) do
407
428
  if (site ~= nil and connectionNode ~= nil) then
408
429
  if (type(site) == "string") then
409
- debug_msg(string.format("IADS - Sam Group name in config file : %s", site))
430
+ jtff_log.info(string.format("Sam Group name in config file : %s", site),"IADS")
410
431
  local set_group_alive = SET_GROUP:New():FilterPrefixes(site):FilterOnce()
411
432
  set_group_alive:ForEachGroupAlive(function(group_alive)
412
- debug_msg(string.format("IADS - Alive Sam Group found %s", group_alive:GetName()))
433
+ jtff_log.info(string.format("Alive Sam Group found %s", group_alive:GetName()),"IADS")
413
434
  attachSAMSiteToSkynet(site, group_alive:GetName(), IADSObjectIndex, connectionName)
414
435
  end)
415
436
  elseif (type(site) == "table") then
416
- debug_msg(string.format("IADS - Sam Group name in config file : %s", site.sam))
437
+ jtff_log.info(string.format("Sam Group name in config file : %s", site.sam),"IADS")
417
438
  local set_group_alive = SET_GROUP:New():FilterPrefixes(site.sam):FilterOnce()
418
439
  set_group_alive:ForEachGroupAlive(function(samGroupAlive)
419
- debug_msg(string.format("IADS - Alive Sam Group found %s", samGroupAlive:GetName()))
440
+ jtff_log.info(string.format("Alive Sam Group found %s", samGroupAlive:GetName()),"IADS")
420
441
  attachSAMSiteToSkynet(site, samGroupAlive:GetName(), IADSObjectIndex, connectionName)
421
442
  if (type(site.pointDefenses) == "string") then
422
443
  local set_pdgroup_alive = SET_GROUP:New():FilterPrefixes(site.pointDefenses):FilterOnce()
423
444
  set_pdgroup_alive:ForEachGroupAlive(function(pdGroupAlive)
424
- debug_msg(string.format("IADS - Alive Point Defense Sam Group found %s", pdGroupAlive:GetName()))
445
+ jtff_log.info(string.format("Alive Point Defense Sam Group found %s", pdGroupAlive:GetName()),"IADS")
425
446
  attachPdSiteToSkynet(site,pdGroupAlive:GetName(), samGroupAlive:GetName(), IADSObjectIndex, connectionName)
426
447
  end)
427
448
  elseif (type(site.pointDefenses) == "table") then
428
449
  for pdIndex, pdSamGroupName in ipairs(site.pointDefenses) do
429
- debug_msg(string.format("IADS - Point Defense Sam Group name in config file : %s", pdSamGroupName))
450
+ jtff_log.info(string.format("Point Defense Sam Group name in config file : %s", pdSamGroupName),"IADS")
430
451
  local set_pdgroup_alive = SET_GROUP:New():FilterPrefixes(pdSamGroupName):FilterOnce()
431
452
  set_pdgroup_alive:ForEachGroupAlive(function(pdGroupAlive)
432
- debug_msg(string.format("IADS - Alive Point Defense Sam Group found %s", pdGroupAlive:GetName()))
453
+ jtff_log.info(string.format("Alive Point Defense Sam Group found %s", pdGroupAlive:GetName()),"IADS")
433
454
  attachPdSiteToSkynet(site,pdGroupAlive:GetName(), samGroupAlive:GetName(), IADSObjectIndex, connectionName)
434
455
  end)
435
456
  end
@@ -444,7 +465,7 @@ function activateSkynet(param)
444
465
 
445
466
  -- activate the radio menu to toggle IADS Status output
446
467
  --if (iadsConfig.radioMenu) then
447
- -- debug_msg(string.format("IADS - Add radio menu %s", iadsConfig.name))
468
+ -- jtff_log.trace(string.format("Add radio menu %s", iadsConfig.name),"IADS")
448
469
  -- IADSArray[IADSObjectIndex].IADSObject:addRadioMenu()
449
470
  --end
450
471
 
@@ -473,7 +494,7 @@ function deleteIADSUnits(param)
473
494
 
474
495
  for index, nodeConfig in ipairs(nodesConfig) do
475
496
  local connection = nodeConfig.connection
476
- destroyStatic(connection)
497
+ destroyStatic(connection)
477
498
  local ewrList = nodeConfig.ewrs
478
499
  if (difficultiesAlreadySpawned <= 1) then
479
500
  for index, ewrGroup in ipairs(ewrList) do
@@ -570,12 +591,21 @@ function manageIADSNetworkMenu(networkRootMenu, iadsconfig, IADSObjectIndex)
570
591
  )
571
592
  --TODO: A tweaker pour que les objets skynets seront basés sur la coalition et non sur la mission globale
572
593
  if (type(iadsconfig.gci) == "table") then
573
- local CommandGCIActivate = MENU_MISSION_COMMAND:New(
574
- "GCI Activation",
575
- networkRootMenu,
576
- activateGCI,
577
- { iadsconfig, IADSObjectIndex, networkRootMenu }
578
- )
594
+ if (IADSArray[IADSObjectIndex].GCIRunning) then
595
+ local CommandGCIDeActivate = MENU_MISSION_COMMAND:New(
596
+ "GCI Unactivation",
597
+ networkRootMenu,
598
+ deactivateGCI,
599
+ { iadsconfig, IADSObjectIndex, networkRootMenu }
600
+ )
601
+ else
602
+ local CommandGCIActivate = MENU_MISSION_COMMAND:New(
603
+ "GCI Activation",
604
+ networkRootMenu,
605
+ activateGCI,
606
+ { iadsconfig, IADSObjectIndex, networkRootMenu }
607
+ )
608
+ end
579
609
  end
580
610
  else
581
611
  --On affiche le menu d activation skynet
@@ -595,7 +625,7 @@ function manageIADSNetworkMenu(networkRootMenu, iadsconfig, IADSObjectIndex)
595
625
  local isThereSomethingToSpawn = false
596
626
  for indexnodes, nodeconfig in ipairs(iadsconfig.nodes) do
597
627
  local tbl_json_txt = net.lua2json(nodeconfig.sites[difficulty])
598
- --debug_msg(string.format('IADS: network=%s node=%s difficulty=%s sites config=%s', iadsconfig.name, nodeconfig.connection, difficulty, tbl_json_txt))
628
+ --jtff_log.debug(string.format('network=%s node=%s difficulty=%s sites config=%s', iadsconfig.name, nodeconfig.connection, difficulty, tbl_json_txt),"IADS")
599
629
  local difficultySiteNumberToSpawn = 0
600
630
  for indexsite, siteconfig in ipairs(nodeconfig.sites[difficulty]) do
601
631
  difficultySiteNumberToSpawn = indexsite
@@ -604,11 +634,11 @@ function manageIADSNetworkMenu(networkRootMenu, iadsconfig, IADSObjectIndex)
604
634
  end
605
635
  end
606
636
  if (type(nodeconfig.connection) == "string") then
607
- debug_msg(string.format('IADS - network=%s node=%s difficulty=%s sites number=%d', iadsconfig.name,
608
- nodeconfig.connection, difficulty, difficultySiteNumberToSpawn))
637
+ jtff_log.info(string.format('network=%s node=%s difficulty=%s sites number=%d', iadsconfig.name,
638
+ nodeconfig.connection, difficulty, difficultySiteNumberToSpawn),"IADS")
609
639
  else
610
- debug_msg(string.format('IADS - network=%s node=%s difficulty=%s sites number=%d', iadsconfig.name,
611
- nodeconfig.connection.name, difficulty, difficultySiteNumberToSpawn))
640
+ jtff_log.info(string.format('network=%s node=%s difficulty=%s sites number=%d', iadsconfig.name,
641
+ nodeconfig.connection.name, difficulty, difficultySiteNumberToSpawn),"IADS")
612
642
  end
613
643
  end
614
644
  if isThereSomethingToSpawn then
@@ -714,6 +744,9 @@ for index, skynetconfig in ipairs(SkynetConfig) do
714
744
  extreme = false,
715
745
  },
716
746
  IADSNetworkRunning = false,
747
+ GCIRunning = false,
748
+ GCIDetectionArea = nil,
749
+ GCIDispatcherObject = nil,
717
750
  radioMenuForSkynet = MENU_MISSION:New(skynetconfig.name , mainRadioMenuForSkynet)
718
751
  }
719
752
  manageIADSNetworkMenu(IADSArray[compteur].radioMenuForSkynet, skynetconfig, compteur)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "3.1.9",
3
+ "version": "3.1.10",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -199,8 +199,8 @@ async function doInject(ciObject, sourceMizFileName, workspacePath,destinationMi
199
199
  });
200
200
  libsArray.push({
201
201
  folder: 'lib',
202
- scriptTitle: 'Skynet',
203
- scripts: ['skynet-iads-compiled.lua'],
202
+ scriptTitle: 'Skynet and Hound',
203
+ scripts: ['skynet-iads-compiled.lua', 'HoundElint.lua'],
204
204
  timing: 15,
205
205
  color: '0x008000ff'
206
206
  });