@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.
- 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
|
@@ -2,12 +2,62 @@
|
|
|
2
2
|
-- ** FoxZone Training **
|
|
3
3
|
-- *********************************************************
|
|
4
4
|
|
|
5
|
+
-- region FoxZoneConfigFunctions
|
|
6
|
+
|
|
7
|
+
-- @type FOXZoneConfig
|
|
8
|
+
-- @field #boolean enable Enable the fox zone training
|
|
9
|
+
-- @field #string name Name of the fox zone training
|
|
10
|
+
-- @field #boolean debug Debug the fox zone training
|
|
11
|
+
-- @field #boolean f10Menu Enable the f10 menu
|
|
12
|
+
-- @field #string launchZoneName Launch zone name
|
|
13
|
+
-- @field #string safeZoneName Safe zone name
|
|
14
|
+
-- @field #boolean missileDestruction Missile destruction
|
|
15
|
+
-- @field #boolean missileLaunchMessages Missile launch messages
|
|
16
|
+
-- @field #boolean drawzone Draw the zone
|
|
17
|
+
-- @field #number distance_small_missile Distance of the small missile detonation in meters
|
|
18
|
+
-- @field #number distance_big_missile Distance of the big missile detonation in meters
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
--- Parse Fox Zone training config from JSON
|
|
22
|
+
--- @param #JsonObject config Config object to parse
|
|
23
|
+
--- @return #FOXZoneConfig foxZoneConfigJson Parsed FOXZoneConfig object
|
|
24
|
+
function ParseFoxZoneConfigJson(config)
|
|
25
|
+
local json = require('Scripts/json')
|
|
26
|
+
local parser_name = "FOX_ZONE"
|
|
27
|
+
-- **************************************************************************
|
|
28
|
+
-- enable
|
|
29
|
+
-- **************************************************************************
|
|
30
|
+
local foxZoneConfigJson
|
|
31
|
+
if config.enable == true then
|
|
32
|
+
foxZoneConfigJson = config
|
|
33
|
+
else
|
|
34
|
+
foxZoneConfigJson = {
|
|
35
|
+
enable = false,
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
Jtff_log.debug(
|
|
39
|
+
string.format(
|
|
40
|
+
"parsed Fox Zone training config for %s Zone, resulting config :\n%s",
|
|
41
|
+
config.type or "",
|
|
42
|
+
json:encode(
|
|
43
|
+
foxZoneConfigJson,
|
|
44
|
+
{ indent = true }
|
|
45
|
+
)
|
|
46
|
+
),
|
|
47
|
+
parser_name
|
|
48
|
+
)
|
|
49
|
+
return foxZoneConfigJson
|
|
50
|
+
end
|
|
51
|
+
-- endregion FoxZoneConfigFunctions
|
|
52
|
+
|
|
53
|
+
-- region FoxZoneFunctions
|
|
54
|
+
|
|
5
55
|
function toggleMissileScript(objFoxZone)
|
|
6
56
|
if (objFoxZone:Is("Running")) then
|
|
7
|
-
|
|
57
|
+
Jtff_log.info('stoping Fox Zone : '.. objFoxZone.customconfig.name..'...',"FOX_ZONE")
|
|
8
58
|
objFoxZone:__Stop(0)
|
|
9
59
|
else
|
|
10
|
-
|
|
60
|
+
Jtff_log.info('starting Fox Zone : '.. objFoxZone.customconfig.name..'...',"FOX_ZONE")
|
|
11
61
|
objFoxZone:__Start(0)
|
|
12
62
|
end
|
|
13
63
|
end
|
|
@@ -22,14 +72,24 @@ function getMissileScriptStatus(objFoxZone)
|
|
|
22
72
|
end
|
|
23
73
|
end
|
|
24
74
|
|
|
75
|
+
-- endregion FoxZoneFunctions
|
|
76
|
+
|
|
25
77
|
FoxRangesArray = {}
|
|
26
|
-
compteur =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
78
|
+
local compteur = #FoxRangesArray
|
|
79
|
+
|
|
80
|
+
MenuCoalitionFoxZone = MENU_MISSION:New("Missile training Zones", nil)
|
|
81
|
+
|
|
82
|
+
for index, currentFoxZoneConfigObject in ipairs(FoxRangesConfig) do
|
|
83
|
+
local foxzoneconfig = ParseFoxZoneConfigJson(currentFoxZoneConfigObject)
|
|
30
84
|
if foxzoneconfig.enable == true then
|
|
31
85
|
compteur = compteur + 1
|
|
32
|
-
|
|
86
|
+
Jtff_log.info(
|
|
87
|
+
string.format(
|
|
88
|
+
'creation Fox Zone : %s ...',
|
|
89
|
+
foxzoneconfig.name
|
|
90
|
+
),
|
|
91
|
+
"FOX_ZONE"
|
|
92
|
+
)
|
|
33
93
|
local objFoxZone = FOX:New()
|
|
34
94
|
objFoxZone:SetExplosionPower(0.01)
|
|
35
95
|
:SetExplosionDistance(foxzoneconfig.distance_small_missile or 100)
|
|
@@ -37,52 +97,64 @@ for index, foxzoneconfig in ipairs(FoxRangesConfig) do
|
|
|
37
97
|
:SetDefaultMissileDestruction(foxzoneconfig.missileDestruction)
|
|
38
98
|
:SetDefaultLaunchAlerts(foxzoneconfig.missileLaunchMessages)
|
|
39
99
|
:SetDefaultLaunchMarks(false)
|
|
40
|
-
|
|
100
|
+
local launchGroupObject = GROUP:FindByName(foxzoneconfig.launchZoneName)
|
|
101
|
+
if type(launchGroupObject) ~= 'nil' then
|
|
41
102
|
objFoxZone.objLaunchZone = ZONE_POLYGON:New(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
103
|
+
string.format(
|
|
104
|
+
'FOX_LAUNCH_ZONE_%s',
|
|
105
|
+
foxzoneconfig.name
|
|
106
|
+
),
|
|
107
|
+
launchGroupObject
|
|
108
|
+
)
|
|
45
109
|
else
|
|
46
|
-
|
|
47
|
-
objFoxZone.objLaunchZone = ZONE:New(foxzoneconfig.launchZoneName)
|
|
48
|
-
objFoxZone:AddLaunchZone(objFoxZone.objLaunchZone)
|
|
49
|
-
end
|
|
110
|
+
objFoxZone.objLaunchZone = ZONE:New(foxzoneconfig.launchZoneName)
|
|
50
111
|
end
|
|
51
|
-
|
|
112
|
+
objFoxZone:AddLaunchZone(objFoxZone.objLaunchZone)
|
|
113
|
+
Jtff_log.info(
|
|
114
|
+
string.format(
|
|
115
|
+
'Launch zone Polygon %s created ...',
|
|
116
|
+
objFoxZone.objLaunchZone:GetName()
|
|
117
|
+
),
|
|
118
|
+
"FOX_ZONE"
|
|
119
|
+
)
|
|
52
120
|
if ((foxzoneconfig.drawzone == true) or false) then
|
|
53
121
|
objFoxZone.objLaunchZone:DrawZone(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
122
|
+
-1,
|
|
123
|
+
{1,0,0},
|
|
124
|
+
1,
|
|
125
|
+
{1,0,0},
|
|
126
|
+
0.10,
|
|
127
|
+
4,
|
|
128
|
+
true,
|
|
129
|
+
nil
|
|
62
130
|
)
|
|
63
131
|
objFoxZone.objLaunchZone:GetCoordinate():TextToAll(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
132
|
+
string.format(
|
|
133
|
+
"Missile trainer %s",
|
|
134
|
+
foxzoneconfig.name
|
|
135
|
+
),
|
|
136
|
+
-1,
|
|
137
|
+
{1,0,0},
|
|
138
|
+
1,
|
|
139
|
+
{1,0,0},
|
|
140
|
+
0,
|
|
141
|
+
20,
|
|
142
|
+
true
|
|
72
143
|
)
|
|
73
144
|
end
|
|
74
|
-
|
|
145
|
+
local safeZoneGroupObject = GROUP:FindByName(foxzoneconfig.safeZoneName)
|
|
146
|
+
if type(safeZoneGroupObject) ~= 'nil' then
|
|
75
147
|
objFoxZone.objSafeZone = ZONE_POLYGON:New(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
148
|
+
string.format(
|
|
149
|
+
'FOX_SAFE_ZONE_%s',
|
|
150
|
+
foxzoneconfig.name
|
|
151
|
+
),
|
|
152
|
+
safeZoneGroupObject
|
|
153
|
+
)
|
|
80
154
|
else
|
|
81
|
-
|
|
82
|
-
objFoxZone.objSafeZone = ZONE:New(foxzoneconfig.safeZoneName)
|
|
83
|
-
objFoxZone:AddSafeZone(objFoxZone.objSafeZone)
|
|
84
|
-
end
|
|
155
|
+
objFoxZone.objSafeZone = ZONE:New(foxzoneconfig.safeZoneName)
|
|
85
156
|
end
|
|
157
|
+
objFoxZone:AddSafeZone(objFoxZone.objSafeZone)
|
|
86
158
|
if foxzoneconfig.debug then
|
|
87
159
|
objFoxZone:SetDebugOn()
|
|
88
160
|
end
|
|
@@ -93,29 +165,46 @@ for index, foxzoneconfig in ipairs(FoxRangesConfig) do
|
|
|
93
165
|
objFoxZone:SetDisableF10Menu()
|
|
94
166
|
end
|
|
95
167
|
|
|
96
|
-
objFoxZone.
|
|
97
|
-
objFoxZone.menuZoneRed = MENU_COALITION:New(coalition.side.RED, foxzoneconfig.name, MenuCoalitionFoxZoneRed)
|
|
168
|
+
objFoxZone.menuZone = MENU_MISSION:New(foxzoneconfig.name, MenuCoalitionFoxZone)
|
|
98
169
|
|
|
99
170
|
objFoxZone.customconfig = foxzoneconfig
|
|
100
171
|
|
|
101
172
|
-- **** Message to client *****
|
|
102
173
|
function objFoxZone:OnAfterEnterSafeZone(From, Event, To, player)
|
|
103
|
-
local message =
|
|
174
|
+
local message = string.format(
|
|
175
|
+
'[%s] You\'re entering in the missile trainer area %s. Missile script is [%s]',
|
|
176
|
+
player.name,
|
|
177
|
+
foxzoneconfig.name,
|
|
178
|
+
objFoxZone:GetState()
|
|
179
|
+
)
|
|
104
180
|
MESSAGE:NewType(message, MESSAGE.Type.Overview):ToClient(player.client)
|
|
105
181
|
end
|
|
106
182
|
|
|
107
183
|
function objFoxZone:OnAfterExitSafeZone(From, Event, To, player)
|
|
108
|
-
local message =
|
|
184
|
+
local message = string.format(
|
|
185
|
+
'[%s] You\'re leaving the missile trainer area %s. Missile script is [%s]',
|
|
186
|
+
player.name,
|
|
187
|
+
foxzoneconfig.name,
|
|
188
|
+
objFoxZone:GetState()
|
|
189
|
+
)
|
|
109
190
|
MESSAGE:NewType(message, MESSAGE.Type.Overview):ToClient(player.client)
|
|
110
191
|
end
|
|
111
192
|
|
|
112
193
|
function objFoxZone:OnAfterStop(From, Event, To)
|
|
113
|
-
local message =
|
|
194
|
+
local message = string.format(
|
|
195
|
+
'Training area [%s] -> Script has been unactivated. Missile script is [%s]',
|
|
196
|
+
foxzoneconfig.name,
|
|
197
|
+
objFoxZone:GetState()
|
|
198
|
+
)
|
|
114
199
|
MESSAGE:NewType(message, MESSAGE.Type.Overview):ToAll()
|
|
115
200
|
end
|
|
116
201
|
|
|
117
202
|
function objFoxZone:OnAfterStart(From, Event, To)
|
|
118
|
-
local message =
|
|
203
|
+
local message = string.format(
|
|
204
|
+
'Training area [%s] -> Script has been activated. Missile script is [%s]',
|
|
205
|
+
foxzoneconfig.name,
|
|
206
|
+
objFoxZone:GetState()
|
|
207
|
+
)
|
|
119
208
|
MESSAGE:NewType(message, MESSAGE.Type.Overview):ToAll()
|
|
120
209
|
end
|
|
121
210
|
|
|
@@ -135,8 +224,8 @@ for index, foxzoneconfig in ipairs(FoxRangesConfig) do
|
|
|
135
224
|
else
|
|
136
225
|
message = playerNameTargeted .. ' HAS BEEN SHOT DOWN BY ' .. unitShooter:GetName()
|
|
137
226
|
end
|
|
138
|
-
|
|
139
|
-
|
|
227
|
+
Jtff_log.info(message,"FOX_ZONE")
|
|
228
|
+
Set_AllClients:ForEachClientInZone(objFoxZone.objSafeZone, function(clientInZone)
|
|
140
229
|
if clientInZone:IsAlive() then
|
|
141
230
|
MESSAGE:NewType(message, MESSAGE.Type.Update):ToClient(clientInZone)
|
|
142
231
|
end
|
|
@@ -146,28 +235,14 @@ for index, foxzoneconfig in ipairs(FoxRangesConfig) do
|
|
|
146
235
|
|
|
147
236
|
FoxRangesArray[compteur] = objFoxZone
|
|
148
237
|
FoxRangesArray[compteur]:Start()
|
|
149
|
-
FoxRangesArray[compteur].
|
|
150
|
-
coalition.side.BLUE,
|
|
238
|
+
FoxRangesArray[compteur].commandToggle = MENU_MISSION_COMMAND:New(
|
|
151
239
|
"Toggle missile script",
|
|
152
|
-
FoxRangesArray[compteur].
|
|
240
|
+
FoxRangesArray[compteur].menuZone,
|
|
153
241
|
toggleMissileScript,
|
|
154
242
|
FoxRangesArray[compteur])
|
|
155
|
-
FoxRangesArray[compteur].
|
|
156
|
-
coalition.side.RED,
|
|
157
|
-
"Toggle missile script",
|
|
158
|
-
FoxRangesArray[compteur].menuZoneRed,
|
|
159
|
-
toggleMissileScript,
|
|
160
|
-
FoxRangesArray[compteur])
|
|
161
|
-
FoxRangesArray[compteur].commandStatusBlue = MENU_COALITION_COMMAND:New(
|
|
162
|
-
coalition.side.BLUE,
|
|
163
|
-
"missile script status",
|
|
164
|
-
FoxRangesArray[compteur].menuZoneBlue,
|
|
165
|
-
getMissileScriptStatus,
|
|
166
|
-
FoxRangesArray[compteur])
|
|
167
|
-
FoxRangesArray[compteur].commandStatusRed = MENU_COALITION_COMMAND:New(
|
|
168
|
-
coalition.side.RED,
|
|
243
|
+
FoxRangesArray[compteur].commandStatus = MENU_MISSION_COMMAND:New(
|
|
169
244
|
"missile script status",
|
|
170
|
-
FoxRangesArray[compteur].
|
|
245
|
+
FoxRangesArray[compteur].menuZone,
|
|
171
246
|
getMissileScriptStatus,
|
|
172
247
|
FoxRangesArray[compteur])
|
|
173
248
|
end
|