@jtff/miztemplate-lib 3.8.2 → 3.8.4

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: 2025-04-03T14:21:58+02:00-b7b6c1ea19b5fe0685a71aa1ac72f69c9c46f696 ***')
1
+ env.info('*** MOOSE GITHUB Commit Hash ID: 2025-05-30T18:37:50+02:00-c1997d9f70e44639b3d2fc055804026e961c1c6c ***')
2
2
  if not MOOSE_DEVELOPMENT_FOLDER then
3
3
  MOOSE_DEVELOPMENT_FOLDER='Scripts'
4
4
  end
@@ -1186,6 +1186,11 @@ ENUMS.Storage.weapons.OH58.Smk_Grenade_White={4,5,9,492}
1186
1186
  ENUMS.Storage.weapons.OH58.Smk_Grenade_Yellow={4,5,9,491}
1187
1187
  ENUMS.Storage.weapons.AH64D.AN_APG78={4,15,44,2114}
1188
1188
  ENUMS.Storage.weapons.AH64D.Internal_Aux_FuelTank={1,3,43,1700}
1189
+ ENUMS.Storage.weapons.droptanks.FuelTank_610gal={1,3,43,10}
1190
+ ENUMS.Storage.weapons.droptanks.FuelTank_370gal={1,3,43,11}
1191
+ ENUMS.Storage.weapons.containers.AV8BNA_GAU_12_AP_M79={4,15,46,824}
1192
+ ENUMS.Storage.weapons.containers.AV8BNA_GAU_12_HE_M792={4,15,46,825}
1193
+ ENUMS.Storage.weapons.containers.AV8BNA_GAU_12_SAPHEI_T={4,15,46,300}
1189
1194
  ENUMS.FARPType={
1190
1195
  FARP="FARP",
1191
1196
  INVISIBLE="INVISIBLE",
@@ -1222,7 +1227,8 @@ Falklands="Falklands",
1222
1227
  Sinai="SinaiMap",
1223
1228
  Kola="Kola",
1224
1229
  Afghanistan="Afghanistan",
1225
- Iraq="Iraq"
1230
+ Iraq="Iraq",
1231
+ GermanyCW="GermanyCW",
1226
1232
  }
1227
1233
  CALLSIGN={
1228
1234
  Aircraft={
@@ -1425,7 +1431,7 @@ local objectreturn=_copy(object)
1425
1431
  return objectreturn
1426
1432
  end
1427
1433
  UTILS.OneLineSerialize=function(tbl)
1428
- lookup_table={}
1434
+ local lookup_table={}
1429
1435
  local function _Serialize(tbl)
1430
1436
  if type(tbl)=='table'then
1431
1437
  if lookup_table[tbl]then
@@ -2297,6 +2303,8 @@ elseif map==DCSMAP.Afghanistan then
2297
2303
  declination=3
2298
2304
  elseif map==DCSMAP.Iraq then
2299
2305
  declination=4.4
2306
+ elseif map==DCSMAP.GermanyCW then
2307
+ declination=0.1
2300
2308
  else
2301
2309
  declination=0
2302
2310
  end
@@ -2470,6 +2478,10 @@ elseif theatre==DCSMAP.Kola then
2470
2478
  return 3
2471
2479
  elseif theatre==DCSMAP.Afghanistan then
2472
2480
  return 4.5
2481
+ elseif theatre==DCSMAP.Iraq then
2482
+ return 3.0
2483
+ elseif theatre==DCSMAP.GermanyCW then
2484
+ return 1.0
2473
2485
  else
2474
2486
  BASE:E(string.format("ERROR: Unknown Map %s in UTILS.GMTToLocal function. Returning 0",tostring(theatre)))
2475
2487
  return 0
@@ -2530,9 +2542,9 @@ local sinDec=0.39782*sin(L)
2530
2542
  local cosDec=cos(asin(sinDec))
2531
2543
  local cosH=(cos(zenith)-(sinDec*sin(latitude)))/(cosDec*cos(latitude))
2532
2544
  if rising and cosH>1 then
2533
- return"N/S"
2534
- elseif cosH<-1 then
2535
2545
  return"N/R"
2546
+ elseif cosH<-1 then
2547
+ return"N/S"
2536
2548
  end
2537
2549
  local H
2538
2550
  if rising then
@@ -2662,7 +2674,9 @@ if type_name=="CH-47Fbl1"and(unit:getDrawArgumentValue(86)>0.5)then
2662
2674
  BASE:T(unit_name.." rear cargo door is open")
2663
2675
  return true
2664
2676
  end
2665
- return false
2677
+ local UnitDescriptor=unit:getDesc()
2678
+ local IsGroundResult=(UnitDescriptor.category==Unit.Category.GROUND_UNIT)
2679
+ return IsGroundResult
2666
2680
  end
2667
2681
  return nil
2668
2682
  end
@@ -7241,11 +7255,12 @@ Event.IniCategory=Event.IniDCSUnit:getDesc().category
7241
7255
  Event.IniTypeName=Event.IniDCSUnit:getTypeName()
7242
7256
  elseif Event.IniObjectCategory==Object.Category.SCENERY then
7243
7257
  Event.IniDCSUnit=Event.initiator
7244
- Event.IniDCSUnitName=Event.IniDCSUnit.getName and Event.IniDCSUnit:getName()or"Scenery no name "..math.random(1,20000)
7258
+ Event.IniDCSUnitName=(Event.IniDCSUnit and Event.IniDCSUnit.getName)and Event.IniDCSUnit:getName()or"Scenery no name "..math.random(1,20000)
7245
7259
  Event.IniUnitName=Event.IniDCSUnitName
7246
7260
  Event.IniUnit=SCENERY:Register(Event.IniDCSUnitName,Event.initiator)
7247
- Event.IniCategory=Event.IniDCSUnit.getDesc and Event.IniDCSUnit:getDesc().category
7248
- Event.IniTypeName=Event.initiator:isExist()and Event.IniDCSUnit:getTypeName()or"SCENERY"
7261
+ Event.IniCategory=(Event.IniDCSUnit and Event.IniDCSUnit.getDesc)and Event.IniDCSUnit:getDesc().category
7262
+ Event.IniTypeName=(Event.initiator and Event.initiator.isExist
7263
+ and Event.initiator:isExist()and Event.IniDCSUnit and Event.IniDCSUnit.getTypeName)and Event.IniDCSUnit:getTypeName()or"SCENERY"
7249
7264
  elseif Event.IniObjectCategory==Object.Category.BASE then
7250
7265
  Event.IniDCSUnit=Event.initiator
7251
7266
  Event.IniDCSUnitName=Event.IniDCSUnit:getName()
@@ -11118,6 +11133,7 @@ end
11118
11133
  return self.CLIENTS[DCSUnitName]
11119
11134
  end
11120
11135
  function DATABASE:FindGroup(GroupName)
11136
+ if type(GroupName)~="string"or GroupName==""then return end
11121
11137
  local GroupFound=self.GROUPS[GroupName]
11122
11138
  if GroupFound==nil and GroupName~=nil and self.Templates.Groups[GroupName]==nil then
11123
11139
  self:_RegisterDynamicGroup(GroupName)
@@ -13036,6 +13052,30 @@ end
13036
13052
  )
13037
13053
  return self
13038
13054
  end
13055
+ function SET_UNIT:FilterGroupPrefixes(Prefixes)
13056
+ if type(Prefixes)=="string"then
13057
+ Prefixes={Prefixes}
13058
+ end
13059
+ self:FilterFunction(
13060
+ function(unit,prefixes)
13061
+ local outcome=false
13062
+ if unit then
13063
+ local grp=unit:GetGroup()
13064
+ local gname=grp~=nil and grp:GetName()or"none"
13065
+ for _,_fix in pairs(prefixes or{})do
13066
+ if string.find(gname,_fix)then
13067
+ outcome=true
13068
+ break
13069
+ end
13070
+ end
13071
+ else
13072
+ return false
13073
+ end
13074
+ return outcome
13075
+ end,Prefixes
13076
+ )
13077
+ return self
13078
+ end
13039
13079
  function SET_UNIT:FilterHasRadar(RadarTypes)
13040
13080
  self.Filter.RadarTypes=self.Filter.RadarTypes or{}
13041
13081
  if type(RadarTypes)~="table"then
@@ -14071,6 +14111,30 @@ self.Filter.ClientPrefixes[Prefix]=Prefix
14071
14111
  end
14072
14112
  return self
14073
14113
  end
14114
+ function SET_CLIENT:FilterGroupPrefixes(Prefixes)
14115
+ if type(Prefixes)=="string"then
14116
+ Prefixes={Prefixes}
14117
+ end
14118
+ self:FilterFunction(
14119
+ function(unit,prefixes)
14120
+ local outcome=false
14121
+ if unit then
14122
+ local grp=unit:GetGroup()
14123
+ local gname=grp~=nil and grp:GetName()or"none"
14124
+ for _,_fix in pairs(prefixes or{})do
14125
+ if string.find(gname,_fix)then
14126
+ outcome=true
14127
+ break
14128
+ end
14129
+ end
14130
+ else
14131
+ return false
14132
+ end
14133
+ return outcome
14134
+ end,Prefixes
14135
+ )
14136
+ return self
14137
+ end
14074
14138
  function SET_CLIENT:FilterActive(Active)
14075
14139
  Active=Active or not(Active==false)
14076
14140
  self.Filter.Active=Active
@@ -16100,7 +16164,6 @@ end
16100
16164
  do
16101
16165
  SET_DYNAMICCARGO={
16102
16166
  ClassName="SET_DYNAMICCARGO",
16103
- Filter={},
16104
16167
  Set={},
16105
16168
  List={},
16106
16169
  Index={},
@@ -17352,83 +17415,93 @@ trigger.action.illuminationBomb(self:GetVec3(),Power)
17352
17415
  end
17353
17416
  return self
17354
17417
  end
17355
- function COORDINATE:Smoke(SmokeColor,name)
17356
- self:F2({SmokeColor})
17357
- self.firename=name or"Smoke-"..math.random(1,100000)
17418
+ function COORDINATE:Smoke(SmokeColor,Duration,Delay,Name)
17419
+ self:F2({SmokeColor,Name,Duration,Delay})
17420
+ SmokeColor=SmokeColor or SMOKECOLOR.Green
17421
+ if Delay and Delay>0 then
17422
+ self:ScheduleOnce(Delay,COORDINATE.Smoke,self,SmokeColor,Duration,0,Name)
17423
+ else
17424
+ self.firename=Name or"Smoke-"..math.random(1,100000)
17358
17425
  trigger.action.smoke(self:GetVec3(),SmokeColor,self.firename)
17426
+ if Duration and Duration>0 then
17427
+ self:ScheduleOnce(Duration,COORDINATE.StopSmoke,self,self.firename)
17428
+ end
17429
+ end
17430
+ return self
17359
17431
  end
17360
17432
  function COORDINATE:StopSmoke(name)
17361
17433
  self:StopBigSmokeAndFire(name)
17362
17434
  end
17363
- function COORDINATE:SmokeGreen()
17364
- self:F2()
17365
- self:Smoke(SMOKECOLOR.Green)
17435
+ function COORDINATE:SmokeGreen(Duration,Delay)
17436
+ self:Smoke(SMOKECOLOR.Green,Duration,Delay)
17437
+ return self
17366
17438
  end
17367
- function COORDINATE:SmokeRed()
17368
- self:F2()
17369
- self:Smoke(SMOKECOLOR.Red)
17439
+ function COORDINATE:SmokeRed(Duration,Delay)
17440
+ self:Smoke(SMOKECOLOR.Red,Duration,Delay)
17441
+ return self
17370
17442
  end
17371
- function COORDINATE:SmokeWhite()
17372
- self:F2()
17373
- self:Smoke(SMOKECOLOR.White)
17443
+ function COORDINATE:SmokeWhite(Duration,Delay)
17444
+ self:Smoke(SMOKECOLOR.White,Duration,Delay)
17445
+ return self
17374
17446
  end
17375
- function COORDINATE:SmokeOrange()
17376
- self:F2()
17377
- self:Smoke(SMOKECOLOR.Orange)
17447
+ function COORDINATE:SmokeOrange(Duration,Delay)
17448
+ self:Smoke(SMOKECOLOR.Orange,Duration,Delay)
17449
+ return self
17378
17450
  end
17379
- function COORDINATE:SmokeBlue()
17380
- self:F2()
17381
- self:Smoke(SMOKECOLOR.Blue)
17451
+ function COORDINATE:SmokeBlue(Duration,Delay)
17452
+ self:Smoke(SMOKECOLOR.Blue,Duration,Delay)
17453
+ return self
17454
+ end
17455
+ function COORDINATE:BigSmokeAndFire(Preset,Density,Duration,Delay,Name)
17456
+ self:F2({preset=Preset,density=Density})
17457
+ Preset=Preset or BIGSMOKEPRESET.SmallSmokeAndFire
17458
+ Density=Density or 0.5
17459
+ if Delay and Delay>0 then
17460
+ self:ScheduleOnce(Delay,COORDINATE.BigSmokeAndFire,self,Preset,Density,Duration,0,Name)
17461
+ else
17462
+ self.firename=Name or"Fire-"..math.random(1,10000)
17463
+ trigger.action.effectSmokeBig(self:GetVec3(),Preset,Density,self.firename)
17464
+ if Duration and Duration>0 then
17465
+ self:ScheduleOnce(Duration,COORDINATE.StopBigSmokeAndFire,self,self.firename)
17382
17466
  end
17383
- function COORDINATE:BigSmokeAndFire(preset,density,name)
17384
- self:F2({preset=preset,density=density})
17385
- density=density or 0.5
17386
- self.firename=name or"Fire-"..math.random(1,10000)
17387
- trigger.action.effectSmokeBig(self:GetVec3(),preset,density,self.firename)
17467
+ end
17468
+ return self
17388
17469
  end
17389
17470
  function COORDINATE:StopBigSmokeAndFire(name)
17390
17471
  name=name or self.firename
17391
17472
  trigger.action.effectSmokeStop(name)
17392
17473
  end
17393
- function COORDINATE:BigSmokeAndFireSmall(density,name)
17394
- self:F2({density=density})
17395
- density=density or 0.5
17396
- self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire,density,name)
17397
- end
17398
- function COORDINATE:BigSmokeAndFireMedium(density,name)
17399
- self:F2({density=density})
17400
- density=density or 0.5
17401
- self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire,density,name)
17402
- end
17403
- function COORDINATE:BigSmokeAndFireLarge(density,name)
17404
- self:F2({density=density})
17405
- density=density or 0.5
17406
- self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire,density,name)
17407
- end
17408
- function COORDINATE:BigSmokeAndFireHuge(density,name)
17409
- self:F2({density=density})
17410
- density=density or 0.5
17411
- self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire,density,name)
17412
- end
17413
- function COORDINATE:BigSmokeSmall(density,name)
17414
- self:F2({density=density})
17415
- density=density or 0.5
17416
- self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke,density,name)
17417
- end
17418
- function COORDINATE:BigSmokeMedium(density,name)
17419
- self:F2({density=density})
17420
- density=density or 0.5
17421
- self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke,density,name)
17422
- end
17423
- function COORDINATE:BigSmokeLarge(density,name)
17424
- self:F2({density=density})
17425
- density=density or 0.5
17426
- self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke,density,name)
17427
- end
17428
- function COORDINATE:BigSmokeHuge(density,name)
17429
- self:F2({density=density})
17430
- density=density or 0.5
17431
- self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke,density,name)
17474
+ function COORDINATE:BigSmokeAndFireSmall(Density,Duration,Delay,Name)
17475
+ self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire,Density,Duration,Delay,Name)
17476
+ return self
17477
+ end
17478
+ function COORDINATE:BigSmokeAndFireMedium(Density,Duration,Delay,Name)
17479
+ self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire,Density,Duration,Delay,Name)
17480
+ return self
17481
+ end
17482
+ function COORDINATE:BigSmokeAndFireLarge(Density,Duration,Delay,Name)
17483
+ self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire,Density,Duration,Delay,Name)
17484
+ return self
17485
+ end
17486
+ function COORDINATE:BigSmokeAndFireHuge(Density,Duration,Delay,Name)
17487
+ self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire,Density,Duration,Delay,Name)
17488
+ return self
17489
+ end
17490
+ function COORDINATE:BigSmokeSmall(Density,Duration,Delay,Name)
17491
+ self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke,Density,Duration,Delay,Name)
17492
+ return self
17493
+ end
17494
+ function COORDINATE:BigSmokeMedium(Density,Duration,Delay,Name)
17495
+ self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke,Density,Duration,Delay,Name)
17496
+ return self
17497
+ end
17498
+ function COORDINATE:BigSmokeLarge(Density,Duration,Delay,Name)
17499
+ self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke,Density,Duration,Delay,Name)
17500
+ return self
17501
+ end
17502
+ function COORDINATE:BigSmokeHuge(Density,Duration,Delay,Name)
17503
+ self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke,Density,Duration,Delay,Name)
17504
+ return self
17432
17505
  end
17433
17506
  function COORDINATE:Flare(FlareColor,Azimuth)
17434
17507
  self:F2({FlareColor})
@@ -17733,8 +17806,10 @@ local Latitude,Longitude=self:GetLLDDM()
17733
17806
  local Tdiff=UTILS.GMTToLocalTimeDifference()
17734
17807
  local sunrise=UTILS.GetSunRiseAndSet(DayOfYear,Latitude,Longitude,true,Tdiff)
17735
17808
  local sunset=UTILS.GetSunRiseAndSet(DayOfYear,Latitude,Longitude,false,Tdiff)
17809
+ if type(sunrise)=="string"or type(sunset)=="string"then
17736
17810
  if sunrise=="N/R"then return false end
17737
- if sunrise=="N/S"then return true end
17811
+ if sunset=="N/S"then return true end
17812
+ end
17738
17813
  local time=UTILS.ClockToSeconds(clock)
17739
17814
  if time>sunrise and time<=sunset then
17740
17815
  return true
@@ -17744,6 +17819,10 @@ end
17744
17819
  else
17745
17820
  local sunrise=self:GetSunrise(true)
17746
17821
  local sunset=self:GetSunset(true)
17822
+ if type(sunrise)=="string"or type(sunset)=="string"then
17823
+ if sunrise=="N/R"then return false end
17824
+ if sunset=="N/S"then return true end
17825
+ end
17747
17826
  local time=UTILS.SecondsOfToday()
17748
17827
  if time>sunrise and time<=sunset then
17749
17828
  return true
@@ -18284,7 +18363,7 @@ return self
18284
18363
  end
18285
18364
  function MESSAGE:ToGroup(Group,Settings)
18286
18365
  self:F(Group.GroupName)
18287
- if Group then
18366
+ if Group and Group:IsAlive()then
18288
18367
  if self.MessageType then
18289
18368
  local Settings=Settings or(Group and _DATABASE:GetPlayerSettings(Group:GetPlayerName()))or _SETTINGS
18290
18369
  self.MessageDuration=Settings:GetMessageTime(self.MessageType)
@@ -18299,7 +18378,7 @@ return self
18299
18378
  end
18300
18379
  function MESSAGE:ToUnit(Unit,Settings)
18301
18380
  self:F(Unit.IdentifiableName)
18302
- if Unit then
18381
+ if Unit and Unit:IsAlive()then
18303
18382
  if self.MessageType then
18304
18383
  local Settings=Settings or(Unit and _DATABASE:GetPlayerSettings(Unit:GetPlayerName()))or _SETTINGS
18305
18384
  self.MessageDuration=Settings:GetMessageTime(self.MessageType)
@@ -26574,13 +26653,16 @@ function GROUP:GetVelocityVec3()
26574
26653
  local DCSGroup=self:GetDCSObject()
26575
26654
  if DCSGroup and DCSGroup:isExist()then
26576
26655
  local GroupUnits=DCSGroup:getUnits()
26577
- local GroupCount=#GroupUnits
26656
+ local GroupCount=0
26578
26657
  local VelocityVec3={x=0,y=0,z=0}
26579
26658
  for _,DCSUnit in pairs(GroupUnits)do
26659
+ if DCSUnit:isExist()and DCSUnit:isActive()then
26580
26660
  local UnitVelocityVec3=DCSUnit:getVelocity()
26581
26661
  VelocityVec3.x=VelocityVec3.x+UnitVelocityVec3.x
26582
26662
  VelocityVec3.y=VelocityVec3.y+UnitVelocityVec3.y
26583
26663
  VelocityVec3.z=VelocityVec3.z+UnitVelocityVec3.z
26664
+ GroupCount=GroupCount+1
26665
+ end
26584
26666
  end
26585
26667
  VelocityVec3.x=VelocityVec3.x/GroupCount
26586
26668
  VelocityVec3.y=VelocityVec3.y/GroupCount
@@ -27026,12 +27108,14 @@ local DCSGroup=self:GetDCSObject()
27026
27108
  if DCSGroup then
27027
27109
  local GroupVelocityMax=0
27028
27110
  for Index,UnitData in pairs(DCSGroup:getUnits())do
27111
+ if UnitData:isExist()and UnitData:isActive()then
27029
27112
  local UnitVelocityVec3=UnitData:getVelocity()
27030
27113
  local UnitVelocity=math.abs(UnitVelocityVec3.x)+math.abs(UnitVelocityVec3.y)+math.abs(UnitVelocityVec3.z)
27031
27114
  if UnitVelocity>GroupVelocityMax then
27032
27115
  GroupVelocityMax=UnitVelocity
27033
27116
  end
27034
27117
  end
27118
+ end
27035
27119
  return GroupVelocityMax
27036
27120
  end
27037
27121
  return nil
@@ -27076,7 +27160,10 @@ return nil
27076
27160
  end
27077
27161
  function GROUP:GetTemplateRoutePoints()
27078
27162
  local GroupName=self:GetName()
27079
- return UTILS.DeepCopy(_DATABASE:GetGroupTemplate(GroupName).route.points)
27163
+ local template=_DATABASE:GetGroupTemplate(GroupName)
27164
+ if template and template.route and template.route.points then
27165
+ return UTILS.DeepCopy(template.route.points)
27166
+ end
27080
27167
  end
27081
27168
  function GROUP:SetTemplateControlled(Template,Controlled)
27082
27169
  Template.uncontrolled=not Controlled
@@ -28158,7 +28245,7 @@ end
28158
28245
  if ammotable[w].desc.typeName and string.find(ammotable[w].desc.typeName,"_AP",1,true)then
28159
28246
  nAPshells=nAPshells+Nammo
28160
28247
  end
28161
- if ammotable[w].desc.typeName and string.find(ammotable[w].desc.typeName,"_HE",1,true)then
28248
+ if ammotable[w].desc.typeName and(string.find(ammotable[w].desc.typeName,"_HE",1,true)or string.find(ammotable[w].desc.typeName,"HESH",1,true))then
28162
28249
  nHEshells=nHEshells+Nammo
28163
28250
  end
28164
28251
  elseif Category==Weapon.Category.ROCKET then
@@ -28273,7 +28360,6 @@ local DCSUnit=self:GetDCSObject()
28273
28360
  local Units={}
28274
28361
  if DCSUnit then
28275
28362
  Units[1]=UNIT:Find(DCSUnit)
28276
- -self:T3(Units)
28277
28363
  return Units
28278
28364
  end
28279
28365
  return nil
@@ -29379,6 +29465,7 @@ AIRBASE.Syria={
29379
29465
  ["Hatzor"]="Hatzor",
29380
29466
  ["Palmashim"]="Palmashim",
29381
29467
  ["Tel_Nof"]="Tel Nof",
29468
+ ["Marka"]="Marka",
29382
29469
  }
29383
29470
  AIRBASE.MarianaIslands={
29384
29471
  ["Andersen_AFB"]="Andersen AFB",
@@ -29486,9 +29573,14 @@ AIRBASE.Kola={
29486
29573
  ["Vidsel"]="Vidsel",
29487
29574
  ["Vuojarvi"]="Vuojarvi",
29488
29575
  ["Andoya"]="Andoya",
29489
- ["Alakourtti"]="Alakourtti",
29576
+ ["Alakurtti"]="Alakurtti",
29490
29577
  ["Kittila"]="Kittila",
29491
29578
  ["Bardufoss"]="Bardufoss",
29579
+ ["Alta"]="Alta",
29580
+ ["Sodankyla"]="Sodankyla",
29581
+ ["Enontekio"]="Enontekio",
29582
+ ["Evenes"]="Evenes",
29583
+ ["Hosio"]="Hosio",
29492
29584
  }
29493
29585
  AIRBASE.Afghanistan={
29494
29586
  ["Bagram"]="Bagram",
@@ -29532,6 +29624,209 @@ AIRBASE.Iraq={
29532
29624
  ["Qayyarah_Airfield_West"]="Qayyarah Airfield West",
29533
29625
  ["K1_Base"]="K1 Base",
29534
29626
  }
29627
+ AIRBASE.GermanyCW={
29628
+ ["Airracing_Frankfurt"]="Airracing Frankfurt",
29629
+ ["Airracing_Koblenz"]="Airracing Koblenz",
29630
+ ["Airracing_Luebeck"]="Airracing Lubeck",
29631
+ ["Allstedt"]="Allstedt",
29632
+ ["Altes_Lager"]="Altes Lager",
29633
+ ["Bad_Duerkheim"]="Bad Durkheim",
29634
+ ["Barth"]="Barth",
29635
+ ["Bienenfarm"]="Bienenfarm",
29636
+ ["Bindersleben"]="Bindersleben",
29637
+ ["Bitburg"]="Bitburg",
29638
+ ["Braunschweig"]="Braunschweig",
29639
+ ["Bremen"]="Bremen",
29640
+ ["Briest"]="Briest",
29641
+ ["Buechel"]="Buchel",
29642
+ ["Bueckeburg"]="Buckeburg",
29643
+ ["Celle"]="Celle",
29644
+ ["Cochstedt"]="Cochstedt",
29645
+ ["Damgarten"]="Damgarten",
29646
+ ["Dedelow"]="Dedelow",
29647
+ ["Dessau"]="Dessau",
29648
+ ["Fassberg"]="Fassberg",
29649
+ ["Finow"]="Finow",
29650
+ ["Frankfurt"]="Frankfurt",
29651
+ ["Fritzlar"]="Fritzlar",
29652
+ ["Fulda"]="Fulda",
29653
+ ["Gardelegen"]="Gardelegen",
29654
+ ["Garz"]="Garz",
29655
+ ["Gatow"]="Gatow",
29656
+ ["Gelnhausen"]="Gelnhausen",
29657
+ ["Giebelstadt"]="Giebelstadt",
29658
+ ["Glindbruchkippe"]="Glindbruchkippe ",
29659
+ ["Gross_Mohrdorf"]="Gross Mohrdorf",
29660
+ ["Grosse_Wiese"]="Grosse Wiese",
29661
+ ["Guetersloh"]="Gutersloh",
29662
+ ["H_FRG_01"]="H FRG 01",
29663
+ ["H_FRG_02"]="H FRG 02",
29664
+ ["H_FRG_03"]="H FRG 03",
29665
+ ["H_FRG_04"]="H FRG 04",
29666
+ ["H_FRG_05"]="H FRG 05",
29667
+ ["H_FRG_06"]="H FRG 06",
29668
+ ["H_FRG_07"]="H FRG 07",
29669
+ ["H_FRG_08"]="H FRG 08",
29670
+ ["H_FRG_09"]="H FRG 09",
29671
+ ["H_FRG_10"]="H FRG 10",
29672
+ ["H_FRG_11"]="H FRG 11",
29673
+ ["H_FRG_12"]="H FRG 12",
29674
+ ["H_FRG_13"]="H FRG 13",
29675
+ ["H_FRG_14"]="H FRG 14",
29676
+ ["H_FRG_15"]="H FRG 15",
29677
+ ["H_FRG_16"]="H FRG 16",
29678
+ ["H_FRG_17"]="H FRG 17",
29679
+ ["H_FRG_18"]="H FRG 18",
29680
+ ["H_FRG_19"]="H FRG 19",
29681
+ ["H_FRG_20"]="H FRG 20",
29682
+ ["H_FRG_21"]="H FRG 21",
29683
+ ["H_FRG_23"]="H FRG 23",
29684
+ ["H_FRG_25"]="H FRG 25",
29685
+ ["H_FRG_27"]="H FRG 27",
29686
+ ["H_FRG_30"]="H FRG 30",
29687
+ ["H_FRG_31"]="H FRG 31",
29688
+ ["H_FRG_32"]="H FRG 32",
29689
+ ["H_FRG_34"]="H FRG 34",
29690
+ ["H_FRG_38"]="H FRG 38",
29691
+ ["H_FRG_39"]="H FRG 39",
29692
+ ["H_FRG_40"]="H FRG 40",
29693
+ ["H_FRG_41"]="H FRG 41",
29694
+ ["H_FRG_42"]="H FRG 42",
29695
+ ["H_FRG_43"]="H FRG 43",
29696
+ ["H_FRG_44"]="H FRG 44",
29697
+ ["H_FRG_45"]="H FRG 45",
29698
+ ["H_FRG_46"]="H FRG 46",
29699
+ ["H_FRG_47"]="H FRG 47",
29700
+ ["H_FRG_48"]="H FRG 48",
29701
+ ["H_FRG_49"]="H FRG 49",
29702
+ ["H_FRG_50"]="H FRG 50",
29703
+ ["H_FRG_51"]="H FRG 51",
29704
+ ["H_GDR_01"]="H GDR 01",
29705
+ ["H_GDR_02"]="H GDR 02",
29706
+ ["H_GDR_03"]="H GDR 03",
29707
+ ["H_GDR_04"]="H GDR 04",
29708
+ ["H_GDR_05"]="H GDR 05",
29709
+ ["H_GDR_06"]="H GDR 06",
29710
+ ["H_GDR_07"]="H GDR 07",
29711
+ ["H_GDR_08"]="H GDR 08",
29712
+ ["H_GDR_09"]="H GDR 09",
29713
+ ["H_GDR_10"]="H GDR 10",
29714
+ ["H_GDR_11"]="H GDR 11",
29715
+ ["H_GDR_12"]="H GDR 12",
29716
+ ["H_GDR_13"]="H GDR 13",
29717
+ ["H_GDR_14"]="H GDR 14",
29718
+ ["H_GDR_15"]="H GDR 15",
29719
+ ["H_GDR_16"]="H GDR 16",
29720
+ ["H_GDR_17"]="H GDR 17",
29721
+ ["H_GDR_18"]="H GDR 18",
29722
+ ["H_GDR_19"]="H GDR 19",
29723
+ ["H_GDR_21"]="H GDR 21",
29724
+ ["H_GDR_22"]="H GDR 22",
29725
+ ["H_GDR_24"]="H GDR 24",
29726
+ ["H_GDR_25"]="H GDR 25",
29727
+ ["H_GDR_26"]="H GDR 26",
29728
+ ["H_GDR_30"]="H GDR 30",
29729
+ ["H_GDR_31"]="H GDR 31",
29730
+ ["H_GDR_32"]="H GDR 32",
29731
+ ["H_GDR_33"]="H GDR 33",
29732
+ ["H_GDR_34"]="H GDR 34",
29733
+ ["H_Med_FRG_01"]="H Med FRG 01",
29734
+ ["H_Med_FRG_02"]="H Med FRG 02",
29735
+ ["H_Med_FRG_04"]="H Med FRG 04",
29736
+ ["H_Med_FRG_06"]="H Med FRG 06",
29737
+ ["H_Med_FRG_11"]="H Med FRG 11",
29738
+ ["H_Med_FRG_12"]="H Med FRG 12",
29739
+ ["H_Med_FRG_13"]="H Med FRG 13",
29740
+ ["H_Med_FRG_14"]="H Med FRG 14",
29741
+ ["H_Med_FRG_15"]="H Med FRG 15",
29742
+ ["H_Med_FRG_16"]="H Med FRG 16",
29743
+ ["H_Med_FRG_17"]="H Med FRG 17",
29744
+ ["H_Med_FRG_21"]="H Med FRG 21",
29745
+ ["H_Med_FRG_24"]="H Med FRG 24",
29746
+ ["H_Med_FRG_26"]="H Med FRG 26",
29747
+ ["H_Med_FRG_27"]="H Med FRG 27",
29748
+ ["H_Med_FRG_29"]="H Med FRG 29",
29749
+ ["H_Med_GDR_01"]="H Med GDR 01",
29750
+ ["H_Med_GDR_02"]="H Med GDR 02",
29751
+ ["H_Med_GDR_03"]="H Med GDR 03",
29752
+ ["H_Med_GDR_08"]="H Med GDR 08",
29753
+ ["H_Med_GDR_09"]="H Med GDR 09",
29754
+ ["H_Med_GDR_10"]="H Med GDR 10",
29755
+ ["H_Med_GDR_11"]="H Med GDR 11",
29756
+ ["H_Med_GDR_12"]="H Med GDR 12",
29757
+ ["H_Med_GDR_13"]="H Med GDR 13",
29758
+ ["H_Med_GDR_14"]="H Med GDR 14",
29759
+ ["H_Med_GDR_16"]="H Med GDR 16",
29760
+ ["H_Radar_FRG_02"]="H Radar FRG 02",
29761
+ ["H_Radar_GDR_01"]="H Radar GDR 01",
29762
+ ["H_Radar_GDR_02"]="H Radar GDR 02",
29763
+ ["H_Radar_GDR_03"]="H Radar GDR 03",
29764
+ ["H_Radar_GDR_04"]="H Radar GDR 04",
29765
+ ["H_Radar_GDR_05"]="H Radar GDR 05",
29766
+ ["H_Radar_GDR_06"]="H Radar GDR 06",
29767
+ ["H_Radar_GDR_07"]="H Radar GDR 07",
29768
+ ["H_Radar_GDR_08"]="H Radar GDR 08",
29769
+ ["H_Radar_GDR_09"]="H Radar GDR 09",
29770
+ ["Hahn"]="Hahn",
29771
+ ["Haina"]="Haina",
29772
+ ["Hamburg"]="Hamburg",
29773
+ ["Hamburg_Finkenwerder"]="Hamburg Finkenwerder",
29774
+ ["Hannover"]="Hannover",
29775
+ ["Hasselfelde"]="Hasselfelde",
29776
+ ["Herrenteich"]="Herrenteich",
29777
+ ["Hildesheim"]="Hildesheim",
29778
+ ["Hockenheim"]="Hockenheim",
29779
+ ["Holzdorf"]="Holzdorf",
29780
+ ["Kammermark"]="Kammermark",
29781
+ ["Koethen"]="Kothen",
29782
+ ["Laage"]="Laage",
29783
+ ["Langenselbold"]="Langenselbold",
29784
+ ["Laerz"]="Larz",
29785
+ ["Leipzig_Halle"]="Leipzig Halle",
29786
+ ["Leipzig_Mockau"]="Leipzig Mockau",
29787
+ ["Luebeck"]="Lubeck",
29788
+ ["Lueneburg"]="Luneburg",
29789
+ ["Mahlwinkel"]="Mahlwinkel",
29790
+ ["Mendig"]="Mendig",
29791
+ ["Merseburg"]="Merseburg",
29792
+ ["Neubrandenburg"]="Neubrandenburg",
29793
+ ["Neuruppin"]="Neuruppin",
29794
+ ["Northeim"]="Northeim",
29795
+ ["Ober_Moerlen"]="Ober-Morlen",
29796
+ ["Obermehler_Schlotheim"]="Obermehler Schlotheim",
29797
+ ["Parchim"]="Parchim",
29798
+ ["Peenemuende"]="Peenemunde",
29799
+ ["Pferdsfeld"]="Pferdsfeld",
29800
+ ["Pinnow"]="Pinnow",
29801
+ ["Pottschutthoehe"]="Pottschutthohe",
29802
+ ["Ramstein"]="Ramstein",
29803
+ ["Rinteln"]="Rinteln",
29804
+ ["Schoenefeld"]="Schonefeld",
29805
+ ["Schweinfurt"]="Schweinfurt",
29806
+ ["Sembach"]="Sembach",
29807
+ ["Spangdahlem"]="Spangdahlem",
29808
+ ["Sperenberg"]="Sperenberg",
29809
+ ["Stendal"]="Stendal",
29810
+ ["Tegel"]="Tegel",
29811
+ ["Tempelhof"]="Tempelhof",
29812
+ ["Templin"]="Templin",
29813
+ ["Tutow"]="Tutow",
29814
+ ["Uelzen"]="Uelzen",
29815
+ ["Uetersen"]="Uetersen",
29816
+ ["Ummern"]="Ummern",
29817
+ ["Verden_Scharnhorst"]="Verden-Scharnhorst",
29818
+ ["Walldorf"]="Walldorf",
29819
+ ["Waren_Vielist"]="Waren Vielist",
29820
+ ["Werneuchen"]="Werneuchen",
29821
+ ["Weser_Wuemme"]="Weser Wumme",
29822
+ ["Wiesbaden"]="Wiesbaden",
29823
+ ["Wismar"]="Wismar",
29824
+ ["Wittstock"]="Wittstock",
29825
+ ["Worms"]="Worms",
29826
+ ["Wunstorf"]="Wunstorf",
29827
+ ["Zerbst"]="Zerbst",
29828
+ ["Zweibruecken"]="Zweibrucken",
29829
+ }
29535
29830
  AIRBASE.TerminalType={
29536
29831
  Runway=16,
29537
29832
  HelicopterOnly=40,
@@ -30155,6 +30450,7 @@ if Name then
30155
30450
  for _,_runway in pairs(self.runways)do
30156
30451
  local runway=_runway
30157
30452
  local name=self:GetRunwayName(runway)
30453
+ self:T("Check Runway Name: "..name)
30158
30454
  if name==Name:upper()then
30159
30455
  return runway
30160
30456
  end
@@ -30169,6 +30465,7 @@ IncludeInverse=true
30169
30465
  end
30170
30466
  local Runways={}
30171
30467
  local function _createRunway(name,course,width,length,center)
30468
+ self:T("Create Runway: name = "..name)
30172
30469
  local bearing=-1*course
30173
30470
  local heading=math.deg(bearing)
30174
30471
  local runway={}
@@ -30364,6 +30661,7 @@ runway.idx=idx
30364
30661
  runway.length=c1:Get2DDistance(c2)
30365
30662
  runway.position=c1
30366
30663
  runway.endpoint=c2
30664
+ self:T(string.format("Airbase %s: Adding runway id=%s, heading=%03d, length=%d m i=%d j=%d",self:GetName(),runway.idx,runway.heading,runway.length,i,j))
30367
30665
  if mark then
30368
30666
  runway.position:MarkToAll(string.format("Runway %s: true heading=%03d (magvar=%d), length=%d m, i=%d, j=%d",runway.idx,runway.heading,magvar,runway.length,i,j))
30369
30667
  end
@@ -43525,7 +43823,12 @@ result.rangename=self.rangename
43525
43823
  result.attackHdg=attackHdg
43526
43824
  result.attackVel=attackVel
43527
43825
  result.attackAlt=attackAlt
43528
- result.date=os and os.date()or"n/a"
43826
+ if os and os.date then
43827
+ result.date=os.date()
43828
+ else
43829
+ self:E(self.lid.."os or os.date() not available")
43830
+ result.date="n/a"
43831
+ end
43529
43832
  table.insert(_results,result)
43530
43833
  self:Impact(result,playerData)
43531
43834
  elseif insidezone then
@@ -52626,7 +52929,6 @@ explosionpower=0.1,
52626
52929
  explosiondist=200,
52627
52930
  explosiondist2=500,
52628
52931
  bigmissilemass=50,
52629
- destroy=nil,
52630
52932
  dt50=5,
52631
52933
  dt10=1,
52632
52934
  dt05=0.5,
@@ -53441,6 +53743,8 @@ checkforfriendlies=false,
53441
53743
  SmokeDecoy=false,
53442
53744
  SmokeDecoyColor=SMOKECOLOR.White,
53443
53745
  checkcounter=1,
53746
+ DLinkCacheTime=120,
53747
+ logsamstatus=false,
53444
53748
  }
53445
53749
  MANTIS.AdvancedState={
53446
53750
  GREEN=0,
@@ -53461,7 +53765,7 @@ MANTIS.radiusscale[MANTIS.SamType.POINT]=3
53461
53765
  MANTIS.SamData={
53462
53766
  ["Hawk"]={Range=35,Blindspot=0,Height=12,Type="Medium",Radar="Hawk"},
53463
53767
  ["NASAMS"]={Range=14,Blindspot=0,Height=7,Type="Short",Radar="NSAMS"},
53464
- ["Patriot"]={Range=99,Blindspot=0,Height=25,Type="Long",Radar="Patriot"},
53768
+ ["Patriot"]={Range=99,Blindspot=0,Height=25,Type="Long",Radar="Patriot str"},
53465
53769
  ["Rapier"]={Range=10,Blindspot=0,Height=3,Type="Short",Radar="rapier"},
53466
53770
  ["SA-2"]={Range=40,Blindspot=7,Height=25,Type="Medium",Radar="S_75M_Volhov"},
53467
53771
  ["SA-3"]={Range=18,Blindspot=6,Height=18,Type="Short",Radar="5p73 s-125 ln"},
@@ -53469,7 +53773,8 @@ MANTIS.SamData={
53469
53773
  ["SA-6"]={Range=25,Blindspot=0,Height=8,Type="Medium",Radar="1S91"},
53470
53774
  ["SA-10"]={Range=119,Blindspot=0,Height=18,Type="Long",Radar="S-300PS 4"},
53471
53775
  ["SA-11"]={Range=35,Blindspot=0,Height=20,Type="Medium",Radar="SA-11"},
53472
- ["Roland"]={Range=5,Blindspot=0,Height=5,Type="Point",Radar="Roland"},
53776
+ ["Roland"]={Range=6,Blindspot=0,Height=5,Type="Short",Radar="Roland"},
53777
+ ["Gepard"]={Range=5,Blindspot=0,Height=4,Type="Point",Radar="Gepard"},
53473
53778
  ["HQ-7"]={Range=12,Blindspot=0,Height=3,Type="Short",Radar="HQ-7"},
53474
53779
  ["SA-9"]={Range=4,Blindspot=0,Height=3,Type="Point",Radar="Strela",Point="true"},
53475
53780
  ["SA-8"]={Range=10,Blindspot=0,Height=5,Type="Short",Radar="Osa 9A33"},
@@ -53480,6 +53785,7 @@ MANTIS.SamData={
53480
53785
  ["Chaparral"]={Range=8,Blindspot=0,Height=3,Type="Short",Radar="Chaparral"},
53481
53786
  ["Linebacker"]={Range=4,Blindspot=0,Height=3,Type="Point",Radar="Linebacker",Point="true"},
53482
53787
  ["Silkworm"]={Range=90,Blindspot=1,Height=0.2,Type="Long",Radar="Silkworm"},
53788
+ ["HEMTT_C-RAM_Phalanx"]={Range=2,Blindspot=0,Height=2,Type="Point",Radar="HEMTT_C-RAM_Phalanx",Point="true"},
53483
53789
  ["SA-10B"]={Range=75,Blindspot=0,Height=18,Type="Medium",Radar="SA-10B"},
53484
53790
  ["SA-17"]={Range=50,Blindspot=3,Height=30,Type="Medium",Radar="SA-17"},
53485
53791
  ["SA-20A"]={Range=150,Blindspot=5,Height=27,Type="Long",Radar="S-300PMU1"},
@@ -53500,59 +53806,61 @@ MANTIS.SamDataHDS={
53500
53806
  ["HQ-2 HDS"]={Range=50,Blindspot=6,Height=35,Type="Medium",Radar="HQ_2_Guideline_LN"},
53501
53807
  }
53502
53808
  MANTIS.SamDataSMA={
53503
- ["RBS98M SMA"]={Range=20,Blindspot=0,Height=8,Type="Short",Radar="RBS-98"},
53504
- ["RBS70 SMA"]={Range=8,Blindspot=0,Height=5.5,Type="Short",Radar="RBS-70"},
53505
- ["RBS70M SMA"]={Range=8,Blindspot=0,Height=5.5,Type="Short",Radar="BV410_RBS70"},
53506
- ["RBS90 SMA"]={Range=8,Blindspot=0,Height=5.5,Type="Short",Radar="RBS-90"},
53507
- ["RBS90M SMA"]={Range=8,Blindspot=0,Height=5.5,Type="Short",Radar="BV410_RBS90"},
53508
- ["RBS103A SMA"]={Range=150,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_Rb103A"},
53509
- ["RBS103B SMA"]={Range=35,Blindspot=0,Height=36,Type="Medium",Radar="LvS-103_Lavett103_Rb103B"},
53510
- ["RBS103AM SMA"]={Range=150,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_HX_Rb103A"},
53511
- ["RBS103BM SMA"]={Range=35,Blindspot=0,Height=36,Type="Medium",Radar="LvS-103_Lavett103_HX_Rb103B"},
53512
- ["Lvkv9040M SMA"]={Range=4,Blindspot=0,Height=2.5,Type="Point",Radar="LvKv9040",Point="true"},
53809
+ ["RBS98M SMA"]={Range=20,Blindspot=0.2,Height=8,Type="Short",Radar="RBS-98"},
53810
+ ["RBS70 SMA"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="RBS-70"},
53811
+ ["RBS70M SMA"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="BV410_RBS70"},
53812
+ ["RBS90 SMA"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="RBS-90"},
53813
+ ["RBS90M SMA"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="BV410_RBS90"},
53814
+ ["RBS103A SMA"]={Range=160,Blindspot=1,Height=36,Type="Long",Radar="LvS-103_Lavett103_Rb103A"},
53815
+ ["RBS103B SMA"]={Range=120,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_Rb103B"},
53816
+ ["RBS103AM SMA"]={Range=160,Blindspot=1,Height=36,Type="Long",Radar="LvS-103_Lavett103_HX_Rb103A"},
53817
+ ["RBS103BM SMA"]={Range=120,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_HX_Rb103B"},
53818
+ ["Lvkv9040M SMA"]={Range=2,Blindspot=0.1,Height=1.2,Type="Point",Radar="LvKv9040",Point="true"},
53513
53819
  }
53514
53820
  MANTIS.SamDataCH={
53515
- ["2S38 CHM"]={Range=8,Blindspot=0.5,Height=6,Type="Short",Radar="2S38"},
53821
+ ["2S38 CHM"]={Range=6,Blindspot=0.1,Height=4.5,Type="Short",Radar="2S38"},
53516
53822
  ["PantsirS1 CHM"]={Range=20,Blindspot=1.2,Height=15,Type="Short",Radar="PantsirS1"},
53517
53823
  ["PantsirS2 CHM"]={Range=30,Blindspot=1.2,Height=18,Type="Medium",Radar="PantsirS2"},
53518
- ["PGL-625 CHM"]={Range=10,Blindspot=0.5,Height=5,Type="Short",Radar="PGL_625"},
53519
- ["HQ-17A CHM"]={Range=20,Blindspot=1.5,Height=10,Type="Short",Radar="HQ17A"},
53520
- ["M903PAC2 CHM"]={Range=160,Blindspot=3,Height=24.5,Type="Long",Radar="MIM104_M903_PAC2"},
53521
- ["M903PAC3 CHM"]={Range=120,Blindspot=1,Height=40,Type="Long",Radar="MIM104_M903_PAC3"},
53824
+ ["PGL-625 CHM"]={Range=10,Blindspot=1,Height=5,Type="Short",Radar="PGL_625"},
53825
+ ["HQ-17A CHM"]={Range=15,Blindspot=1.5,Height=10,Type="Short",Radar="HQ17A"},
53826
+ ["M903PAC2 CHM"]={Range=120,Blindspot=3,Height=24.5,Type="Long",Radar="MIM104_M903_PAC2"},
53827
+ ["M903PAC3 CHM"]={Range=160,Blindspot=1,Height=40,Type="Long",Radar="MIM104_M903_PAC3"},
53522
53828
  ["TorM2 CHM"]={Range=12,Blindspot=1,Height=10,Type="Short",Radar="TorM2"},
53523
53829
  ["TorM2K CHM"]={Range=12,Blindspot=1,Height=10,Type="Short",Radar="TorM2K"},
53524
53830
  ["TorM2M CHM"]={Range=16,Blindspot=1,Height=10,Type="Short",Radar="TorM2M"},
53525
53831
  ["NASAMS3-AMRAAMER CHM"]={Range=50,Blindspot=2,Height=35.7,Type="Medium",Radar="CH_NASAMS3_LN_AMRAAM_ER"},
53526
53832
  ["NASAMS3-AIM9X2 CHM"]={Range=20,Blindspot=0.2,Height=18,Type="Short",Radar="CH_NASAMS3_LN_AIM9X2"},
53527
53833
  ["C-RAM CHM"]={Range=2,Blindspot=0,Height=2,Type="Point",Radar="CH_Centurion_C_RAM",Point="true"},
53528
- ["PGZ-09 CHM"]={Range=4,Blindspot=0,Height=3,Type="Point",Radar="CH_PGZ09",Point="true"},
53529
- ["S350-9M100 CHM"]={Range=15,Blindspot=1.5,Height=8,Type="Short",Radar="CH_S350_50P6_9M100"},
53834
+ ["PGZ-09 CHM"]={Range=4,Blindspot=0.5,Height=3,Type="Point",Radar="CH_PGZ09",Point="true"},
53835
+ ["S350-9M100 CHM"]={Range=15,Blindspot=1,Height=8,Type="Short",Radar="CH_S350_50P6_9M100"},
53530
53836
  ["S350-9M96D CHM"]={Range=150,Blindspot=2.5,Height=30,Type="Long",Radar="CH_S350_50P6_9M96D"},
53531
- ["LAV-AD CHM"]={Range=8,Blindspot=0.2,Height=4.8,Type="Short",Radar="CH_LAVAD"},
53837
+ ["LAV-AD CHM"]={Range=8,Blindspot=0.16,Height=4.8,Type="Short",Radar="CH_LAVAD"},
53532
53838
  ["HQ-22 CHM"]={Range=170,Blindspot=5,Height=27,Type="Long",Radar="CH_HQ22_LN"},
53533
- ["PGZ-95 CHM"]={Range=2,Blindspot=0,Height=2,Type="Point",Radar="CH_PGZ95",Point="true"},
53534
- ["LD-3000 CHM"]={Range=3,Blindspot=0,Height=3,Type="Point",Radar="CH_LD3000_stationary",Point="true"},
53535
- ["LD-3000M CHM"]={Range=3,Blindspot=0,Height=3,Type="Point",Radar="CH_LD3000",Point="true"},
53536
- ["FlaRakRad CHM"]={Range=8,Blindspot=1.5,Height=6,Type="Short",Radar="HQ17A"},
53839
+ ["PGZ-95 CHM"]={Range=2.5,Blindspot=0.5,Height=2,Type="Point",Radar="CH_PGZ95",Point="true"},
53840
+ ["LD-3000 CHM"]={Range=2.5,Blindspot=0.1,Height=3,Type="Point",Radar="CH_LD3000_stationary",Point="true"},
53841
+ ["LD-3000M CHM"]={Range=2.5,Blindspot=0.1,Height=3,Type="Point",Radar="CH_LD3000",Point="true"},
53842
+ ["FlaRakRad CHM"]={Range=8,Blindspot=1.5,Height=6,Type="Short",Radar="CH_FlaRakRad"},
53537
53843
  ["IRIS-T SLM CHM"]={Range=40,Blindspot=0.5,Height=20,Type="Medium",Radar="CH_IRIST_SLM"},
53538
- ["M903PAC2KAT1 CHM"]={Range=160,Blindspot=3,Height=24.5,Type="Long",Radar="CH_MIM104_M903_PAC2_KAT1"},
53539
- ["Skynex CHM"]={Range=3.5,Blindspot=0,Height=3.5,Type="Point",Radar="CH_SkynexHX",Point="true"},
53540
- ["Skyshield CHM"]={Range=3.5,Blindspot=0,Height=3.5,Type="Point",Radar="CH_Skyshield_Gun",Point="true"},
53541
- ["WieselOzelot CHM"]={Range=8,Blindspot=0.2,Height=4.8,Type="Short",Radar="CH_Wiesel2Ozelot"},
53844
+ ["M903PAC2KAT1 CHM"]={Range=120,Blindspot=3,Height=24.5,Type="Long",Radar="CH_MIM104_M903_PAC2_KAT1"},
53845
+ ["Skynex CHM"]={Range=3.5,Blindspot=0.1,Height=3.5,Type="Point",Radar="CH_SkynexHX",Point="true"},
53846
+ ["Skyshield CHM"]={Range=3.5,Blindspot=0.1,Height=3.5,Type="Point",Radar="CH_Skyshield_Gun",Point="true"},
53847
+ ["WieselOzelot CHM"]={Range=8,Blindspot=0.16,Height=4.8,Type="Short",Radar="CH_Wiesel2Ozelot"},
53542
53848
  ["BukM3-9M317M CHM"]={Range=70,Blindspot=0.25,Height=35,Type="Medium",Radar="CH_BukM3_9A317M"},
53543
53849
  ["BukM3-9M317MA CHM"]={Range=70,Blindspot=0.25,Height=35,Type="Medium",Radar="CH_BukM3_9A317MA"},
53544
53850
  ["SkySabre CHM"]={Range=30,Blindspot=0.5,Height=10,Type="Medium",Radar="CH_SkySabreLN"},
53545
53851
  ["Stormer CHM"]={Range=7.5,Blindspot=0.3,Height=7,Type="Short",Radar="CH_StormerHVM"},
53546
53852
  ["THAAD CHM"]={Range=200,Blindspot=40,Height=150,Type="Long",Radar="CH_THAAD_M1120"},
53547
- ["USInfantryFIM92K CHM"]={Range=8,Blindspot=0.2,Height=4.8,Type="Short",Radar="CH_USInfantry_FIM92"},
53548
- ["RBS98M CHM"]={Range=20,Blindspot=0,Height=8,Type="Short",Radar="RBS-98"},
53549
- ["RBS70 CHM"]={Range=8,Blindspot=0,Height=5.5,Type="Short",Radar="RBS-70"},
53550
- ["RBS90 CHM"]={Range=8,Blindspot=0,Height=5.5,Type="Short",Radar="RBS-90"},
53551
- ["RBS103A CHM"]={Range=150,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_Rb103A"},
53552
- ["RBS103B CHM"]={Range=35,Blindspot=0,Height=36,Type="Medium",Radar="LvS-103_Lavett103_Rb103B"},
53553
- ["RBS103AM CHM"]={Range=150,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_HX_Rb103A"},
53554
- ["RBS103BM CHM"]={Range=35,Blindspot=0,Height=36,Type="Medium",Radar="LvS-103_Lavett103_HX_Rb103B"},
53555
- ["Lvkv9040M CHM"]={Range=4,Blindspot=0,Height=2.5,Type="Point",Radar="LvKv9040",Point="true"},
53853
+ ["USInfantryFIM92K CHM"]={Range=8,Blindspot=0.16,Height=4.8,Type="Short",Radar="CH_USInfantry_FIM92"},
53854
+ ["RBS98M CHM"]={Range=20,Blindspot=0.2,Height=8,Type="Short",Radar="RBS-98"},
53855
+ ["RBS70 CHM"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="RBS-70"},
53856
+ ["RBS70M CHM"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="BV410_RBS70"},
53857
+ ["RBS90 CHM"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="RBS-90"},
53858
+ ["RBS90M CHM"]={Range=8,Blindspot=0.25,Height=6,Type="Short",Radar="BV410_RBS90"},
53859
+ ["RBS103A CHM"]={Range=160,Blindspot=1,Height=36,Type="Long",Radar="LvS-103_Lavett103_Rb103A"},
53860
+ ["RBS103B CHM"]={Range=120,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_Rb103B"},
53861
+ ["RBS103AM CHM"]={Range=160,Blindspot=1,Height=36,Type="Long",Radar="LvS-103_Lavett103_HX_Rb103A"},
53862
+ ["RBS103BM CHM"]={Range=120,Blindspot=3,Height=24.5,Type="Long",Radar="LvS-103_Lavett103_HX_Rb103B"},
53863
+ ["Lvkv9040M CHM"]={Range=2,Blindspot=0.1,Height=1.2,Type="Point",Radar="LvKv9040",Point="true"},
53556
53864
  }
53557
53865
  do
53558
53866
  function MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic,awacs,EmOnOff,Padding,Zones)
@@ -53620,6 +53928,7 @@ self.advAwacs=true
53620
53928
  else
53621
53929
  self.advAwacs=false
53622
53930
  end
53931
+ self:SetDLinkCacheTime()
53623
53932
  self.lid=string.format("MANTIS %s | ",self.name)
53624
53933
  if self.debug then
53625
53934
  BASE:TraceOnOff(true)
@@ -53642,6 +53951,7 @@ end
53642
53951
  if self.advAwacs then
53643
53952
  table.insert(self.ewr_templates,awacs)
53644
53953
  end
53954
+ self.logsamstatus=false
53645
53955
  self:T({self.ewr_templates})
53646
53956
  self.SAM_Group=SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition)
53647
53957
  self.EWR_Group=SET_GROUP:New():FilterPrefixes(self.ewr_templates):FilterCoalitions(self.Coalition)
@@ -53659,7 +53969,7 @@ if self.HQ_Template_CC then
53659
53969
  self.HQ_CC=GROUP:FindByName(self.HQ_Template_CC)
53660
53970
  end
53661
53971
  self.checkcounter=1
53662
- self.version="0.9.27"
53972
+ self.version="0.9.30"
53663
53973
  self:I(string.format("***** Starting MANTIS Version %s *****",self.version))
53664
53974
  self:SetStartState("Stopped")
53665
53975
  self:AddTransition("Stopped","Start","Running")
@@ -53804,6 +54114,11 @@ end
53804
54114
  end
53805
54115
  return self
53806
54116
  end
54117
+ function MANTIS:SetDLinkCacheTime(seconds)
54118
+ self.DLinkCacheTime=math.abs(seconds or 120)
54119
+ if self.DLinkCacheTime<5 then self.DLinkCacheTime=5 end
54120
+ return self
54121
+ end
53807
54122
  function MANTIS:SetDetectInterval(interval)
53808
54123
  self:T(self.lid.."SetDetectInterval")
53809
54124
  local interval=interval or 30
@@ -54073,7 +54388,8 @@ local IntelOne=INTEL:New(groupset,self.Coalition,self.name.." IntelOne")
54073
54388
  IntelOne:Start()
54074
54389
  local IntelTwo=INTEL:New(samset,self.Coalition,self.name.." IntelTwo")
54075
54390
  IntelTwo:Start()
54076
- local IntelDlink=INTEL_DLINK:New({IntelOne,IntelTwo},self.name.." DLINK",22,300)
54391
+ local CacheTime=self.DLinkCacheTime or 120
54392
+ local IntelDlink=INTEL_DLINK:New({IntelOne,IntelTwo},self.name.." DLINK",22,CacheTime)
54077
54393
  IntelDlink:__Start(1)
54078
54394
  self:SetUsingDLink(IntelDlink)
54079
54395
  table.insert(self.intelset,IntelOne)
@@ -54276,7 +54592,7 @@ if group:IsGround()and group:IsAlive()then
54276
54592
  local grpname=group:GetName()
54277
54593
  local grpcoord=group:GetCoordinate()
54278
54594
  local grprange,grpheight,type,blind=self:_GetSAMRange(grpname)
54279
- local radaralive=group:IsSAM()
54595
+ local radaralive=true
54280
54596
  table.insert(SAM_Tbl,{grpname,grpcoord,grprange,grpheight,blind,type})
54281
54597
  table.insert(SEAD_Grps,grpname)
54282
54598
  if type==MANTIS.SamType.LONG and radaralive then
@@ -54406,7 +54722,7 @@ end
54406
54722
  end
54407
54723
  end
54408
54724
  end
54409
- if self.debug or self.verbose then
54725
+ if self.debug or self.verbose or self.logsamstatus then
54410
54726
  for _,_status in pairs(self.SamStateTracker)do
54411
54727
  if _status=="GREEN"then
54412
54728
  instatusgreen=instatusgreen+1
@@ -54422,7 +54738,7 @@ end
54422
54738
  end
54423
54739
  return instatusred,instatusgreen,activeshorads
54424
54740
  end
54425
- function MANTIS:_Check(detection,dlink)
54741
+ function MANTIS:_Check(detection,dlink,reporttolog)
54426
54742
  self:T(self.lid.."Check")
54427
54743
  local detset=detection:GetDetectedItemCoordinates()
54428
54744
  if self.checkcounter%3==0 then
@@ -54445,7 +54761,7 @@ else
54445
54761
  local samset=self:_GetSAMTable()
54446
54762
  instatusred,instatusgreen,activeshorads=self:_CheckLoop(samset,detset,dlink,self.maxclassic)
54447
54763
  end
54448
- if self.debug or self.verbose then
54764
+ local function GetReport()
54449
54765
  local statusreport=REPORT:New("\nMANTIS Status "..self.name)
54450
54766
  statusreport:Add("+-----------------------------+")
54451
54767
  statusreport:Add(string.format("+ SAM in RED State: %2d",instatusred))
@@ -54454,7 +54770,14 @@ if self.Shorad then
54454
54770
  statusreport:Add(string.format("+ SHORAD active: %2d",activeshorads))
54455
54771
  end
54456
54772
  statusreport:Add("+-----------------------------+")
54773
+ return statusreport
54774
+ end
54775
+ if self.debug or self.verbose then
54776
+ local statusreport=GetReport()
54457
54777
  MESSAGE:New(statusreport:Text(),10):ToAll():ToLog()
54778
+ elseif reporttolog==true then
54779
+ local statusreport=GetReport()
54780
+ MESSAGE:New(statusreport:Text(),10):ToLog()
54458
54781
  end
54459
54782
  return self
54460
54783
  end
@@ -54525,7 +54848,7 @@ end
54525
54848
  function MANTIS:onbeforeStatus(From,Event,To)
54526
54849
  self:T({From,Event,To})
54527
54850
  if not self.state2flag then
54528
- self:_Check(self.Detection,self.DLink)
54851
+ self:_Check(self.Detection,self.DLink,self.logsamstatus)
54529
54852
  end
54530
54853
  local EWRAlive=self:_CheckAnyEWRAlive()
54531
54854
  local function FindSAMSRTR()
@@ -55792,6 +56115,7 @@ self:SetBeaconRefresh()
55792
56115
  self:SetMaxLandingPattern()
55793
56116
  self:SetMaxMarshalStacks()
55794
56117
  self:SetMaxSectionSize()
56118
+ self:SetMaxSectionDistance()
55795
56119
  self:SetMaxFlightsPerStack()
55796
56120
  self:SetHandleAION()
55797
56121
  self:SetExtraVoiceOvers(false)
@@ -56421,6 +56745,17 @@ nmax=math.min(nmax,4)
56421
56745
  self.NmaxSection=nmax-1
56422
56746
  return self
56423
56747
  end
56748
+ function AIRBOSS:SetMaxSectionDistance(dmax)
56749
+ if dmax then
56750
+ if dmax<10 then
56751
+ dmax=10
56752
+ elseif dmax>5000 then
56753
+ dmax=5000
56754
+ end
56755
+ end
56756
+ self.maxsectiondistance=dmax or 100
56757
+ return self
56758
+ end
56424
56759
  function AIRBOSS:SetMaxFlightsPerStack(nmax)
56425
56760
  nmax=nmax or 2
56426
56761
  nmax=math.max(nmax,1)
@@ -63280,7 +63615,7 @@ if _unit and _playername then
63280
63615
  local playerData=self.players[_playername]
63281
63616
  if playerData then
63282
63617
  local mycoord=_unit:GetCoordinate()
63283
- local dmax=100
63618
+ local dmax=self.maxsectiondistance
63284
63619
  local text
63285
63620
  if self.NmaxSection==0 then
63286
63621
  text=string.format("negative, setting sections is disabled in this mission. You stay alone.")
@@ -65335,7 +65670,8 @@ Falklands=12,
65335
65670
  SinaiMap=5,
65336
65671
  Kola=15,
65337
65672
  Afghanistan=3,
65338
- Iraq=4.4
65673
+ Iraq=4.4,
65674
+ GermanyCW=0.1,
65339
65675
  }
65340
65676
  ATIS.ICAOPhraseology={
65341
65677
  Caucasus=true,
@@ -65350,6 +65686,7 @@ SinaiMap=true,
65350
65686
  Kola=true,
65351
65687
  Afghanistan=true,
65352
65688
  Iraq=true,
65689
+ GermanyCW=true,
65353
65690
  }
65354
65691
  ATIS.Sound={
65355
65692
  ActiveRunway={filename="ActiveRunway.ogg",duration=0.85},
@@ -66758,7 +67095,6 @@ end
66758
67095
  end
66759
67096
  end
66760
67097
  _RUNACT=subtitle
66761
- alltext=alltext..";\n"..subtitle
66762
67098
  if self.rwylength then
66763
67099
  local runact=self.airbase:GetActiveRunway(self.runwaym2t)
66764
67100
  local length=runact.length
@@ -67531,6 +67867,7 @@ TroopUnloadDistHover=1.5,
67531
67867
  UserSetGroup=nil,
67532
67868
  LoadedGroupsTable={},
67533
67869
  keeploadtable=true,
67870
+ allowCATransport=false,
67534
67871
  }
67535
67872
  CTLD.RadioModulation={
67536
67873
  AM=0,
@@ -67565,13 +67902,14 @@ CTLD.UnitTypeCapabilities={
67565
67902
  ["OH58D"]={type="OH58D",crates=false,troops=false,cratelimit=0,trooplimit=0,length=14,cargoweightlimit=400},
67566
67903
  ["CH-47Fbl1"]={type="CH-47Fbl1",crates=true,troops=true,cratelimit=4,trooplimit=31,length=20,cargoweightlimit=10800},
67567
67904
  ["MosquitoFBMkVI"]={type="MosquitoFBMkVI",crates=true,troops=false,cratelimit=2,trooplimit=0,length=13,cargoweightlimit=1800},
67905
+ ["M 818"]={type="M 818",crates=true,troops=true,cratelimit=4,trooplimit=12,length=9,cargoweightlimit=4500},
67568
67906
  }
67569
67907
  CTLD.FixedWingTypes={
67570
67908
  ["Hercules"]="Hercules",
67571
67909
  ["Bronco"]="Bronco",
67572
67910
  ["Mosquito"]="Mosquito",
67573
67911
  }
67574
- CTLD.version="1.1.31"
67912
+ CTLD.version="1.3.34"
67575
67913
  function CTLD:New(Coalition,Prefixes,Alias)
67576
67914
  local self=BASE:Inherit(self,FSM:New())
67577
67915
  BASE:T({Coalition,Prefixes,Alias})
@@ -67697,6 +68035,7 @@ self.usesubcats=false
67697
68035
  self.subcats={}
67698
68036
  self.subcatsTroop={}
67699
68037
  self.showstockinmenuitems=false
68038
+ self.onestepmenu=false
67700
68039
  self.nobuildinloadzones=true
67701
68040
  self.movecratesbeforebuild=true
67702
68041
  self.surfacetypes={land.SurfaceType.LAND,land.SurfaceType.ROAD,land.SurfaceType.RUNWAY,land.SurfaceType.SHALLOW_WATER}
@@ -67713,6 +68052,8 @@ self.FlareColor=FLARECOLOR.Red
67713
68052
  for i=1,100 do
67714
68053
  math.random()
67715
68054
  end
68055
+ self.allowCATransport=false
68056
+ self.CATransportSet=nil
67716
68057
  self:_GenerateVHFrequencies()
67717
68058
  self:_GenerateUHFrequencies()
67718
68059
  self:_GenerateFMFrequencies()
@@ -67735,6 +68076,11 @@ capabilities.cargoweightlimit=0
67735
68076
  end
67736
68077
  return capabilities
67737
68078
  end
68079
+ function CTLD:AllowCATransport(OnOff,ClientSet)
68080
+ self.allowCATransport=OnOff
68081
+ self.CATransportSet=ClientSet
68082
+ return self
68083
+ end
67738
68084
  function CTLD:_GenerateUHFrequencies()
67739
68085
  self:T(self.lid.." _GenerateUHFrequencies")
67740
68086
  self.FreeUHFFrequencies={}
@@ -67791,6 +68137,11 @@ local unitname=event.IniUnitName or"none"
67791
68137
  self.Loaded_Cargo[unitname]=nil
67792
68138
  self:_RefreshF10Menus()
67793
68139
  end
68140
+ if _unit:IsGround()and self.allowCATransport then
68141
+ local unitname=event.IniUnitName or"none"
68142
+ self.Loaded_Cargo[unitname]=nil
68143
+ self:_RefreshF10Menus()
68144
+ end
67794
68145
  return
67795
68146
  elseif event.id==EVENTS.Land or event.id==EVENTS.Takeoff then
67796
68147
  local unitname=event.IniUnitName
@@ -68330,6 +68681,7 @@ return self
68330
68681
  end
68331
68682
  local IsHerc=self:IsFixedWing(Unit)
68332
68683
  local IsHook=self:IsHook(Unit)
68684
+ local IsTruck=Unit:IsGround()
68333
68685
  local cargotype=Cargo
68334
68686
  local number=number or cargotype:GetCratesNeeded()
68335
68687
  local cratesneeded=cargotype:GetCratesNeeded()
@@ -68350,7 +68702,7 @@ local cratedistance=0
68350
68702
  local rheading=0
68351
68703
  local angleOffNose=0
68352
68704
  local addon=0
68353
- if IsHerc or IsHook then
68705
+ if IsHerc or IsHook or IsTruck then
68354
68706
  addon=180
68355
68707
  end
68356
68708
  heading=(heading+addon)%360
@@ -68456,8 +68808,9 @@ local text=string.format("Crates for %s have been positioned near you!",cratenam
68456
68808
  if drop then
68457
68809
  text=string.format("Crates for %s have been dropped!",cratename)
68458
68810
  self:__CratesDropped(1,Group,Unit,droppedcargo)
68459
- end
68811
+ else
68460
68812
  self:_SendMessage(text,10,false,Group)
68813
+ end
68461
68814
  self:_RefreshLoadCratesMenu(Group,Unit)
68462
68815
  return self
68463
68816
  end
@@ -68624,20 +68977,24 @@ local IsHook=self:IsHook(_unit)
68624
68977
  if not _ignoreweight then
68625
68978
  maxloadable=self:_GetMaxLoadableMass(_unit)
68626
68979
  end
68627
- self:T2(self.lid.." Max loadable mass: "..maxloadable)
68980
+ self:T(self.lid.." Max loadable mass: "..maxloadable)
68628
68981
  for _,_cargoobject in pairs(existingcrates)do
68629
68982
  local cargo=_cargoobject
68630
68983
  local static=cargo:GetPositionable()
68631
68984
  local weight=cargo:GetMass()
68632
68985
  local staticid=cargo:GetID()
68633
- self:T2(self.lid.." Found cargo mass: "..weight)
68986
+ self:T(self.lid.." Found cargo mass: "..weight)
68634
68987
  if static and static:IsAlive()then
68635
68988
  local restricthooktononstatics=self.enableChinookGCLoading and IsHook
68989
+ self:T(self.lid.." restricthooktononstatics: "..tostring(restricthooktononstatics))
68636
68990
  local cargoisstatic=cargo:GetType()==CTLD_CARGO.Enum.STATIC and true or false
68991
+ self:T(self.lid.." Cargo is static: "..tostring(cargoisstatic))
68637
68992
  local restricted=cargoisstatic and restricthooktononstatics
68993
+ self:T(self.lid.." Loading restricted: "..tostring(restricted))
68638
68994
  local staticpos=static:GetCoordinate()
68639
68995
  local cando=cargo:UnitCanCarry(_unit)
68640
68996
  if ignoretype==true then cando=true end
68997
+ self:T(self.lid.." Unit can carry: "..tostring(cando))
68641
68998
  local distance=self:_GetDistance(location,staticpos)
68642
68999
  self:T(self.lid..string.format("Dist %dm/%dm | weight %dkg | maxloadable %dkg",distance,finddist,weight,maxloadable))
68643
69000
  if distance<=finddist and(weight<=maxloadable or _ignoreweight)and restricted==false and cando==true then
@@ -68967,14 +69324,17 @@ end
68967
69324
  function CTLD:IsFixedWing(Unit)
68968
69325
  local typename=Unit:GetTypeName()or"none"
68969
69326
  for _,_name in pairs(self.FixedWingTypes or{})do
68970
- if typename==_name or string.find(typename,_name,1,true)then
69327
+ if _name and(typename==_name or string.find(typename,_name,1,true))then
68971
69328
  return true
68972
69329
  end
68973
69330
  end
68974
69331
  return false
68975
69332
  end
68976
69333
  function CTLD:IsHook(Unit)
68977
- if Unit and string.find(Unit:GetTypeName(),"CH.47")then
69334
+ if not Unit then return false end
69335
+ local typeName=Unit:GetTypeName()
69336
+ if not typeName then return false end
69337
+ if string.find(typeName,"CH.47")then
68978
69338
  return true
68979
69339
  else
68980
69340
  return false
@@ -69152,6 +69512,8 @@ local unitname=Unit:GetName()
69152
69512
  if self.Loaded_Cargo[unitname]and(grounded or hoverunload)then
69153
69513
  local loadedcargo=self.Loaded_Cargo[unitname]or{}
69154
69514
  local cargotable=loadedcargo.Cargo
69515
+ local droppedCount={}
69516
+ local neededMap={}
69155
69517
  for _,_cargo in pairs(cargotable)do
69156
69518
  local cargo=_cargo
69157
69519
  local type=cargo:GetType()
@@ -69159,6 +69521,27 @@ if type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS and type~=CT
69159
69521
  self:_GetCrates(Group,Unit,cargo,1,true)
69160
69522
  cargo:SetWasDropped(true)
69161
69523
  cargo:SetHasMoved(true)
69524
+ local cname=cargo:GetName()or"Unknown"
69525
+ droppedCount[cname]=(droppedCount[cname]or 0)+1
69526
+ if not neededMap[cname]then
69527
+ neededMap[cname]=cargo:GetCratesNeeded()or 1
69528
+ end
69529
+ end
69530
+ end
69531
+ for cname,count in pairs(droppedCount)do
69532
+ local needed=neededMap[cname]or 1
69533
+ if needed>1 then
69534
+ local full=math.floor(count/needed)
69535
+ local left=count%needed
69536
+ if full>0 and left==0 then
69537
+ self:_SendMessage(string.format("Dropped %d %s.",full,cname),10,false,Group)
69538
+ elseif full>0 and left>0 then
69539
+ self:_SendMessage(string.format("Dropped %d %s(s), with %d leftover crate(s).",full,cname,left),10,false,Group)
69540
+ else
69541
+ self:_SendMessage(string.format("Dropped %d/%d crate(s) of %s.",count,needed,cname),15,false,Group)
69542
+ end
69543
+ else
69544
+ self:_SendMessage(string.format("Dropped %d %s(s).",count,cname),10,false,Group)
69162
69545
  end
69163
69546
  end
69164
69547
  local loaded={}
@@ -69191,7 +69574,7 @@ end
69191
69574
  end
69192
69575
  return self
69193
69576
  end
69194
- function CTLD:_BuildCrates(Group,Unit,Engineering)
69577
+ function CTLD:_BuildCrates(Group,Unit,Engineering,MultiDrop)
69195
69578
  self:T(self.lid.." _BuildCrates")
69196
69579
  if self:IsFixedWing(Unit)and self.enableFixedWing and not Engineering then
69197
69580
  local speed=Unit:GetVelocityKMH()
@@ -69276,12 +69659,13 @@ local build=_build
69276
69659
  if build.CanBuild then
69277
69660
  self:_CleanUpCrates(crates,build,number)
69278
69661
  if self.buildtime and self.buildtime>0 then
69279
- local buildtimer=TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,build,false,Group:GetCoordinate())
69662
+ local buildtimer=TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,build,false,Group:GetCoordinate(),MultiDrop)
69280
69663
  buildtimer:Start(self.buildtime)
69281
69664
  self:_SendMessage(string.format("Build started, ready in %d seconds!",self.buildtime),15,false,Group)
69282
69665
  self:__CratesBuildStarted(1,Group,Unit)
69666
+ self:_RefreshDropTroopsMenu(Group,Unit)
69283
69667
  else
69284
- self:_BuildObjectFromCrates(Group,Unit,build)
69668
+ self:_BuildObjectFromCrates(Group,Unit,build,false,nil,MultiDrop)
69285
69669
  end
69286
69670
  end
69287
69671
  end
@@ -69303,13 +69687,14 @@ if(_entry.Templates[1]==_Template.GroupName)then
69303
69687
  _Group:Destroy()
69304
69688
  self:_GetCrates(Group,Unit,_entry,nil,false,true)
69305
69689
  self:_RefreshLoadCratesMenu(Group,Unit)
69306
- return self
69690
+ return true
69307
69691
  end
69308
69692
  end
69309
69693
  end
69310
69694
  end
69311
69695
  end
69312
- return self
69696
+ self:_SendMessage("Nothing to pack at this distance pilot!",10,false,Group)
69697
+ return false
69313
69698
  end
69314
69699
  function CTLD:_RepairCrates(Group,Unit,Engineering)
69315
69700
  self:T(self.lid.." _RepairCrates")
@@ -69382,7 +69767,7 @@ if not Engineering then self:_SendMessage(string.format("No crates within %d met
69382
69767
  end
69383
69768
  return self
69384
69769
  end
69385
- function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation)
69770
+ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation,MultiDrop)
69386
69771
  self:T(self.lid.." _BuildObjectFromCrates")
69387
69772
  if Group and Group:IsAlive()or(RepairLocation and not Repair)then
69388
69773
  local name=Build.Name
@@ -69403,6 +69788,9 @@ else
69403
69788
  zone=ZONE_GROUP:New(string.format("Unload zone-%d",math.random(1,10000)),Group,100)
69404
69789
  end
69405
69790
  local randomcoord=Build.Coord or zone:GetRandomCoordinate(35):GetVec2()
69791
+ if MultiDrop and(not Repair)and canmove then
69792
+ local randomcoord=zone:GetRandomCoordinate(35):GetVec2()
69793
+ end
69406
69794
  if Repair then
69407
69795
  randomcoord=RepairLocation:GetVec2()
69408
69796
  end
@@ -69436,6 +69824,7 @@ self:T(self.lid.." _MoveGroupToZone")
69436
69824
  local groupname=Group:GetName()or"none"
69437
69825
  local groupcoord=Group:GetCoordinate()
69438
69826
  local outcome,name,zone,distance=self:IsUnitInZone(Group,CTLD.CargoZoneType.MOVE)
69827
+ self:T({canmove=outcome,name=name,zone=zone,dist=distance,max=self.movetroopsdistance})
69439
69828
  if(distance<=self.movetroopsdistance)and outcome==true and zone~=nil then
69440
69829
  local groupname=Group:GetName()
69441
69830
  local zonecoord=zone:GetRandomCoordinate(20,125)
@@ -69474,8 +69863,62 @@ end
69474
69863
  self:_CleanupTrackedCrates(destIDs)
69475
69864
  return self
69476
69865
  end
69866
+ function CTLD:_DropAndBuild(Group,Unit)
69867
+ if self.nobuildinloadzones then
69868
+ if self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)then
69869
+ self:_SendMessage("You cannot build in a loading area, Pilot!",10,false,Group)
69870
+ return self
69871
+ end
69872
+ end
69873
+ self:_UnloadCrates(Group,Unit)
69874
+ timer.scheduleFunction(function()self:_BuildCrates(Group,Unit,false,true)end,{},timer.getTime()+1)
69875
+ end
69876
+ function CTLD:_DropSingleAndBuild(Group,Unit,setIndex)
69877
+ if self.nobuildinloadzones then
69878
+ if self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)then
69879
+ self:_SendMessage("You cannot build in a loading area, Pilot!",10,false,Group)
69880
+ return self
69881
+ end
69882
+ end
69883
+ self:_UnloadSingleCrateSet(Group,Unit,setIndex)
69884
+ timer.scheduleFunction(function()self:_BuildCrates(Group,Unit,false)end,{},timer.getTime()+1)
69885
+ end
69886
+ function CTLD:_PackAndLoad(Group,Unit)
69887
+ if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName())then
69888
+ self:_SendMessage("You need to open the door(s) to load cargo!",10,false,Group)
69889
+ return self
69890
+ end
69891
+ if not self:_PackCratesNearby(Group,Unit)then
69892
+ return self
69893
+ end
69894
+ timer.scheduleFunction(function()self:_LoadCratesNearby(Group,Unit)end,{},timer.getTime()+1)
69895
+ return self
69896
+ end
69897
+ function CTLD:_PackAndRemove(Group,Unit)
69898
+ if not self:_PackCratesNearby(Group,Unit)then
69899
+ return self
69900
+ end
69901
+ timer.scheduleFunction(function()self:_RemoveCratesNearby(Group,Unit)end,{},timer.getTime()+1)
69902
+ return self
69903
+ end
69904
+ function CTLD:_GetAndLoad(Group,Unit,cargoObj)
69905
+ if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName())then
69906
+ self:_SendMessage("You need to open the door(s) to load cargo!",10,false,Group)
69907
+ return self
69908
+ end
69909
+ self:_GetCrates(Group,Unit,cargoObj)
69910
+ timer.scheduleFunction(function()self:_LoadSingleCrateSet(Group,Unit,cargoObj.Name)end,{},timer.getTime()+1)
69911
+ end
69912
+ function CTLD:_GetAllAndLoad(Group,Unit)
69913
+ if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName())then
69914
+ self:_SendMessage("You need to open the door(s) to load cargo!",10,false,Group)
69915
+ return self
69916
+ end
69917
+ timer.scheduleFunction(function()self:_LoadCratesNearby(Group,Unit)end,{},timer.getTime()+1)
69918
+ end
69477
69919
  function CTLD:_RefreshF10Menus()
69478
69920
  self:T(self.lid.." _RefreshF10Menus")
69921
+ self.onestepmenu=self.onestepmenu or false
69479
69922
  local PlayerSet=self.PilotGroups
69480
69923
  local PlayerTable=PlayerSet:GetSetObjects()
69481
69924
  local _UnitList={}
@@ -69490,6 +69933,16 @@ end
69490
69933
  end
69491
69934
  end
69492
69935
  end
69936
+ if self.allowCATransport and self.CATransportSet then
69937
+ for _,_clientobj in pairs(self.CATransportSet.Set)do
69938
+ local client=_clientobj
69939
+ if client:IsGround()then
69940
+ local cname=client:GetName()
69941
+ self:T(self.lid.."Adding: "..cname)
69942
+ _UnitList[cname]=cname
69943
+ end
69944
+ end
69945
+ end
69493
69946
  self.CtldUnits=_UnitList
69494
69947
  if self.usesubcats then
69495
69948
  for _id,_cargo in pairs(self.Cargo_Crates)do
@@ -69515,10 +69968,15 @@ local menucount=0
69515
69968
  local menus={}
69516
69969
  for _,_unitName in pairs(self.CtldUnits)do
69517
69970
  if(not self.MenusDone[_unitName])or(self.showstockinmenuitems==true)then
69971
+ self:T(self.lid.."Menu not done yet for ".._unitName)
69518
69972
  local _unit=UNIT:FindByName(_unitName)
69973
+ if not _unit and self.allowCATransport then
69974
+ _unit=CLIENT:FindByName(_unitName)
69975
+ end
69519
69976
  if _unit and _unit:IsAlive()then
69520
69977
  local _group=_unit:GetGroup()
69521
69978
  if _group then
69979
+ self:T(self.lid.."Unit and Group exist")
69522
69980
  local capabilities=self:_GetUnitCapabilities(_unit)
69523
69981
  local cantroops=capabilities.troops
69524
69982
  local cancrates=capabilities.crates
@@ -69581,6 +70039,59 @@ if cancrates then
69581
70039
  local topcrates=MENU_GROUP:New(_group,"Manage Crates",topmenu)
69582
70040
  _group.MyTopCratesMenu=topcrates
69583
70041
  local cratesmenu=MENU_GROUP:New(_group,"Get Crates",topcrates)
70042
+ if self.onestepmenu then
70043
+ if self.usesubcats then
70044
+ local subcatmenus={}
70045
+ for catName,_ in pairs(self.subcats)do
70046
+ subcatmenus[catName]=MENU_GROUP:New(_group,catName,cratesmenu)
70047
+ end
70048
+ for _,cargoObj in pairs(self.Cargo_Crates)do
70049
+ if not cargoObj.DontShowInMenu then
70050
+ local txt=string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
70051
+ if cargoObj.Location then txt=txt.."[R]"end
70052
+ local stock=cargoObj:GetStock()
70053
+ if stock>=0 and self.showstockinmenuitems then txt=txt.."["..stock.."]"end
70054
+ local mSet=MENU_GROUP:New(_group,txt,subcatmenus[cargoObj.Subcategory])
70055
+ MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
70056
+ MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
70057
+ end
70058
+ end
70059
+ for _,cargoObj in pairs(self.Cargo_Statics)do
70060
+ if not cargoObj.DontShowInMenu then
70061
+ local txt=string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
70062
+ if cargoObj.Location then txt=txt.."[R]"end
70063
+ local stock=cargoObj:GetStock()
70064
+ if stock>=0 and self.showstockinmenuitems then txt=txt.."["..stock.."]"end
70065
+ local mSet=MENU_GROUP:New(_group,txt,subcatmenus[cargoObj.Subcategory])
70066
+ MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
70067
+ MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
70068
+ end
70069
+ end
70070
+ else
70071
+ for _,cargoObj in pairs(self.Cargo_Crates)do
70072
+ if not cargoObj.DontShowInMenu then
70073
+ local txt=string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
70074
+ if cargoObj.Location then txt=txt.."[R]"end
70075
+ local stock=cargoObj:GetStock()
70076
+ if stock>=0 and self.showstockinmenuitems then txt=txt.."["..stock.."]"end
70077
+ local mSet=MENU_GROUP:New(_group,txt,cratesmenu)
70078
+ MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
70079
+ MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
70080
+ end
70081
+ end
70082
+ for _,cargoObj in pairs(self.Cargo_Statics)do
70083
+ if not cargoObj.DontShowInMenu then
70084
+ local txt=string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
70085
+ if cargoObj.Location then txt=txt.."[R]"end
70086
+ local stock=cargoObj:GetStock()
70087
+ if stock>=0 and self.showstockinmenuitems then txt=txt.."["..stock.."]"end
70088
+ local mSet=MENU_GROUP:New(_group,txt,cratesmenu)
70089
+ MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
70090
+ MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
70091
+ end
70092
+ end
70093
+ end
70094
+ else
69584
70095
  if self.usesubcats then
69585
70096
  local subcatmenus={}
69586
70097
  for catName,_ in pairs(self.subcats)do
@@ -69624,6 +70135,7 @@ MENU_GROUP_COMMAND:New(_group,txt,cratesmenu,self._GetCrates,self,_group,_unit,c
69624
70135
  end
69625
70136
  end
69626
70137
  end
70138
+ end
69627
70139
  local loadCratesMenu=MENU_GROUP:New(_group,"Load Crates",topcrates)
69628
70140
  _group.MyLoadCratesMenu=loadCratesMenu
69629
70141
  MENU_GROUP_COMMAND:New(_group,"Load ALL",loadCratesMenu,self._LoadCratesNearby,self,_group,_unit)
@@ -69636,8 +70148,16 @@ MENU_GROUP_COMMAND:New(_group,"Repair",topcrates,self._RepairCrates,self,_group,
69636
70148
  end
69637
70149
  local removecratesmenu=MENU_GROUP:New(_group,"Remove crates",topcrates)
69638
70150
  MENU_GROUP_COMMAND:New(_group,"Remove crates nearby",removecratesmenu,self._RemoveCratesNearby,self,_group,_unit)
70151
+ if self.onestepmenu then
70152
+ local mPack=MENU_GROUP:New(_group,"Pack crates",topcrates)
70153
+ MENU_GROUP_COMMAND:New(_group,"Pack",mPack,self._PackCratesNearby,self,_group,_unit)
70154
+ MENU_GROUP_COMMAND:New(_group,"Pack and Load",mPack,self._PackAndLoad,self,_group,_unit)
70155
+ MENU_GROUP_COMMAND:New(_group,"Pack and Remove",mPack,self._PackAndRemove,self,_group,_unit)
70156
+ MENU_GROUP_COMMAND:New(_group,"List crates nearby",topcrates,self._ListCratesNearby,self,_group,_unit)
70157
+ else
69639
70158
  MENU_GROUP_COMMAND:New(_group,"Pack crates",topcrates,self._PackCratesNearby,self,_group,_unit)
69640
70159
  MENU_GROUP_COMMAND:New(_group,"List crates nearby",topcrates,self._ListCratesNearby,self,_group,_unit)
70160
+ end
69641
70161
  local uName=_unit:GetName()
69642
70162
  local loadedData=self.Loaded_Cargo[uName]
69643
70163
  if loadedData and loadedData.Cargo then
@@ -69698,21 +70218,28 @@ end
69698
70218
  MENU_GROUP_COMMAND:New(Group,"Load ALL",Group.MyLoadCratesMenu,self._LoadCratesNearby,self,Group,Unit)
69699
70219
  local cargoByName={}
69700
70220
  for _,crate in pairs(nearby)do
69701
- local cName=crate:GetName()
69702
- cargoByName[cName]=cargoByName[cName]or{}
69703
- table.insert(cargoByName[cName],crate)
70221
+ local name=crate:GetName()
70222
+ cargoByName[name]=cargoByName[name]or{}
70223
+ table.insert(cargoByName[name],crate)
69704
70224
  end
69705
- for cName,cList in pairs(cargoByName)do
69706
- local needed=cList[1]:GetCratesNeeded()or 1
69707
- local found=#cList
69708
- local line
69709
- if found>=needed then
69710
- line=string.format("Load %s",cName)
70225
+ local lineIndex=1
70226
+ for cName,list in pairs(cargoByName)do
70227
+ local needed=list[1]:GetCratesNeeded()or 1
70228
+ table.sort(list,function(a,b)return a:GetID()<b:GetID()end)
70229
+ local i=1
70230
+ while i<=#list do
70231
+ local left=#list-i+1
70232
+ local label
70233
+ if left>=needed then
70234
+ label=string.format("%d. Load %s",lineIndex,cName)
70235
+ i=i+needed
69711
70236
  else
69712
- MENU_GROUP_COMMAND:New(Group,"Rescan?",Group.MyLoadCratesMenu,function()self:_RefreshLoadCratesMenu(Group,Unit)end)
69713
- line=string.format("Load %s (%d/%d)",cName,found,needed)
70237
+ label=string.format("%d. Load %s (%d/%d)",lineIndex,cName,left,needed)
70238
+ i=#list+1
70239
+ end
70240
+ MENU_GROUP_COMMAND:New(Group,label,Group.MyLoadCratesMenu,self._LoadSingleCrateSet,self,Group,Unit,cName)
70241
+ lineIndex=lineIndex+1
69714
70242
  end
69715
- MENU_GROUP_COMMAND:New(Group,line,Group.MyLoadCratesMenu,self._LoadSingleCrateSet,self,Group,Unit,cName)
69716
70243
  end
69717
70244
  end
69718
70245
  function CTLD:_LoadSingleCrateSet(Group,Unit,cargoName)
@@ -69925,6 +70452,7 @@ if dropableCrates==0 then
69925
70452
  MENU_GROUP_COMMAND:New(Group,"No crates to drop!",dropCratesMenu,function()end)
69926
70453
  return
69927
70454
  end
70455
+ if not self.onestepmenu then
69928
70456
  MENU_GROUP_COMMAND:New(Group,"Drop ALL crates",dropCratesMenu,self._UnloadCrates,self,Group,Unit)
69929
70457
  self.CrateGroupList=self.CrateGroupList or{}
69930
70458
  self.CrateGroupList[Unit:GetName()]={}
@@ -69959,6 +70487,46 @@ end
69959
70487
  lineIndex=lineIndex+1
69960
70488
  end
69961
70489
  end
70490
+ else
70491
+ local mAll=MENU_GROUP:New(Group,"Drop ALL crates",dropCratesMenu)
70492
+ MENU_GROUP_COMMAND:New(Group,"Drop",mAll,self._UnloadCrates,self,Group,Unit)
70493
+ MENU_GROUP_COMMAND:New(Group,"Drop and build",mAll,self._DropAndBuild,self,Group,Unit)
70494
+ self.CrateGroupList=self.CrateGroupList or{}
70495
+ self.CrateGroupList[Unit:GetName()]={}
70496
+ local lineIndex=1
70497
+ for cName,list in pairs(cargoByName)do
70498
+ local needed=list[1]:GetCratesNeeded()or 1
70499
+ table.sort(list,function(a,b)return a:GetID()<b:GetID()end)
70500
+ local i=1
70501
+ while i<=#list do
70502
+ local left=(#list-i+1)
70503
+ if left>=needed then
70504
+ local chunk={}
70505
+ for n=i,i+needed-1 do
70506
+ table.insert(chunk,list[n])
70507
+ end
70508
+ local label=string.format("%d. %s",lineIndex,cName)
70509
+ table.insert(self.CrateGroupList[Unit:GetName()],chunk)
70510
+ local setIndex=#self.CrateGroupList[Unit:GetName()]
70511
+ local mSet=MENU_GROUP:New(Group,label,dropCratesMenu)
70512
+ MENU_GROUP_COMMAND:New(Group,"Drop",mSet,self._UnloadSingleCrateSet,self,Group,Unit,setIndex)
70513
+ MENU_GROUP_COMMAND:New(Group,"Drop and build",mSet,self._DropSingleAndBuild,self,Group,Unit,setIndex)
70514
+ i=i+needed
70515
+ else
70516
+ local chunk={}
70517
+ for n=i,#list do
70518
+ table.insert(chunk,list[n])
70519
+ end
70520
+ local label=string.format("%d. %s %d/%d",lineIndex,cName,left,needed)
70521
+ table.insert(self.CrateGroupList[Unit:GetName()],chunk)
70522
+ local setIndex=#self.CrateGroupList[Unit:GetName()]
70523
+ MENU_GROUP_COMMAND:New(Group,label,dropCratesMenu,self._UnloadSingleCrateSet,self,Group,Unit,setIndex)
70524
+ i=#list+1
70525
+ end
70526
+ lineIndex=lineIndex+1
70527
+ end
70528
+ end
70529
+ end
69962
70530
  end
69963
70531
  function CTLD:_UnloadSingleTroopByID(Group,Unit,chunkID)
69964
70532
  self:T(self.lid.." _UnloadSingleTroopByID chunkID="..tostring(chunkID))
@@ -70271,6 +70839,8 @@ elseif ZoneType==CTLD.CargoZoneType.DROP then
70271
70839
  table=self.dropOffZones
70272
70840
  elseif ZoneType==CTLD.CargoZoneType.SHIP then
70273
70841
  table=self.shipZones
70842
+ elseif ZoneType==CTLD.CargoZoneType.BEACON then
70843
+ table=self.droppedBeacons
70274
70844
  else
70275
70845
  table=self.wpZones
70276
70846
  end
@@ -70559,6 +71129,7 @@ local zonewidth=20
70559
71129
  if Zonetype==CTLD.CargoZoneType.SHIP then
70560
71130
  self:T("Checking Type Ship: "..zonename)
70561
71131
  local ZoneUNIT=UNIT:FindByName(zonename)
71132
+ if not ZoneUNIT then return false end
70562
71133
  zonecoord=ZoneUNIT:GetCoordinate()
70563
71134
  zoneradius=czone.shiplength
70564
71135
  zonewidth=czone.shipwidth
@@ -70577,7 +71148,8 @@ zonewidth=zoneradius
70577
71148
  end
70578
71149
  local distance=self:_GetDistance(zonecoord,unitcoord)
70579
71150
  self:T("Distance Zone: "..distance)
70580
- if(zone:IsVec2InZone(unitVec2)or Zonetype==CTLD.CargoZoneType.MOVE)and active==true and maxdist>distance then
71151
+ self:T("Zone Active: "..tostring(active))
71152
+ if(zone:IsVec2InZone(unitVec2)or Zonetype==CTLD.CargoZoneType.MOVE)and active==true and distance<maxdist then
70581
71153
  outcome=true
70582
71154
  maxdist=distance
70583
71155
  zoneret=zone
@@ -70631,6 +71203,7 @@ zone=AIRBASE:FindByName(zonename):GetZone()
70631
71203
  end
70632
71204
  end
70633
71205
  local zonecoord=zone:GetCoordinate()
71206
+ if zonecoord then
70634
71207
  local active=CZone.active
70635
71208
  local color=CZone.color
70636
71209
  local distance=self:_GetDistance(zonecoord,unitcoord)
@@ -70648,6 +71221,7 @@ smoked=true
70648
71221
  end
70649
71222
  end
70650
71223
  end
71224
+ end
70651
71225
  if not smoked then
70652
71226
  local distance=UTILS.MetersToNM(self.smokedistance)
70653
71227
  self:_SendMessage(string.format("Negative, need to be closer than %dnm to a zone!",distance),10,false,Group)
@@ -70660,9 +71234,8 @@ local unittype=nil
70660
71234
  local unit=nil
70661
71235
  if type(Unittype)=="string"then
70662
71236
  unittype=Unittype
70663
- elseif type(Unittype)=="table"then
70664
- unit=UNIT:FindByName(Unittype)
70665
- unittype=unit:GetTypeName()
71237
+ elseif type(Unittype)=="table"and Unittype.ClassName and Unittype:IsInstanceOf("UNIT")then
71238
+ unittype=Unittype:GetTypeName()
70666
71239
  else
70667
71240
  return self
70668
71241
  end
@@ -71520,12 +72093,17 @@ local task=Task
71520
72093
  local subtype=task:GetSubType()
71521
72094
  if Event==subtype and not task:IsDone()then
71522
72095
  local targetzone=task.Target:GetObject()
72096
+ self:T2({Name=Groupname,Property=task:GetProperty("ExtractName")})
72097
+ if task:GetProperty("ExtractName")then
71523
72098
  local okaygroup=string.find(Groupname,task:GetProperty("ExtractName"),1,true)
71524
72099
  if targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE")and okaygroup then
71525
72100
  if task.Clients:HasUniqueID(playername)then
71526
72101
  task:__Success(-1)
71527
72102
  end
71528
72103
  end
72104
+ else
72105
+ self:T({Text="'ExtractName' Property not set",Name=Groupname,Property=task.Type})
72106
+ end
71529
72107
  end
71530
72108
  end
71531
72109
  )
@@ -72317,6 +72895,7 @@ rescues=0,
72317
72895
  rescuedpilots=0,
72318
72896
  limitmaxdownedpilots=true,
72319
72897
  maxdownedpilots=10,
72898
+ useFIFOLimitReplacement=false,
72320
72899
  allheligroupset=nil,
72321
72900
  topmenuname="CSAR",
72322
72901
  ADFRadioPwr=1000,
@@ -72344,7 +72923,7 @@ CSAR.AircraftType["MH-60R"]=10
72344
72923
  CSAR.AircraftType["OH-6A"]=2
72345
72924
  CSAR.AircraftType["OH58D"]=2
72346
72925
  CSAR.AircraftType["CH-47Fbl1"]=31
72347
- CSAR.version="1.0.30"
72926
+ CSAR.version="1.0.33"
72348
72927
  function CSAR:New(Coalition,Template,Alias)
72349
72928
  local self=BASE:Inherit(self,FSM:New())
72350
72929
  BASE:T({Coalition,Template,Alias})
@@ -72448,7 +73027,7 @@ self.csarUsePara=false
72448
73027
  self.wetfeettemplate=nil
72449
73028
  self.usewetfeet=false
72450
73029
  self.allowbronco=false
72451
- self.ADFRadioPwr=1000
73030
+ self.ADFRadioPwr=500
72452
73031
  self.PilotWeight=80
72453
73032
  self.UserSetGroup=nil
72454
73033
  self.useSRS=false
@@ -72788,11 +73367,6 @@ if self:_DoubleEjection(_unitname)then
72788
73367
  self:T("Double Ejection!")
72789
73368
  return self
72790
73369
  end
72791
- if self.limitmaxdownedpilots and self:_ReachedPilotLimit()then
72792
- self:T("Maxed Downed Pilot!")
72793
- return self
72794
- end
72795
- local wetfeet=false
72796
73370
  local initdcscoord=nil
72797
73371
  local initcoord=nil
72798
73372
  if _event.id==EVENTS.Ejection then
@@ -72804,6 +73378,27 @@ initdcscoord=_event.IniDCSUnit:getPoint()
72804
73378
  initcoord=COORDINATE:NewFromVec3(initdcscoord)
72805
73379
  self:T({initdcscoord})
72806
73380
  end
73381
+ if _event.IniPlayerName then
73382
+ local PilotTable=self.downedPilots
73383
+ local _foundPilot=nil
73384
+ for _,_pilot in pairs(PilotTable)do
73385
+ if _pilot.player==_event.IniPlayerName and _pilot.alive==true then
73386
+ _foundPilot=_pilot
73387
+ break
73388
+ end
73389
+ end
73390
+ if _foundPilot then
73391
+ self:T("Downed pilot already exists!")
73392
+ _foundPilot.group:Destroy(false)
73393
+ self:_RemoveNameFromDownedPilots(_foundPilot.name)
73394
+ self:_CheckDownedPilotTable()
73395
+ end
73396
+ end
73397
+ if self.limitmaxdownedpilots and self:_ReachedPilotLimit()then
73398
+ self:T("Maxed Downed Pilot!")
73399
+ return self
73400
+ end
73401
+ local wetfeet=false
72807
73402
  local surface=initcoord:GetSurfaceType()
72808
73403
  if surface==land.SurfaceType.WATER then
72809
73404
  self:T("Wet feet!")
@@ -73508,41 +74103,37 @@ end
73508
74103
  function CSAR:_GetClosestMASH(_heli)
73509
74104
  self:T(self.lid.." _GetClosestMASH")
73510
74105
  local _mashset=self.mash
73511
- local _mashes=_mashset:GetSetObjects()
74106
+ local MashSets={}
74107
+ table.insert(MashSets,_mashset.Set)
74108
+ table.insert(MashSets,self.zonemashes.Set)
74109
+ table.insert(MashSets,self.staticmashes.Set)
73512
74110
  local _shortestDistance=-1
73513
74111
  local _distance=0
73514
74112
  local _helicoord=_heli:GetCoordinate()
73515
- local function GetCloseAirbase(coordinate,Coalition,Category)
73516
- local a=coordinate:GetVec3()
73517
- local distmin=math.huge
73518
- local airbase=nil
73519
- for DCSairbaseID,DCSairbase in pairs(world.getAirbases(Coalition))do
73520
- local b=DCSairbase:getPoint()
73521
- local c=UTILS.VecSubstract(a,b)
73522
- local dist=UTILS.VecNorm(c)
73523
- if dist<distmin and(Category==nil or Category==DCSairbase:getDesc().category)then
73524
- distmin=dist
73525
- airbase=DCSairbase
73526
- end
73527
- end
73528
- return distmin
73529
- end
74113
+ local MashName=nil
73530
74114
  if self.allowFARPRescue then
73531
74115
  local position=_heli:GetCoordinate()
73532
74116
  local afb,distance=position:GetClosestAirbase(nil,self.coalition)
73533
74117
  _shortestDistance=distance
74118
+ MashName=(afb~=nil)and afb:GetName()or"Unknown"
74119
+ end
74120
+ for _,_mashes in pairs(MashSets)do
74121
+ for _,_mashUnit in pairs(_mashes or{})do
74122
+ local _mashcoord
74123
+ if _mashUnit and(not _mashUnit:IsInstanceOf("ZONE_BASE"))and _mashUnit:IsAlive()then
74124
+ _mashcoord=_mashUnit:GetCoordinate()
74125
+ elseif _mashUnit and _mashUnit:IsInstanceOf("ZONE_BASE")then
74126
+ _mashcoord=_mashUnit:GetCoordinate()
73534
74127
  end
73535
- for _,_mashUnit in pairs(_mashes)do
73536
- if _mashUnit and _mashUnit:IsAlive()then
73537
- local _mashcoord=_mashUnit:GetCoordinate()
73538
74128
  _distance=self:_GetDistance(_helicoord,_mashcoord)
73539
74129
  if _distance~=nil and(_shortestDistance==-1 or _distance<_shortestDistance)then
73540
74130
  _shortestDistance=_distance
74131
+ MashName=_mashUnit:GetName()or"Unknown"
73541
74132
  end
73542
74133
  end
73543
74134
  end
73544
74135
  if _shortestDistance~=-1 then
73545
- return _shortestDistance
74136
+ return _shortestDistance,MashName
73546
74137
  else
73547
74138
  return-1
73548
74139
  end
@@ -73662,7 +74253,7 @@ if clock>12 then clock=clock-12 end
73662
74253
  end
73663
74254
  return clock
73664
74255
  end
73665
- function CSAR:_AddBeaconToGroup(_group,_freq,_name)
74256
+ function CSAR:_AddBeaconToGroup(_group,_freq,BeaconName)
73666
74257
  self:T(self.lid.." _AddBeaconToGroup")
73667
74258
  if self.CreateRadioBeacons==false then return end
73668
74259
  local _group=_group
@@ -73680,10 +74271,10 @@ local _radioUnit=_group:GetUnit(1)
73680
74271
  if _radioUnit then
73681
74272
  local name=_radioUnit:GetName()
73682
74273
  local Frequency=_freq
73683
- local name=_radioUnit:GetName()
73684
74274
  local Sound="l10n/DEFAULT/"..self.radioSound
73685
74275
  local vec3=_radioUnit:GetVec3()or _radioUnit:GetPositionVec3()or{x=0,y=0,z=0}
73686
- trigger.action.radioTransmission(Sound,vec3,0,false,Frequency,self.ADFRadioPwr or 1000,_name)
74276
+ self:I(self.lid..string.format("Added Radio Beacon %d Hertz | Name %s | Position {%d,%d,%d}",Frequency,BeaconName,vec3.x,vec3.y,vec3.z))
74277
+ trigger.action.radioTransmission(Sound,vec3,0,true,Frequency,self.ADFRadioPwr or 500,BeaconName)
73687
74278
  end
73688
74279
  end
73689
74280
  return self
@@ -73699,9 +74290,11 @@ local pilot=_pilot
73699
74290
  local group=pilot.group
73700
74291
  local frequency=pilot.frequency or 0
73701
74292
  local bname=pilot.BeaconName or pilot.name..math.random(1,100000)
73702
- trigger.action.stopRadioTransmission(bname)
73703
74293
  if group and group:IsAlive()and frequency>0 then
73704
- self:_AddBeaconToGroup(group,frequency,bname)
74294
+ else
74295
+ if frequency>0 then
74296
+ trigger.action.stopRadioTransmission(bname)
74297
+ end
73705
74298
  end
73706
74299
  end
73707
74300
  end
@@ -73724,6 +74317,21 @@ local limit=self.maxdownedpilots
73724
74317
  local islimited=self.limitmaxdownedpilots
73725
74318
  local count=self:_CountActiveDownedPilots()
73726
74319
  if islimited and(count>=limit)then
74320
+ if self.useFIFOLimitReplacement then
74321
+ local oldIndex=-1
74322
+ local oldDownedPilot=nil
74323
+ for _index,_downedpilot in pairs(self.downedPilots)do
74324
+ oldIndex=_index
74325
+ oldDownedPilot=_downedpilot
74326
+ break
74327
+ end
74328
+ if oldDownedPilot then
74329
+ oldDownedPilot.group:Destroy(false)
74330
+ oldDownedPilot.alive=false
74331
+ self:_CheckDownedPilotTable()
74332
+ return false
74333
+ end
74334
+ end
73727
74335
  return true
73728
74336
  else
73729
74337
  return false
@@ -73755,18 +74363,8 @@ else
73755
74363
  self.allheligroupset=SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterCategoryHelicopter():FilterStart()
73756
74364
  end
73757
74365
  self.mash=SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart()
73758
- local staticmashes=SET_STATIC:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterOnce()
73759
- local zonemashes=SET_ZONE:New():FilterPrefixes(self.mashprefix):FilterOnce()
73760
- if staticmashes:Count()>0 then
73761
- for _,_mash in pairs(staticmashes.Set)do
73762
- self.mash:AddObject(_mash)
73763
- end
73764
- end
73765
- if zonemashes:Count()>0 then
73766
- for _,_mash in pairs(zonemashes.Set)do
73767
- self.mash:AddObject(_mash)
73768
- end
73769
- end
74366
+ self.staticmashes=SET_STATIC:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterOnce()
74367
+ self.zonemashes=SET_ZONE:New():FilterPrefixes(self.mashprefix):FilterOnce()
73770
74368
  if not self.coordinate then
73771
74369
  local csarhq=self.mash:GetRandom()
73772
74370
  if csarhq then
@@ -78983,7 +79581,6 @@ Attack="A",
78983
79581
  Reconnaissance="R",
78984
79582
  }
78985
79583
  AI_FORMATION.__Enum.ReportType={
78986
- Airborne="*",
78987
79584
  Airborne="A",
78988
79585
  GroundRadar="R",
78989
79586
  Ground="G",
@@ -79253,7 +79850,6 @@ end
79253
79850
  local CVI={
79254
79851
  x=CV2.x+CS*10*math.sin(Ca),
79255
79852
  y=GH2.y+Inclination,
79256
- y=GH2.y,
79257
79853
  z=CV2.z+CS*10*math.cos(Ca),
79258
79854
  }
79259
79855
  local DV={x=CV2.x-CVI.x,y=CV2.y-CVI.y,z=CV2.z-CVI.z}
@@ -82435,7 +83031,7 @@ self.DisplayCount=self.DisplayCount+1
82435
83031
  end
82436
83032
  return true
82437
83033
  end
82438
- function ACT_ACCOUNT:onafterEvent(ProcessUnit,From,Event,To,Event)
83034
+ function ACT_ACCOUNT:onafterEvent(ProcessUnit,From,Event,To)
82439
83035
  self:__NoMore(1)
82440
83036
  end
82441
83037
  end