@jtff/miztemplate-lib 3.8.7 → 3.8.8

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.
@@ -48,7 +48,7 @@ if (not(SRSConfig)) then
48
48
  jtff_log.error(string.format("Local SRS config not specified ! Initializing empty values for SRS"), "Initialization")
49
49
  SRSConfig= {
50
50
  port = 5002,
51
- path = "C:/Program Files/DCS-SimpleRadio-Standalone",
51
+ path = "C:/Program Files/DCS-SimpleRadio-Standalone/ExternalAudio",
52
52
  ip = "127.0.0.1",
53
53
  }
54
54
  end
@@ -1,12 +1,73 @@
1
1
  -- *****************************************************************************
2
2
  -- ** ATIS **
3
3
  -- *********************************************************
4
+ --- Enable ATIS for a specific airbase.
5
+ ---@param airbase string The name of the airbase for which to enable ATIS for. (MOOSE Enum)
6
+ 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
31
+ end
32
+
33
+ --- Disable ATIS for a specific airbase.
34
+ ---@param airbase string The name of the airbase for which to disable ATIS for. (MOOSE Enum)
35
+ 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
60
+ end
61
+
4
62
  ATISArray = {}
5
63
  compteur = 0
64
+ 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)
6
67
  for index, atisconfig in ipairs(AtisConfig) do
7
68
  if atisconfig.enable == true then
8
69
  compteur = compteur + 1
9
- env.info('creation ATIS : '.. atisconfig.airfield..'...')
70
+ jtff_log.info(string.format("Creation ATIS at airfield %s", atisconfig.airfield),"ATIS")
10
71
  local objAtis = ATIS:New(atisconfig.airfield, atisconfig.radio.freq, atisconfig.radio.modulation)
11
72
  :SetImperialUnits()
12
73
  :SetSoundfilesPath(soundFilesPrefix .. 'ATIS/ATIS Soundfiles/')
@@ -47,7 +108,28 @@ for index, atisconfig in ipairs(AtisConfig) do
47
108
  objAtis:SetSRS(SRSConfig.path, "male", "en-US", nil, SRSConfig.port)
48
109
  end
49
110
  objAtis.customconfig = atisconfig
111
+ 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
+ )
50
126
  ATISArray[compteur] = objAtis
51
127
  ATISArray[compteur]:Start()
52
128
  end
53
129
  end
130
+
131
+ if compteur == 0 then
132
+ MenuCoalitionAtis[coalition.side.BLUE]:Remove()
133
+ MenuCoalitionAtis[coalition.side.RED]:Remove()
134
+ MenuCoalitionAtis = {}
135
+ end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "3.8.7",
3
+ "version": "3.8.8",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [