@jtff/miztemplate-lib 4.0.0 → 4.0.1
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 +149 -194
- package/lua/lib/Moose_.lua +1524 -372
- package/lua/src/020-mission_functions.lua +98 -0
- package/lua/src/120-tankers.lua +13 -0
- package/lua/src/150-awacs.lua +10 -0
- package/package.json +1 -1
|
@@ -89,6 +89,25 @@ function SwitchGroupImmortalStatus(group)
|
|
|
89
89
|
MESSAGE:NewType("Immortal status of your group : " .. tostring(status) , MESSAGE.Type.Update):ToGroup(group)
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
+
function SwitchGroupUnlimitedFuelStatus(group)
|
|
93
|
+
local status = not BASE:GetState(group, "isUnlimitedFuel")
|
|
94
|
+
Jtff_log.info(
|
|
95
|
+
string.format(
|
|
96
|
+
"switch group %s to unlimited fuel status %s",
|
|
97
|
+
group:GetName(),
|
|
98
|
+
tostring(status)
|
|
99
|
+
),
|
|
100
|
+
"GENERAL"
|
|
101
|
+
)
|
|
102
|
+
group:CommandSetUnlimitedFuel(status)
|
|
103
|
+
BASE:SetState(group, "isUnlimitedFuel", status)
|
|
104
|
+
MESSAGE:NewType(
|
|
105
|
+
"Unlimited fuel status of your group : " .. tostring(status) ,
|
|
106
|
+
MESSAGE.Type.Update
|
|
107
|
+
):ToGroup(group)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
|
|
92
111
|
function SwitchGroupAirbossSubtitlesStatus(group)
|
|
93
112
|
for index, airbossObject in ipairs(AIRBOSSArray) do
|
|
94
113
|
for playerindex, player in ipairs(group:GetPlayerUnits()) do
|
|
@@ -1791,6 +1810,85 @@ function ParseAwacsCallsignConfigJson(config, parser_name)
|
|
|
1791
1810
|
return awacsCallsignConfigJson
|
|
1792
1811
|
end
|
|
1793
1812
|
|
|
1813
|
+
-- @type SquawkConfig
|
|
1814
|
+
-- @field #string mode1 Mode1 code for the aircraft.
|
|
1815
|
+
-- @field #string mode2 Mode2 code for the aircraft.
|
|
1816
|
+
-- @field #string mode3 Mode3 code for the aircraft.
|
|
1817
|
+
-- @field #string mode4 Mode4 code for the aircraft.
|
|
1818
|
+
|
|
1819
|
+
--- Parse an SquawkConfig Object.
|
|
1820
|
+
-- @param #JsonObject config Config object to parse
|
|
1821
|
+
-- @param #string parser_name Parser name ("AIRBASE", "AIRBOSS", etc...).
|
|
1822
|
+
-- @return #SquawkConfig SquawkConfigJson Parsed SquawkConfig object
|
|
1823
|
+
function ParseSquawkConfigJson(config, parser_name)
|
|
1824
|
+
local squawkConfigJson = {}
|
|
1825
|
+
local default_mode4 = 'UN'
|
|
1826
|
+
local default_mode1 = ''
|
|
1827
|
+
local default_mode2 = ''
|
|
1828
|
+
local default_mode3 = ''
|
|
1829
|
+
-- **************************************************************************
|
|
1830
|
+
-- mode4
|
|
1831
|
+
-- **************************************************************************
|
|
1832
|
+
if type(config.mode4) == "string" then
|
|
1833
|
+
if string.upper(config.mode4) == "FR" or string.lower(config.mode4) == "friend" then
|
|
1834
|
+
squawkConfigJson.mode4 = 'FR'
|
|
1835
|
+
else
|
|
1836
|
+
squawkConfigJson.mode4 = 'UN'
|
|
1837
|
+
end
|
|
1838
|
+
else
|
|
1839
|
+
Jtff_log.warn(string.format("Squawk firendOrFoe is not a string, defaulting to %s", default_mode4), parser_name)
|
|
1840
|
+
squawkConfigJson.mode4 = default_mode4
|
|
1841
|
+
end
|
|
1842
|
+
-- **************************************************************************
|
|
1843
|
+
-- mode1
|
|
1844
|
+
-- **************************************************************************
|
|
1845
|
+
if type(config.mode1) == "number" then
|
|
1846
|
+
squawkConfigJson.mode1 = string.format("%02d", config.mode1)
|
|
1847
|
+
else
|
|
1848
|
+
Jtff_log.error("Squawk mode1 is not a number, skipping mode 1 configuration", parser_name)
|
|
1849
|
+
squawkConfigJson.mode1 = default_mode1
|
|
1850
|
+
end
|
|
1851
|
+
-- **************************************************************************
|
|
1852
|
+
-- mode2
|
|
1853
|
+
-- **************************************************************************
|
|
1854
|
+
if type(config.mode2) == "number" then
|
|
1855
|
+
squawkConfigJson.mode2 = string.format("%02d", config.mode2)
|
|
1856
|
+
else
|
|
1857
|
+
Jtff_log.error("Squawk mode2 is not a number, skipping mode 2 configuration", parser_name)
|
|
1858
|
+
squawkConfigJson.mode2 = default_mode2
|
|
1859
|
+
end
|
|
1860
|
+
-- **************************************************************************
|
|
1861
|
+
-- mode3
|
|
1862
|
+
-- **************************************************************************
|
|
1863
|
+
if type(config.mode3) == "number" then
|
|
1864
|
+
squawkConfigJson.mode3 = string.format("%02d", config.mode3)
|
|
1865
|
+
else
|
|
1866
|
+
Jtff_log.error("Squawk mode3 is not a number, skipping mode 3 configuration", parser_name)
|
|
1867
|
+
squawkConfigJson.mode3 = default_mode3
|
|
1868
|
+
end
|
|
1869
|
+
return squawkConfigJson
|
|
1870
|
+
end
|
|
1871
|
+
|
|
1872
|
+
--- Create a Squawk string understandable by LotATC based on a SquawkConfig Object
|
|
1873
|
+
-- @param #SquawkConfig config Config object to parse
|
|
1874
|
+
-- @return #string squawkString
|
|
1875
|
+
function CreateSquawkString(squawkConfigJson)
|
|
1876
|
+
local squawkString = "@IFF:"
|
|
1877
|
+
if squawkConfigJson.mode1 ~= '' then
|
|
1878
|
+
squawkString = string.format("%s(%s)", squawkString, squawkConfigJson.mode1)
|
|
1879
|
+
end
|
|
1880
|
+
if squawkConfigJson.mode2 ~= '' then
|
|
1881
|
+
squawkString = string.format("%s[%s]", squawkString, squawkConfigJson.mode2)
|
|
1882
|
+
end
|
|
1883
|
+
if squawkConfigJson.mode3 ~= '' then
|
|
1884
|
+
squawkString = string.format("%s%s", squawkString, squawkConfigJson.mode3)
|
|
1885
|
+
end
|
|
1886
|
+
if squawkConfigJson.mode4 ~= '' then
|
|
1887
|
+
squawkString = string.format("%s%s", squawkString, squawkConfigJson.mode4)
|
|
1888
|
+
end
|
|
1889
|
+
return squawkString
|
|
1890
|
+
end
|
|
1891
|
+
|
|
1794
1892
|
-- @field #JTFF_QRA JTFF_QRA
|
|
1795
1893
|
JTFF_QRA = {
|
|
1796
1894
|
ClassName = "JTFF_QRA",
|
package/lua/src/120-tankers.lua
CHANGED
|
@@ -73,6 +73,7 @@ end
|
|
|
73
73
|
-- @field #radioConfig radio Radio configuration.
|
|
74
74
|
-- @field #number fuelLowThreshold Fuel low threshold in %.
|
|
75
75
|
-- @field #TankerCallsignConfig callsign Callsign configuration.
|
|
76
|
+
-- @field #SquawkConfig squawk Squawk configuration.
|
|
76
77
|
|
|
77
78
|
|
|
78
79
|
--- Parse Tanker config Object.
|
|
@@ -233,6 +234,15 @@ function ParseTankersConfigJson(config)
|
|
|
233
234
|
config.enable = false
|
|
234
235
|
return config
|
|
235
236
|
end
|
|
237
|
+
-- **************************************************************************
|
|
238
|
+
-- squawk
|
|
239
|
+
-- **************************************************************************
|
|
240
|
+
if type(config.squawk) == "table" then
|
|
241
|
+
tankerConfigJson.squawk = ParseSquawkConfigJson(config.squawk, parser_name)
|
|
242
|
+
else
|
|
243
|
+
Jtff_log.warn("Tanker squawk is not a table, defaulting tanker squawk configuration", parser_name)
|
|
244
|
+
tankerConfigJson.squawk = ParseSquawkConfigJson({}, parser_name)
|
|
245
|
+
end
|
|
236
246
|
Jtff_log.debug(
|
|
237
247
|
string.format(
|
|
238
248
|
"parsed Tanker config for %s Tanker, resulting config :\n%s",
|
|
@@ -458,6 +468,9 @@ for _index, _currentTankerConfigObject in ipairs(TankersConfig) do
|
|
|
458
468
|
),
|
|
459
469
|
"TANKER"
|
|
460
470
|
)
|
|
471
|
+
-- local templateGroup = UTILS.DeepCopy(GROUP:FindByName(tankerconfig.templateGroup))
|
|
472
|
+
-- templateGroup.name = string.format("Tanker-%s %s", tankerconfig.type, CreateSquawkString(tankerconfig.squawk))
|
|
473
|
+
-- FindAirwingByAirbaseName(tankerconfig.airbaseName):AddAsset(templateGroup,2)
|
|
461
474
|
local tankermission, airwing = GenerateTankerMission(tankerconfig, true)
|
|
462
475
|
if tankermission == nil or airwing == nil then
|
|
463
476
|
Jtff_log.error(
|
package/lua/src/150-awacs.lua
CHANGED
|
@@ -72,6 +72,7 @@ end
|
|
|
72
72
|
-- @field #radioConfig radio Radio configuration.
|
|
73
73
|
-- @field #number fuelLowThreshold Fuel low threshold in %.
|
|
74
74
|
-- @field #AwacsCallsignConfig callsign Callsign configuration.
|
|
75
|
+
-- @field #SquawkConfig squawk Squawk configuration.
|
|
75
76
|
|
|
76
77
|
--- Parse Awacs config Object.
|
|
77
78
|
-- @param #JsonObject config Config object to parse
|
|
@@ -216,6 +217,15 @@ function ParseAwacsConfigJson(config)
|
|
|
216
217
|
config.enable = false
|
|
217
218
|
return config
|
|
218
219
|
end
|
|
220
|
+
-- **************************************************************************
|
|
221
|
+
-- squawk
|
|
222
|
+
-- **************************************************************************
|
|
223
|
+
if type(config.squawk) == "table" then
|
|
224
|
+
awacsConfigJson.squawk = ParseSquawkConfigJson(config.squawk, parser_name)
|
|
225
|
+
else
|
|
226
|
+
Jtff_log.warn("Awacs squawk is not a table, defaulting awacs squawk configuration", parser_name)
|
|
227
|
+
awacsConfigJson.squawk = ParseSquawkConfigJson({}, parser_name)
|
|
228
|
+
end
|
|
219
229
|
Jtff_log.debug(
|
|
220
230
|
string.format(
|
|
221
231
|
"parsed Awacs config for %s Awacs, resulting config :\n%s",
|