@jtff/miztemplate-lib 3.1.8 → 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.
@@ -4,41 +4,32 @@
4
4
  function detectShitHotBreak(objAirboss)
5
5
  local clientData={}
6
6
  local player_name=""
7
- --env.info('detectShitHotBreak : '.. objAirboss.customconfig.alias..' suspense ...')
8
- objAirboss.CVNClients:ForEachClientInZone( objAirboss.CVN_GROUPZone,
7
+ jtff_log.debug('detectShitHotBreak : '.. objAirboss.customconfig.alias .. ' has ' .. objAirboss.CVNClients:Count()..' clients in Set ...',"AIRBOSS")
8
+ objAirboss.CVNClients:ForEachClientInZone( objAirboss.CVN_UNITZone,
9
9
  function( MooseClient )
10
10
 
11
- local function resetFlag()
11
+ local function resetFlag(userflag)
12
12
  --trigger.action.outText('RESET SH Pass FLAG)', 5 )
13
- client_in_zone_flag:Set(0)
13
+ userflag:Set(0)
14
14
  end
15
15
 
16
16
  local player_velocity = MooseClient:GetVelocityKNOTS()
17
17
  local player_name = MooseClient:GetPlayerName()
18
- local player_alt = MooseClient:GetAltitude()
19
18
  local player_type = MooseClient:GetTypeName()
20
-
21
- local player_alt_feet = math.floor((player_alt * ( 3.28 / 10)))*10
22
-
23
- local player_velocity_round = math.floor((player_velocity/10))*10
19
+ local player_fuel = MooseClient:GetFuel()
20
+ local player_alt_feet = UTILS.MetersToFeet(MooseClient:GetAltitude())
21
+ --trigger.action.outText('ForEachClientInZone: MooseClient name is '..player_name , 5)
24
22
 
25
23
  local Play_SH_Sound = USERSOUND:New( soundFilesPrefix .. "AIRBOSS/Airboss Soundfiles/GreatBallsOfFire.ogg" )
26
- --trigger.action.outText(player_name..' altitude is '..player_alt, 5)
24
+ --trigger.action.outText(player_name..' altitude is '..player_alt_feet..' feet', 5)
27
25
  --trigger.action.outText(player_name..' speed is '..player_velocity, 5)
28
- if client_in_zone_flag == nil then
29
- client_in_zone_flag = USERFLAG:New(MooseClient:GetClientGroupID() + 10000000)
30
- else
31
- end
26
+ local client_in_zone_flag = USERFLAG:New(MooseClient:GetUCID())
27
+ local client_performing_sh = USERFLAG:New(MooseClient:GetUCID()..'_sh')
32
28
 
33
- if client_performing_sh == nil then
34
- client_performing_sh = USERFLAG:New(MooseClient:GetClientGroupID() + 100000000)
35
- else
36
- end
37
-
38
- if client_in_zone_flag:Get() == 0 and player_velocity > 475 and player_alt < 213 then
39
- -- Requirements for Shit Hot break are velocity >475 knots and less than 213 meters (700')
40
- --trigger.action.outText(player_name..' performing a Sierra Hotel Break!', 10)
41
- local sh_message_to_discord = ('**'..player_name..' is performing a Sierra Hotel Break at '..player_velocity_round..' knots and '..player_alt_feet..' feet!**')
29
+ if client_in_zone_flag:Get() == 0 and player_velocity > 475 and player_alt_feet < 700 then
30
+ -- Requirements for Shit Hot break are velocity >475 knots and less than 700 feet
31
+ trigger.action.outText(player_name..' performing a Sierra Hotel Break around ' .. objAirboss.customconfig.alias .. ' !', 10)
32
+ local sh_message_to_discord = ('**'..player_name..' is performing a Sierra Hotel Break at '..UTILS.Round(player_velocity, 0)..' knots and '..player_alt_feet..' feet!**')
42
33
  GemMan:SendTable({
43
34
  command="moose_text",
44
35
  text=sh_message_to_discord,
@@ -47,12 +38,12 @@ function detectShitHotBreak(objAirboss)
47
38
  Play_SH_Sound:ToAll()
48
39
  client_in_zone_flag:Set(1)
49
40
  client_performing_sh:Set(1)
50
- timer.scheduleFunction(resetFlag, {}, timer.getTime() + 10)
41
+ timer.scheduleFunction(resetFlag, {client_in_zone_flag}, timer.getTime() + 10)
51
42
  else
52
43
  end
53
44
 
54
- --trigger.action.outText('ForEachClientInZone: Client name is '..clientData.clientName , 5)
55
- --trigger.action.outText('ForEachClientInZone: Client fuel1 is '..clientData.clientFuel1 , 5)
45
+ --trigger.action.outText('ForEachClientInZone: Client name is '..player_name , 5)
46
+ --trigger.action.outText('ForEachClientInZone: Client fuel is '..player_fuel , 5)
56
47
 
57
48
  end
58
49
  )
@@ -64,12 +55,12 @@ function switchCarrierDefCon2(params)
64
55
  local cvUnit = UNIT:FindByName(carrierName)
65
56
  local cvGroup = cvUnit:GetGroup()
66
57
  cvGroup:OptionROE(ENUMS.ROE.WeaponFree):OptionAlarmStateRed()
67
- debug_msg(string.format("CSG : %s DEFCON 2 -> ROE = %d", carrierName, ENUMS.ROE.WeaponFree))
58
+ jtff_log.info(string.format("CSG : %s DEFCON 2 -> ROE = %d", carrierName, ENUMS.ROE.WeaponFree),"AIRBOSS")
68
59
  SCHEDULER:New(
69
60
  nil,
70
61
  function(carrierName)
71
- debug_squeduler_msg(carrierName .. " switchback to DEFCON 4")
72
- debug_msg(string.format("CSG : %s DEFCON 4 -> ROE = %d", carrierName, ENUMS.ROE.ReturnFire))
62
+ jtff_log.info(carrierName .. " switchback to DEFCON 4","AIRBOSS")
63
+ jtff_log.info(string.format("CSG : %s DEFCON 4 -> ROE = %d", carrierName, ENUMS.ROE.ReturnFire),"AIRBOSS")
73
64
  UNIT:FindByName(carrierName):GetGroup():OptionROE(ENUMS.ROE.ReturnFire):OptionAlarmStateRed()
74
65
  end,
75
66
  { carrierName },
@@ -88,20 +79,20 @@ function getCaseTypeFromWeather(CVNCoordinates, recovery_start, recovery_stop)
88
79
  if (CVNCoordinates) then
89
80
  if ((timer.getAbsTime() >= (CVNCoordinates:GetSunset(true) - 30*60)) or (timer.getAbsTime() <= (CVNCoordinates:GetSunrise(true) + 30*60))) then
90
81
  --Navy Night conditions
91
- debug_msg("CASE III weather : Navy Night")
82
+ jtff_log.info("CASE III weather : Navy Night", "AIRBOSS")
92
83
  return 3
93
84
  end
94
85
  if (recovery_stop) then
95
86
  if (recovery_stop > (CVNCoordinates:GetSunset(true) - 30*60)) then
96
87
  --recovery_stop after Navy SunSet
97
- debug_msg("CASE III weather : Recovery ending after Navy SunSet")
88
+ jtff_log.info("CASE III weather : Recovery ending after Navy SunSet", "AIRBOSS")
98
89
  return 3
99
90
  end
100
91
  end
101
92
  if (recovery_start) then
102
93
  if (recovery_start < (CVNCoordinates:GetSunrise(true) + 30*60)) then
103
94
  --recover_start before Navy SunRise
104
- debug_msg("CASE III weather : Recovery starting before Navy SunRise")
95
+ jtff_log.info("CASE III weather : Recovery starting before Navy SunRise","AIRBOSS")
105
96
  return 3
106
97
  end
107
98
  end
@@ -120,7 +111,7 @@ function getCaseTypeFromWeather(CVNCoordinates, recovery_start, recovery_stop)
120
111
  fog = weather.fog
121
112
  end
122
113
 
123
- -- debug_msg(string.format("visibility : %i | cloud : base %i density %i | fog %i,%i | dust %i", visibility, clouds.base, clouds.density, fog.thickness, fog.visibility, dust))
114
+ -- jtff_log.trace(string.format("visibility : %i | cloud : base %i density %i | fog %i,%i | dust %i", visibility, clouds.base, clouds.density, fog.thickness, fog.visibility, dust),"AIRBOSS")
124
115
  local minVisibility = visibility
125
116
  if (weather.enable_fog and fog.thickness > 0) then
126
117
  minVisibility = math.min(minVisibility,fog.visibility)
@@ -131,17 +122,17 @@ function getCaseTypeFromWeather(CVNCoordinates, recovery_start, recovery_stop)
131
122
 
132
123
  if (minVisibility > UTILS.NMToMeters(5)) then
133
124
  if (clouds.base > UTILS.FeetToMeters(3000)) then
134
- debug_msg("CASE I weather")
125
+ jtff_log.debug("CASE I weather","AIRBOSS")
135
126
  return 1
136
127
  elseif (clouds.base > UTILS.FeetToMeters(1000)) then
137
- debug_msg("CASE II weather")
128
+ jtff_log.debug("CASE II weather","AIRBOSS")
138
129
  return 2
139
130
  else
140
- debug_msg("CASE III weather")
131
+ jtff_log.debug("CASE III weather","AIRBOSS")
141
132
  return 3
142
133
  end
143
134
  else
144
- debug_msg("CASE III weather")
135
+ jtff_log.debug("CASE III weather","AIRBOSS")
145
136
  return 3
146
137
  end
147
138
  end
@@ -343,25 +334,25 @@ for index, airbossconfig in ipairs(AirBossConfig) do
343
334
  local player_wire = playerData.wire
344
335
 
345
336
  player_name = player_name:gsub('[%p]', '')
346
- local client_performing_sh = USERFLAG:New(UNIT:FindByName(unit_name):GetClient():GetClientGroupID() + 100000000)
337
+ local client_performing_sh = USERFLAG:New(UNIT:FindByName(unit_name):GetClient():GetUCID()..'_sh')
347
338
  --local gradeForFile
348
339
  if string_grade == "_OK_" then
349
340
  --if string_grade == "_OK_" and player_wire == "3" and player_Tgroove >=15 and player_Tgroove <19 then
350
341
  timer.scheduleFunction(
351
342
  function()
352
- trigger.action.outSound("Airboss Soundfiles/ffyrtp.ogg")
343
+ trigger.action.outSound("AIRBOSS/Airboss Soundfiles/ffyrtp.ogg")
353
344
  end,
354
345
  {},
355
346
  timer.getTime() + 5
356
347
  )
357
348
  if client_performing_sh:Get() == 1 then
358
349
  myGrade.grade = "_OK_<SH>"
359
- myGrade.points = myGrade.points
350
+ myGrade.points = myGrade.points + 1.00
360
351
  client_performing_sh:Set(0)
361
352
  self:SetTrapSheet(self.trappath, "SH_unicorn_AIRBOSS-trapsheet-"..player_name)
362
353
  timer.scheduleFunction(
363
354
  function()
364
- trigger.action.outSound("Airboss Soundfiles/sureshot.ogg")
355
+ trigger.action.outSound("AIRBOSS/Airboss Soundfiles/sureshot.ogg")
365
356
  end,
366
357
  {},
367
358
  timer.getTime() + 5
@@ -373,7 +364,7 @@ for index, airbossconfig in ipairs(AirBossConfig) do
373
364
  elseif string_grade == "OK" and player_wire >1 then
374
365
  if client_performing_sh:Get() == 1 then
375
366
  myGrade.grade = "OK<SH>"
376
- myGrade.points = myGrade.points + 0.5
367
+ myGrade.points = myGrade.points + 1.00
377
368
  client_performing_sh:Set(0)
378
369
  self:SetTrapSheet(self.trappath, "SH_AIRBOSS-trapsheet-"..player_name)
379
370
  else
@@ -415,6 +406,13 @@ for index, airbossconfig in ipairs(AirBossConfig) do
415
406
  text=onewire_to_discord,
416
407
  msg_type='lso'
417
408
  })
409
+ timer.scheduleFunction(
410
+ function()
411
+ trigger.action.outSound("AIRBOSS/Airboss Soundfiles/GetYourButtsUptoVipersOffice.ogg")
412
+ end,
413
+ {},
414
+ timer.getTime() + 5
415
+ )
418
416
  end
419
417
  self:_SaveTrapSheet(playerData, myGrade)
420
418
 
@@ -546,12 +544,13 @@ for index, airbossconfig in ipairs(AirBossConfig) do
546
544
 
547
545
  AIRBOSSArray[compteur] = objAirboss
548
546
  AIRBOSSArray[compteur]:Start()
549
- AIRBOSSArray[compteur].CVN_GROUPZone = ZONE_GROUP:New(
550
- 'cvnGroupZone-'..AIRBOSSArray[compteur].customconfig.alias,
551
- AIRBOSSArray[compteur].carrier:GetGroup(),
547
+ AIRBOSSArray[compteur].CVN_UNITZone = ZONE_UNIT:New(
548
+ 'cvnUnitZone-'..AIRBOSSArray[compteur].customconfig.alias,
549
+ AIRBOSSArray[compteur].carrier,
552
550
  1111)
553
551
  AIRBOSSArray[compteur].CVNClients = SET_CLIENT:New()
554
- :FilterCoalitions(UTILS.GetCoalitionName(AIRBOSSArray[compteur].customconfig.coalition))
552
+ :FilterActive()
553
+ :FilterCoalitions(string.lower(UTILS.GetCoalitionName(objAirboss.customconfig.coalition)))
555
554
  :FilterStart()
556
555
  local myscheduler
557
556
  local myschedulerID
@@ -8,7 +8,7 @@ MenuCoalitionAwacsRed = MENU_COALITION:New(coalition.side.RED, "Awacs", MenuCoal
8
8
  for index, awacsconfig in ipairs(AwacsConfig) do
9
9
  if awacsconfig.enable == true then
10
10
  compteur = compteur + 1
11
- env.info('creation AWACS : '.. awacsconfig.groupName..'...')
11
+ jtff_log.info('creation AWACS : '.. awacsconfig.groupName..'...',"AWACS")
12
12
  local objAwacs = RECOVERYTANKER:New(UNIT:FindByName(awacsconfig.patternUnit), awacsconfig.groupName)
13
13
  :SetAWACS(true, true)
14
14
  :SetRespawnOnOff(awacsconfig.autorespawn)
@@ -32,7 +32,7 @@ for index, awacsconfig in ipairs(AwacsConfig) do
32
32
  end
33
33
  objAwacs.customconfig = awacsconfig
34
34
  function objAwacs:OnAfterStart(from, event, to)
35
- env.info('popup AWACS : '..self.tanker.GroupName)
35
+ jtff_log.info('popup AWACS : '..self.tanker.GroupName, "AWACS")
36
36
  if self.customconfig.escortgroupname then
37
37
  self.escortSpawnObject = SPAWN:NewWithAlias(self.customconfig.escortgroupname,'escort-'.. self.customconfig.groupName)
38
38
  :InitRepeatOnEngineShutDown()
@@ -83,9 +83,9 @@ for index, awacsconfig in ipairs(AwacsConfig) do
83
83
  end
84
84
  function objAwacs:OnAfterRTB(from, event, to, airbase)
85
85
  if self.customconfig.escortgroupname then
86
- env.info('Tanker RTB: '..self.tanker.GroupName..'...')
86
+ jtff_log.info('RTB: '..self.tanker.GroupName..'...',"AWACS")
87
87
  if self.escortGroupObject:IsAirborne(false) == true then
88
- env.info('escort RTB : '.. self.escortGroupObject.GroupName..' Tanker : '..self.tanker.GroupName..'...')
88
+ jtff_log.info('escort RTB : '.. self.escortGroupObject.GroupName..' Tanker : '..self.tanker.GroupName..'...',"AWACS")
89
89
  self.escortGroupObject:RouteRTB(airbase)
90
90
  else
91
91
  --self.escortGroupObject:Destroy(nil, 5)
@@ -94,14 +94,14 @@ for index, awacsconfig in ipairs(AwacsConfig) do
94
94
  end
95
95
  function objAwacs:OnEventKill(event)
96
96
  if self.customconfig.escortgroupname then
97
- env.info(event.target' Killed !! Sending escort Home')
97
+ jtff_log.info(event.target' Killed !! Sending escort Home',"AWACS")
98
98
  self.escortGroupObject:RouteRTB(AIRBASE:FindByName(self.customconfig.baseUnit))
99
99
  end
100
100
  end
101
101
  function objAwacs:OnAfterStatus(from, event, to)
102
102
  if ((self.customconfig.escortgroupname) and (self.escortGroupObject)) then
103
103
  if not(GROUP:FindByName(self.escortGroupObject.GroupName)) then
104
- env.info('Respawning escort Group '..self.escortGroupObject.GroupName)
104
+ jtff_log.info('Respawning escort Group '..self.escortGroupObject.GroupName,"AWACS")
105
105
  self.escortGroupObject = self.escortSpawnObject
106
106
  :SpawnAtAirbase(AIRBASE:FindByName(self.customconfig.baseUnit),SPAWN.Takeoff.Cold, self.customconfig.altitude)
107
107
  end
@@ -125,7 +125,7 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
125
125
  if (OnDemandAwacsConfig) then
126
126
  for index, OnDemandAwacs in ipairs(OnDemandAwacsConfig) do
127
127
  if ((OnDemandAwacs.type == type) and (OnDemandAwacs.enable)) then
128
- debug_msg(string.format('OnDemandAwacs : Found type %s Awacs : %s Group!', type, OnDemandAwacs.groupName))
128
+ jtff_log.debug(string.format('Found type %s Awacs : %s Group!', type, OnDemandAwacs.groupName),"AWACS")
129
129
  if (askedSpeed and askedSpeed > 0) then
130
130
  OnDemandAwacs.speed = askedSpeed
131
131
  end
@@ -189,7 +189,7 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
189
189
  local aliveAwacsGroupList = set_group_awacs:GetSetObjects()
190
190
 
191
191
  local is_awacs_spawned = false
192
- debug_msg(string.format('OnDemandAwacs : Looking for a Group corresponding to template %s', string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)))
192
+ jtff_log.debug(string.format('Looking for a Group corresponding to template %s', string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)),"AWACS")
193
193
  for index, current_group in ipairs(aliveAwacsGroupList) do
194
194
  if (
195
195
  (not(is_awacs_spawned)) and
@@ -200,7 +200,7 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
200
200
  true
201
201
  ) ~= nil)
202
202
  ) then
203
- debug_msg(string.format('OnDemandAwacs Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)))
203
+ jtff_log.info(string.format('Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)),"AWACS")
204
204
  is_awacs_spawned = true
205
205
  AwacsGroup = current_group
206
206
  end
@@ -214,7 +214,7 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
214
214
  RTBAirbase = askedAnchorCoord:GetClosestAirbase2(Airbase.Category.AIRDROME, OnDemandAwacs.benefit_coalition)
215
215
  end
216
216
  if (is_awacs_spawned) then
217
- debug_msg(string.format('OnDemandAwacs already in air : rerouting %s', OnDemandAwacs.groupName))
217
+ jtff_log.info(string.format('OnDemandAwacs already in air : rerouting %s', OnDemandAwacs.groupName),"AWACS")
218
218
  AwacsGroup:ClearTasks()
219
219
  table.insert(
220
220
  AwacsRoute,
@@ -278,7 +278,7 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
278
278
  )
279
279
  )
280
280
  else
281
- debug_msg(string.format('OnDemandAwacs Spawning %s', OnDemandAwacs.groupName))
281
+ jtff_log.info(string.format('OnDemandAwacs Spawning %s', OnDemandAwacs.groupName),"AWACS")
282
282
  local SpawnAwacs = SPAWN:NewWithAlias(
283
283
  OnDemandAwacs.groupName,
284
284
  string.format("%s-%s", OnDemandAwacs.groupName, OnDemandAwacs.type)
@@ -390,9 +390,9 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
390
390
  end
391
391
  if OnDemandAwacs.escortgroupname then
392
392
  AwacsGroup.escortSpawnObject = SPAWN:NewWithAlias(OnDemandAwacs.escortgroupname,'escort-'.. OnDemandAwacs.groupName)
393
- :InitRepeatOnEngineShutDown()
394
- :InitSkill("Excellent")
395
- :OnSpawnGroup(function(SpawnGroup)
393
+ :InitRepeatOnEngineShutDown()
394
+ :InitSkill("Excellent")
395
+ :OnSpawnGroup(function(SpawnGroup)
396
396
  taskGroupEscort({AwacsGroup, SpawnGroup})
397
397
  end)
398
398
  AwacsGroup.escortGroupObject = spawnRecoveryTankerEscort(AwacsGroup.escortSpawnObject,OnDemandAwacs)
@@ -451,9 +451,9 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
451
451
  function AwacsGroup:OnEventLand(EventData)
452
452
  COORDINATE:RemoveMark(map_marker[self:GetName()])
453
453
  if self.custommconfig.escortgroupname then
454
- env.info('AWACS RTB: '..self.GroupName..'...')
454
+ jtff_log.info('RTB: '..self.GroupName..'...',"AWACS")
455
455
  if self.escortGroupObject:IsAirborne(false) == true then
456
- env.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...')
456
+ jtff_log.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...',"AWACS")
457
457
  self.escortGroupObject:RouteRTB()
458
458
  else
459
459
  --self.escortGroupObject:Destroy(nil, 5)
@@ -463,9 +463,9 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
463
463
  function AwacsGroup:OnEventCrash(EventData)
464
464
  COORDINATE:RemoveMark(map_marker[self:GetName()])
465
465
  if self.custommconfig.escortgroupname then
466
- env.info('AWACS RTB: '..self.GroupName..'...')
466
+ jtff_log.info('RTB: '..self.GroupName..'...',"AWACS")
467
467
  if self.escortGroupObject:IsAirborne(false) == true then
468
- env.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...')
468
+ jtff_log.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...',"AWACS")
469
469
  self.escortGroupObject:RouteRTB()
470
470
  else
471
471
  --self.escortGroupObject:Destroy(nil, 5)
@@ -475,9 +475,9 @@ function triggerOnDemandAwacs(type, askedDuration, askedFL, askedSpeed, askedAnc
475
475
  function AwacsGroup:OnEventDead(EventData)
476
476
  COORDINATE:RemoveMark(map_marker[self:GetName()])
477
477
  if self.custommconfig.escortgroupname then
478
- env.info('AWACS RTB: '..self.GroupName..'...')
478
+ jtff_log.info('RTB: '..self.GroupName..'...',"AWACS")
479
479
  if self.escortGroupObject:IsAirborne(false) == true then
480
- env.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...')
480
+ jtff_log.info('escort RTB : '.. self.escortGroupObject.GroupName..' AWACS : '..self.GroupName..'...',"AWACS")
481
481
  self.escortGroupObject:RouteRTB()
482
482
  else
483
483
  --self.escortGroupObject:Destroy(nil, 5)
@@ -566,7 +566,7 @@ function AwacsMarkHandler:onEvent(event)
566
566
  else
567
567
  cmd = full
568
568
  end
569
- if DEBUG_MSG == true then
569
+ if log_levels[JTFF_LOGLEVEL] <= log_levels['debug'] then
570
570
  trigger.action.outText("Full Text = " .. full, 10)
571
571
  trigger.action.outText("Command = " .. cmd, 10)
572
572
  if param1 ~= nil then trigger.action.outText("type = " .. param1, 10) end
@@ -578,7 +578,7 @@ function AwacsMarkHandler:onEvent(event)
578
578
  end
579
579
 
580
580
  if string.find(cmd, "awacs") then
581
- if DEBUG_MSG == true then
581
+ if log_levels[JTFF_LOGLEVEL] <= log_levels['debug'] then
582
582
  trigger.action.outText("DEBUG: On Demand Awacs Started!", 10)
583
583
  end
584
584
  awacsOnDemandArray[#awacsOnDemandArray+1] = triggerOnDemandAwacs(
@@ -6,7 +6,7 @@ compteur = 0
6
6
  for index, foxzoneconfig in ipairs(FoxRangesConfig) do
7
7
  if foxzoneconfig.enable == true then
8
8
  compteur = compteur + 1
9
- env.info('creation Fox Zone : '.. foxzoneconfig.name..'...')
9
+ jtff_log.info('creation Fox Zone : '.. foxzoneconfig.name..'...',"FOX_ZONE")
10
10
  local objFoxZone = FOX:New()
11
11
  objFoxZone:SetExplosionPower(0.01)
12
12
  :SetExplosionDistance(foxzoneconfig.distance_small_missile or 100)
@@ -19,7 +19,7 @@ for index, foxzoneconfig in ipairs(FoxRangesConfig) do
19
19
  'FOX_LAUNCH_ZONE_'..foxzoneconfig.name,
20
20
  GROUP:FindByName(foxzoneconfig.launchZoneGroupName))
21
21
  objFoxZone:AddLaunchZone(objFoxZone.objLaunchZone)
22
- env.info('Fox Zone : Launch zone Polygon created : '.. objFoxZone.objLaunchZone:GetName() ..'...')
22
+ jtff_log.info('Launch zone Polygon created : '.. objFoxZone.objLaunchZone:GetName() ..'...',"FOX_ZONE")
23
23
  else
24
24
  if foxzoneconfig.launchZoneName then
25
25
  objFoxZone.objLaunchZone = ZONE:New(foxzoneconfig.launchZoneName)
@@ -31,7 +31,7 @@ for index, foxzoneconfig in ipairs(FoxRangesConfig) do
31
31
  'FOX_SAFE_ZONE_'..foxzoneconfig.name,
32
32
  GROUP:FindByName(foxzoneconfig.safeZoneGroupName))
33
33
  objFoxZone:AddSafeZone(objFoxZone.objSafeZone)
34
- env.info('Fox Zone : Safe zone Polygon created : '.. objFoxZone.objSafeZone:GetName() ..'...')
34
+ jtff_log.info('Safe zone Polygon created : '.. objFoxZone.objSafeZone:GetName() ..'...',"FOX_ZONE")
35
35
  else
36
36
  if foxzoneconfig.safeZoneName then
37
37
  objFoxZone.objSafeZone = ZONE:New(foxzoneconfig.safeZoneName)
@@ -72,7 +72,7 @@ for index, foxzoneconfig in ipairs(FoxRangesConfig) do
72
72
  else
73
73
  message = playerNameTargeted .. ' HAS BEEN SHOT DOWN BY ' .. unitShooter:GetName()
74
74
  end
75
- debug_msg(message)
75
+ jtff_log.info(message,"FOX_ZONE")
76
76
  Set_CLIENT:ForEachClientInZone(objFoxZone.objSafeZone, function(clientInZone)
77
77
  if clientInZone:IsAlive() then
78
78
  MESSAGE:NewType(message, MESSAGE.Type.Update):ToClient(clientInZone)
@@ -5,7 +5,7 @@ RATManagerArray = {}
5
5
  compteur = 0
6
6
  for index, ratconfig in ipairs(RATConfig) do
7
7
  if ratconfig.enable == true then
8
- debug_msg(string.format("RAT Enable"))
8
+ jtff_log.info(string.format("RAT Enable"),"RAT")
9
9
  compteur = compteur +1
10
10
  if not (ratconfig.maximum_aircrafts) then
11
11
  ratconfig.maximum_aircrafts = 10
@@ -17,7 +17,7 @@ for index, ratconfig in ipairs(RATConfig) do
17
17
  end
18
18
  if (type(planegroupconfig.templatename) == "table") then
19
19
  for index, templatename in ipairs(planegroupconfig.templatename) do
20
- debug_msg(string.format("RAT %s", templatename))
20
+ jtff_log.debug(string.format("RAT %s", templatename),"RAT")
21
21
  local RATGroup = RAT:New(templatename)
22
22
  if (type(planegroupconfig.airbases_names) == "table" ) then
23
23
  RATGroup:SetTakeoff("cold")
@@ -64,7 +64,7 @@ for index, ratconfig in ipairs(RATConfig) do
64
64
  RATmanager:Add(RATGroup, planegroupconfig.minimun_spawns)
65
65
  end
66
66
  else
67
- debug_msg(string.format("RAT error in template name type : %s", planegroupconfig.templatename))
67
+ jtff_log.error(string.format("RAT error in template name type : %s", planegroupconfig.templatename),"RAT")
68
68
  end
69
69
  end
70
70
  RATManagerArray[compteur] = RATmanager
@@ -4,7 +4,7 @@
4
4
  function clearIntercept(param)
5
5
  local objInterceptIndex = param[1]
6
6
  local objIntercept = InterceptArray[objInterceptIndex]
7
- debug_msg(string.format("Intercept: objIntercept.objSpawn is %s", net.lua2json(objIntercept.objSpawn)))
7
+ jtff_log.debug(string.format("objIntercept.objSpawn is %s", net.lua2json(objIntercept.objSpawn)),"INTERCEPT")
8
8
  local GroupPlane, Index = objIntercept.objSpawn:GetFirstAliveGroup()
9
9
  while GroupPlane ~= nil do
10
10
  GroupPlane:ScheduleStop()
@@ -57,18 +57,18 @@ end
57
57
 
58
58
  function interceptDetection(param)
59
59
  local objIntercept = param[1]
60
- debug_msg(string.format("Intercept: objIntercept.interceptDetectionZone is %s", net.lua2json(objIntercept.interceptDetectionZone)))
61
- --debug_msg(string.format("Intercept: interceptorUnitName is %s", net.lua2json(interceptorUnitName)))
60
+ jtff_log.debug(string.format("objIntercept.interceptDetectionZone is %s", net.lua2json(objIntercept.interceptDetectionZone)),"INTERCEPT")
61
+ --jtff_log.debug(string.format("interceptorUnitName is %s", net.lua2json(interceptorUnitName)),"INTERCEPT")
62
62
  if ( objIntercept.bubbleInvaded == false ) then
63
- debug_msg(string.format("Intercept: %s has not yet been intercepted", objIntercept.interceptTarget:GetName()))
64
- --debug_msg(string.format("Intercept: interceptDetectionZone is %s", net.lua2json(interceptDetectionZone)))
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
65
  if (SET_CLIENT:New():FilterZones({objIntercept.interceptDetectionZone}):FilterOnce():CountAlive() > 0) then
66
66
  objIntercept.bubbleInvaded = true
67
- debug_msg(string.format("Intercept: %s has been intercepted", objIntercept.interceptTarget:GetName()))
67
+ jtff_log.info(string.format("%s has been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
68
68
  if (objIntercept.knowIsIntercepted == false) then
69
69
  if (math.random(1,100) >= 75) then
70
70
  local delay = math.random(15,120)
71
- debug_msg(string.format("Intercept: %s has detected it has been intercepted : he will react accordingly in %i seconds !", objIntercept.interceptTarget:GetName(), delay))
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
72
  objIntercept.knowIsIntercepted = true
73
73
  if objIntercept.customconfig.type == 'fastbomber' then
74
74
  SCHEDULER:New(
@@ -86,7 +86,7 @@ function interceptDetection(param)
86
86
  )
87
87
  end
88
88
  else
89
- debug_msg(string.format("Intercept: %s has not detected soon enough it has been intercepted", objIntercept.interceptTarget:GetName()))
89
+ jtff_log.info(string.format("%s has not detected soon enough it has been intercepted", objIntercept.interceptTarget:GetName()),"INTERCEPT")
90
90
  end
91
91
  end
92
92
  end
@@ -118,8 +118,8 @@ function StartInterceptTraining(param)
118
118
  targetRange = 90
119
119
  deltaAltMax = 15000
120
120
  end
121
- debug_msg(string.format("Intercept: Launching exercise TargetAngle %i degrees", targetAngle))
122
- debug_msg(string.format("Intercept: Index is : %i", objInterceptIndex))
121
+ jtff_log.info(string.format("Launching exercise TargetAngle %i degrees", targetAngle),"INTERCEPT")
122
+ jtff_log.debug(string.format("Index is : %i", objInterceptIndex),"INTERCEPT")
123
123
  local targetSpawnObj = InterceptArray[objInterceptIndex].objSpawn
124
124
  local targetCoord = POINT_VEC3:NewFromVec3(
125
125
  {
@@ -137,7 +137,7 @@ function StartInterceptTraining(param)
137
137
  z = fighterCoord.z + math.floor(UTILS.NMToMeters(targetRange) * math.sin(math.rad(fighterHeading))),
138
138
  }
139
139
  )
140
- debug_msg(string.format("Intercept: Spawning target based on %s with TargetAngle of %i degrees", targetSpawnObj.SpawnTemplatePrefix, targetAngle))
140
+ jtff_log.info(string.format("Spawning target based on %s with TargetAngle of %i degrees", targetSpawnObj.SpawnTemplatePrefix, targetAngle),"INTERCEPT")
141
141
  targetGroup = targetSpawnObj:InitHeading(math.mod(fighterHeading + 180 + targetAngle,360)):SpawnFromVec3(targetCoord)
142
142
  targetGroup:OptionROE(ENUMS.ROE.WeaponHold)
143
143
  targetGroup:OptionROT(ENUMS.ROT.NoReaction)
@@ -202,7 +202,7 @@ MenuCoalitionInterceptBlue = MENU_COALITION:New(coalition.side.BLUE, "Intercept
202
202
  MenuCoalitionInterceptRed = MENU_COALITION:New(coalition.side.RED, "Intercept Training", MenuCoalitionRed)
203
203
  for index, intconfig in ipairs(InterceptConfig) do
204
204
  if intconfig.enable == true then
205
- debug_msg(string.format("Intercept: Enable %s with %s behavior", intconfig.name, intconfig.type))
205
+ jtff_log.info(string.format("Enable %s with %s behavior", intconfig.name, intconfig.type),"INTERCEPT")
206
206
  compteur = compteur +1
207
207
  local objIntercept = {
208
208
  customconfig = {},
@@ -6,7 +6,7 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
6
6
  if (OnDemandReapersConfig) then
7
7
  for index, OnDemandReaper in ipairs(OnDemandReapersConfig) do
8
8
  if ((OnDemandReaper.type == type) and (OnDemandReaper.enable)) then
9
- debug_msg(string.format('OnDemandUAV : Found type %s UAV : %s Group!', type, OnDemandReaper.groupName))
9
+ jtff_log.info(string.format('Found type %s UAV : %s Group!', type, OnDemandReaper.groupName),"UAV")
10
10
  if (askedSpeed and askedSpeed > 0) then
11
11
  OnDemandReaper.speed = askedSpeed
12
12
  end
@@ -27,7 +27,7 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
27
27
  local aliveReapersGroupList = set_group_reaper:GetSetObjects()
28
28
 
29
29
  local is_reaper_spawned = false
30
- debug_msg(string.format('OnDemandUAV : Looking for a Group corresponding to template %s', string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)))
30
+ jtff_log.debug(string.format('Looking for a Group corresponding to template %s', string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)),"UAV")
31
31
  for index, current_group in ipairs(aliveReapersGroupList) do
32
32
  if (
33
33
  (not(is_reaper_spawned)) and
@@ -38,7 +38,7 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
38
38
  true
39
39
  ) ~= nil)
40
40
  ) then
41
- debug_msg(string.format('OnDemandUAV Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)))
41
+ jtff_log.info(string.format('Found %s corresponding to template %s', current_group.GroupName, string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)),"UAV")
42
42
  is_reaper_spawned = true
43
43
  ReaperGroup = current_group
44
44
  end
@@ -52,7 +52,7 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
52
52
  RTBAirbase = askedAnchorCoord:GetClosestAirbase2(Airbase.Category.AIRDROME, OnDemandReaper.benefit_coalition)
53
53
  end
54
54
  if (is_reaper_spawned) then
55
- debug_msg(string.format('OnDemandUAV already in air : rerouting %s', OnDemandReaper.groupName))
55
+ jtff_log.debug(string.format('OnDemandUAV already in air : rerouting %s', OnDemandReaper.groupName), "UAV")
56
56
  ReaperGroup:ClearTasks()
57
57
  table.insert(
58
58
  ReaperRoute,
@@ -98,7 +98,7 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
98
98
  )
99
99
  )
100
100
  else
101
- debug_msg(string.format('OnDemandUAV Spawning %s', OnDemandReaper.groupName))
101
+ jtff_log.info(string.format('OnDemandUAV Spawning %s', OnDemandReaper.groupName),"UAV")
102
102
  local SpawnReaper = SPAWN:NewWithAlias(
103
103
  OnDemandReaper.groupName,
104
104
  string.format("%s-%s", OnDemandReaper.groupName, OnDemandReaper.type)
@@ -249,7 +249,7 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
249
249
  local reaperInfraIndex = 0
250
250
  for infra_index, reaper_object in ipairs(ReapersInfraArray) do
251
251
  if (reaper_object.customconfig.type == OnDemandReaper.type) then
252
- debug_msg(string.format("OnDemandUAV : Found infra %s for UAV %s", reaper_object.customconfig.type, ReaperGroup:GetName()))
252
+ jtff_log.info(string.format("Found infra %s for UAV %s", reaper_object.customconfig.type, ReaperGroup:GetName()),"UAV")
253
253
  reaperInfraIndex = infra_index
254
254
  end
255
255
  end
@@ -260,9 +260,9 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
260
260
  :FilterPrefixes(ReaperGroup:GetName())
261
261
  :FilterOnce()
262
262
  local detectionReaper = DETECTION_AREAS:New(setGroupReaper, UTILS.NMToMeters(5))
263
- debug_msg(string.format("OnDemandUAV : Detection Areas created for SET_GROUP %s with %d members", ReapersInfraArray[reaperInfraIndex].customconfig.groupName, setGroupReaper:Count()))
263
+ jtff_log.info(string.format("Detection Areas created for SET_GROUP %s with %d members", ReapersInfraArray[reaperInfraIndex].customconfig.groupName, setGroupReaper:Count()),"UAV")
264
264
  local reaperCommandCenter = COMMANDCENTER:New( ReapersInfraArray[reaperInfraIndex].HQGroup, OnDemandReaper.hq_template_name )
265
- debug_msg(string.format("OnDemandUAV : Command Center %s created and operating", reaperCommandCenter:GetName()))
265
+ jtff_log.info(string.format("Command Center %s created and operating", reaperCommandCenter:GetName()),"UAV")
266
266
  reaperCommandCenter.FlashStatus=DEBUG_DETECT_MSG and false
267
267
  if (OnDemandReaper.benefit_coalition == coalition.side.BLUE) then
268
268
  currentDesignateObject = DESIGNATE:New( reaperCommandCenter, detectionReaper, SET_GROUP:New():FilterCoalitions("blue"):FilterStart())
@@ -277,11 +277,11 @@ function triggerOnDemandReaper(type, askedLaserCode, askedDuration, askedFL, ask
277
277
  currentDesignateObject:SetFlashStatusMenu( DEBUG_DETECT_MSG and false)
278
278
  function currentDesignateObject:OnAfterDetect(From, Event, To)
279
279
  local DetectedItems = self.Detection:GetDetectedItems()
280
- debug_msg(string.format("OnDemandUAV : OnAfterDetect"))
280
+ jtff_log.trace(string.format("OnAfterDetect"),"UAV")
281
281
  if self.Detection:GetDetectedItemsCount() > 0 then
282
282
  local DetectedItem = DetectedItems[1]
283
283
  if self.RecceSet:GetFirst():GetUnit(1):IsLasing() then
284
- debug_msg(string.format("OnDemandUAV : %s Spoting %s Unit", self.RecceSet:GetFirst():GetName(), self.RecceSet:GetFirst():GetUnit(1):GetSpot().TargetName))
284
+ jtff_log.trace(string.format("%s Spoting %s Unit", self.RecceSet:GetFirst():GetName(), self.RecceSet:GetFirst():GetUnit(1):GetSpot().TargetName),"UAV")
285
285
  --Spot.createInfraRed(self.RecceSet:GetFirst():GetUnit(1):GetDCSObject(), {x = 0, y = 1, z = 0}, UNIT:FindByName(self.RecceSet:GetFirst():GetUnit(1):GetSpot().TargetName):GetPointVec3():AddY(1):GetVec3())
286
286
  end
287
287
  end
@@ -406,7 +406,8 @@ function ReaperMarkHandler:onEvent(event)
406
406
  else
407
407
  cmd = full
408
408
  end
409
- if DEBUG_MSG == true then
409
+
410
+ if log_levels[JTFF_LOGLEVEL] <= log_levels['debug'] then
410
411
  trigger.action.outText("Full Text = " .. full, 10)
411
412
  trigger.action.outText("Command = " .. cmd, 10)
412
413
  if param1 ~= nil then trigger.action.outText("type = " .. param1, 10) end
@@ -417,7 +418,7 @@ function ReaperMarkHandler:onEvent(event)
417
418
  end
418
419
 
419
420
  if string.find(cmd, "uav") then
420
- if DEBUG_MSG == true then
421
+ if log_levels[JTFF_LOGLEVEL] <= log_levels['debug'] then
421
422
  trigger.action.outText("DEBUG: On UAV Started!", 10)
422
423
  end
423
424
  reapersOnDemandArray[#reapersOnDemandArray+1] = triggerOnDemandReaper(
@@ -474,13 +475,13 @@ function SpawnReaperHQ(param)
474
475
  local reaperName = reaperObject.customconfig.type
475
476
  local reaperHQName = reaperObject.customconfig.hq_template_name
476
477
 
477
- debug_msg(string.format("OnDemandUAV : Reaper %s - HQ %s", reaperName, reaperHQName))
478
+ jtff_log.info(string.format("Reaper %s - HQ %s", reaperName, reaperHQName),"UAV")
478
479
  if (GROUP:FindByName(reaperHQName) ~= nil) then
479
480
  reaperObject.HQSpawn = SPAWN:New(reaperHQName)
480
- debug_msg(string.format("SPAWN %s", reaperHQName))
481
+ jtff_log.info(string.format("SPAWN %s", reaperHQName),"UAV")
481
482
  reaperObject.HQGroup = reaperObject.HQSpawn:Spawn()
482
483
  else
483
- debug_msg(string.format("GROUP to spawn %s not found in mission", reaperHQName))
484
+ jtff_log.error(string.format("GROUP to spawn %s not found in mission", reaperHQName),"UAV")
484
485
  end
485
486
  MESSAGE:NewType(string.format("HQ group %s for %s UAV in place", reaperHQName, reaperName), MESSAGE.Type.Information)
486
487
  :ToCoalition(reaperObject.customconfig.benefit_coalition)
@@ -499,7 +500,7 @@ local compteur = 0
499
500
  for index, reapersconfig in ipairs(OnDemandReapersConfig) do
500
501
  if reapersconfig.enable == true then
501
502
  compteur = compteur + 1
502
- debug_msg(string.format("OnDemandUAV : %s creation HQ : %s", reapersconfig.type, reapersconfig.hq_template_name))
503
+ jtff_log.info(string.format("%s creation HQ : %s", reapersconfig.type, reapersconfig.hq_template_name),"UAV")
503
504
  ReapersInfraArray[compteur] = {
504
505
  customconfig = reapersconfig,
505
506
  ReaperRootMenu = {},