@jtff/miztemplate-lib 3.10.13 → 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.
- package/lua/lib/HoundElint.lua +11423 -11415
- package/lua/lib/Moose_.lua +26495 -35921
- package/lua/src/010-root_menus.lua +4 -3
- package/lua/src/020-mission_functions.lua +807 -217
- package/lua/src/110-set_clients.lua +53 -43
- package/lua/src/115-airbases.lua +191 -0
- package/lua/src/120-tankers.lua +577 -461
- package/lua/src/130-airboss.lua +1982 -440
- package/lua/src/150-awacs.lua +541 -445
- package/lua/src/160-atis.lua +136 -73
- package/lua/src/170-cap_zone_training.lua +176 -73
- package/lua/src/172-cap_zone_war.lua +383 -226
- package/lua/src/173-fox_zone_training.lua +142 -67
- package/lua/src/174-qra-scenario.lua +417 -362
- package/lua/src/176-random_air_traffic.lua +101 -12
- package/lua/src/178-training-intercept.lua +312 -261
- package/lua/src/180-logistics.lua +2 -2
- package/lua/src/190-ranges.lua +104 -37
- package/lua/src/191-sams.lua +4 -4
- package/lua/src/193-training_ranges.lua +2 -2
- package/lua/src/195-reaper-ondemand.lua +29 -29
- package/lua/src/196-fac_ranges.lua +2 -2
- package/lua/src/197-elint-ondemand.lua +53 -53
- package/lua/src/199-skynet.lua +55 -55
- package/package.json +1 -1
- package/scripts/inject-scripts.js +3 -31
- package/lua/src/135-pedro.lua +0 -21
- package/lua/src/140-beacons.lua +0 -19
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
-- *****************************************************************************
|
|
2
|
-
-- **
|
|
2
|
+
-- ** ClientWatch **
|
|
3
3
|
-- *********************************************************
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Set_AllClients = SET_CLIENT:New():FilterOnce()
|
|
5
|
+
Jtff_log.debug(string.format("Nbre Clients : %i", Set_AllClients:Count()),"GENERAL")
|
|
6
|
+
Set_AllBlueClients = SET_CLIENT:New():FilterCoalitions(coalition.side.BLUE):FilterOnce()
|
|
7
|
+
Jtff_log.debug(string.format("Nbre Blue Client : %i", Set_AllBlueClients:Count()),"GENERAL")
|
|
8
|
+
Set_AllRedClients = SET_CLIENT:New():FilterCoalitions(coalition.side.RED):FilterOnce()
|
|
9
|
+
Jtff_log.debug(string.format("Nbre Red Client : %i", Set_AllRedClients:Count()),"GENERAL")
|
|
10
|
+
|
|
11
|
+
AllClientsWatch = CLIENTWATCH:New(Set_AllClients:GetSetNames())
|
|
12
|
+
AllClientsWatch:HandleEvent(EVENTS.PlayerEnterAircraft)
|
|
13
|
+
AllClientsWatch:HandleEvent(EVENTS.Refueling)
|
|
14
|
+
AllClientsWatch:HandleEvent(EVENTS.RefuelingStop)
|
|
15
|
+
|
|
16
|
+
function AllClientsWatch:OnEventPlayerEnterAircraft(EventData)
|
|
9
17
|
if (EventData.IniGroupName) then
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
Jtff_log.debug(string.format("OnEventPlayerEnterAircraft: IniGroupName = %s", EventData.IniGroupName),"GENERAL")
|
|
19
|
+
Jtff_log.debug(string.format("OnEventPlayerEnterAircraft: IniPlayerName = %s", EventData.IniPlayerName),"GENERAL")
|
|
20
|
+
Jtff_log.debug(string.format("OnEventPlayerEnterAircraft: IniUnitName = %s", net.lua2json(EventData.IniUnitName)),"GENERAL")
|
|
13
21
|
local clientGroup = GROUP:FindByName(EventData.IniGroupName)
|
|
14
22
|
local clientUnit = UNIT:FindByName(EventData.IniUnitName)
|
|
15
23
|
local clientSetting = SETTINGS:Set( EventData.IniPlayerName)
|
|
@@ -27,14 +35,14 @@ function Set_CLIENT:OnEventPlayerEnterAircraft(EventData)
|
|
|
27
35
|
end
|
|
28
36
|
end
|
|
29
37
|
end
|
|
30
|
-
|
|
38
|
+
Jtff_log.debug(string.format("Add QRA Menu for group [%s], player name [%s]",EventData.IniGroupName , EventData.IniPlayerName),"QRA")
|
|
31
39
|
if type(QRAArray) == 'table' then
|
|
32
40
|
for index, objQRA in ipairs(QRAArray) do
|
|
33
|
-
if (MenuCoalitionQRA[clientUnit:GetCoalition()]) and (objQRA.customconfig.type == JTFF_QRA.Type.TangoAuto) then
|
|
41
|
+
if (MenuCoalitionQRA[UTILS.GetCoalitionName(clientUnit:GetCoalition())]) and (objQRA.customconfig.type == JTFF_QRA.Type.TangoAuto) then
|
|
34
42
|
objQRA.menu[clientUnit:GetCoalition()] = MENU_GROUP_COMMAND:New(
|
|
35
43
|
clientGroup,
|
|
36
44
|
"Trigger " .. objQRA.customconfig.name,
|
|
37
|
-
MenuCoalitionQRA[clientUnit:GetCoalition()],
|
|
45
|
+
MenuCoalitionQRA[UTILS.GetCoalitionName(clientUnit:GetCoalition())],
|
|
38
46
|
QRATrigger,
|
|
39
47
|
{
|
|
40
48
|
objQRA,
|
|
@@ -45,27 +53,34 @@ function Set_CLIENT:OnEventPlayerEnterAircraft(EventData)
|
|
|
45
53
|
end
|
|
46
54
|
end
|
|
47
55
|
end
|
|
48
|
-
|
|
56
|
+
Jtff_log.debug(
|
|
57
|
+
string.format(
|
|
58
|
+
"Add Tanker Menu for group [%s], player name [%s]",
|
|
59
|
+
EventData.IniGroupName,
|
|
60
|
+
EventData.IniPlayerName
|
|
61
|
+
),
|
|
62
|
+
"TANKER"
|
|
63
|
+
)
|
|
49
64
|
if clientUnit:GetCoalition() == coalition.side.BLUE then
|
|
50
|
-
MENU_GROUP_COMMAND:New( clientGroup, "Nearest Tanker Info",
|
|
51
|
-
MENU_GROUP_COMMAND:New( clientGroup, "All Tankers Info",
|
|
65
|
+
MENU_GROUP_COMMAND:New( clientGroup, "Nearest Tanker Info", MenuCoalitionTankers[UTILS.GetCoalitionName(coalition.side.BLUE)], NearestTankerInfo, { clientUnit, clientGroup} )
|
|
66
|
+
MENU_GROUP_COMMAND:New( clientGroup, "All Tankers Info", MenuCoalitionTankers[UTILS.GetCoalitionName(coalition.side.BLUE)], AllTankersInfo, {clientUnit,clientGroup} )
|
|
52
67
|
else
|
|
53
|
-
MENU_GROUP_COMMAND:New( clientGroup, "Nearest Tanker Info",
|
|
54
|
-
MENU_GROUP_COMMAND:New( clientGroup, "All Tankers Info",
|
|
68
|
+
MENU_GROUP_COMMAND:New( clientGroup, "Nearest Tanker Info", MenuCoalitionTankers[UTILS.GetCoalitionName(coalition.side.RED)], NearestTankerInfo, { clientUnit, clientGroup} )
|
|
69
|
+
MENU_GROUP_COMMAND:New( clientGroup, "All Tankers Info", MenuCoalitionTankers[UTILS.GetCoalitionName(coalition.side.RED)], AllTankersInfo, {clientUnit,clientGroup} )
|
|
55
70
|
end
|
|
56
71
|
local GroupMenu = MENU_GROUP:New( clientGroup, "My Group settings" )
|
|
57
|
-
|
|
72
|
+
Jtff_log.debug(string.format("Add Immortal Menu for group [%s], player name [%s]",EventData.IniGroupName , EventData.IniPlayerName),"GENERAL")
|
|
58
73
|
BASE:SetState( clientGroup, "isImmortal", false )
|
|
59
74
|
BASE:SetState( clientUnit, "isRefueling", false )
|
|
60
|
-
MENU_GROUP_COMMAND:New( clientGroup, "Switch immortal status", GroupMenu,
|
|
75
|
+
MENU_GROUP_COMMAND:New( clientGroup, "Switch immortal status", GroupMenu, SwitchGroupImmortalStatus, clientGroup )
|
|
61
76
|
if (type(AIRBOSSArray) == 'table') then
|
|
62
77
|
if #AIRBOSSArray > 0 then
|
|
63
|
-
MENU_GROUP_COMMAND:New( clientGroup, "Switch Airboss subtitles", GroupMenu,
|
|
78
|
+
MENU_GROUP_COMMAND:New( clientGroup, "Switch Airboss subtitles", GroupMenu, SwitchGroupAirbossSubtitlesStatus, clientGroup )
|
|
64
79
|
end
|
|
65
80
|
end
|
|
66
81
|
end
|
|
67
82
|
end
|
|
68
|
-
function
|
|
83
|
+
function AllClientsWatch:OnEventRefueling(EventData)
|
|
69
84
|
if (EventData.initiator) then
|
|
70
85
|
if NET:GetMyPlayerID() == 1 then
|
|
71
86
|
--trigger.action.outText("Vous êtes en mode multijoueur.", 90)
|
|
@@ -99,12 +114,12 @@ function Set_CLIENT:OnEventRefueling(EventData)
|
|
|
99
114
|
--trigger.action.outText(string.format("testing unit %s for clientRefuelableSet",unit:GetName()), 90)
|
|
100
115
|
if type(clientRefueling) ~= 'nil' then
|
|
101
116
|
clientRefuelableSet:AddObject(clientRefueling)
|
|
102
|
-
|
|
117
|
+
Jtff_log.trace(string.format("adding %s to clientRefuelableSet (refuelable aicrafts near tanker)",clientRefueling:GetPlayer()),"TANKER")
|
|
103
118
|
end
|
|
104
119
|
end
|
|
105
120
|
)
|
|
106
|
-
|
|
107
|
-
|
|
121
|
+
Jtff_log.trace(string.format("refuelingUnitSet (refuelable aicrafts near tanker) : count = %d",refuelingUnitsSet:Count()),"TANKER")
|
|
122
|
+
Jtff_log.trace(string.format("clientRefuelableSet (client refuelable aircrafts near tanker): count = %d",clientRefuelableSet:Count()),"TANKER")
|
|
108
123
|
if clientRefuelableSet:Count() >= 1 then
|
|
109
124
|
if clientRefuelableSet:Count() >= 2 then
|
|
110
125
|
clientRefuelableSet:ForEachClient(
|
|
@@ -118,7 +133,7 @@ function Set_CLIENT:OnEventRefueling(EventData)
|
|
|
118
133
|
local clientNameString = clientObject:GetPlayer() or unit:GetName()
|
|
119
134
|
BASE:SetState( unit, "isRefueling", true )
|
|
120
135
|
BASE:SetState( unit, "FuelState", initialFuelState )
|
|
121
|
-
|
|
136
|
+
Jtff_log.info(
|
|
122
137
|
string.format(
|
|
123
138
|
"[%s] Start refueling at the tanker [%s], current fuel : %.0f Lbs",
|
|
124
139
|
clientNameString,
|
|
@@ -145,19 +160,19 @@ function Set_CLIENT:OnEventRefueling(EventData)
|
|
|
145
160
|
clientName = client:GetPlayer() or clientUnit:GetName()
|
|
146
161
|
BASE:SetState( clientUnit, "FuelState", clientFuel )
|
|
147
162
|
BASE:SetState( clientUnit, "isRefueling", true )
|
|
148
|
-
|
|
163
|
+
Jtff_log.info(string.format("[%s] Start refueling at the tanker [%s], current fuel : %.0f Lbs", clientName, tankerUnitName, UTILS.kg2lbs(clientFuel)),"TANKER")
|
|
149
164
|
end
|
|
150
165
|
end
|
|
151
166
|
else
|
|
152
|
-
|
|
167
|
+
Jtff_log.error("tanker not found !!!","TANKER")
|
|
153
168
|
end
|
|
154
169
|
else
|
|
155
170
|
--trigger.action.outText("Vous êtes en mode solo.", 90)
|
|
156
171
|
local client = CLIENT:Find(EventData.initiator, true)
|
|
157
172
|
if (type(client) ~= 'nil') then
|
|
158
|
-
local clientUnit = UNIT:Find(EventData.initiator)
|
|
173
|
+
local clientUnit = UNIT:Find(EventData.initiator) or {}
|
|
159
174
|
local clientFuel = clientUnit:GetFuel() * clientUnit:GetDesc().fuelMassMax
|
|
160
|
-
local tankerUnit =
|
|
175
|
+
local tankerUnit = GetNearestTankerfromPlayerUnit(clientUnit)
|
|
161
176
|
local tankerUnitName = 'unknown'
|
|
162
177
|
if (type(tankerUnit) ~= 'nil') then
|
|
163
178
|
tankerUnitName = tankerUnit:GetName()
|
|
@@ -166,30 +181,30 @@ function Set_CLIENT:OnEventRefueling(EventData)
|
|
|
166
181
|
clientName = client:GetPlayer()
|
|
167
182
|
BASE:SetState( clientUnit, "FuelState", clientFuel )
|
|
168
183
|
BASE:SetState( clientUnit, "isRefueling", true )
|
|
169
|
-
|
|
184
|
+
Jtff_log.info(string.format("[%s] Start refueling at the tanker [%s], current fuel : %.0f Lbs", clientName, tankerUnitName, UTILS.kg2lbs(clientFuel)),"TANKER")
|
|
170
185
|
end
|
|
171
186
|
end
|
|
172
187
|
end
|
|
173
188
|
end
|
|
174
|
-
function
|
|
189
|
+
function AllClientsWatch:OnEventRefuelingStop(EventData)
|
|
175
190
|
if (EventData.initiator) then
|
|
176
191
|
local client = CLIENT:Find(EventData.initiator, true)
|
|
177
192
|
if (type(client) ~= 'nil') then
|
|
178
|
-
local clientUnit = UNIT:Find(EventData.initiator)
|
|
193
|
+
local clientUnit = UNIT:Find(EventData.initiator) or {}
|
|
179
194
|
local clientFuel = clientUnit:GetFuel() * clientUnit:GetDesc().fuelMassMax
|
|
180
|
-
local tankerUnit =
|
|
195
|
+
local tankerUnit = GetNearestTankerfromPlayerUnit(clientUnit)
|
|
181
196
|
local tankerUnitName = 'unknown'
|
|
182
197
|
if (type(tankerUnit) ~= 'nil') then
|
|
183
198
|
tankerUnitName = tankerUnit:GetName()
|
|
184
199
|
end
|
|
185
200
|
if not(BASE:GetState(clientUnit,"isRefueling")) then
|
|
186
|
-
|
|
201
|
+
Jtff_log.error(string.format("impossible to determine accurately fuel taken by [%s] : trying anyway...",client:GetPlayer()),"TANKER")
|
|
187
202
|
end
|
|
188
203
|
local clientFuelTaken = clientFuel - BASE:GetState(clientUnit,"FuelState")
|
|
189
204
|
BASE:SetState( clientUnit, "FuelState", clientFuel )
|
|
190
205
|
BASE:SetState( clientUnit, "isRefueling", false )
|
|
191
|
-
|
|
192
|
-
if (type(
|
|
206
|
+
Jtff_log.info(string.format("[%s] just finsihed refueling at the tanker [%s], taken %.0f Lbs",client:GetPlayer() , tankerUnitName, UTILS.kg2lbs(clientFuelTaken)),"TANKER")
|
|
207
|
+
if (type(Jtff_dcsbot) ~= 'nil') then
|
|
193
208
|
local title = string.format('End of Air refuel !')
|
|
194
209
|
local description = string.format("[%s] just finsihed refueling at the tanker [%s], taken %.0f Lbs",client:GetPlayer() , tankerUnitName, UTILS.kg2lbs(clientFuelTaken))
|
|
195
210
|
local img = 'https://cdn10.picryl.com/photo/2004/10/03/a-us-navy-usn-f-14b-tomcat-aircraft-assigned-to-fighter-squadron-one-zero-three-f5f749-1024.jpg'
|
|
@@ -199,13 +214,8 @@ function Set_CLIENT:OnEventRefuelingStop(EventData)
|
|
|
199
214
|
['RefuelQty'] = string.format("%.0f Lbs", UTILS.kg2lbs(clientFuelTaken))
|
|
200
215
|
}
|
|
201
216
|
local footer = 'Sorry, tomcats took it all again...'
|
|
202
|
-
|
|
217
|
+
Jtff_dcsbot.sendEmbed(title, description, img, fields, footer)
|
|
203
218
|
end
|
|
204
219
|
end
|
|
205
220
|
end
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
Set_CLIENT_Bleu = SET_CLIENT:New():FilterCoalitions(coalition.side.BLUE):FilterOnce()
|
|
209
|
-
jtff_log.debug(string.format("Nbre Blue Client : %i", Set_CLIENT_Bleu:Count()),"GENERAL")
|
|
210
|
-
Set_CLIENT_Red = SET_CLIENT:New():FilterCoalitions(coalition.side.RED):FilterOnce()
|
|
211
|
-
jtff_log.debug(string.format("Nbre Red Client : %i", Set_CLIENT_Red:Count()),"GENERAL")
|
|
221
|
+
end
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
-- *****************************************************************************
|
|
2
|
+
-- ** Root Commanders **
|
|
3
|
+
-- *********************************************************
|
|
4
|
+
Commander = {}
|
|
5
|
+
for _k,_coalition in pairs(coalition.side) do
|
|
6
|
+
Commander[UTILS.GetCoalitionName(_coalition)] = COMMANDER:New(_coalition,string.format('commander-%s', UTILS.GetCoalitionName(_coalition)))
|
|
7
|
+
Commander[UTILS.GetCoalitionName(_coalition)]:SetVerbosity(JTFF_verbosity_levels[JTFF_LOGLEVEL])
|
|
8
|
+
Commander[UTILS.GetCoalitionName(_coalition)]:Start()
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
-- *****************************************************************************
|
|
13
|
+
-- ** Airbases **
|
|
14
|
+
-- *********************************************************
|
|
15
|
+
|
|
16
|
+
-- region AirbaseConfigFunctions
|
|
17
|
+
-- @type AirbaseConfig
|
|
18
|
+
-- @field #string name Airbase name.
|
|
19
|
+
-- @field #string warehouse Warehouse name.
|
|
20
|
+
-- @field #boolean enable Enable airbase creation.
|
|
21
|
+
-- @field #AirwingConfig airwing Airwing configuration.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
--- Parse Airbases config Object.
|
|
25
|
+
-- @param #JsonObject config Config object to parse
|
|
26
|
+
-- @return #AirbaseConfig airbaseConfigJson Parsed AirbaseConfig object
|
|
27
|
+
function ParseAirbaseConfigJson(config)
|
|
28
|
+
local json = require('Scripts/json')
|
|
29
|
+
local parser_name = "AIRBASE"
|
|
30
|
+
-- **************************************************************************
|
|
31
|
+
-- enable
|
|
32
|
+
-- **************************************************************************
|
|
33
|
+
local airbaseConfigJson = {
|
|
34
|
+
enable = config.enable or false,
|
|
35
|
+
}
|
|
36
|
+
-- **************************************************************************
|
|
37
|
+
-- name
|
|
38
|
+
-- **************************************************************************
|
|
39
|
+
if type(config.name) == "string" then
|
|
40
|
+
airbaseConfigJson.name = config.name
|
|
41
|
+
if type(AIRBASE:FindByName(config.name)) == 'nil' then
|
|
42
|
+
Jtff_log.error(
|
|
43
|
+
string.format(
|
|
44
|
+
"Airbase %s not found, skipping its configuration",
|
|
45
|
+
config.name
|
|
46
|
+
),
|
|
47
|
+
parser_name
|
|
48
|
+
)
|
|
49
|
+
config.enable = false
|
|
50
|
+
return config
|
|
51
|
+
end
|
|
52
|
+
else
|
|
53
|
+
Jtff_log.error("Airbase name is not a string, skipping airbase configuration", parser_name)
|
|
54
|
+
config.enable = false
|
|
55
|
+
return config
|
|
56
|
+
end
|
|
57
|
+
-- **************************************************************************
|
|
58
|
+
-- Warehouse name
|
|
59
|
+
-- **************************************************************************
|
|
60
|
+
if type(config.warehouse) == "string" then
|
|
61
|
+
airbaseConfigJson.warehouse = config.warehouse
|
|
62
|
+
if type(STATIC:FindByName(config.warehouse, false)) == 'nil'
|
|
63
|
+
and type(UNIT:FindByName(config.warehouse)) == 'nil' then
|
|
64
|
+
Jtff_log.error(
|
|
65
|
+
string.format(
|
|
66
|
+
"Warehouse %s not found, skipping %s Airbase",
|
|
67
|
+
config.warehouse,
|
|
68
|
+
config.name or "unknown"
|
|
69
|
+
),
|
|
70
|
+
parser_name
|
|
71
|
+
)
|
|
72
|
+
config.enable = false
|
|
73
|
+
return config
|
|
74
|
+
end
|
|
75
|
+
else
|
|
76
|
+
Jtff_log.error("Airbase warehouse is not a string", parser_name)
|
|
77
|
+
config.enable = false
|
|
78
|
+
return config
|
|
79
|
+
end
|
|
80
|
+
-- **************************************************************************
|
|
81
|
+
-- AirWing
|
|
82
|
+
-- **************************************************************************
|
|
83
|
+
if type(config.airwing) == "table" then
|
|
84
|
+
airbaseConfigJson.airwing = ParseAirwingConfigJson(config.airwing, parser_name)
|
|
85
|
+
else
|
|
86
|
+
Jtff_log.error("Airbase airwing is not a table", parser_name)
|
|
87
|
+
config.enable = false
|
|
88
|
+
return config
|
|
89
|
+
end
|
|
90
|
+
Jtff_log.debug(
|
|
91
|
+
string.format(
|
|
92
|
+
"parsed Airbase config for %s Airbase, resulting config :\n%s",
|
|
93
|
+
config.name or "",
|
|
94
|
+
json:encode(
|
|
95
|
+
airbaseConfigJson,
|
|
96
|
+
{ indent = true }
|
|
97
|
+
)
|
|
98
|
+
),
|
|
99
|
+
parser_name
|
|
100
|
+
)
|
|
101
|
+
return airbaseConfigJson
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
-- endregion AirbaseConfigFunctions
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
AirbasesArray = {}
|
|
108
|
+
MenuCoalitionAirbases = {}
|
|
109
|
+
for _k, _coalition in pairs(coalition.side) do
|
|
110
|
+
MenuCoalitionAirbases[UTILS.GetCoalitionName(_coalition)] = MENU_COALITION:New(_coalition, "Airbases", MenuCoalition[UTILS.GetCoalitionName(_coalition)])
|
|
111
|
+
end
|
|
112
|
+
local compteur = #AirbasesArray
|
|
113
|
+
for _index, _currentAirbaseConfigObject in ipairs(AirBasesConfig) do
|
|
114
|
+
local airbaseconfig = ParseAirbaseConfigJson(_currentAirbaseConfigObject)
|
|
115
|
+
if airbaseconfig.enable == true then
|
|
116
|
+
compteur = compteur + 1
|
|
117
|
+
Jtff_log.info(
|
|
118
|
+
string.format(
|
|
119
|
+
'creation Airbase %s: Warehouse=%s ...',
|
|
120
|
+
airbaseconfig.name,
|
|
121
|
+
airbaseconfig.warehouse
|
|
122
|
+
),
|
|
123
|
+
"AIRBASE"
|
|
124
|
+
)
|
|
125
|
+
local objAirbase = AIRBASE:FindByName(airbaseconfig.name)
|
|
126
|
+
objAirbase.airwing = AIRWING:New(
|
|
127
|
+
airbaseconfig.warehouse,
|
|
128
|
+
airbaseconfig.airwing.name
|
|
129
|
+
)
|
|
130
|
+
Commander[objAirbase.airwing:GetCoalitionName()]:AddAirwing(
|
|
131
|
+
objAirbase.airwing
|
|
132
|
+
)
|
|
133
|
+
for _, _squadronconfig in ipairs(airbaseconfig.airwing.squadrons) do
|
|
134
|
+
local squadronToCreate = SQUADRON:New(
|
|
135
|
+
_squadronconfig.template,
|
|
136
|
+
_squadronconfig.nb_aircrafts,
|
|
137
|
+
_squadronconfig.name
|
|
138
|
+
)
|
|
139
|
+
squadronToCreate:SetFuelLowThreshold(_squadronconfig.fuellowthreshold)
|
|
140
|
+
squadronToCreate:SetFuelLowRefuel(_squadronconfig.lowfuelrtb)
|
|
141
|
+
squadronToCreate:SetGrouping(_squadronconfig.grouping)
|
|
142
|
+
squadronToCreate:SetModex(_squadronconfig.modex)
|
|
143
|
+
squadronToCreate:SetRadio(_squadronconfig.radio.freq, _squadronconfig.radio.modulation)
|
|
144
|
+
squadronToCreate:SetSkill(_squadronconfig.skill)
|
|
145
|
+
squadronToCreate:SetVerbosity(
|
|
146
|
+
JTFF_verbosity_levels[JTFF_LOGLEVEL]
|
|
147
|
+
)
|
|
148
|
+
squadronToCreate:SetTurnoverTime(
|
|
149
|
+
_squadronconfig.turnovertime,
|
|
150
|
+
_squadronconfig.repairtime
|
|
151
|
+
)
|
|
152
|
+
if type(_squadronconfig.livery) == 'string' then
|
|
153
|
+
squadronToCreate:SetLivery(_squadronconfig.livery)
|
|
154
|
+
end
|
|
155
|
+
for _, _payload in ipairs(_squadronconfig.payloads) do
|
|
156
|
+
local payloadTemplateGroup = GROUP:FindByName(_payload.name)
|
|
157
|
+
if #(_payload.payloadconfigs) > 0 then
|
|
158
|
+
for _, _payloadconfig in ipairs(_payload.payloadconfigs) do
|
|
159
|
+
squadronToCreate:AddMissionCapability(_payloadconfig.roles)
|
|
160
|
+
objAirbase.airwing:NewPayload(
|
|
161
|
+
payloadTemplateGroup:GetUnit(1),
|
|
162
|
+
_payloadconfig.qty,
|
|
163
|
+
_payloadconfig.roles,
|
|
164
|
+
_payloadconfig.perf
|
|
165
|
+
)
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
objAirbase.airwing:AddSquadron(
|
|
170
|
+
squadronToCreate
|
|
171
|
+
)
|
|
172
|
+
end
|
|
173
|
+
objAirbase.customconfig = airbaseconfig
|
|
174
|
+
AirbasesArray[compteur] = objAirbase
|
|
175
|
+
AirbasesArray[compteur].airwing:Start()
|
|
176
|
+
Jtff_log.debug(
|
|
177
|
+
string.format(
|
|
178
|
+
"Airbase %s added to AirbasesArray, index %d",
|
|
179
|
+
objAirbase.customconfig.name,
|
|
180
|
+
compteur
|
|
181
|
+
),
|
|
182
|
+
"AIRBASE"
|
|
183
|
+
)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if #AirbasesArray == 0 then
|
|
188
|
+
for _k, _coalition in pairs(coalition.side) do
|
|
189
|
+
MenuCoalitionAirbases[UTILS.GetCoalitionName(_coalition)]:Remove()
|
|
190
|
+
end
|
|
191
|
+
end
|