@jtff/miztemplate-lib 2.2.0 → 3.0.0-rc2
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/index.js +4 -3
- package/lib/jtff-lib-ci.js +1 -307
- package/lib/mizlib.js +337 -0
- package/lua/lib/Hercules_Cargo.lua +686 -0
- package/lua/lib/Moose_.lua +117314 -0
- package/lua/lib/Splash_Damage_2_0.lua +472 -0
- package/lua/lib/gemman.lua +1 -0
- package/lua/lib/mist_4_5_107.lua +9084 -0
- package/lua/lib/skynet-iads-compiled.lua +3864 -0
- package/lua/settings/settings-RAT.lua +235 -0
- package/lua/settings/settings-airboss.lua +142 -0
- package/lua/settings/settings-atis.lua +31 -0
- package/lua/settings/settings-awacs.lua +58 -0
- package/lua/settings/settings-awacsondemand.lua +26 -0
- package/lua/settings/settings-beacons.lua +10 -0
- package/lua/settings/settings-capwarzone.lua +164 -0
- package/lua/settings/settings-capzone.lua +32 -0
- package/lua/settings/settings-fac_ranges.lua +17 -0
- package/lua/settings/settings-foxzone.lua +14 -0
- package/lua/settings/settings-gemman.lua +6 -0
- package/lua/settings/settings-global.lua +31 -0
- package/lua/settings/settings-intercept.lua +23 -0
- package/lua/settings/settings-logistics.lua +22 -0
- package/lua/settings/settings-ondemandawacs.lua +29 -0
- package/lua/settings/settings-ondemandtankers.lua +29 -0
- package/lua/settings/settings-pedros.lua +11 -0
- package/lua/settings/settings-ranges.lua +28 -0
- package/lua/settings/settings-reapers.lua +25 -0
- package/lua/settings/settings-sams.lua +19 -0
- package/lua/settings/settings-skynet.lua +239 -0
- package/lua/settings/settings-tankers.lua +32 -0
- package/lua/settings/settings-training_ranges.lua +37 -0
- package/lua/src/010-root_menus.lua +5 -0
- package/lua/src/020-mission_functions.lua +1059 -0
- package/lua/src/110-set_clients.lua +61 -0
- package/lua/src/120-tankers.lua +589 -0
- package/lua/src/130-airboss.lua +621 -0
- package/lua/src/135-pedro.lua +21 -0
- package/lua/src/140-beacons.lua +19 -0
- package/lua/src/150-awacs.lua +599 -0
- package/lua/src/160-atis.lua +53 -0
- package/lua/src/170-cap_zone_training.lua +127 -0
- package/lua/src/172-cap_zone_war.lua +190 -0
- package/lua/src/173-fox_zone_training.lua +87 -0
- package/lua/src/176-random_air_traffic.lua +73 -0
- package/lua/src/178-training-intercept.lua +263 -0
- package/lua/src/180-logistics.lua +80 -0
- package/lua/src/190-ranges.lua +54 -0
- package/lua/src/191-sams.lua +49 -0
- package/lua/src/193-training_ranges.lua +191 -0
- package/lua/src/195-reaper-ondemand.lua +522 -0
- package/lua/src/196-fac_ranges.lua +34 -0
- package/lua/src/199-skynet.lua +721 -0
- package/lua/src/200-mission.lua +3 -0
- package/package.json +4 -3
- package/resources/radios/.gitkeep +0 -0
- package/resources/sounds/CTLD/beacon.ogg +0 -0
- package/resources/sounds/CTLD/beaconsilent.ogg +0 -0
- package/resources/sounds/Misc/.gitkeep +0 -0
- package/resources/sounds/Misc/2_Bips.ogg +0 -0
- package/resources/sounds/Misc/Bip.ogg +0 -0
- package/resources/sounds/Misc/crash_wood.ogg +0 -0
- package/scripts/build.js +2 -1
- package/scripts/inject-scripts.js +127 -230
- package/scripts/template-update.js +1 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
-- *****************************************************************************
|
|
2
|
+
-- ** Interception Training **
|
|
3
|
+
-- *********************************************************
|
|
4
|
+
function clearIntercept(param)
|
|
5
|
+
local objInterceptIndex = param[1]
|
|
6
|
+
local objIntercept = InterceptArray[objInterceptIndex]
|
|
7
|
+
debug_msg(string.format("Intercept: objIntercept.objSpawn is %s", net.lua2json(objIntercept.objSpawn)))
|
|
8
|
+
local GroupPlane, Index = objIntercept.objSpawn:GetFirstAliveGroup()
|
|
9
|
+
while GroupPlane ~= nil do
|
|
10
|
+
GroupPlane:ScheduleStop()
|
|
11
|
+
GroupPlane:Destroy(true,0)
|
|
12
|
+
GroupPlane, Index = objIntercept.objSpawn:GetNextAliveGroup( Index )
|
|
13
|
+
end
|
|
14
|
+
collectgarbage()
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
function interceptDefendFicghter(targetGroup)
|
|
18
|
+
targetGroup:OptionROEWeaponFree()
|
|
19
|
+
targetGroup:OptionROTVertical()
|
|
20
|
+
targetGroup:OptionRTBBingoFuel(true)
|
|
21
|
+
targetGroup:OptionRestrictBurner(false)
|
|
22
|
+
targetGroup:EnableEmission(true)
|
|
23
|
+
targetGroup:OptionAlarmStateRed()
|
|
24
|
+
targetGroup:OptionECM_DetectedLockByRadar()
|
|
25
|
+
targetGroup:CommandEPLRS(true)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
function interceptDefendFastBomber(targetGroup)
|
|
29
|
+
targetGroup:OptionRestrictBurner(false)
|
|
30
|
+
local targetDestinationCoord = targetGroup:GetCoordinate():Translate(
|
|
31
|
+
UTILS.NMToMeters(150),
|
|
32
|
+
targetGroup:GetHeading(),
|
|
33
|
+
true,
|
|
34
|
+
false
|
|
35
|
+
):SetAltitude(UTILS.FeetToMeters(55000), true)
|
|
36
|
+
targetGroup:Route(
|
|
37
|
+
{
|
|
38
|
+
targetDestinationCoord:WaypointAirTurningPoint(
|
|
39
|
+
COORDINATE.WaypointAltType.BARO,
|
|
40
|
+
UTILS.KnotsToKmph(5000),
|
|
41
|
+
nil,
|
|
42
|
+
"End interception"
|
|
43
|
+
),
|
|
44
|
+
targetDestinationCoord:GetClosestAirbase(
|
|
45
|
+
targetGroup:GetCategory(),
|
|
46
|
+
targetGroup:GetCoalition()
|
|
47
|
+
):GetCoordinate():WaypointAirLanding(
|
|
48
|
+
UTILS.KnotsToKmph(250),
|
|
49
|
+
targetDestinationCoord:GetClosestAirbase(
|
|
50
|
+
targetGroup:GetCategory(),
|
|
51
|
+
targetGroup:GetCoalition()
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
function interceptDetection(param)
|
|
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)))
|
|
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)))
|
|
65
|
+
if (SET_CLIENT:New():FilterZones({objIntercept.interceptDetectionZone}):FilterOnce():CountAlive() > 0) then
|
|
66
|
+
objIntercept.bubbleInvaded = true
|
|
67
|
+
debug_msg(string.format("Intercept: %s has been intercepted", objIntercept.interceptTarget:GetName()))
|
|
68
|
+
if (objIntercept.knowIsIntercepted == false) then
|
|
69
|
+
if (math.random(1,100) >= 75) then
|
|
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))
|
|
72
|
+
objIntercept.knowIsIntercepted = true
|
|
73
|
+
if objIntercept.customconfig.type == 'fastbomber' then
|
|
74
|
+
SCHEDULER:New(
|
|
75
|
+
objIntercept.interceptTarget,
|
|
76
|
+
interceptDefendFastBomber,
|
|
77
|
+
{},
|
|
78
|
+
delay
|
|
79
|
+
)
|
|
80
|
+
elseif objIntercept.customconfig.type == 'fighter' then
|
|
81
|
+
SCHEDULER:New(
|
|
82
|
+
objIntercept.interceptTarget,
|
|
83
|
+
interceptDefendFicghter,
|
|
84
|
+
{},
|
|
85
|
+
delay
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
else
|
|
89
|
+
debug_msg(string.format("Intercept: %s has not detected soon enough it has been intercepted", objIntercept.interceptTarget:GetName()))
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
function StartInterceptTraining(param)
|
|
97
|
+
local fighterUnitName = param[1]
|
|
98
|
+
local objInterceptIndex = param[2]
|
|
99
|
+
local minTA = param[3]
|
|
100
|
+
local maxTA = param[4]
|
|
101
|
+
local fighterUnit = UNIT:FindByName(fighterUnitName)
|
|
102
|
+
local fighterGroup = fighterUnit:GetGroup()
|
|
103
|
+
local fighterCoord = fighterUnit:GetCoordinate()
|
|
104
|
+
local fighterHeading = fighterUnit:GetHeading()
|
|
105
|
+
local fighterAltitude = fighterUnit:GetAltitude(false)
|
|
106
|
+
local deltaAltMax = nil
|
|
107
|
+
local targetGroup = nil
|
|
108
|
+
local targetRange = nil
|
|
109
|
+
local targetGroundSpeed = 450
|
|
110
|
+
local targetAngle = math.mod(minTA + math.random(0,maxTA-minTA),360)
|
|
111
|
+
if (math.abs(math.mod(targetAngle,180)) > 50) then
|
|
112
|
+
targetRange = 40
|
|
113
|
+
deltaAltMax = 7000
|
|
114
|
+
elseif (math.abs(math.mod(targetAngle,180)) > 20) then
|
|
115
|
+
targetRange = 60
|
|
116
|
+
deltaAltMax = 10000
|
|
117
|
+
else
|
|
118
|
+
targetRange = 90
|
|
119
|
+
deltaAltMax = 15000
|
|
120
|
+
end
|
|
121
|
+
debug_msg(string.format("Intercept: Launching exercise TargetAngle %i degrees", targetAngle))
|
|
122
|
+
debug_msg(string.format("Intercept: Index is : %i", objInterceptIndex))
|
|
123
|
+
local targetSpawnObj = InterceptArray[objInterceptIndex].objSpawn
|
|
124
|
+
local targetCoord = POINT_VEC3:NewFromVec3(
|
|
125
|
+
{
|
|
126
|
+
x = fighterCoord.x + math.floor(UTILS.NMToMeters(targetRange) * math.cos(math.rad(fighterHeading))),
|
|
127
|
+
y = math.max(
|
|
128
|
+
math.min(
|
|
129
|
+
math.random(
|
|
130
|
+
fighterCoord.y - UTILS.FeetToMeters(deltaAltMax),
|
|
131
|
+
fighterCoord.y + UTILS.FeetToMeters(deltaAltMax)
|
|
132
|
+
),
|
|
133
|
+
UTILS.FeetToMeters(32000)
|
|
134
|
+
),
|
|
135
|
+
UTILS.FeetToMeters(8000)
|
|
136
|
+
),
|
|
137
|
+
z = fighterCoord.z + math.floor(UTILS.NMToMeters(targetRange) * math.sin(math.rad(fighterHeading))),
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
debug_msg(string.format("Intercept: Spawning target based on %s with TargetAngle of %i degrees", targetSpawnObj.SpawnTemplatePrefix, targetAngle))
|
|
141
|
+
targetGroup = targetSpawnObj:InitHeading(math.mod(fighterHeading + 180 + targetAngle,360)):SpawnFromVec3(targetCoord)
|
|
142
|
+
targetGroup:OptionROE(ENUMS.ROE.WeaponHold)
|
|
143
|
+
targetGroup:OptionROT(ENUMS.ROT.NoReaction)
|
|
144
|
+
targetGroup:OptionRTBBingoFuel(true)
|
|
145
|
+
targetGroup:OptionRestrictBurner(false)
|
|
146
|
+
targetGroup:EnableEmission(false)
|
|
147
|
+
targetGroup:OptionAlarmStateGreen()
|
|
148
|
+
targetGroup:OptionECM_Never()
|
|
149
|
+
targetGroup:CommandEPLRS(true)
|
|
150
|
+
InterceptArray[objInterceptIndex].interceptTarget = targetGroup
|
|
151
|
+
InterceptArray[objInterceptIndex].knowIsIntercepted = false
|
|
152
|
+
InterceptArray[objInterceptIndex].bubbleInvaded = false
|
|
153
|
+
local targetDetectionRange = 1.5
|
|
154
|
+
--targetDetectionRange = 70
|
|
155
|
+
InterceptArray[objInterceptIndex].interceptDetectionZone = ZONE_GROUP:New(
|
|
156
|
+
"intercept-" .. targetGroup:GetName(),
|
|
157
|
+
targetGroup,
|
|
158
|
+
UTILS.NMToMeters(targetDetectionRange)
|
|
159
|
+
)
|
|
160
|
+
InterceptArray[objInterceptIndex].interceptTarget:ScheduleRepeat(
|
|
161
|
+
0,
|
|
162
|
+
5,
|
|
163
|
+
nil,
|
|
164
|
+
nil,
|
|
165
|
+
interceptDetection,
|
|
166
|
+
{
|
|
167
|
+
InterceptArray[objInterceptIndex]
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
local targetDestinationCoord = targetGroup:GetCoordinate():Translate(
|
|
171
|
+
UTILS.NMToMeters(200),
|
|
172
|
+
math.mod(fighterHeading+180+ targetAngle,360),
|
|
173
|
+
true,
|
|
174
|
+
false
|
|
175
|
+
)
|
|
176
|
+
targetGroup:Route(
|
|
177
|
+
{
|
|
178
|
+
targetDestinationCoord:WaypointAirTurningPoint(
|
|
179
|
+
COORDINATE.WaypointAltType.BARO,
|
|
180
|
+
UTILS.KnotsToKmph(targetGroundSpeed),
|
|
181
|
+
nil,
|
|
182
|
+
"End interception"
|
|
183
|
+
),
|
|
184
|
+
targetDestinationCoord:GetClosestAirbase(
|
|
185
|
+
targetGroup:GetCategory(),
|
|
186
|
+
targetGroup:GetCoalition()
|
|
187
|
+
):GetCoordinate():WaypointAirLanding(
|
|
188
|
+
UTILS.KnotsToKmph(targetGroundSpeed),
|
|
189
|
+
targetDestinationCoord:GetClosestAirbase(
|
|
190
|
+
targetGroup:GetCategory(),
|
|
191
|
+
targetGroup:GetCoalition()
|
|
192
|
+
)
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
return targetGroup
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
InterceptArray = {}
|
|
200
|
+
compteur = 0
|
|
201
|
+
MenuCoalitionInterceptBlue = MENU_COALITION:New(coalition.side.BLUE, "Intercept Training", MenuCoalitionBlue)
|
|
202
|
+
MenuCoalitionInterceptRed = MENU_COALITION:New(coalition.side.RED, "Intercept Training", MenuCoalitionRed)
|
|
203
|
+
for index, intconfig in ipairs(InterceptConfig) do
|
|
204
|
+
if intconfig.enable == true then
|
|
205
|
+
debug_msg(string.format("Intercept: Enable %s with %s behavior", intconfig.name, intconfig.type))
|
|
206
|
+
compteur = compteur +1
|
|
207
|
+
local objIntercept = {
|
|
208
|
+
customconfig = {},
|
|
209
|
+
objSpawn = nil,
|
|
210
|
+
menus = {},
|
|
211
|
+
menu_finex = {},
|
|
212
|
+
knowIsIntercepted = false,
|
|
213
|
+
bubbleInvaded = false,
|
|
214
|
+
}
|
|
215
|
+
objIntercept.objSpawn = SPAWN:New(intconfig.templates[1])
|
|
216
|
+
:InitSkill(intconfig.skill)
|
|
217
|
+
:InitRandomizeTemplatePrefixes(intconfig.templates)
|
|
218
|
+
if (intconfig.type == 'civil') then
|
|
219
|
+
objIntercept.menus[coalition.side.BLUE] = MENU_COALITION:New(coalition.side.BLUE, intconfig.name, MenuCoalitionInterceptBlue)
|
|
220
|
+
objIntercept.menu_finex[coalition.side.BLUE] = MENU_COALITION_COMMAND:New(
|
|
221
|
+
coalition.side.BLUE,
|
|
222
|
+
"Knock it off, FinEx !!",
|
|
223
|
+
objIntercept.menus[coalition.side.BLUE],
|
|
224
|
+
clearIntercept,
|
|
225
|
+
{
|
|
226
|
+
compteur
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
objIntercept.menus[coalition.side.RED] = MENU_COALITION:New(coalition.side.RED, intconfig.name, MenuCoalitionInterceptRed)
|
|
230
|
+
objIntercept.menu_finex[coalition.side.RED] = MENU_COALITION_COMMAND:New(
|
|
231
|
+
coalition.side.RED,
|
|
232
|
+
"Knock it off, FinEx !!",
|
|
233
|
+
objIntercept.menus[coalition.side.RED],
|
|
234
|
+
clearIntercept,
|
|
235
|
+
{
|
|
236
|
+
compteur
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
else
|
|
240
|
+
if (intconfig.benefitCoalition == coalition.side.BLUE) then
|
|
241
|
+
objIntercept.menus[intconfig.benefitCoalition] = MENU_COALITION:New(intconfig.benefitCoalition, intconfig.name, MenuCoalitionInterceptBlue)
|
|
242
|
+
else
|
|
243
|
+
objIntercept.menus[intconfig.benefitCoalition] = MENU_COALITION:New(intconfig.benefitCoalition, intconfig.name, MenuCoalitionInterceptRed)
|
|
244
|
+
end
|
|
245
|
+
objIntercept.menu_finex[intconfig.benefitCoalition] = MENU_COALITION_COMMAND:New(
|
|
246
|
+
intconfig.benefitCoalition,
|
|
247
|
+
"Knock it off, FinEx !!",
|
|
248
|
+
objIntercept.menus[intconfig.benefitCoalition],
|
|
249
|
+
clearIntercept,
|
|
250
|
+
{
|
|
251
|
+
compteur
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
end
|
|
255
|
+
objIntercept.customconfig = intconfig
|
|
256
|
+
InterceptArray[compteur] = objIntercept
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
if compteur == 0 then
|
|
261
|
+
MenuCoalitionInterceptBlue:Remove()
|
|
262
|
+
MenuCoalitionInterceptRed:Remove()
|
|
263
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
-- *****************************************************************************
|
|
2
|
+
-- ** CTLD Logistics **
|
|
3
|
+
-- *********************************************************
|
|
4
|
+
|
|
5
|
+
CTLDArray = {}
|
|
6
|
+
compteur = 0
|
|
7
|
+
mainRadioMenuForLogisticsBlue = MENU_COALITION:New( coalition.side.BLUE , "Logistics", MenuCoalitionBlue )
|
|
8
|
+
mainRadioMenuForLogisticsRed = MENU_COALITION:New( coalition.side.RED , "Logistics", MenuCoalitionRed )
|
|
9
|
+
for index, ctldconfig in ipairs(CTLDConfig) do
|
|
10
|
+
if ctldconfig.enable == true then
|
|
11
|
+
compteur = compteur + 1
|
|
12
|
+
env.info('creation Logistics : '.. ctldconfig.name..'...')
|
|
13
|
+
CTLDArray[compteur] = {
|
|
14
|
+
customconfig = ctldconfig,
|
|
15
|
+
CTLDObject = CTLD:New(ctldconfig.benefit_coalition,{},ctldconfig.name),
|
|
16
|
+
LogisticsRootMenu = {},
|
|
17
|
+
SubLogisticsMenus = {},
|
|
18
|
+
}
|
|
19
|
+
if (ctldconfig.benefit_coalition == coalition.side.BLUE) then
|
|
20
|
+
CTLDArray[compteur].LogisticsRootMenu = MENU_COALITION:New( coalition.side.BLUE, ctldconfig.name , mainRadioMenuForLogisticsBlue)
|
|
21
|
+
local radioMenuForRange = CTLDArray[compteur].LogisticsRootMenu
|
|
22
|
+
else
|
|
23
|
+
CTLDArray[compteur].LogisticsRootMenu = MENU_COALITION:New( coalition.side.RED, ctldconfig.name , mainRadioMenuForLogisticsRed)
|
|
24
|
+
local radioMenuForRange = CTLDArray[compteur].LogisticsRootMenu
|
|
25
|
+
end
|
|
26
|
+
CTLDArray[compteur].CTLDObject.useprefix = ctldconfig.useprefix
|
|
27
|
+
CTLDArray[compteur].CTLDObject.CrateDistance = ctldconfig.CrateDistance or 35
|
|
28
|
+
CTLDArray[compteur].CTLDObject.dropcratesanywhere = ctldconfig.dropcratesanywhere
|
|
29
|
+
CTLDArray[compteur].CTLDObject.maximumHoverHeight = ctldconfig.maximumHoverHeight or 15
|
|
30
|
+
CTLDArray[compteur].CTLDObject.minimumHoverHeight = ctldconfig.minimumHoverHeight or 4
|
|
31
|
+
CTLDArray[compteur].CTLDObject.forcehoverload = ctldconfig.forcehoverload
|
|
32
|
+
CTLDArray[compteur].CTLDObject.hoverautoloading = ctldconfig.hoverautoloading
|
|
33
|
+
CTLDArray[compteur].CTLDObject.smokedistance = ctldconfig.smokedistance or UTILS.NMToMeters(5)
|
|
34
|
+
CTLDArray[compteur].CTLDObject.movetroopstowpzone = ctldconfig.movetroopstowpzone
|
|
35
|
+
CTLDArray[compteur].CTLDObject.movetroopsdistance = ctldconfig.movetroopsdistance or UTILS.NMToMeters(3)
|
|
36
|
+
CTLDArray[compteur].CTLDObject.smokedistance = ctldconfig.smokedistance or UTILS.NMToMeters(2)
|
|
37
|
+
CTLDArray[compteur].CTLDObject.suppressmessages = ctldconfig.suppressmessages
|
|
38
|
+
CTLDArray[compteur].CTLDObject.repairtime = ctldconfig.repairtime or 300
|
|
39
|
+
CTLDArray[compteur].CTLDObject.buildtime = ctldconfig.buildtime or 300
|
|
40
|
+
CTLDArray[compteur].CTLDObject.allowcratepickupagain = ctldconfig.allowcratepickupagain
|
|
41
|
+
CTLDArray[compteur].CTLDObject.enableslingload = ctldconfig.enableslingload
|
|
42
|
+
CTLDArray[compteur].CTLDObject.pilotmustopendoors = ctldconfig.pilotmustopendoors
|
|
43
|
+
CTLDArray[compteur].CTLDObject.placeCratesAhead = ctldconfig.placeCratesAhead
|
|
44
|
+
CTLDArray[compteur].CTLDObject.nobuildinloadzones = ctldconfig.nobuildinloadzones
|
|
45
|
+
for indexzone, zone in ipairs(ctldconfig.zones) do
|
|
46
|
+
CTLDArray[compteur].CTLDObject:AddCTLDZone(
|
|
47
|
+
zone.zoneName,
|
|
48
|
+
zone.zoneType or CTLD.CargoZoneType.LOAD,
|
|
49
|
+
zone.smokeColor or nil,
|
|
50
|
+
zone.active or false,
|
|
51
|
+
zone.beacon or false)
|
|
52
|
+
end
|
|
53
|
+
for indexcrate, crate in ipairs(ctldconfig.crates) do
|
|
54
|
+
CTLDArray[compteur].CTLDObject:AddCratesCargo(
|
|
55
|
+
crate.crateName,
|
|
56
|
+
crate.templateGroups or {},
|
|
57
|
+
crate.crateCargoType or CTLD_CARGO.Enum.CRATE,
|
|
58
|
+
crate.crateNumber or 1,
|
|
59
|
+
crate.crateWeight or 0,
|
|
60
|
+
crate.crateStock or 10
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
for indextroops, troop in ipairs(ctldconfig.troops) do
|
|
64
|
+
CTLDArray[compteur].CTLDObject:AddTroopsCargo(
|
|
65
|
+
troop.troopName,
|
|
66
|
+
troop.templateGroups or {},
|
|
67
|
+
troop.crateCargoType or CTLD_CARGO.Enum.TROOPS,
|
|
68
|
+
troop.troopSeats or 1,
|
|
69
|
+
troop.troopWeight or 0,
|
|
70
|
+
troop.troopStock or 10
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
CTLDArray[compteur].CTLDObject:__Start(5)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
if compteur == 0 then
|
|
78
|
+
mainRadioMenuForLogisticsBlue:Remove()
|
|
79
|
+
mainRadioMenuForLogisticsRed:Remove()
|
|
80
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
-- *****************************************************************************
|
|
2
|
+
-- ** RANGES **
|
|
3
|
+
-- *********************************************************
|
|
4
|
+
RangesArray = {}
|
|
5
|
+
compteur = 0
|
|
6
|
+
mainRadioMenuForRangesBlue = MENU_COALITION:New( coalition.side.BLUE , "RANGES", MenuCoalitionBlue )
|
|
7
|
+
mainRadioMenuForRangesRed = MENU_COALITION:New( coalition.side.RED , "RANGES", MenuCoalitionRed )
|
|
8
|
+
for index, rangeconfig in ipairs(RangeConfig) do
|
|
9
|
+
if rangeconfig.enable == true then
|
|
10
|
+
compteur = compteur + 1
|
|
11
|
+
env.info('creation Range : '.. rangeconfig.name..'...')
|
|
12
|
+
RangesArray[compteur] = {
|
|
13
|
+
customconfig = rangeconfig,
|
|
14
|
+
RangeRootMenu = {},
|
|
15
|
+
SubRangeMenus = {},
|
|
16
|
+
}
|
|
17
|
+
if (rangeconfig.benefit_coalition == coalition.side.BLUE) then
|
|
18
|
+
RangesArray[compteur].RangeRootMenu = MENU_COALITION:New( coalition.side.BLUE, rangeconfig.name , mainRadioMenuForRangesBlue)
|
|
19
|
+
local radioMenuForRange = RangesArray[compteur].RangeRootMenu
|
|
20
|
+
for indexsubRange, subRangeConfig in ipairs(rangeconfig.subRange) do
|
|
21
|
+
RangesArray[compteur].SubRangeMenus[indexsubRange] = MENU_COALITION:New(rangeconfig.benefit_coalition, subRangeConfig.name, radioMenuForRange)
|
|
22
|
+
local radioMenuSubRange = RangesArray[compteur].SubRangeMenus[indexsubRange]
|
|
23
|
+
if (subRangeConfig.subsubRange ~= nil) then
|
|
24
|
+
for indexSubSubRange, subsubRangeConfig in ipairs(subRangeConfig.subsubRange) do
|
|
25
|
+
local radioMenuSubSubRange = MENU_COALITION:New(rangeconfig.benefit_coalition, subsubRangeConfig.name, radioMenuSubRange)
|
|
26
|
+
addSubRangeRadioMenus(radioMenuSubSubRange, rangeconfig, subsubRangeConfig)
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
addSubRangeRadioMenus(radioMenuSubRange, rangeconfig, subRangeConfig)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
AddWholeRangeCoalitionCommandMenus(radioMenuForRange, rangeconfig)
|
|
33
|
+
else
|
|
34
|
+
local radioMenuForRange = MENU_COALITION:New( coalition.side.RED, rangeconfig.name , mainRadioMenuForRangesRed)
|
|
35
|
+
for index, subRangeConfig in ipairs(rangeconfig.subRange) do
|
|
36
|
+
local radioMenuSubRange = MENU_COALITION:New(rangeconfig.benefit_coalition, subRangeConfig.name, radioMenuForRange)
|
|
37
|
+
if (subRangeConfig.subsubRange ~= nil) then
|
|
38
|
+
for index, subsubRangeConfig in ipairs(subRangeConfig.subsubRange) do
|
|
39
|
+
local radioMenuSubSubRange = MENU_COALITION:New(rangeconfig.benefit_coalition, subsubRangeConfig.name, radioMenuSubRange)
|
|
40
|
+
addSubRangeRadioMenus(radioMenuSubSubRange, rangeconfig, subsubRangeConfig)
|
|
41
|
+
end
|
|
42
|
+
else
|
|
43
|
+
addSubRangeRadioMenus(radioMenuSubRange, rangeconfig, subRangeConfig)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
AddWholeRangeCoalitionCommandMenus(radioMenuForRange, rangeconfig)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
if compteur == 0 then
|
|
52
|
+
mainRadioMenuForRangesBlue:Remove()
|
|
53
|
+
mainRadioMenuForRangesRed:Remove()
|
|
54
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
-- *****************************************************************************
|
|
2
|
+
-- ** SAMS **
|
|
3
|
+
-- *********************************************************
|
|
4
|
+
|
|
5
|
+
SamsArray = {}
|
|
6
|
+
compteur = 0
|
|
7
|
+
mainRadioMenuForSamsBlue = MENU_COALITION:New( coalition.side.BLUE , "SAMs", MenuCoalitionBlue )
|
|
8
|
+
mainRadioMenuForSamsRed = MENU_COALITION:New( coalition.side.RED , "SAMs", MenuCoalitionRed )
|
|
9
|
+
for index, samconfig in ipairs(SamsConfig) do
|
|
10
|
+
if samconfig.enable == true then
|
|
11
|
+
compteur = compteur + 1
|
|
12
|
+
env.info('creation Sam site : '.. samconfig.name..'...')
|
|
13
|
+
SamsArray[compteur] = {
|
|
14
|
+
customconfig = samconfig
|
|
15
|
+
}
|
|
16
|
+
if (samconfig.benefit_coalition == coalition.side.BLUE) then
|
|
17
|
+
local radioMenuForRange = MENU_COALITION:New( coalition.side.BLUE, samconfig.name , mainRadioMenuForSamsBlue)
|
|
18
|
+
for index, subRangeConfig in ipairs(samconfig.subRange) do
|
|
19
|
+
local radioMenuSubRange = MENU_COALITION:New(samconfig.benefit_coalition, subRangeConfig.name, radioMenuForRange)
|
|
20
|
+
if (subRangeConfig.subsubRange ~= nil) then
|
|
21
|
+
for index, subsubRangeConfig in ipairs(subRangeConfig.subsubRange) do
|
|
22
|
+
local radioMenuSubSubRange = MENU_COALITION:New(samconfig.benefit_coalition, subsubRangeConfig.name, radioMenuSubRange)
|
|
23
|
+
addSubRangeRadioMenus(radioMenuSubSubRange, samconfig, subsubRangeConfig)
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
addSubRangeRadioMenus(radioMenuSubRange, samconfig, subRangeConfig)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
else
|
|
30
|
+
local radioMenuForRange = MENU_COALITION:New( coalition.side.RED, samconfig.name , mainRadioMenuForSamsRed)
|
|
31
|
+
for index, subRangeConfig in ipairs(samconfig.subRange) do
|
|
32
|
+
local radioMenuSubRange = MENU_COALITION:New(samconfig.benefit_coalition, subRangeConfig.name, radioMenuForRange)
|
|
33
|
+
if (subRangeConfig.subsubRange ~= nil) then
|
|
34
|
+
for index, subsubRangeConfig in ipairs(subRangeConfig.subsubRange) do
|
|
35
|
+
local radioMenuSubSubRange = MENU_COALITION:New(samconfig.benefit_coalition, subsubRangeConfig.name, radioMenuSubRange)
|
|
36
|
+
addSubRangeRadioMenus(radioMenuSubSubRange, samconfig, subsubRangeConfig)
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
addSubRangeRadioMenus(radioMenuSubRange, samconfig, subRangeConfig)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if compteur == 0 then
|
|
47
|
+
mainRadioMenuForSamsBlue:Remove()
|
|
48
|
+
mainRadioMenuForSamsRed:Remove()
|
|
49
|
+
end
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
-- *****************************************************************************
|
|
2
|
+
-- ** Training RANGES **
|
|
3
|
+
-- *********************************************************
|
|
4
|
+
|
|
5
|
+
TrainingRangeArray = {}
|
|
6
|
+
compteur = 0
|
|
7
|
+
for index, traingingrangeconfig in ipairs(TrainingRangeConfig) do
|
|
8
|
+
if traingingrangeconfig.enable == true then
|
|
9
|
+
compteur = compteur + 1
|
|
10
|
+
env.info('creation of Training Range : ' .. traingingrangeconfig.name .. '...')
|
|
11
|
+
TrainingRangeArray[compteur] = {
|
|
12
|
+
customconfig = traingingrangeconfig
|
|
13
|
+
}
|
|
14
|
+
trainingRange = RANGE:New(traingingrangeconfig.name)
|
|
15
|
+
trainingRange:SetDefaultPlayerSmokeBomb(false)
|
|
16
|
+
trainingRange:SetRangeRadius(0.2) -- bomb impact at more than 200m is out of range
|
|
17
|
+
trainingRange:SetScoreBombDistance(100)-- bomb impact at more than 100m won't be taken into account
|
|
18
|
+
trainingRange:SetFunkManOn(10043,"127.0.0.1")
|
|
19
|
+
trainingRange:SetAutosaveOn()
|
|
20
|
+
trainingRange:SetTargetSheet(traingingrangeconfig.targetsheetpath)
|
|
21
|
+
if ( type(traingingrangeconfig.srs) ~= nil ) then
|
|
22
|
+
if ( traingingrangeconfig.srs.useSRS == true) then
|
|
23
|
+
trainingRange:SetSRS(traingingrangeconfig.srs.path, traingingrangeconfig.srs.port, coalition.side.BLUE)
|
|
24
|
+
else
|
|
25
|
+
trainingRange:SetSoundfilesPath(soundFilesPrefix .. 'RANGE/Range Soundfiles/')
|
|
26
|
+
end
|
|
27
|
+
else
|
|
28
|
+
trainingRange:SetSoundfilesPath(soundFilesPrefix .. 'RANGE/Range Soundfiles/')
|
|
29
|
+
end
|
|
30
|
+
if (traingingrangeconfig.instructionradio) then
|
|
31
|
+
if ( type(traingingrangeconfig.srs) ~= nil ) then
|
|
32
|
+
if (traingingrangeconfig.srs.useSRS == true) then
|
|
33
|
+
trainingRange:SetSRSRangeInstructor(traingingrangeconfig.instructionradio.freq, nil, nil, nil, nil,traingingrangeconfig.instructionradio.unitname)
|
|
34
|
+
else
|
|
35
|
+
trainingRange:SetInstructorRadio(
|
|
36
|
+
traingingrangeconfig.instructionradio.freq,
|
|
37
|
+
traingingrangeconfig.instructionradio.unitname
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
else
|
|
41
|
+
trainingRange:SetInstructorRadio(
|
|
42
|
+
traingingrangeconfig.instructionradio.freq,
|
|
43
|
+
traingingrangeconfig.instructionradio.unitname
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
if (traingingrangeconfig.controlradio) then
|
|
48
|
+
if ( type(traingingrangeconfig.srs) ~= nil ) then
|
|
49
|
+
if (traingingrangeconfig.srs.useSRS == true) then
|
|
50
|
+
trainingRange:SetSRSRangeControl(traingingrangeconfig.controlradio.freq, nil, nil, nil, nil, traingingrangeconfig.controlradio.unitname)
|
|
51
|
+
else
|
|
52
|
+
trainingRange:SetRangeControl(
|
|
53
|
+
traingingrangeconfig.controlradio.freq,
|
|
54
|
+
traingingrangeconfig.controlradio.unitname
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
else
|
|
58
|
+
trainingRange:SetRangeControl(
|
|
59
|
+
traingingrangeconfig.controlradio.freq,
|
|
60
|
+
traingingrangeconfig.controlradio.unitname
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
for index, subrangeTraining in ipairs(traingingrangeconfig.targets) do
|
|
65
|
+
env.info('subrangeTraining type : ' .. subrangeTraining.type)
|
|
66
|
+
if (subrangeTraining.type == "Strafepit") then
|
|
67
|
+
local fouldist = trainingRange:GetFoullineDistance(subrangeTraining.unit_name,
|
|
68
|
+
subrangeTraining.foul_line)
|
|
69
|
+
env.info('Add strafe pit : ' .. subrangeTraining.unit_name)
|
|
70
|
+
trainingRange:AddStrafePit(subrangeTraining.unit_name, subrangeTraining.boxlength,
|
|
71
|
+
subrangeTraining.boxwidth, subrangeTraining.heading, subrangeTraining.inverseheading,
|
|
72
|
+
subrangeTraining.goodpass, fouldist)
|
|
73
|
+
elseif (subrangeTraining.type == "BombCircle") then
|
|
74
|
+
env.info('Add bombing target : ' .. subrangeTraining.unit_name)
|
|
75
|
+
trainingRange:AddBombingTargets(subrangeTraining.unit_name, subrangeTraining.precision)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
--function saveTargetSheet(result, path, prefix)
|
|
80
|
+
-- local function _savefile(filename, data)
|
|
81
|
+
-- local f = io.open(filename, "wb")
|
|
82
|
+
-- if f then
|
|
83
|
+
-- f:write(data)
|
|
84
|
+
-- f:close()
|
|
85
|
+
-- else
|
|
86
|
+
-- env.info("RANGEBOSS EDIT - could not save target sheet to file")
|
|
87
|
+
-- end
|
|
88
|
+
-- end
|
|
89
|
+
--
|
|
90
|
+
-- -- Set path or default.
|
|
91
|
+
-- local _path = path
|
|
92
|
+
-- if lfs then
|
|
93
|
+
-- _path = _path or lfs.writedir() .. [[Logs\]]
|
|
94
|
+
-- end
|
|
95
|
+
--
|
|
96
|
+
-- -- Create unused file name.
|
|
97
|
+
-- local filename = nil
|
|
98
|
+
-- for i = 1, 9999 do
|
|
99
|
+
--
|
|
100
|
+
-- -- Create file name
|
|
101
|
+
-- if prefix then
|
|
102
|
+
-- filename = string.format("%s_%s-%04d.csv", prefix, result.airframe, i)
|
|
103
|
+
-- else
|
|
104
|
+
-- local name = UTILS.ReplaceIllegalCharacters(result.player, "_")
|
|
105
|
+
-- filename = string.format("RANGERESULTS-%s_Targetsheet-%s-%04d.csv", result.rangename, name, i)
|
|
106
|
+
-- end
|
|
107
|
+
--
|
|
108
|
+
-- -- Set path.
|
|
109
|
+
-- if _path ~= nil then
|
|
110
|
+
-- filename = _path .. "\\" .. filename
|
|
111
|
+
-- end
|
|
112
|
+
--
|
|
113
|
+
-- -- Check if file exists.
|
|
114
|
+
-- local _exists = UTILS.FileExists(filename)
|
|
115
|
+
-- if not _exists then
|
|
116
|
+
-- break
|
|
117
|
+
-- end
|
|
118
|
+
-- end
|
|
119
|
+
--
|
|
120
|
+
-- -- Header line
|
|
121
|
+
-- local data = "Name,Target,Distance,Radial,Quality,Rounds Fired,Rounds Hit,Rounds Quality,Weapon,Attack Heading,Airframe,Mission Time,OS Time\n"
|
|
122
|
+
--
|
|
123
|
+
-- -- local result=_result --#RANGE.BombResult
|
|
124
|
+
-- local playername = result.player
|
|
125
|
+
-- local distance = result.distance
|
|
126
|
+
-- local weapon = result.weapon
|
|
127
|
+
-- local target = result.name
|
|
128
|
+
-- local radial = result.radial
|
|
129
|
+
-- local quality = result.quality
|
|
130
|
+
-- local time = result.clock
|
|
131
|
+
-- local airframe = result.airframe
|
|
132
|
+
-- local date = "n/a"
|
|
133
|
+
-- local roundsFired = result.roundsFired
|
|
134
|
+
-- local roundsHit = result.roundsHit
|
|
135
|
+
-- local roundsQuality = result.roundsQuality
|
|
136
|
+
-- local attackHeading = result.heading
|
|
137
|
+
-- if os then
|
|
138
|
+
-- date = os.date()
|
|
139
|
+
-- end
|
|
140
|
+
-- data = data .. string.format( "%s,%s,%.2f,%03d,%s,%03d,%03d,%s,%s,%s,%s,%s", playername, target, distance, radial, quality, roundsFired, roundsHit, roundsQuality, weapon, attackHeading, airframe, time, date )
|
|
141
|
+
--
|
|
142
|
+
-- -- Save file.
|
|
143
|
+
-- _savefile( filename, data )
|
|
144
|
+
--end
|
|
145
|
+
|
|
146
|
+
--function trainingRange:OnAfterImpact(From, Event, To, result, player)
|
|
147
|
+
-- result.messageType = 4
|
|
148
|
+
-- result.callsign = player.playername
|
|
149
|
+
-- result.rangeName = result.rangename
|
|
150
|
+
-- result.missionType = "1"
|
|
151
|
+
-- result.mizTime = result.clock
|
|
152
|
+
-- result.strafeAccuracy = "N/A"
|
|
153
|
+
-- result.strafeQuality = "N/A"
|
|
154
|
+
-- result.altitude = result.attackAlt*3.28084
|
|
155
|
+
-- result.pitch = playerPitchForRangeData
|
|
156
|
+
-- result.heading = math.floor(result.attackHdg)
|
|
157
|
+
-- result.strafeScore = "N/A"
|
|
158
|
+
-- result.bombScore = "notSet"
|
|
159
|
+
--
|
|
160
|
+
-- if result.quality == "SHACK" then
|
|
161
|
+
-- result.bombScore = "5"
|
|
162
|
+
-- elseif result.quality == "EXCELLENT" then
|
|
163
|
+
-- result.bombScore = "4"
|
|
164
|
+
-- elseif result.quality == "GOOD" then
|
|
165
|
+
-- result.bombScore = "3"
|
|
166
|
+
-- elseif result.quality == "INEFFECTIVE" then
|
|
167
|
+
-- result.bombScore = "2"
|
|
168
|
+
-- elseif result.quality == "POOR" then
|
|
169
|
+
-- result.bombScore = "1"
|
|
170
|
+
-- end
|
|
171
|
+
-- result.targetSheetPath = self.targetpath
|
|
172
|
+
--
|
|
173
|
+
-- local text=string.format("%s, impact %03d° for %d m", result.player, result.radial, result.distance)
|
|
174
|
+
-- text=text..string.format(" %s hit.", result.quality)
|
|
175
|
+
-- env.info(text)
|
|
176
|
+
--
|
|
177
|
+
-- env.info(net.lua2json(result))
|
|
178
|
+
-- saveTargetSheet(result, self.targetpath, self.targetprefix)
|
|
179
|
+
-- HypeMan.sendBotTable(result)
|
|
180
|
+
--end
|
|
181
|
+
trainingRange:Start()
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
ShootingEvent = EVENTHANDLER:New():HandleEvent(EVENTS.Shot)
|
|
186
|
+
function ShootingEvent:OnEventShot(EventData)
|
|
187
|
+
if EventData.IniPlayerName ~= nil then
|
|
188
|
+
local PlayerUnit = EventData.IniUnit
|
|
189
|
+
playerPitchForRangeData = PlayerUnit:GetPitch()
|
|
190
|
+
end
|
|
191
|
+
end
|