@jtff/miztemplate-lib 3.10.14 → 4.0.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.
@@ -1,80 +1,144 @@
1
1
  -- *****************************************************************************
2
2
  -- ** ATIS **
3
3
  -- *********************************************************
4
+
5
+ -- region ATISFunctions
6
+
4
7
  --- Enable ATIS for a specific airbase.
5
8
  ---@param airbase string The name of the airbase for which to enable ATIS for. (MOOSE Enum)
6
9
  function EnableAtis(airbase)
7
- for _, atis in ipairs(ATISArray) do
8
- if atis.customconfig.airfield == airbase then
9
- -- Enable ATIS
10
- atis:Start()
11
- jtff_log.info(string.format("ATIS at airfield %s enabled (usually by bot).", atis.customconfig.airfield),"ATIS")
12
- atis.menu[coalition.side.BLUE]:Remove()
13
- atis.menu[coalition.side.BLUE] = MENU_COALITION_COMMAND:New(
14
- coalition.side.BLUE,
15
- "Disable Auto Atis at " .. atis.customconfig.airfield,
16
- MenuCoalitionAtis[coalition.side.BLUE],
17
- DisableAtis,
18
- atis.customconfig.airfield
19
- )
20
- atis.menu[coalition.side.RED]:Remove()
21
- atis.menu[coalition.side.RED] = MENU_COALITION_COMMAND:New(
22
- coalition.side.RED,
23
- "Disable Auto Atis at " .. atis.customconfig.airfield,
24
- MenuCoalitionAtis[coalition.side.RED],
25
- DisableAtis,
26
- atis.customconfig.airfield
27
- )
28
- return true
29
- end
30
- end
10
+ for _, atis in ipairs(ATISArray) do
11
+ if atis.customconfig.airfield == airbase then
12
+ -- Enable ATIS
13
+ atis:Start()
14
+ Jtff_log.info(
15
+ string.format(
16
+ "ATIS at airfield %s enabled (usually by bot).",
17
+ atis.customconfig.airfield
18
+ ),
19
+ "ATIS"
20
+ )
21
+ for _k, _coalition in pairs(coalition.side) do
22
+ atis.menu[_coalition]:Remove()
23
+ atis.menu[_coalition] = MENU_COALITION_COMMAND:New(
24
+ _coalition,
25
+ "Disable Auto Atis at " .. atis.customconfig.airfield,
26
+ MenuCoalitionAtis[UTILS.GetCoalitionName(_coalition)],
27
+ DisableAtis,
28
+ atis.customconfig.airfield
29
+ )
30
+ end
31
+ return true
32
+ end
33
+ end
31
34
  end
32
35
 
33
36
  --- Disable ATIS for a specific airbase.
34
37
  ---@param airbase string The name of the airbase for which to disable ATIS for. (MOOSE Enum)
35
38
  function DisableAtis(airbase)
36
- for _, atis in ipairs(ATISArray) do
37
- if atis.customconfig.airfield == airbase then
38
- -- Disable ATIS
39
- atis:Stop()
40
- jtff_log.info(string.format("ATIS at airfield %s disabled (usually by bot).", atis.customconfig.airfield),"ATIS")
41
- atis.menu[coalition.side.BLUE]:Remove()
42
- atis.menu[coalition.side.BLUE] = MENU_COALITION_COMMAND:New(
43
- coalition.side.BLUE,
44
- "Enable Auto Atis at " .. atis.customconfig.airfield,
45
- MenuCoalitionAtis[coalition.side.BLUE],
46
- EnableAtis,
47
- atis.customconfig.airfield
48
- )
49
- atis.menu[coalition.side.RED]:Remove()
50
- atis.menu[coalition.side.RED] = MENU_COALITION_COMMAND:New(
51
- coalition.side.RED,
52
- "Enable Auto Atis at " .. atis.customconfig.airfield,
53
- MenuCoalitionAtis[coalition.side.RED],
54
- EnableAtis,
55
- atis.customconfig.airfield
56
- )
57
- return true
58
- end
59
- end
39
+ for _, atis in ipairs(ATISArray) do
40
+ if atis.customconfig.airfield == airbase then
41
+ -- Disable ATIS
42
+ atis:Stop()
43
+ Jtff_log.info(
44
+ string.format(
45
+ "ATIS at airfield %s disabled (usually by bot).",
46
+ atis.customconfig.airfield
47
+ ),
48
+ "ATIS"
49
+ )
50
+ for _k, _coalition in pairs(coalition.side) do
51
+ atis.menu[_coalition]:Remove()
52
+ atis.menu[_coalition] = MENU_COALITION_COMMAND:New(
53
+ _coalition,
54
+ "Enable Auto Atis at " .. atis.customconfig.airfield,
55
+ MenuCoalitionAtis[UTILS.GetCoalitionName(_coalition)],
56
+ EnableAtis,
57
+ atis.customconfig.airfield
58
+ )
59
+ end
60
+ return true
61
+ end
62
+ end
60
63
  end
61
64
 
65
+ -- endregion ATISFunctions
66
+
67
+ -- region ATISConfigFunctions
68
+ -- @type ATISConfig
69
+ -- @field #boolean enable Enable Atis creation.
70
+ -- @field #string airfield Airfield name.
71
+ -- @field #radioConfig radio configuration object.
72
+ -- @field #string relayunit UNIT Name to emit radio On.
73
+ -- @field #table active Active Runway config Object.
74
+ -- @field #tacanConfig tacan TACAN configuration..
75
+ -- @field #table ils ILS configuration.
76
+ -- @field #boolean useSRS Use SRS for the ATIS.
77
+
78
+ --- Parse ATIS config Object.
79
+ -- @param #JsonObject config Config object to parse
80
+ -- @return #ATISConfig atisConfigJson Parsed ATISConfig object
81
+ function ParseAtisConfigJson(config)
82
+ local json = require('Scripts/json')
83
+ local parser_name = "ATIS"
84
+ -- **************************************************************************
85
+ -- enable
86
+ -- **************************************************************************
87
+ local atisConfigJson = {
88
+ enable = config.enable or false,
89
+ }
90
+ if type(config) ~= 'table' then
91
+ Jtff_log.error(
92
+ string.format(
93
+ "no proper atisconfig defined, skipping Atis configuration"
94
+ ),
95
+ parser_name
96
+ )
97
+ atisConfigJson.enable = false
98
+ return atisConfigJson
99
+ end
100
+ atisConfigJson = config
101
+ Jtff_log.debug(
102
+ string.format(
103
+ "parsed ATIS config for %s ATIS, resulting config :\n%s",
104
+ config.airfield or "unknown Airbase",
105
+ json:encode(
106
+ atisConfigJson,
107
+ { indent = true }
108
+ )
109
+ ),
110
+ parser_name
111
+ )
112
+ return atisConfigJson
113
+ end
114
+
115
+ -- endregion ATISConfigFunctions
116
+
62
117
  ATISArray = {}
63
- compteur = 0
64
118
  MenuCoalitionAtis = {}
65
- MenuCoalitionAtis[coalition.side.BLUE] = MENU_COALITION:New(coalition.side.BLUE, "Atis", MenuCoalitionBlue)
66
- MenuCoalitionAtis[coalition.side.RED] = MENU_COALITION:New(coalition.side.RED, "Atis", MenuCoalitionRed)
67
- for index, atisconfig in ipairs(AtisConfig) do
119
+ for _k, _coalition in pairs(coalition.side) do
120
+ MenuCoalitionAtis[UTILS.GetCoalitionName(_coalition)] = MENU_COALITION:New(_coalition, "Atis", MenuCoalition[UTILS.GetCoalitionName(_coalition)])
121
+ end
122
+
123
+ local compteur = #ATISArray
124
+ for _index, _currentAtisConfigObject in ipairs(AtisConfig or {}) do
125
+ local atisconfig = ParseAtisConfigJson(_currentAtisConfigObject)
68
126
  if atisconfig.enable == true then
69
127
  compteur = compteur + 1
70
- jtff_log.info(string.format("Creation ATIS at airfield %s", atisconfig.airfield),"ATIS")
128
+ Jtff_log.info(
129
+ string.format(
130
+ "Creation ATIS at airfield %s",
131
+ atisconfig.airfield
132
+ ),
133
+ "ATIS"
134
+ )
71
135
  local objAtis = ATIS:New(atisconfig.airfield, atisconfig.radio.freq, atisconfig.radio.modulation)
72
136
  :SetImperialUnits()
73
- :SetSoundfilesPath(soundFilesPrefix .. 'ATIS/ATIS Soundfiles/')
137
+ :SetSoundfilesPath(SoundFilesPrefix .. 'ATIS/ATIS Soundfiles/')
74
138
  :SetSubtitleDuration(0)
75
139
  :SetMapMarks(true)
76
- if (atisconfig.radio.relayunit) then
77
- objAtis:SetRadioRelayUnitName(atisconfig.radio.relayunit)
140
+ if (atisconfig.relayunit) then
141
+ objAtis:SetRadioRelayUnitName(atisconfig.relayunit)
78
142
  else
79
143
  if (atisconfig.radio.power) then
80
144
  objAtis:SetRadioPower(atisconfig.radio.power)
@@ -109,27 +173,26 @@ for index, atisconfig in ipairs(AtisConfig) do
109
173
  end
110
174
  objAtis.customconfig = atisconfig
111
175
  objAtis.menu = {}
112
- objAtis.menu[coalition.side.BLUE] = MENU_COALITION_COMMAND:New(
113
- coalition.side.BLUE,
114
- "Disable Auto Atis at " .. atisconfig.airfield,
115
- MenuCoalitionAtis[coalition.side.BLUE],
116
- DisableAtis,
117
- atisconfig.airfield
118
- )
119
- objAtis.menu[coalition.side.RED] = MENU_COALITION_COMMAND:New(
120
- coalition.side.RED,
121
- "Disable Auto Atis at " .. atisconfig.airfield,
122
- MenuCoalitionAtis[coalition.side.RED],
123
- DisableAtis,
124
- atisconfig.airfield
125
- )
176
+ for _k, _coalition in pairs(coalition.side) do
177
+ objAtis.menu[_coalition] = MENU_COALITION_COMMAND:New(
178
+ _coalition,
179
+ string.format(
180
+ "Disable Auto Atis at %s",
181
+ atisconfig.airfield
182
+ ),
183
+ MenuCoalitionAtis[UTILS.GetCoalitionName(_coalition)],
184
+ DisableAtis,
185
+ atisconfig.airfield
186
+ )
187
+ end
126
188
  ATISArray[compteur] = objAtis
127
189
  ATISArray[compteur]:Start()
128
190
  end
129
191
  end
130
192
 
131
193
  if compteur == 0 then
132
- MenuCoalitionAtis[coalition.side.BLUE]:Remove()
133
- MenuCoalitionAtis[coalition.side.RED]:Remove()
134
- MenuCoalitionAtis = {}
194
+ for _k, _coalition in pairs(coalition.side) do
195
+ MenuCoalitionAtis[UTILS.GetCoalitionName(_coalition)]:Remove()
196
+ end
197
+ MenuCoalitionAtis = {}
135
198
  end
@@ -2,92 +2,160 @@
2
2
  -- ** CAPZone Training **
3
3
  -- *********************************************************
4
4
  function wipeCapZone(objCAPZone)
5
- fctKillSpawnObject(objCAPZone.objSpawn)
5
+ while (#(objCAPZone.objFlightGroups) > 0) do
6
+ Jtff_log.debug(string.format("Wipe CAP Zone : %s, before wipe remaining flight groups: %d", objCAPZone.customconfig.name, #(objCAPZone.objFlightGroups)),"CAP_ZONE_TRAINING")
7
+ if objCAPZone.objFlightGroups[1].MissionPatrol then
8
+ objCAPZone.objFlightGroups[1].MissionPatrol.markerOn = false
9
+ if objCAPZone.objFlightGroups[1].MissionPatrol.marker then
10
+ objCAPZone.objFlightGroups[1].MissionPatrol.marker:Remove()
11
+ end
12
+ end
13
+ objCAPZone.objFlightGroups[1]:Destroy()
14
+ objCAPZone.objFlightGroups[1]:__Stop(10)
15
+ table.remove(objCAPZone.objFlightGroups, 1)
16
+ Jtff_log.debug(string.format("Wipe CAP Zone : %s, after wipe remaining flight groups: %d", objCAPZone.customconfig.name, #(objCAPZone.objFlightGroups)),"CAP_ZONE_TRAINING")
17
+ end
18
+ objCAPZone.objFlightGroups = {}
19
+ -- fctKillSpawnObject(objCAPZone.objSpawn)
6
20
  trigger.action.outText('CAP Training Zone '..(objCAPZone.customconfig.name)..' cleaned !!', 30)
21
+ Jtff_log.info(string.format("Wipe CAP Zone : %s", objCAPZone.customconfig.name),"CAP_ZONE_TRAINING")
7
22
  end
8
23
 
9
- function startCapZone(objCAPZone)
24
+ function startCapZone(params)
25
+ local objCAPZone = params[1]
26
+ local effectiveForce = params[2] or 2
27
+ objCAPZone.objSpawn:InitGrouping(effectiveForce)
10
28
  local AICapGroup = objCAPZone.objSpawn:SpawnInZone(objCAPZone.objPatrolZone,
11
29
  true
12
30
  )
13
- local objCAP = AI_CAP_ZONE:New(
14
- objCAPZone.objPatrolZone,
15
- UTILS.Round(objCAPZone.customconfig.capParameters.patrolFloor*0.3048,0),
16
- UTILS.Round(objCAPZone.customconfig.capParameters.patrolCeiling*0.3048,0),
17
- UTILS.Round(objCAPZone.customconfig.capParameters.minPatrolSpeed*1.852,0),
18
- UTILS.Round(objCAPZone.customconfig.capParameters.maxPatrolSpeed*1.852,0),
19
- AI.Task.AltitudeType.BARO
20
- )
21
- objCAP:SetControllable(AICapGroup)
22
- objCAP:SetEngageZone(objCAPZone.objEngageZone)
23
- objCAP:__Start(1)
24
- --local objAiCapZone = AI_CAP_ZONE:New(
25
- -- objCAPZone.objPatrolZone,
26
- -- UTILS.Round(objCAPZone.customconfig.capParameters.patrolFloor*0.3048,0),
27
- -- UTILS.Round(objCAPZone.customconfig.capParameters.patrolCeiling*0.3048,0),
28
- -- UTILS.Round(objCAPZone.customconfig.capParameters.minPatrolSpeed*1.852,0),
29
- -- UTILS.Round(objCAPZone.customconfig.capParameters.maxPatrolSpeed*1.852,0),
30
- -- AI.Task.AltitudeType.BARO
31
- --)
32
- --function objAiCapZone:OnAfterStart(from, event, to)
33
- --end
34
-
35
- --objAiCapZone:SetControllable(
36
- -- objCAPZone.objSpawn:SpawnInZone(objCAPZone.objPatrolZone,
37
- -- true
38
- -- )
39
- --)
40
31
  end
41
32
 
42
33
 
43
34
  CAPZoneArray = {}
44
- compteur = 0
45
- MenuCoalitionCAPZoneBlue = MENU_COALITION:New(coalition.side.BLUE, "Hostile CAP Zones", MenuCoalitionBlue)
46
- MenuCoalitionCAPZoneRed = MENU_COALITION:New(coalition.side.RED, "Hostile CAP Zones", MenuCoalitionRed)
35
+ MenuCoalitionCAPZoneBlue = MENU_COALITION:New(coalition.side.BLUE, "Hostile CAP Zones", MenuCoalition[coalition.side.BLUE])
36
+ MenuCoalitionCAPZoneRed = MENU_COALITION:New(coalition.side.RED, "Hostile CAP Zones", MenuCoalition[coalition.side.RED])
37
+ local compteur = #CAPZoneArray
47
38
  for index, capzoneconfig in ipairs(TrainingCAPConfig) do
48
39
  if capzoneconfig.enable == true then
49
40
  compteur = compteur + 1
50
- env.info('creation CAP Zone : '.. capzoneconfig.name..'...')
41
+ Jtff_log.info(string.format("creation CAP Zone : %s", capzoneconfig.name),"CAP_ZONE_TRAINING")
51
42
  objCapZone = {}
43
+ objCapZone.objFlightGroups = {}
52
44
  objCapZone.objSpawn = SPAWN:New(capzoneconfig.CAPGoups[1])
53
45
  :InitSkill(capzoneconfig.skill)
54
46
  :InitRandomizeTemplate(capzoneconfig.CAPGoups)
55
- :OnSpawnGroup(function(SpawnGroup)
56
- SpawnGroup:OptionROE(ENUMS.ROE.OpenFireWeaponFree)
57
- SpawnGroup:OptionROT(ENUMS.ROT.EvadeFire)
58
- SpawnGroup:OptionRTBBingoFuel(false)
59
- --if math.random(0,100) > 50 then
60
- -- SpawnGroup:OptionAAAttackRange(AI.Option.Air.val.MISSILE_ATTACK.MAX_RANGE)
61
- --else
62
- -- SpawnGroup:OptionAAAttackRange(AI.Option.Air.val.MISSILE_ATTACK.HALF_WAY_RMAX_NEZ)
63
- --end
64
- SpawnGroup:OptionRestrictBurner(false)
65
- SpawnGroup:OptionECM_OnlyLockByRadar()
66
- SpawnGroup:EnableEmission(true)
67
- SpawnGroup:OptionAlarmStateRed()
68
- end)
47
+ :OnSpawnGroup(function(SpawnGroup, objCapZone)
48
+ -- ******************************************************
49
+ -- ** OnGroupSpawn : Setup FlightGroup and mission **
50
+ -- ******************************************************
51
+ -- **********************Flight GroupSetup*************************
52
+ Jtff_log.info(string.format("Group spawned : %s - %s", SpawnGroup:GetName(), SpawnGroup:GetTypeName()),"CAP_ZONE_TRAINING")
53
+ local flightgroup = FLIGHTGROUP:New(SpawnGroup)
54
+ Jtff_log.debug(string.format("FlightGroup created from group %s", SpawnGroup:GetName()),"CAP_ZONE_TRAINING")
55
+ flightgroup:SetFuelCriticalThreshold(15)
56
+ flightgroup:SetFuelLowThreshold(25)
57
+ flightgroup:SetOutOfAAMRTB(true)
58
+ flightgroup:SetFuelCriticalRTB(true)
59
+ flightgroup:SetFuelLowRTB(true)
60
+ flightgroup:SetAllowAfterburner()
61
+ flightgroup:SetDetection(true)
62
+ Jtff_log.debug(string.format("FlightGroup %s goes nose hot !", SpawnGroup:GetName()),"CAP_ZONE_TRAINING")
63
+ flightgroup:SetVerbosity(JTFF_verbosity_levels[JTFF_LOGLEVEL])
64
+ function flightgroup:OnAfterDead(From, Event, To)
65
+ self:CancelAllMissions()
66
+ self.MissionPatrol.markerOn = false
67
+ if self.MissionPatrol.marker then
68
+ self.MissionPatrol.marker:Remove()
69
+ end
70
+ self.MissionPatrol:Stop()
71
+ self.MissionPatrol = nil
72
+ Jtff_log.debug(string.format("Zone %s: FlightGroup %s Dead !", objCapZone.customconfig.name, SpawnGroup:GetName()),"CAP_ZONE_TRAINING")
73
+ self:__Stop(10)
74
+ end
75
+ function flightgroup:OnAfterRTB(From, Event, To, airbase)
76
+ Jtff_log.debug(string.format("Zone %s: FlightGroup %s is RTB to %s !", objCapZone.customconfig.name, SpawnGroup:GetName(), airbase:GetName()),"CAP_ZONE_TRAINING")
77
+ self:CancelAllMissions()
78
+ self.MissionPatrol.markerOn = false
79
+ if self.MissionPatrol.marker then
80
+ self.MissionPatrol.marker:Remove()
81
+ end
82
+ self.MissionPatrol:Stop()
83
+ for index, curFlightGroup in ipairs(objCapZone.objFlightGroups) do
84
+ if curFlightGroup:GetName() == self:GetName() then
85
+ table.remove(objCapZone.objFlightGroups, index)
86
+ break
87
+ end
88
+ end
89
+ end
90
+ if objCapZone.customconfig.airBaseName and AIRBASE:FindByName(objCapZone.customconfig.airBaseName) then
91
+ flightgroup:SetHomebase(AIRBASE:FindByName(objCapZone.customconfig.airBaseName))
92
+ end
93
+ -- *********************Mission Setup******************************
94
+ flightgroup.MissionPatrol = AUFTRAG:NewPATROL_RACETRACK(
95
+ objCapZone.objPatrolZone:GetRandomCoordinate(),
96
+ objCapZone.customconfig.capParameters.patrolAltitude,
97
+ objCapZone.customconfig.capParameters.patrolSpeed,
98
+ objCapZone.customconfig.capParameters.patrolHeading,
99
+ objCapZone.customconfig.capParameters.patrolLegLength,
100
+ ENUMS.Formation.FixedWing.LineAbreast.Group
101
+ )
102
+ flightgroup.MissionPatrol:SetName(
103
+ string.format('MISSION_CAP_PATROL_%s_%d', objCapZone.customconfig.name, #objCapZone.objFlightGroups + 1)
104
+ )
105
+ flightgroup.MissionPatrol:SetEngageDetected(
106
+ 150,
107
+ {"All"},
108
+ objCapZone.objEngageZone
109
+ )
110
+ if objCapZone.customconfig.coalitionCAP == coalition.side.RED then
111
+ flightgroup.MissionPatrol:SetEnableMarkers(coalition.side.BLUE)
112
+ else
113
+ flightgroup.MissionPatrol:SetEnableMarkers(coalition.side.RED)
114
+ end
115
+ flightgroup.MissionPatrol.markerOn = (JTFF_verbosity_levels[JTFF_LOGLEVEL] >= 1)
116
+ flightgroup.MissionPatrol:UpdateMarker()
117
+ flightgroup.MissionPatrol:SetDuration((10*60*60))
118
+ flightgroup.MissionPatrol:SetVerbosity(JTFF_verbosity_levels[JTFF_LOGLEVEL])
119
+
120
+ -- ****************************Mission Add to FlightGroup**********************
121
+ flightgroup:AddMission(flightgroup.MissionPatrol)
122
+ flightgroup:MissionStart(flightgroup.MissionPatrol)
123
+ table.insert(objCapZone.objFlightGroups, flightgroup)
124
+ Jtff_log.debug(string.format("FlightGroup %s is assigned mission %s", SpawnGroup:GetName(), flightgroup.MissionPatrol:GetName()),"CAP_ZONE_TRAINING")
125
+ end, objCapZone)
126
+
127
+ -- ******************************************
128
+ -- ** Set Patrol Zone **
129
+ -- ******************************************
69
130
  if capzoneconfig.patrolZoneGroupName then
70
131
  objCapZone.objPatrolZone = ZONE_POLYGON:New(
71
132
  'CAP_PATROL_ZONE_'..capzoneconfig.name,
72
133
  GROUP:FindByName(capzoneconfig.patrolZoneGroupName))
73
- env.info('Training CAP : Patrol zone Polygon created : '.. objCapZone.objPatrolZone:GetName() ..'...')
134
+ Jtff_log.info(string.format("Patrol zone Polygon created : %s", objCapZone.objPatrolZone:GetName()),"CAP_ZONE_TRAINING")
74
135
  else
75
136
  if capzoneconfig.patrolZoneName then
76
137
  objCapZone.objPatrolZone = ZONE:New(capzoneconfig.patrolZoneName)
77
138
  end
78
139
  end
140
+ -- ******************************************
141
+ -- ** Set Engage Zone **
142
+ -- ******************************************
79
143
  if capzoneconfig.engageZoneGroupName then
80
144
  objCapZone.objEngageZone = ZONE_POLYGON:New(
81
145
  'CAP_ENGAGE_ZONE_'..capzoneconfig.name,
82
146
  GROUP:FindByName(capzoneconfig.engageZoneGroupName))
83
- env.info('Training CAP : Engage zone Polygon created : '.. objCapZone.objEngageZone:GetName() ..'...')
147
+ Jtff_log.info(string.format("Engage zone Polygon created : %s", objCapZone.objEngageZone:GetName()),"CAP_ZONE_TRAINING")
84
148
  else
85
149
  if capzoneconfig.engageZoneName then
86
150
  objCapZone.objEngageZone = ZONE:New(capzoneconfig.engageZoneName)
87
151
  end
88
152
  end
153
+
154
+ -- ******************************************
155
+ -- ** Draw Engage Zone **
156
+ -- ******************************************
89
157
  if capzoneconfig.coalitionCAP == coalition.side.RED then
90
- if ((capzoneconfig.drawzone == true) or false) then
158
+ if ((capzoneconfig.drawzone == true) or false or (JTFF_verbosity_levels[JTFF_LOGLEVEL] >= 5)) then
91
159
  objCapZone.objEngageZone:DrawZone(
92
160
  coalition.side.BLUE,
93
161
  {1,0,0},
@@ -110,7 +178,7 @@ for index, capzoneconfig in ipairs(TrainingCAPConfig) do
110
178
  )
111
179
  end
112
180
  else
113
- if ((capzoneconfig.drawzone == true) or false) then
181
+ if ((capzoneconfig.drawzone == true) or false or (JTFF_verbosity_levels[JTFF_LOGLEVEL] >= 5)) then
114
182
  objCapZone.objEngageZone:DrawZone(
115
183
  coalition.side.RED,
116
184
  {1,0,0},
@@ -133,42 +201,77 @@ for index, capzoneconfig in ipairs(TrainingCAPConfig) do
133
201
  )
134
202
  end
135
203
  end
204
+ -- *****************************************
205
+ -- ** Set Custom Config **
206
+ -- *****************************************
136
207
  objCapZone.customconfig = capzoneconfig
137
208
  CAPZoneArray[compteur] = objCapZone
209
+ -- ******************************************
210
+ -- ** Set Menu Commands **
211
+ -- ******************************************
138
212
  if capzoneconfig.coalitionCAP == coalition.side.RED then
139
213
  MENU_COALITION_COMMAND:New(
140
- coalition.side.BLUE,
141
- "Zone "..capzoneconfig.name.." Start",
142
- MenuCoalitionCAPZoneBlue,
143
- startCapZone,
144
- CAPZoneArray[compteur])
214
+ coalition.side.BLUE,
215
+ string.format("Zone %s : Spawn %d Hostile(s)", capzoneconfig.name, 1),
216
+ MenuCoalitionCAPZoneBlue,
217
+ startCapZone,
218
+ {CAPZoneArray[compteur], 1}
219
+ )
220
+ MENU_COALITION_COMMAND:New(
221
+ coalition.side.BLUE,
222
+ string.format("Zone %s : Spawn %d Hostile(s)", capzoneconfig.name, 2),
223
+ MenuCoalitionCAPZoneBlue,
224
+ startCapZone,
225
+ {CAPZoneArray[compteur], 2}
226
+ )
227
+ MENU_COALITION_COMMAND:New(
228
+ coalition.side.BLUE,
229
+ string.format("Zone %s : Spawn %d Hostile(s)", capzoneconfig.name, 4),
230
+ MenuCoalitionCAPZoneBlue,
231
+ startCapZone,
232
+ {CAPZoneArray[compteur], 4}
233
+ )
145
234
  MENU_COALITION_COMMAND:New(
146
- coalition.side.BLUE,
147
- "Zone "..capzoneconfig.name.." Clean",
148
- MenuCoalitionCAPZoneBlue,
149
- wipeCapZone,
150
- CAPZoneArray[compteur]
235
+ coalition.side.BLUE,
236
+ string.format("Zone %s : Clean", capzoneconfig.name),
237
+ MenuCoalitionCAPZoneBlue,
238
+ wipeCapZone,
239
+ CAPZoneArray[compteur]
151
240
  )
152
241
  else
153
242
  MENU_COALITION_COMMAND:New(
154
- coalition.side.RED,
155
- "Zone "..capzoneconfig.name.." Start",
156
- MenuCoalitionCAPZoneRed,
157
- startCapZone,
158
- CAPZoneArray[compteur])
243
+ coalition.side.RED,
244
+ string.format("Zone %s : Spawn %d Hostile(s)", capzoneconfig.name, 1),
245
+ MenuCoalitionCAPZoneRed,
246
+ startCapZone,
247
+ {CAPZoneArray[compteur], 1}
248
+ )
249
+ MENU_COALITION_COMMAND:New(
250
+ coalition.side.RED,
251
+ string.format("Zone %s : Spawn %d Hostile(s)", capzoneconfig.name, 2),
252
+ MenuCoalitionCAPZoneRed,
253
+ startCapZone,
254
+ {CAPZoneArray[compteur], 2}
255
+ )
256
+ MENU_COALITION_COMMAND:New(
257
+ coalition.side.RED,
258
+ string.format("Zone %s : Spawn %d Hostile(s)", capzoneconfig.name, 4),
259
+ MenuCoalitionCAPZoneRed,
260
+ startCapZone,
261
+ {CAPZoneArray[compteur], 4}
262
+ )
159
263
  MENU_COALITION_COMMAND:New(
160
- coalition.side.RED,
161
- "Zone "..capzoneconfig.name.." Clean",
162
- MenuCoalitionCAPZoneRed,
163
- wipeCapZone,
164
- CAPZoneArray[compteur]
264
+ coalition.side.RED,
265
+ string.format("Zone %s : Clean", capzoneconfig.name),
266
+ MenuCoalitionCAPZoneRed,
267
+ wipeCapZone,
268
+ CAPZoneArray[compteur]
165
269
  )
166
270
  end
167
- --CAPZoneArray[compteur]:Start()
168
271
  end
169
272
  end
170
273
 
171
- if compteur == 0 then
274
+ if #CAPZoneArray == 0 then
172
275
  MenuCoalitionCAPZoneBlue:Remove()
173
276
  MenuCoalitionCAPZoneRed:Remove()
174
277
  end