@jtff/miztemplate-lib 3.4.19 → 3.4.20

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.
@@ -1,4 +1,4 @@
1
- env.info('*** MOOSE GITHUB Commit Hash ID: 2024-09-08T13:24:09+02:00-051286acd119752bf389e7fc1bb685ffdee767a1 ***')
1
+ env.info('*** MOOSE GITHUB Commit Hash ID: 2024-10-03T14:05:51+02:00-d5a406c60f78e13bde4182636aabde8cb2880cc8 ***')
2
2
  if not MOOSE_DEVELOPMENT_FOLDER then
3
3
  MOOSE_DEVELOPMENT_FOLDER='Scripts'
4
4
  end
@@ -2532,8 +2532,8 @@ if type_name=="MH-60R"and(unit:getDrawArgumentValue(403)>0 or unit:getDrawArgume
2532
2532
  BASE:T(unit_name.." cargo door is open")
2533
2533
  return true
2534
2534
  end
2535
- if type_name=="OH-58D"and(unit:getDrawArgumentValue(35)>0 or unit:getDrawArgumentValue(421)==-1)then
2536
- BASE:T(unit_name.." cargo door is open")
2535
+ if type_name=="OH58D"then
2536
+ BASE:T(unit_name.." front door(s) are open")
2537
2537
  return true
2538
2538
  end
2539
2539
  if type_name=="CH-47Fbl1"and(unit:getDrawArgumentValue(86)>0.5)then
@@ -7489,7 +7489,7 @@ Event.IniCategory=Event.IniDCSUnit:getDesc().category
7489
7489
  Event.IniTypeName=Event.IniDCSUnit:getTypeName()
7490
7490
  elseif Event.IniObjectCategory==Object.Category.SCENERY then
7491
7491
  Event.IniDCSUnit=Event.initiator
7492
- Event.IniDCSUnitName=Event.IniDCSUnit:getName()
7492
+ Event.IniDCSUnitName=Event.IniDCSUnit.getName and Event.IniDCSUnit:getName()or"Scenery no name "..math.random(1,20000)
7493
7493
  Event.IniUnitName=Event.IniDCSUnitName
7494
7494
  Event.IniUnit=SCENERY:Register(Event.IniDCSUnitName,Event.initiator)
7495
7495
  Event.IniCategory=Event.IniDCSUnit:getDesc().category
@@ -11831,8 +11831,15 @@ end
11831
11831
  return self
11832
11832
  end
11833
11833
  function DATABASE:_RegisterAirbase(airbase)
11834
+ local IsSyria=UTILS.GetDCSMap()=="Syria"and true or false
11835
+ local countHSyria=0
11834
11836
  if airbase then
11835
11837
  local DCSAirbaseName=airbase:getName()
11838
+ if IsSyria and DCSAirbaseName=="H"and countHSyria>0 then
11839
+ return self
11840
+ elseif IsSyria and DCSAirbaseName=="H"and countHSyria==0 then
11841
+ countHSyria=countHSyria+1
11842
+ end
11836
11843
  local airbaseID=airbase:getID()
11837
11844
  local airbase=self:AddAirbase(DCSAirbaseName)
11838
11845
  local airbaseUID=airbase:GetID(true)
@@ -16216,11 +16223,7 @@ self:ForEach(IteratorFunction,arg,self:GetSet())
16216
16223
  return self
16217
16224
  end
16218
16225
  function SET_SCENERY:GetCoordinate()
16219
- local Coordinate=COORDINATE:New({0,0,0})
16220
- local Item=self:GetRandomSurely()
16221
- if Item then
16222
- Coordinate:GetCoordinate()
16223
- end
16226
+ local Coordinate=self:GetFirst():GetCoordinate()
16224
16227
  local x1=Coordinate.x
16225
16228
  local x2=Coordinate.x
16226
16229
  local y1=Coordinate.y
@@ -21014,7 +21017,8 @@ count=count+_grp:CountAliveUnits()
21014
21017
  end
21015
21018
  end
21016
21019
  end
21017
- return count
21020
+ self.AliveUnits=count
21021
+ return self
21018
21022
  end
21019
21023
  function SPAWN:_OnDeadOrCrash(EventData)
21020
21024
  local unit=UNIT:FindByName(EventData.IniUnitName)
@@ -21022,7 +21026,7 @@ if unit then
21022
21026
  local EventPrefix=self:_GetPrefixFromGroupName(unit.GroupName)
21023
21027
  if EventPrefix then
21024
21028
  if EventPrefix==self.SpawnTemplatePrefix or(self.SpawnAliasPrefix and EventPrefix==self.SpawnAliasPrefix)and self.AliveUnits>0 then
21025
- self.AliveUnits=self:_CountAliveUnits()
21029
+ self:ScheduleOnce(1,self._CountAliveUnits,self)
21026
21030
  end
21027
21031
  end
21028
21032
  end
@@ -29372,6 +29376,7 @@ AIRBASE.Syria={
29372
29376
  ["Gaziantep"]="Gaziantep",
29373
29377
  ["Gazipasa"]="Gazipasa",
29374
29378
  ["Gecitkale"]="Gecitkale",
29379
+ ["H"]="H",
29375
29380
  ["H3"]="H3",
29376
29381
  ["H3_Northwest"]="H3 Northwest",
29377
29382
  ["H3_Southwest"]="H3 Southwest",
@@ -29509,20 +29514,22 @@ AIRBASE.Sinai={
29509
29514
  AIRBASE.Kola={
29510
29515
  ["Banak"]="Banak",
29511
29516
  ["Bodo"]="Bodo",
29517
+ ["Ivalo"]="Ivalo",
29512
29518
  ["Jokkmokk"]="Jokkmokk",
29513
29519
  ["Kalixfors"]="Kalixfors",
29520
+ ["Kallax"]="Kallax",
29514
29521
  ["Kemi_Tornio"]="Kemi Tornio",
29522
+ ["Kirkenes"]="Kirkenes",
29515
29523
  ["Kiruna"]="Kiruna",
29524
+ ["Kuusamo"]="Kuusamo",
29516
29525
  ["Monchegorsk"]="Monchegorsk",
29517
29526
  ["Murmansk_International"]="Murmansk International",
29518
29527
  ["Olenya"]="Olenya",
29519
29528
  ["Rovaniemi"]="Rovaniemi",
29520
29529
  ["Severomorsk_1"]="Severomorsk-1",
29521
29530
  ["Severomorsk_3"]="Severomorsk-3",
29522
- ["Vuojarvi"]="Vuojarvi",
29523
- ["Kirkenes"]="Kirkenes",
29524
- ["Kallax"]="Kallax",
29525
29531
  ["Vidsel"]="Vidsel",
29532
+ ["Vuojarvi"]="Vuojarvi",
29526
29533
  }
29527
29534
  AIRBASE.Afghanistan={
29528
29535
  ["Bost"]="Bost",
@@ -32040,7 +32047,7 @@ agl=UTILS.Round(agl,2)
32040
32047
  self:T(self.lid.." AGL: "..agl or-1)
32041
32048
  local isunloaded=true
32042
32049
  local client
32043
- local playername
32050
+ local playername=self.Owner
32044
32051
  if count>0 and(agl>0 or self.testing)then
32045
32052
  self:T(self.lid.." Possible alive helos: "..count or-1)
32046
32053
  if agl~=0 or self.testing then
@@ -32052,6 +32059,11 @@ self.CargoState=DYNAMICCARGO.State.UNLOADED
32052
32059
  self.Owner=playername
32053
32060
  _DATABASE:CreateEventDynamicCargoUnloaded(self)
32054
32061
  end
32062
+ elseif count>0 and agl==0 then
32063
+ self:T(self.lid.." moved! LOADED -> UNLOADED by "..tostring(playername))
32064
+ self.CargoState=DYNAMICCARGO.State.UNLOADED
32065
+ self.Owner=playername
32066
+ _DATABASE:CreateEventDynamicCargoUnloaded(self)
32055
32067
  end
32056
32068
  end
32057
32069
  self.LastPosition=pos
@@ -34812,10 +34824,11 @@ Excellent={Evade=10,DelayOn={10,30}}
34812
34824
  SEADGroupPrefixes={},
34813
34825
  SuppressedGroups={},
34814
34826
  EngagementRange=75,
34815
- Padding=10,
34827
+ Padding=15,
34816
34828
  CallBack=nil,
34817
34829
  UseCallBack=false,
34818
34830
  debug=false,
34831
+ WeaponTrack=false,
34819
34832
  }
34820
34833
  SEAD.Harms={
34821
34834
  ["AGM_88"]="AGM_88",
@@ -34872,7 +34885,7 @@ self:HandleEvent(EVENTS.Shot,self.HandleEventShot)
34872
34885
  self:SetStartState("Running")
34873
34886
  self:AddTransition("*","ManageEvasion","*")
34874
34887
  self:AddTransition("*","CalculateHitZone","*")
34875
- self:I("*** SEAD - Started Version 0.4.6")
34888
+ self:I("*** SEAD - Started Version 0.4.8")
34876
34889
  return self
34877
34890
  end
34878
34891
  function SEAD:UpdateSet(SEADGroupPrefixes)
@@ -35020,7 +35033,7 @@ local wpndata=SEAD.HarmData[data]
35020
35033
  reach=wpndata[1]*1.1
35021
35034
  local mach=wpndata[2]
35022
35035
  wpnspeed=math.floor(mach*340.29)
35023
- if Weapon then
35036
+ if Weapon and Weapon:GetSpeed()>0 then
35024
35037
  wpnspeed=Weapon:GetSpeed()
35025
35038
  self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
35026
35039
  end
@@ -35087,17 +35100,23 @@ return self
35087
35100
  end
35088
35101
  function SEAD:HandleEventShot(EventData)
35089
35102
  self:T({EventData.id})
35103
+ local SEADWeapon=EventData.Weapon
35104
+ local SEADWeaponName=EventData.WeaponName or"None"
35105
+ if self:_CheckHarms(SEADWeaponName)then
35090
35106
  local SEADPlane=EventData.IniUnit
35107
+ if not SEADPlane then return self end
35091
35108
  local SEADGroup=EventData.IniGroup
35092
35109
  local SEADPlanePos=SEADPlane:GetCoordinate()
35093
35110
  local SEADUnit=EventData.IniDCSUnit
35094
35111
  local SEADUnitName=EventData.IniDCSUnitName
35095
- local SEADWeapon=EventData.Weapon
35096
- local SEADWeaponName=EventData.WeaponName
35097
35112
  local WeaponWrapper=WEAPON:New(EventData.Weapon)
35098
35113
  self:T("*** SEAD - Missile Launched = "..SEADWeaponName)
35099
- if self:_CheckHarms(SEADWeaponName)then
35100
35114
  self:T('*** SEAD - Weapon Match')
35115
+ if self.WeaponTrack==true then
35116
+ WeaponWrapper:SetFuncTrack(function(weapon)env.info(string.format("*** Weapon Speed: %d m/s",weapon:GetSpeed()or-1))end)
35117
+ WeaponWrapper:StartTrack(0.1)
35118
+ WeaponWrapper:StopTrack(30)
35119
+ end
35101
35120
  local _targetskill="Random"
35102
35121
  local _targetgroupname="none"
35103
35122
  local _target=EventData.Weapon:getTarget()
@@ -35149,7 +35168,7 @@ end
35149
35168
  end
35150
35169
  if SEADGroupFound==true then
35151
35170
  if string.find(SEADWeaponName,"ADM_141",1,true)then
35152
- self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
35171
+ self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,2,WeaponWrapper)
35153
35172
  else
35154
35173
  self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
35155
35174
  end
@@ -51695,7 +51714,8 @@ end
51695
51714
  function WAREHOUSE:_GetAttribute(group)
51696
51715
  local attribute=WAREHOUSE.Attribute.OTHER_UNKNOWN
51697
51716
  if group then
51698
- local transportplane=group:HasAttribute("Transports")and group:HasAttribute("Planes")
51717
+ local groupCat=group:GetCategory()
51718
+ local transportplane=group:HasAttribute("Transports")and group:HasAttribute("Planes")and groupCat==Group.Category.AIRPLANE
51699
51719
  local awacs=group:HasAttribute("AWACS")
51700
51720
  local fighter=group:HasAttribute("Fighters")or group:HasAttribute("Interceptors")or group:HasAttribute("Multirole fighters")or(group:HasAttribute("Bombers")and not group:HasAttribute("Strategic bombers"))
51701
51721
  local bomber=group:HasAttribute("Strategic bombers")
@@ -66940,6 +66960,8 @@ pickupZones={},
66940
66960
  DynamicCargo={},
66941
66961
  ChinookTroopCircleRadius=5,
66942
66962
  TroopUnloadDistGround=5,
66963
+ TroopUnloadDistGroundHerc=25,
66964
+ TroopUnloadDistGroundHook=15,
66943
66965
  TroopUnloadDistHover=1.5,
66944
66966
  UserSetGroup=nil,
66945
66967
  }
@@ -66973,10 +66995,10 @@ CTLD.UnitTypeCapabilities={
66973
66995
  ["AH-64D_BLK_II"]={type="AH-64D_BLK_II",crates=false,troops=true,cratelimit=0,trooplimit=2,length=17,cargoweightlimit=200},
66974
66996
  ["Bronco-OV-10A"]={type="Bronco-OV-10A",crates=false,troops=true,cratelimit=0,trooplimit=5,length=13,cargoweightlimit=1450},
66975
66997
  ["OH-6A"]={type="OH-6A",crates=false,troops=true,cratelimit=0,trooplimit=4,length=7,cargoweightlimit=550},
66976
- ["OH-58D"]={type="OH58D",crates=false,troops=false,cratelimit=0,trooplimit=0,length=14,cargoweightlimit=400},
66998
+ ["OH58D"]={type="OH58D",crates=false,troops=false,cratelimit=0,trooplimit=0,length=14,cargoweightlimit=400},
66977
66999
  ["CH-47Fbl1"]={type="CH-47Fbl1",crates=true,troops=true,cratelimit=4,trooplimit=31,length=20,cargoweightlimit=10800},
66978
67000
  }
66979
- CTLD.version="1.1.16"
67001
+ CTLD.version="1.1.17"
66980
67002
  function CTLD:New(Coalition,Prefixes,Alias)
66981
67003
  local self=BASE:Inherit(self,FSM:New())
66982
67004
  BASE:T({Coalition,Prefixes,Alias})
@@ -68377,7 +68399,10 @@ local heading=Group:GetHeading()or 0
68377
68399
  if hoverunload or grounded then
68378
68400
  randomcoord=Group:GetCoordinate()
68379
68401
  local Angle=(heading+270)%360
68402
+ if IsHerc or IsHook then Angle=(heading+180)%360 end
68380
68403
  local offset=hoverunload and self.TroopUnloadDistHover or self.TroopUnloadDistGround
68404
+ if IsHerc then offset=self.TroopUnloadDistGroundHerc or 25 end
68405
+ if IsHook then offset=self.TroopUnloadDistGroundHook or 15 end
68381
68406
  randomcoord:Translate(offset,Angle,nil,true)
68382
68407
  end
68383
68408
  local tempcount=0
@@ -68387,7 +68412,7 @@ for _,_template in pairs(temptable)do
68387
68412
  self.TroopCounter=self.TroopCounter+1
68388
68413
  tempcount=tempcount+1
68389
68414
  local alias=string.format("%s-%d",_template,math.random(1,100000))
68390
- local rad=2.5+tempcount
68415
+ local rad=2.5+(tempcount*2)
68391
68416
  local Positions=self:_GetUnitPositions(randomcoord,rad,heading,_template)
68392
68417
  self.DroppedTroops[self.TroopCounter]=SPAWN:NewWithAlias(_template,alias)
68393
68418
  :InitDelayOff()
@@ -70928,7 +70953,7 @@ CSAR.AircraftType["AH-64D_BLK_II"]=2
70928
70953
  CSAR.AircraftType["Bronco-OV-10A"]=2
70929
70954
  CSAR.AircraftType["MH-60R"]=10
70930
70955
  CSAR.AircraftType["OH-6A"]=2
70931
- CSAR.AircraftType["OH-58D"]=2
70956
+ CSAR.AircraftType["OH58D"]=2
70932
70957
  CSAR.AircraftType["CH-47Fbl1"]=31
70933
70958
  CSAR.version="1.0.29"
70934
70959
  function CSAR:New(Coalition,Template,Alias)
@@ -71187,9 +71212,9 @@ end
71187
71212
  end
71188
71213
  local BeaconName
71189
71214
  if _playerName then
71190
- BeaconName=_unitName..math.random(1,10000)
71191
- elseif _unitName then
71192
71215
  BeaconName=_playerName..math.random(1,10000)
71216
+ elseif _unitName then
71217
+ BeaconName=_unitName..math.random(1,10000)
71193
71218
  else
71194
71219
  BeaconName="Ghost-1-1"..math.random(1,10000)
71195
71220
  end
@@ -83028,8 +83053,9 @@ ConfigFileName="Moose_MSRS.lua",
83028
83053
  ConfigFilePath="Config\\",
83029
83054
  ConfigLoaded=false,
83030
83055
  poptions={},
83056
+ UsePowerShell=false,
83031
83057
  }
83032
- MSRS.version="0.3.0"
83058
+ MSRS.version="0.3.3"
83033
83059
  MSRS.Voices={
83034
83060
  Microsoft={
83035
83061
  ["Hedda"]="Microsoft Hedda Desktop",
@@ -83608,24 +83634,30 @@ label=label or self.Label
83608
83634
  coordinate=coordinate or self.coordinate
83609
83635
  modus=modus:gsub("0","AM")
83610
83636
  modus=modus:gsub("1","FM")
83637
+ local pwsh=string.format('Start-Process -WindowStyle Hidden -WorkingDirectory \"%s\" -FilePath \"%s\" -ArgumentList \'-f "%s" -m "%s" -c %s -p %s -n "%s" -v "%.1f"',path,exe,freqs,modus,coal,port,label,volume)
83611
83638
  local command=string.format('"%s\\%s" -f "%s" -m "%s" -c %s -p %s -n "%s" -v "%.1f"',path,exe,freqs,modus,coal,port,label,volume)
83612
- if voice then
83639
+ if voice and self.UsePowerShell~=true then
83613
83640
  command=command..string.format(" --voice=\"%s\"",tostring(voice))
83641
+ pwsh=pwsh..string.format(" --voice=\"%s\"",tostring(voice))
83614
83642
  else
83615
83643
  if gender and gender~="female"then
83616
83644
  command=command..string.format(" -g %s",tostring(gender))
83645
+ pwsh=pwsh..string.format(" -g %s",tostring(gender))
83617
83646
  end
83618
83647
  if culture and culture~="en-GB"then
83619
83648
  command=command..string.format(" -l %s",tostring(culture))
83649
+ pwsh=pwsh..string.format(" -l %s",tostring(culture))
83620
83650
  end
83621
83651
  end
83622
83652
  if coordinate then
83623
83653
  local lat,lon,alt=self:_GetLatLongAlt(coordinate)
83624
83654
  command=command..string.format(" -L %.4f -O %.4f -A %d",lat,lon,alt)
83655
+ pwsh=pwsh..string.format(" -L %.4f -O %.4f -A %d",lat,lon,alt)
83625
83656
  end
83626
83657
  if self.provider==MSRS.Provider.GOOGLE then
83627
83658
  local pops=self:GetProviderOptions()
83628
83659
  command=command..string.format(' --ssml -G "%s"',pops.credentials)
83660
+ pwsh=pwsh..string.format(' --ssml -G "%s"',pops.credentials)
83629
83661
  elseif self.provider==MSRS.Provider.WINDOWS then
83630
83662
  else
83631
83663
  self:E("ERROR: SRS only supports WINWOWS and GOOGLE as TTS providers! Use DCS-gRPC backend for other providers such as ")
@@ -83635,20 +83667,29 @@ self:E("ERROR: MSRS SRS executable does not exist! FullPath="..fullPath)
83635
83667
  command="CommandNotFound"
83636
83668
  end
83637
83669
  self:T("MSRS command from _GetCommand="..command)
83670
+ if self.UsePowerShell==true then
83671
+ return pwsh
83672
+ else
83638
83673
  return command
83639
83674
  end
83675
+ end
83640
83676
  function MSRS:_ExecCommand(command)
83641
- self:F({command=command})
83677
+ self:T2({command=command})
83642
83678
  if string.find(command,"CommandNotFound")then return 0 end
83643
83679
  local batContent=command.." && exit"
83644
83680
  local filename=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".bat"
83681
+ if self.UsePowerShell==true then
83682
+ filename=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".ps1"
83683
+ batContent=command.."\'"
83684
+ self:I({batContent=batContent})
83685
+ end
83645
83686
  local script=io.open(filename,"w+")
83646
83687
  script:write(batContent)
83647
83688
  script:close()
83648
83689
  self:T("MSRS batch file created: "..filename)
83649
83690
  self:T("MSRS batch content: "..batContent)
83650
83691
  local res=nil
83651
- if true then
83692
+ if self.UsePowerShell~=true then
83652
83693
  local filenvbs=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".vbs"
83653
83694
  local script=io.open(filenvbs,"w+")
83654
83695
  script:write(string.format('Dim WinScriptHost\n'))
@@ -83663,16 +83704,13 @@ res=os.execute(runvbs)
83663
83704
  timer.scheduleFunction(os.remove,filename,timer.getTime()+1)
83664
83705
  timer.scheduleFunction(os.remove,filenvbs,timer.getTime()+1)
83665
83706
  self:T("MSRS vbs and batch file removed")
83666
- elseif false then
83667
- local filenvbs=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".vbs"
83668
- local script=io.open(filenvbs,"w+")
83669
- script:write(string.format('Set oShell = CreateObject ("Wscript.Shell")\n'))
83670
- script:write(string.format('Dim strArgs\n'))
83671
- script:write(string.format('strArgs = "cmd /c %s"\n',filename))
83672
- script:write(string.format('oShell.Run strArgs, 0, false'))
83673
- script:close()
83674
- local runvbs=string.format('cscript.exe //Nologo //B "%s"',filenvbs)
83675
- res=os.execute(runvbs)
83707
+ elseif self.UsePowerShell==true then
83708
+ local pwsh=string.format('powershell.exe -ExecutionPolicy Unrestricted -WindowStyle Hidden -Command "%s"',filename)
83709
+ if string.len(pwsh)>255 then
83710
+ self:E("[MSRS] - pwsh string too long")
83711
+ end
83712
+ res=os.execute(pwsh)
83713
+ timer.scheduleFunction(os.remove,filename,timer.getTime()+1)
83676
83714
  else
83677
83715
  command=string.format('start /b "" "%s"',filename)
83678
83716
  self:T("MSRS execute command="..command)
@@ -1324,7 +1324,7 @@ for index, airbossconfig in ipairs(AirBossConfig) do
1324
1324
  jtff_log.info(string.format("CSG : %s is Supercarrier apply Deck Layout...", objAirboss.customconfig.alias),"AIRBOSS")
1325
1325
  flexDeck7SpawnLayout(objAirboss)
1326
1326
  else
1327
- jtff_log.info(string.format("CSG : %s is not Supercarrier (%s) skipping Deck Layout...", objAirboss.customconfig.alias, objAirboss.CarrierType),"AIRBOSS")
1327
+ jtff_log.info(string.format("CSG : %s is not Supercarrier (%s) skipping Deck Layout...", objAirboss.customconfig.alias, objAirboss.carriertype),"AIRBOSS")
1328
1328
  end
1329
1329
  function objAirboss:OnAfterLSOGrade(From, Event, To, playerData, myGrade)
1330
1330
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "3.4.19",
3
+ "version": "3.4.20",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [