@jtff/miztemplate-lib 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lua/lib/HoundElint.lua +7101 -7101
- package/lua/lib/Moose_.lua +1422 -470
- package/lua/settings/settings-airboss.lua +3 -0
- package/lua/src/130-airboss.lua +48 -3
- package/package.json +1 -1
package/lua/lib/Moose_.lua
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
env.info('*** MOOSE GITHUB Commit Hash ID: 2024-08-
|
|
1
|
+
env.info('*** MOOSE GITHUB Commit Hash ID: 2024-08-29T10:25:13+02:00-f531fdaa7055bd56bd3afb8a03857833d7c3122b ***')
|
|
2
2
|
if not MOOSE_DEVELOPMENT_FOLDER then
|
|
3
3
|
MOOSE_DEVELOPMENT_FOLDER='Scripts'
|
|
4
4
|
end
|
|
@@ -464,6 +464,11 @@ containers={},
|
|
|
464
464
|
droptanks={},
|
|
465
465
|
adapters={},
|
|
466
466
|
torpedoes={},
|
|
467
|
+
Gazelle={},
|
|
468
|
+
CH47={},
|
|
469
|
+
OH58={},
|
|
470
|
+
UH1H={},
|
|
471
|
+
AH64D={},
|
|
467
472
|
}
|
|
468
473
|
}
|
|
469
474
|
ENUMS.Storage.weapons.nurs.SNEB_TYPE253_F1B="weapons.nurs.SNEB_TYPE253_F1B"
|
|
@@ -1023,6 +1028,57 @@ ENUMS.Storage.weapons.bombs.AGM_62="weapons.bombs.AGM_62"
|
|
|
1023
1028
|
ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_WHITE="weapons.containers.{US_M10_SMOKE_TANK_WHITE}"
|
|
1024
1029
|
ENUMS.Storage.weapons.missiles.MICA_T="weapons.missiles.MICA_T"
|
|
1025
1030
|
ENUMS.Storage.weapons.containers.HVAR_rocket="weapons.containers.HVAR_rocket"
|
|
1031
|
+
ENUMS.Storage.weapons.Gazelle.HMP400_100RDS={4,15,46,1771}
|
|
1032
|
+
ENUMS.Storage.weapons.Gazelle.HMP400_200RDS={4,15,46,1770}
|
|
1033
|
+
ENUMS.Storage.weapons.Gazelle.HMP400_400RDS={4,15,46,1769}
|
|
1034
|
+
ENUMS.Storage.weapons.Gazelle.GIAT_M261_AP={4,15,46,1768}
|
|
1035
|
+
ENUMS.Storage.weapons.Gazelle.GIAT_M261_SAPHEI={4,15,46,1767}
|
|
1036
|
+
ENUMS.Storage.weapons.Gazelle.GIAT_M261_HE={4,15,46,1766}
|
|
1037
|
+
ENUMS.Storage.weapons.Gazelle.GIAT_M261_HEAP={4,15,46,1765}
|
|
1038
|
+
ENUMS.Storage.weapons.Gazelle.GIAT_M261_APHE={4,15,46,1764}
|
|
1039
|
+
ENUMS.Storage.weapons.Gazelle.GAZELLE_IR_DEFLECTOR={4,15,47,680}
|
|
1040
|
+
ENUMS.Storage.weapons.Gazelle.GAZELLE_FAS_SANDFILTER={4,15,47,679}
|
|
1041
|
+
ENUMS.Storage.weapons.CH47.CH47_PORT_M60D={4,15,46,2476}
|
|
1042
|
+
ENUMS.Storage.weapons.CH47.CH47_STBD_M60D={4,15,46,2477}
|
|
1043
|
+
ENUMS.Storage.weapons.CH47.CH47_AFT_M60D={4,15,46,2478}
|
|
1044
|
+
ENUMS.Storage.weapons.CH47.CH47_PORT_M134D={4,15,46,2482}
|
|
1045
|
+
ENUMS.Storage.weapons.CH47.CH47_STBD_M134D={4,15,46,2483}
|
|
1046
|
+
ENUMS.Storage.weapons.CH47.CH47_AFT_M3M={4,15,46,2484}
|
|
1047
|
+
ENUMS.Storage.weapons.CH47.CH47_PORT_M240H={4,15,46,2479}
|
|
1048
|
+
ENUMS.Storage.weapons.CH47.CH47_STBD_M240H={4,15,46,2480}
|
|
1049
|
+
ENUMS.Storage.weapons.CH47.CH47_AFT_M240H={4,15,46,2481}
|
|
1050
|
+
ENUMS.Storage.weapons.UH1H.M134_MiniGun_Right={4,15,46,161}
|
|
1051
|
+
ENUMS.Storage.weapons.UH1H.M134_MiniGun_Left={4,15,46,160}
|
|
1052
|
+
ENUMS.Storage.weapons.UH1H.M134_MiniGun_Right_Door={4,15,46,175}
|
|
1053
|
+
ENUMS.Storage.weapons.UH1H.M60_MG_Right_Door={4,15,46,177}
|
|
1054
|
+
ENUMS.Storage.weapons.UH1H.M134_MiniGun_Left_Door={4,15,46,174}
|
|
1055
|
+
ENUMS.Storage.weapons.UH1H.M60_MG_Left_Door={4,15,46,176}
|
|
1056
|
+
ENUMS.Storage.weapons.OH58.FIM92={4,4,7,446}
|
|
1057
|
+
ENUMS.Storage.weapons.OH58.MG_M3P100={4,15,46,2578}
|
|
1058
|
+
ENUMS.Storage.weapons.OH58.MG_M3P200={4,15,46,2577}
|
|
1059
|
+
ENUMS.Storage.weapons.OH58.MG_M3P300={4,15,46,2576}
|
|
1060
|
+
ENUMS.Storage.weapons.OH58.MG_M3P400={4,15,46,2575}
|
|
1061
|
+
ENUMS.Storage.weapons.OH58.MG_M3P500={4,15,46,2574}
|
|
1062
|
+
ENUMS.Storage.weapons.OH58.Smk_Grenade_Blue={4,5,9,484}
|
|
1063
|
+
ENUMS.Storage.weapons.OH58.Smk_Grenade_Green={4,5,9,485}
|
|
1064
|
+
ENUMS.Storage.weapons.OH58.Smk_Grenade_Red={4,5,9,483}
|
|
1065
|
+
ENUMS.Storage.weapons.OH58.Smk_Grenade_Violet={4,5,9,486}
|
|
1066
|
+
ENUMS.Storage.weapons.OH58.Smk_Grenade_White={4,5,9,488}
|
|
1067
|
+
ENUMS.Storage.weapons.OH58.Smk_Grenade_Yellow={4,5,9,487}
|
|
1068
|
+
ENUMS.Storage.weapons.AH64D.AN_APG78={4,15,44,2138}
|
|
1069
|
+
ENUMS.Storage.weapons.AH64D.Internal_Aux_FuelTank={1,3,43,1700}
|
|
1070
|
+
ENUMS.FARPType={
|
|
1071
|
+
FARP="FARP",
|
|
1072
|
+
INVISIBLE="INVISIBLE",
|
|
1073
|
+
HELIPADSINGLE="HELIPADSINGLE",
|
|
1074
|
+
PADSINGLE="PADSINGLE",
|
|
1075
|
+
}
|
|
1076
|
+
ENUMS.FARPObjectTypeNamesAndShape={
|
|
1077
|
+
[ENUMS.FARPType.FARP]={TypeName="FARP",ShapeName="FARPS"},
|
|
1078
|
+
[ENUMS.FARPType.INVISIBLE]={TypeName="Invisible FARP",ShapeName="invisiblefarp"},
|
|
1079
|
+
[ENUMS.FARPType.HELIPADSINGLE]={TypeName="SINGLE_HELIPAD",ShapeName="FARP"},
|
|
1080
|
+
[ENUMS.FARPType.PADSINGLE]={TypeName="FARP_SINGLE_01",ShapeName="FARP_SINGLE_01"},
|
|
1081
|
+
}
|
|
1026
1082
|
SMOKECOLOR=trigger.smokeColor
|
|
1027
1083
|
FLARECOLOR=trigger.flareColor
|
|
1028
1084
|
BIGSMOKEPRESET={
|
|
@@ -1826,7 +1882,7 @@ function UTILS.SecondsToClock(seconds,short)
|
|
|
1826
1882
|
if seconds==nil then
|
|
1827
1883
|
return nil
|
|
1828
1884
|
end
|
|
1829
|
-
local seconds=tonumber(seconds)
|
|
1885
|
+
local seconds=tonumber(seconds)or 0
|
|
1830
1886
|
local _seconds=seconds%(60*60*24)
|
|
1831
1887
|
if seconds<0 then
|
|
1832
1888
|
return nil
|
|
@@ -2352,9 +2408,9 @@ local sinDec=0.39782*sin(L)
|
|
|
2352
2408
|
local cosDec=cos(asin(sinDec))
|
|
2353
2409
|
local cosH=(cos(zenith)-(sinDec*sin(latitude)))/(cosDec*cos(latitude))
|
|
2354
2410
|
if rising and cosH>1 then
|
|
2355
|
-
return"N/R"
|
|
2356
|
-
elseif cosH<-1 then
|
|
2357
2411
|
return"N/S"
|
|
2412
|
+
elseif cosH<-1 then
|
|
2413
|
+
return"N/R"
|
|
2358
2414
|
end
|
|
2359
2415
|
local H
|
|
2360
2416
|
if rising then
|
|
@@ -2502,14 +2558,16 @@ return FreeFMFrequencies
|
|
|
2502
2558
|
end
|
|
2503
2559
|
function UTILS.GenerateVHFrequencies()
|
|
2504
2560
|
local _skipFrequencies={
|
|
2505
|
-
214,274,291.5,295,297.5,
|
|
2506
|
-
300.5,304,305,307,309.5,311,312,312.5,316,
|
|
2507
|
-
320,324,328,329,330,332,336,337,
|
|
2508
|
-
342,343,348,351,352,353,358,
|
|
2509
|
-
363,365,368,372.5,374,
|
|
2510
|
-
380,381,384,385,389,395,396,
|
|
2511
|
-
|
|
2512
|
-
|
|
2561
|
+
214,243,264,273,274,288,291.5,295,297.5,
|
|
2562
|
+
300.5,304,305,307,309.5,310,311,312,312.5,316,317,
|
|
2563
|
+
320,323,324,325,326,328,329,330,332,335,336,337,
|
|
2564
|
+
340,342,343,346,348,351,352,353,358,
|
|
2565
|
+
360,363,364,365,368,372.5,373,374,
|
|
2566
|
+
380,381,384,385,387,389,391,395,396,399,
|
|
2567
|
+
403,404,410,412,414,418,420,423,
|
|
2568
|
+
430,432,435,440,445,
|
|
2569
|
+
450,455,462,470,485,490,
|
|
2570
|
+
507,515,520,525,528,540,550,560,563,570,577,580,595,
|
|
2513
2571
|
602,625,641,662,670,680,682,690,
|
|
2514
2572
|
705,720,722,730,735,740,745,750,770,795,
|
|
2515
2573
|
822,830,862,866,
|
|
@@ -3661,6 +3719,80 @@ end
|
|
|
3661
3719
|
UTILS.lcg.seed=(UTILS.lcg.a*UTILS.lcg.seed+UTILS.lcg.c)%UTILS.lcg.m
|
|
3662
3720
|
return UTILS.lcg.seed/UTILS.lcg.m
|
|
3663
3721
|
end
|
|
3722
|
+
function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,Country,CallSign,Frequency,Modulation,ADF,SpawnRadius,VehicleTemplate,Liquids,Equipment)
|
|
3723
|
+
local farplocation=Coordinate
|
|
3724
|
+
local farptype=FARPType or ENUMS.FARPType.FARP
|
|
3725
|
+
local Coalition=Coalition or coalition.side.BLUE
|
|
3726
|
+
local callsign=CallSign or CALLSIGN.FARP.Berlin
|
|
3727
|
+
local freq=Frequency or 127.5
|
|
3728
|
+
local mod=Modulation or radio.modulation.AM
|
|
3729
|
+
local radius=SpawnRadius or 100
|
|
3730
|
+
if radius<0 or radius>150 then radius=100 end
|
|
3731
|
+
local liquids=Liquids or 10
|
|
3732
|
+
liquids=liquids*1000
|
|
3733
|
+
local equip=Equipment or 10
|
|
3734
|
+
local statictypes=ENUMS.FARPObjectTypeNamesAndShape[farptype]or{TypeName="FARP",ShapeName="FARPS"}
|
|
3735
|
+
local STypeName=statictypes.TypeName
|
|
3736
|
+
local SShapeName=statictypes.ShapeName
|
|
3737
|
+
local Country=Country or(Coalition==coalition.side.BLUE and country.id.USA or country.id.RUSSIA)
|
|
3738
|
+
local ReturnObjects={}
|
|
3739
|
+
local newfarp=SPAWNSTATIC:NewFromType(STypeName,"Heliports",Country)
|
|
3740
|
+
newfarp:InitShape(SShapeName)
|
|
3741
|
+
newfarp:InitFARP(callsign,freq,mod)
|
|
3742
|
+
local spawnedfarp=newfarp:SpawnFromCoordinate(farplocation,0,Name)
|
|
3743
|
+
table.insert(ReturnObjects,spawnedfarp)
|
|
3744
|
+
local FARPStaticObjectsNato={
|
|
3745
|
+
["FUEL"]={TypeName="FARP Fuel Depot",ShapeName="GSM Rus",Category="Fortifications"},
|
|
3746
|
+
["AMMO"]={TypeName="FARP Ammo Dump Coating",ShapeName="SetkaKP",Category="Fortifications"},
|
|
3747
|
+
["TENT"]={TypeName="FARP Tent",ShapeName="PalatkaB",Category="Fortifications"},
|
|
3748
|
+
["WINDSOCK"]={TypeName="Windsock",ShapeName="H-Windsock_RW",Category="Fortifications"},
|
|
3749
|
+
}
|
|
3750
|
+
local farpobcount=0
|
|
3751
|
+
for _name,_object in pairs(FARPStaticObjectsNato)do
|
|
3752
|
+
local objloc=farplocation:Translate(radius,farpobcount*30)
|
|
3753
|
+
local heading=objloc:HeadingTo(farplocation)
|
|
3754
|
+
local newobject=SPAWNSTATIC:NewFromType(_object.TypeName,_object.Category,Country)
|
|
3755
|
+
newobject:InitShape(_object.ShapeName)
|
|
3756
|
+
newobject:InitHeading(heading)
|
|
3757
|
+
newobject:SpawnFromCoordinate(objloc,farpobcount*30,_name.." - "..Name)
|
|
3758
|
+
table.insert(ReturnObjects,newobject)
|
|
3759
|
+
farpobcount=farpobcount+1
|
|
3760
|
+
end
|
|
3761
|
+
if VehicleTemplate and type(VehicleTemplate)=="string"then
|
|
3762
|
+
local vcoordinate=farplocation:Translate(radius,farpobcount*30)
|
|
3763
|
+
local heading=vcoordinate:HeadingTo(farplocation)
|
|
3764
|
+
local vehicles=SPAWN:NewWithAlias(VehicleTemplate,"FARP Vehicles - "..Name)
|
|
3765
|
+
vehicles:InitGroupHeading(heading)
|
|
3766
|
+
vehicles:InitCountry(Country)
|
|
3767
|
+
vehicles:InitCoalition(Coalition)
|
|
3768
|
+
vehicles:InitDelayOff()
|
|
3769
|
+
local spawnedvehicle=vehicles:SpawnFromCoordinate(vcoordinate)
|
|
3770
|
+
table.insert(ReturnObjects,spawnedvehicle)
|
|
3771
|
+
end
|
|
3772
|
+
local newWH=STORAGE:New(Name)
|
|
3773
|
+
if liquids and liquids>0 then
|
|
3774
|
+
newWH:SetLiquid(STORAGE.Liquid.DIESEL,liquids)
|
|
3775
|
+
newWH:SetLiquid(STORAGE.Liquid.GASOLINE,liquids)
|
|
3776
|
+
newWH:SetLiquid(STORAGE.Liquid.JETFUEL,liquids)
|
|
3777
|
+
newWH:SetLiquid(STORAGE.Liquid.MW50,liquids)
|
|
3778
|
+
end
|
|
3779
|
+
if equip and equip>0 then
|
|
3780
|
+
for cat,nitem in pairs(ENUMS.Storage.weapons)do
|
|
3781
|
+
for name,item in pairs(nitem)do
|
|
3782
|
+
newWH:SetItem(item,equip)
|
|
3783
|
+
end
|
|
3784
|
+
end
|
|
3785
|
+
end
|
|
3786
|
+
local ADFName
|
|
3787
|
+
if ADF and type(ADF)=="number"then
|
|
3788
|
+
local ADFFreq=ADF*1000
|
|
3789
|
+
local Sound="l10n/DEFAULT/beacon.ogg"
|
|
3790
|
+
local vec3=farplocation:GetVec3()
|
|
3791
|
+
ADFName=Name.." ADF "..tostring(ADF).."KHz"
|
|
3792
|
+
trigger.action.radioTransmission(Sound,vec3,0,true,ADFFreq,250,ADFName)
|
|
3793
|
+
end
|
|
3794
|
+
return ReturnObjects,ADFName
|
|
3795
|
+
end
|
|
3664
3796
|
PROFILER={
|
|
3665
3797
|
ClassName="PROFILER",
|
|
3666
3798
|
Counters={},
|
|
@@ -5146,6 +5278,46 @@ initiator=PlayerUnit:GetDCSObject()
|
|
|
5146
5278
|
}
|
|
5147
5279
|
world.onEvent(Event)
|
|
5148
5280
|
end
|
|
5281
|
+
function BASE:CreateEventNewDynamicCargo(DynamicCargo)
|
|
5282
|
+
self:F({DynamicCargo})
|
|
5283
|
+
local Event={
|
|
5284
|
+
id=EVENTS.NewDynamicCargo,
|
|
5285
|
+
time=timer.getTime(),
|
|
5286
|
+
dynamiccargo=DynamicCargo,
|
|
5287
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
5288
|
+
}
|
|
5289
|
+
world.onEvent(Event)
|
|
5290
|
+
end
|
|
5291
|
+
function BASE:CreateEventDynamicCargoLoaded(DynamicCargo)
|
|
5292
|
+
self:F({DynamicCargo})
|
|
5293
|
+
local Event={
|
|
5294
|
+
id=EVENTS.DynamicCargoLoaded,
|
|
5295
|
+
time=timer.getTime(),
|
|
5296
|
+
dynamiccargo=DynamicCargo,
|
|
5297
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
5298
|
+
}
|
|
5299
|
+
world.onEvent(Event)
|
|
5300
|
+
end
|
|
5301
|
+
function BASE:CreateEventDynamicCargoUnloaded(DynamicCargo)
|
|
5302
|
+
self:F({DynamicCargo})
|
|
5303
|
+
local Event={
|
|
5304
|
+
id=EVENTS.DynamicCargoUnloaded,
|
|
5305
|
+
time=timer.getTime(),
|
|
5306
|
+
dynamiccargo=DynamicCargo,
|
|
5307
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
5308
|
+
}
|
|
5309
|
+
world.onEvent(Event)
|
|
5310
|
+
end
|
|
5311
|
+
function BASE:CreateEventDynamicCargoRemoved(DynamicCargo)
|
|
5312
|
+
self:F({DynamicCargo})
|
|
5313
|
+
local Event={
|
|
5314
|
+
id=EVENTS.DynamicCargoRemoved,
|
|
5315
|
+
time=timer.getTime(),
|
|
5316
|
+
dynamiccargo=DynamicCargo,
|
|
5317
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
5318
|
+
}
|
|
5319
|
+
world.onEvent(Event)
|
|
5320
|
+
end
|
|
5149
5321
|
function BASE:onEvent(event)
|
|
5150
5322
|
if self then
|
|
5151
5323
|
for EventID,EventObject in pairs(self.Events)do
|
|
@@ -6515,6 +6687,10 @@ world.event.S_EVENT_NEW_ZONE_GOAL=world.event.S_EVENT_MAX+1004
|
|
|
6515
6687
|
world.event.S_EVENT_DELETE_ZONE_GOAL=world.event.S_EVENT_MAX+1005
|
|
6516
6688
|
world.event.S_EVENT_REMOVE_UNIT=world.event.S_EVENT_MAX+1006
|
|
6517
6689
|
world.event.S_EVENT_PLAYER_ENTER_AIRCRAFT=world.event.S_EVENT_MAX+1007
|
|
6690
|
+
world.event.S_EVENT_NEW_DYNAMIC_CARGO=world.event.S_EVENT_MAX+1008
|
|
6691
|
+
world.event.S_EVENT_DYNAMIC_CARGO_LOADED=world.event.S_EVENT_MAX+1009
|
|
6692
|
+
world.event.S_EVENT_DYNAMIC_CARGO_UNLOADED=world.event.S_EVENT_MAX+1010
|
|
6693
|
+
world.event.S_EVENT_DYNAMIC_CARGO_REMOVED=world.event.S_EVENT_MAX+1011
|
|
6518
6694
|
EVENTS={
|
|
6519
6695
|
Shot=world.event.S_EVENT_SHOT,
|
|
6520
6696
|
Hit=world.event.S_EVENT_HIT,
|
|
@@ -6584,6 +6760,10 @@ SimulationFreeze=world.event.S_EVENT_SIMULATION_FREEZE or-1,
|
|
|
6584
6760
|
SimulationUnfreeze=world.event.S_EVENT_SIMULATION_UNFREEZE or-1,
|
|
6585
6761
|
HumanAircraftRepairStart=world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_START or-1,
|
|
6586
6762
|
HumanAircraftRepairFinish=world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH or-1,
|
|
6763
|
+
NewDynamicCargo=world.event.S_EVENT_NEW_DYNAMIC_CARGO or-1,
|
|
6764
|
+
DynamicCargoLoaded=world.event.S_EVENT_DYNAMIC_CARGO_LOADED or-1,
|
|
6765
|
+
DynamicCargoUnloaded=world.event.S_EVENT_DYNAMIC_CARGO_UNLOADED or-1,
|
|
6766
|
+
DynamicCargoRemoved=world.event.S_EVENT_DYNAMIC_CARGO_REMOVED or-1,
|
|
6587
6767
|
}
|
|
6588
6768
|
local _EVENTMETA={
|
|
6589
6769
|
[world.event.S_EVENT_SHOT]={
|
|
@@ -6963,6 +7143,30 @@ Side="I",
|
|
|
6963
7143
|
Event="OnEventHumanAircraftRepairFinish",
|
|
6964
7144
|
Text="S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH"
|
|
6965
7145
|
},
|
|
7146
|
+
[EVENTS.NewDynamicCargo]={
|
|
7147
|
+
Order=1,
|
|
7148
|
+
Side="I",
|
|
7149
|
+
Event="OnEventNewDynamicCargo",
|
|
7150
|
+
Text="S_EVENT_NEW_DYNAMIC_CARGO"
|
|
7151
|
+
},
|
|
7152
|
+
[EVENTS.DynamicCargoLoaded]={
|
|
7153
|
+
Order=1,
|
|
7154
|
+
Side="I",
|
|
7155
|
+
Event="OnEventDynamicCargoLoaded",
|
|
7156
|
+
Text="S_EVENT_DYNAMIC_CARGO_LOADED"
|
|
7157
|
+
},
|
|
7158
|
+
[EVENTS.DynamicCargoUnloaded]={
|
|
7159
|
+
Order=1,
|
|
7160
|
+
Side="I",
|
|
7161
|
+
Event="OnEventDynamicCargoUnloaded",
|
|
7162
|
+
Text="S_EVENT_DYNAMIC_CARGO_UNLOADED"
|
|
7163
|
+
},
|
|
7164
|
+
[EVENTS.DynamicCargoRemoved]={
|
|
7165
|
+
Order=1,
|
|
7166
|
+
Side="I",
|
|
7167
|
+
Event="OnEventDynamicCargoRemoved",
|
|
7168
|
+
Text="S_EVENT_DYNAMIC_CARGO_REMOVED"
|
|
7169
|
+
},
|
|
6966
7170
|
}
|
|
6967
7171
|
function EVENT:New()
|
|
6968
7172
|
local self=BASE:Inherit(self,BASE:New())
|
|
@@ -7157,6 +7361,46 @@ initiator=PlayerUnit:GetDCSObject()
|
|
|
7157
7361
|
}
|
|
7158
7362
|
world.onEvent(Event)
|
|
7159
7363
|
end
|
|
7364
|
+
function EVENT:CreateEventNewDynamicCargo(DynamicCargo)
|
|
7365
|
+
self:F({DynamicCargo})
|
|
7366
|
+
local Event={
|
|
7367
|
+
id=EVENTS.NewDynamicCargo,
|
|
7368
|
+
time=timer.getTime(),
|
|
7369
|
+
dynamiccargo=DynamicCargo,
|
|
7370
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
7371
|
+
}
|
|
7372
|
+
world.onEvent(Event)
|
|
7373
|
+
end
|
|
7374
|
+
function EVENT:CreateEventDynamicCargoLoaded(DynamicCargo)
|
|
7375
|
+
self:F({DynamicCargo})
|
|
7376
|
+
local Event={
|
|
7377
|
+
id=EVENTS.DynamicCargoLoaded,
|
|
7378
|
+
time=timer.getTime(),
|
|
7379
|
+
dynamiccargo=DynamicCargo,
|
|
7380
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
7381
|
+
}
|
|
7382
|
+
world.onEvent(Event)
|
|
7383
|
+
end
|
|
7384
|
+
function EVENT:CreateEventDynamicCargoUnloaded(DynamicCargo)
|
|
7385
|
+
self:F({DynamicCargo})
|
|
7386
|
+
local Event={
|
|
7387
|
+
id=EVENTS.DynamicCargoUnloaded,
|
|
7388
|
+
time=timer.getTime(),
|
|
7389
|
+
dynamiccargo=DynamicCargo,
|
|
7390
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
7391
|
+
}
|
|
7392
|
+
world.onEvent(Event)
|
|
7393
|
+
end
|
|
7394
|
+
function EVENT:CreateEventDynamicCargoRemoved(DynamicCargo)
|
|
7395
|
+
self:F({DynamicCargo})
|
|
7396
|
+
local Event={
|
|
7397
|
+
id=EVENTS.DynamicCargoRemoved,
|
|
7398
|
+
time=timer.getTime(),
|
|
7399
|
+
dynamiccargo=DynamicCargo,
|
|
7400
|
+
initiator=DynamicCargo:GetDCSObject(),
|
|
7401
|
+
}
|
|
7402
|
+
world.onEvent(Event)
|
|
7403
|
+
end
|
|
7160
7404
|
end
|
|
7161
7405
|
function EVENT:onEvent(Event)
|
|
7162
7406
|
local ErrorHandler=function(errmsg)
|
|
@@ -7233,7 +7477,13 @@ elseif Event.IniObjectCategory==Object.Category.CARGO then
|
|
|
7233
7477
|
Event.IniDCSUnit=Event.initiator
|
|
7234
7478
|
Event.IniDCSUnitName=Event.IniDCSUnit:getName()
|
|
7235
7479
|
Event.IniUnitName=Event.IniDCSUnitName
|
|
7480
|
+
if string.match(Event.IniUnitName,".+|%d%d:%d%d|PKG%d+")then
|
|
7481
|
+
Event.IniDynamicCargo=DYNAMICCARGO:FindByName(Event.IniUnitName)
|
|
7482
|
+
Event.IniDynamicCargoName=Event.IniUnitName
|
|
7483
|
+
Event.IniPlayerName=string.match(Event.IniUnitName,"^(.+)|%d%d:%d%d|PKG%d+")
|
|
7484
|
+
else
|
|
7236
7485
|
Event.IniUnit=CARGO:FindByName(Event.IniDCSUnitName)
|
|
7486
|
+
end
|
|
7237
7487
|
Event.IniCoalition=Event.IniDCSUnit:getCoalition()
|
|
7238
7488
|
Event.IniCategory=Event.IniDCSUnit:getDesc().category
|
|
7239
7489
|
Event.IniTypeName=Event.IniDCSUnit:getTypeName()
|
|
@@ -7320,7 +7570,7 @@ Event.TgtCategory=Event.TgtDCSUnit:getDesc().category
|
|
|
7320
7570
|
Event.TgtTypeName=Event.TgtDCSUnit:getTypeName()
|
|
7321
7571
|
end
|
|
7322
7572
|
end
|
|
7323
|
-
if Event.weapon and type(Event.weapon)=="table"then
|
|
7573
|
+
if Event.weapon and type(Event.weapon)=="table"and Event.weapon.isExist and Event.weapon:isExist()then
|
|
7324
7574
|
Event.Weapon=Event.weapon
|
|
7325
7575
|
Event.WeaponName=Event.weapon:isExist()and Event.weapon:getTypeName()or"Unknown Weapon"
|
|
7326
7576
|
Event.WeaponUNIT=CLIENT:Find(Event.Weapon,'',true)
|
|
@@ -7351,6 +7601,13 @@ if Event.cargo then
|
|
|
7351
7601
|
Event.Cargo=Event.cargo
|
|
7352
7602
|
Event.CargoName=Event.cargo.Name
|
|
7353
7603
|
end
|
|
7604
|
+
if Event.dynamiccargo then
|
|
7605
|
+
Event.IniDynamicCargo=Event.dynamiccargo
|
|
7606
|
+
Event.IniDynamicCargoName=Event.IniDynamicCargo.StaticName
|
|
7607
|
+
if Event.IniDynamicCargo.Owner or Event.IniUnitName then
|
|
7608
|
+
Event.IniPlayerName=Event.IniDynamicCargo.Owner or string.match(Event.IniUnitName or"None|00:00|PKG00","^(.+)|%d%d:%d%d|PKG%d+")
|
|
7609
|
+
end
|
|
7610
|
+
end
|
|
7354
7611
|
if Event.zone then
|
|
7355
7612
|
Event.Zone=Event.zone
|
|
7356
7613
|
Event.ZoneName=Event.zone.ZoneName
|
|
@@ -10790,6 +11047,7 @@ PATHLINES={},
|
|
|
10790
11047
|
STORAGES={},
|
|
10791
11048
|
STNS={},
|
|
10792
11049
|
SADL={},
|
|
11050
|
+
DYNAMICCARGO={},
|
|
10793
11051
|
}
|
|
10794
11052
|
local _DATABASECoalition=
|
|
10795
11053
|
{
|
|
@@ -10820,6 +11078,7 @@ self:HandleEvent(EVENTS.DeleteCargo)
|
|
|
10820
11078
|
self:HandleEvent(EVENTS.NewZone)
|
|
10821
11079
|
self:HandleEvent(EVENTS.DeleteZone)
|
|
10822
11080
|
self:HandleEvent(EVENTS.PlayerLeaveUnit,self._EventOnPlayerLeaveUnit)
|
|
11081
|
+
self:HandleEvent(EVENTS.DynamicCargoRemoved,self._EventOnDynamicCargoRemoved)
|
|
10823
11082
|
self:_RegisterTemplates()
|
|
10824
11083
|
self:_RegisterGroupsAndUnits()
|
|
10825
11084
|
self:_RegisterClients()
|
|
@@ -10832,11 +11091,13 @@ local UnitFound=self.UNITS[UnitName]
|
|
|
10832
11091
|
return UnitFound
|
|
10833
11092
|
end
|
|
10834
11093
|
function DATABASE:AddUnit(DCSUnitName,force)
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
self.UNITS[
|
|
11094
|
+
local DCSunitName=DCSUnitName
|
|
11095
|
+
if type(DCSunitName)=="number"then DCSunitName=string.format("%d",DCSUnitName)end
|
|
11096
|
+
if not self.UNITS[DCSunitName]or force==true then
|
|
11097
|
+
self:T({"Add UNIT:",DCSunitName})
|
|
11098
|
+
self.UNITS[DCSunitName]=UNIT:Register(DCSunitName)
|
|
10838
11099
|
end
|
|
10839
|
-
return self.UNITS[
|
|
11100
|
+
return self.UNITS[DCSunitName]
|
|
10840
11101
|
end
|
|
10841
11102
|
function DATABASE:DeleteUnit(DCSUnitName)
|
|
10842
11103
|
self:T("DeleteUnit "..tostring(DCSUnitName))
|
|
@@ -10856,6 +11117,21 @@ function DATABASE:FindStatic(StaticName)
|
|
|
10856
11117
|
local StaticFound=self.STATICS[StaticName]
|
|
10857
11118
|
return StaticFound
|
|
10858
11119
|
end
|
|
11120
|
+
function DATABASE:AddDynamicCargo(Name)
|
|
11121
|
+
if not self.DYNAMICCARGO[Name]then
|
|
11122
|
+
self.DYNAMICCARGO[Name]=DYNAMICCARGO:Register(Name)
|
|
11123
|
+
return self.DYNAMICCARGO[Name]
|
|
11124
|
+
end
|
|
11125
|
+
return nil
|
|
11126
|
+
end
|
|
11127
|
+
function DATABASE:FindDynamicCargo(DynamicCargoName)
|
|
11128
|
+
local StaticFound=self.DYNAMICCARGO[DynamicCargoName]
|
|
11129
|
+
return StaticFound
|
|
11130
|
+
end
|
|
11131
|
+
function DATABASE:DeleteDynamicCargo(DynamicCargoName)
|
|
11132
|
+
self.DYNAMICCARGO[DynamicCargoName]=nil
|
|
11133
|
+
return self
|
|
11134
|
+
end
|
|
10859
11135
|
function DATABASE:AddAirbase(AirbaseName)
|
|
10860
11136
|
if not self.AIRBASES[AirbaseName]then
|
|
10861
11137
|
self.AIRBASES[AirbaseName]=AIRBASE:Register(AirbaseName)
|
|
@@ -11124,10 +11400,12 @@ local ClientFound=self.CLIENTS[ClientName]
|
|
|
11124
11400
|
return ClientFound
|
|
11125
11401
|
end
|
|
11126
11402
|
function DATABASE:AddClient(ClientName,Force)
|
|
11127
|
-
|
|
11128
|
-
|
|
11403
|
+
local DCSUnitName=ClientName
|
|
11404
|
+
if type(DCSUnitName)=="number"then DCSUnitName=string.format("%d",ClientName)end
|
|
11405
|
+
if not self.CLIENTS[DCSUnitName]or Force==true then
|
|
11406
|
+
self.CLIENTS[DCSUnitName]=CLIENT:Register(DCSUnitName)
|
|
11129
11407
|
end
|
|
11130
|
-
return self.CLIENTS[
|
|
11408
|
+
return self.CLIENTS[DCSUnitName]
|
|
11131
11409
|
end
|
|
11132
11410
|
function DATABASE:FindGroup(GroupName)
|
|
11133
11411
|
local GroupFound=self.GROUPS[GroupName]
|
|
@@ -11145,13 +11423,24 @@ end
|
|
|
11145
11423
|
return self.GROUPS[GroupName]
|
|
11146
11424
|
end
|
|
11147
11425
|
function DATABASE:AddPlayer(UnitName,PlayerName)
|
|
11426
|
+
if type(UnitName)=="number"then UnitName=string.format("%d",UnitName)end
|
|
11148
11427
|
if PlayerName then
|
|
11149
|
-
self:
|
|
11428
|
+
self:I({"Add player for unit:",UnitName,PlayerName})
|
|
11150
11429
|
self.PLAYERS[PlayerName]=UnitName
|
|
11151
11430
|
self.PLAYERUNITS[PlayerName]=self:FindUnit(UnitName)
|
|
11152
11431
|
self.PLAYERSJOINED[PlayerName]=PlayerName
|
|
11153
11432
|
end
|
|
11154
11433
|
end
|
|
11434
|
+
function DATABASE:_FindPlayerNameByUnitName(UnitName)
|
|
11435
|
+
if UnitName then
|
|
11436
|
+
for playername,unitname in pairs(self.PLAYERS)do
|
|
11437
|
+
if unitname==UnitName and self.PLAYERUNITS[playername]and self.PLAYERUNITS[playername]:IsAlive()then
|
|
11438
|
+
return playername,self.PLAYERUNITS[playername]
|
|
11439
|
+
end
|
|
11440
|
+
end
|
|
11441
|
+
end
|
|
11442
|
+
return nil
|
|
11443
|
+
end
|
|
11155
11444
|
function DATABASE:DeletePlayer(UnitName,PlayerName)
|
|
11156
11445
|
if PlayerName then
|
|
11157
11446
|
self:T({"Clean player:",PlayerName})
|
|
@@ -11388,7 +11677,6 @@ resourcePayload={
|
|
|
11388
11677
|
StaticTemplate.CategoryID="static"
|
|
11389
11678
|
StaticTemplate.CoalitionID=Coalition or coalition.side.BLUE
|
|
11390
11679
|
StaticTemplate.CountryID=Country or country.id.GERMANY
|
|
11391
|
-
UTILS.PrintTableToLog(StaticTemplate)
|
|
11392
11680
|
return StaticTemplate
|
|
11393
11681
|
end
|
|
11394
11682
|
function DATABASE:GetStaticGroupTemplate(StaticName)
|
|
@@ -11437,21 +11725,21 @@ function DATABASE:GetCoalitionFromClientTemplate(ClientName)
|
|
|
11437
11725
|
if self.Templates.ClientsByName[ClientName]then
|
|
11438
11726
|
return self.Templates.ClientsByName[ClientName].CoalitionID
|
|
11439
11727
|
end
|
|
11440
|
-
self:E("
|
|
11728
|
+
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
|
11441
11729
|
return nil
|
|
11442
11730
|
end
|
|
11443
11731
|
function DATABASE:GetCategoryFromClientTemplate(ClientName)
|
|
11444
11732
|
if self.Templates.ClientsByName[ClientName]then
|
|
11445
11733
|
return self.Templates.ClientsByName[ClientName].CategoryID
|
|
11446
11734
|
end
|
|
11447
|
-
self:E("
|
|
11735
|
+
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
|
11448
11736
|
return nil
|
|
11449
11737
|
end
|
|
11450
11738
|
function DATABASE:GetCountryFromClientTemplate(ClientName)
|
|
11451
11739
|
if self.Templates.ClientsByName[ClientName]then
|
|
11452
11740
|
return self.Templates.ClientsByName[ClientName].CountryID
|
|
11453
11741
|
end
|
|
11454
|
-
self:E("
|
|
11742
|
+
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
|
11455
11743
|
return nil
|
|
11456
11744
|
end
|
|
11457
11745
|
function DATABASE:GetCoalitionFromAirbase(AirbaseName)
|
|
@@ -11486,7 +11774,7 @@ self:AddGroup(DCSGroupName,true)
|
|
|
11486
11774
|
for DCSUnitId,DCSUnit in pairs(DCSGroup:getUnits())do
|
|
11487
11775
|
local DCSUnitName=DCSUnit:getName()
|
|
11488
11776
|
self:I(string.format("Register Unit: %s",tostring(DCSUnitName)))
|
|
11489
|
-
self:AddUnit(DCSUnitName,true)
|
|
11777
|
+
self:AddUnit(tostring(DCSUnitName),true)
|
|
11490
11778
|
end
|
|
11491
11779
|
else
|
|
11492
11780
|
self:E({"Group does not exist: ",DCSGroup})
|
|
@@ -11565,10 +11853,14 @@ end
|
|
|
11565
11853
|
return self
|
|
11566
11854
|
end
|
|
11567
11855
|
function DATABASE:_EventOnBirth(Event)
|
|
11568
|
-
self:
|
|
11856
|
+
self:T({Event})
|
|
11569
11857
|
if Event.IniDCSUnit then
|
|
11570
11858
|
if Event.IniObjectCategory==Object.Category.STATIC then
|
|
11571
11859
|
self:AddStatic(Event.IniDCSUnitName)
|
|
11860
|
+
elseif Event.IniObjectCategory==Object.Category.CARGO and string.match(Event.IniUnitName,".+|%d%d:%d%d|PKG%d+")then
|
|
11861
|
+
local cargo=self:AddDynamicCargo(Event.IniDCSUnitName)
|
|
11862
|
+
self:I(string.format("Adding dynamic cargo %s",tostring(Event.IniDCSUnitName)))
|
|
11863
|
+
self:CreateEventNewDynamicCargo(cargo)
|
|
11572
11864
|
else
|
|
11573
11865
|
if Event.IniObjectCategory==Object.Category.UNIT then
|
|
11574
11866
|
self:AddUnit(Event.IniDCSUnitName)
|
|
@@ -11660,6 +11952,12 @@ end
|
|
|
11660
11952
|
end
|
|
11661
11953
|
end
|
|
11662
11954
|
end
|
|
11955
|
+
function DATABASE:_EventOnDynamicCargoRemoved(Event)
|
|
11956
|
+
self:T({Event})
|
|
11957
|
+
if Event.IniDynamicCargoName then
|
|
11958
|
+
self:DeleteDynamicCargo(Event.IniDynamicCargoName)
|
|
11959
|
+
end
|
|
11960
|
+
end
|
|
11663
11961
|
function DATABASE:_EventOnPlayerLeaveUnit(Event)
|
|
11664
11962
|
self:F2({Event})
|
|
11665
11963
|
local function FindPlayerName(UnitName)
|
|
@@ -11950,8 +12248,6 @@ List={},
|
|
|
11950
12248
|
Index={},
|
|
11951
12249
|
Database=nil,
|
|
11952
12250
|
CallScheduler=nil,
|
|
11953
|
-
TimeInterval=nil,
|
|
11954
|
-
YieldInterval=nil,
|
|
11955
12251
|
}
|
|
11956
12252
|
function SET_BASE:New(Database)
|
|
11957
12253
|
local self=BASE:Inherit(self,FSM:New())
|
|
@@ -11998,11 +12294,9 @@ local ObjectFound=self.Set[ObjectName]
|
|
|
11998
12294
|
return ObjectFound
|
|
11999
12295
|
end
|
|
12000
12296
|
function SET_BASE:GetSet()
|
|
12001
|
-
self:F2()
|
|
12002
12297
|
return self.Set or{}
|
|
12003
12298
|
end
|
|
12004
12299
|
function SET_BASE:GetSetNames()
|
|
12005
|
-
self:F2()
|
|
12006
12300
|
local Names={}
|
|
12007
12301
|
for Name,Object in pairs(self.Set)do
|
|
12008
12302
|
table.insert(Names,Name)
|
|
@@ -12010,7 +12304,6 @@ end
|
|
|
12010
12304
|
return Names
|
|
12011
12305
|
end
|
|
12012
12306
|
function SET_BASE:GetSetObjects()
|
|
12013
|
-
self:F2()
|
|
12014
12307
|
local Objects={}
|
|
12015
12308
|
for Name,Object in pairs(self.Set)do
|
|
12016
12309
|
table.insert(Objects,Object)
|
|
@@ -12018,7 +12311,6 @@ end
|
|
|
12018
12311
|
return Objects
|
|
12019
12312
|
end
|
|
12020
12313
|
function SET_BASE:Remove(ObjectName,NoTriggerEvent)
|
|
12021
|
-
self:F2({ObjectName=ObjectName})
|
|
12022
12314
|
local TriggerEvent=true
|
|
12023
12315
|
if NoTriggerEvent then
|
|
12024
12316
|
TriggerEvent=false
|
|
@@ -12040,7 +12332,6 @@ end
|
|
|
12040
12332
|
end
|
|
12041
12333
|
end
|
|
12042
12334
|
function SET_BASE:Add(ObjectName,Object)
|
|
12043
|
-
self:T2({ObjectName=ObjectName,Object=Object})
|
|
12044
12335
|
if self.Set[ObjectName]then
|
|
12045
12336
|
self:Remove(ObjectName,true)
|
|
12046
12337
|
end
|
|
@@ -12050,9 +12341,6 @@ self:Added(ObjectName,Object)
|
|
|
12050
12341
|
return self
|
|
12051
12342
|
end
|
|
12052
12343
|
function SET_BASE:AddObject(Object)
|
|
12053
|
-
self:F2(Object.ObjectName)
|
|
12054
|
-
self:T(Object.UnitName)
|
|
12055
|
-
self:T(Object.ObjectName)
|
|
12056
12344
|
self:Add(Object.ObjectName,Object)
|
|
12057
12345
|
end
|
|
12058
12346
|
function SET_BASE:SortByName()
|
|
@@ -12105,22 +12393,18 @@ end
|
|
|
12105
12393
|
return SetA
|
|
12106
12394
|
end
|
|
12107
12395
|
function SET_BASE:Get(ObjectName)
|
|
12108
|
-
self:F(ObjectName)
|
|
12109
12396
|
local Object=self.Set[ObjectName]
|
|
12110
|
-
self:T3({ObjectName,Object})
|
|
12111
12397
|
return Object
|
|
12112
12398
|
end
|
|
12113
12399
|
function SET_BASE:GetFirst()
|
|
12114
12400
|
local ObjectName=self.Index[1]
|
|
12115
12401
|
local FirstObject=self.Set[ObjectName]
|
|
12116
|
-
self:T3({FirstObject})
|
|
12117
12402
|
return FirstObject
|
|
12118
12403
|
end
|
|
12119
12404
|
function SET_BASE:GetLast()
|
|
12120
12405
|
local tablemax=table.maxn(self.Index)
|
|
12121
12406
|
local ObjectName=self.Index[tablemax]
|
|
12122
12407
|
local LastObject=self.Set[ObjectName]
|
|
12123
|
-
self:T3({LastObject})
|
|
12124
12408
|
return LastObject
|
|
12125
12409
|
end
|
|
12126
12410
|
function SET_BASE:GetRandom()
|
|
@@ -12129,7 +12413,6 @@ for _,_ind in pairs(self.Index)do
|
|
|
12129
12413
|
tablemax=tablemax+1
|
|
12130
12414
|
end
|
|
12131
12415
|
local RandomItem=self.Set[self.Index[math.random(1,tablemax)]]
|
|
12132
|
-
self:T3({RandomItem})
|
|
12133
12416
|
return RandomItem
|
|
12134
12417
|
end
|
|
12135
12418
|
function SET_BASE:GetRandomSurely()
|
|
@@ -12140,7 +12423,6 @@ tablemax=tablemax+1
|
|
|
12140
12423
|
sorted[tablemax]=_obj
|
|
12141
12424
|
end
|
|
12142
12425
|
local RandomItem=sorted[math.random(1,tablemax)]
|
|
12143
|
-
self:T3({RandomItem})
|
|
12144
12426
|
return RandomItem
|
|
12145
12427
|
end
|
|
12146
12428
|
function SET_BASE:Count()
|
|
@@ -12152,11 +12434,6 @@ self.Filter=OtherFilter
|
|
|
12152
12434
|
self.Database=BaseSet:GetSet()
|
|
12153
12435
|
return self
|
|
12154
12436
|
end
|
|
12155
|
-
function SET_BASE:SetIteratorIntervals(YieldInterval,TimeInterval)
|
|
12156
|
-
self.YieldInterval=YieldInterval
|
|
12157
|
-
self.TimeInterval=TimeInterval
|
|
12158
|
-
return self
|
|
12159
|
-
end
|
|
12160
12437
|
function SET_BASE:SetSomeIteratorLimit(Limit)
|
|
12161
12438
|
self.SomeIteratorLimit=Limit or 1
|
|
12162
12439
|
return self
|
|
@@ -12203,7 +12480,6 @@ self:UnHandleEvent(EVENTS.Crash)
|
|
|
12203
12480
|
return self
|
|
12204
12481
|
end
|
|
12205
12482
|
function SET_BASE:FindNearestObjectFromPointVec2(PointVec2)
|
|
12206
|
-
self:F2(PointVec2)
|
|
12207
12483
|
local NearestObject=nil
|
|
12208
12484
|
local ClosestDistance=nil
|
|
12209
12485
|
for ObjectID,ObjectData in pairs(self.Set)do
|
|
@@ -12221,17 +12497,14 @@ end
|
|
|
12221
12497
|
return NearestObject
|
|
12222
12498
|
end
|
|
12223
12499
|
function SET_BASE:_EventOnBirth(Event)
|
|
12224
|
-
self:F3({Event})
|
|
12225
12500
|
if Event.IniDCSUnit then
|
|
12226
12501
|
local ObjectName,Object=self:AddInDatabase(Event)
|
|
12227
|
-
self:T3(ObjectName,Object)
|
|
12228
12502
|
if Object and self:IsIncludeObject(Object)then
|
|
12229
12503
|
self:Add(ObjectName,Object)
|
|
12230
12504
|
end
|
|
12231
12505
|
end
|
|
12232
12506
|
end
|
|
12233
12507
|
function SET_BASE:_EventOnDeadOrCrash(Event)
|
|
12234
|
-
self:F({Event})
|
|
12235
12508
|
if Event.IniDCSUnit then
|
|
12236
12509
|
local ObjectName,Object=self:FindInDatabase(Event)
|
|
12237
12510
|
if ObjectName then
|
|
@@ -12240,14 +12513,12 @@ end
|
|
|
12240
12513
|
end
|
|
12241
12514
|
end
|
|
12242
12515
|
function SET_BASE:ForEach(IteratorFunction,arg,Set,Function,FunctionArguments)
|
|
12243
|
-
self:F3(arg)
|
|
12244
12516
|
Set=Set or self:GetSet()
|
|
12245
12517
|
arg=arg or{}
|
|
12246
12518
|
local function CoRoutine()
|
|
12247
12519
|
local Count=0
|
|
12248
12520
|
for ObjectID,ObjectData in pairs(Set)do
|
|
12249
12521
|
local Object=ObjectData
|
|
12250
|
-
self:T3(Object)
|
|
12251
12522
|
if Function then
|
|
12252
12523
|
if Function(unpack(FunctionArguments or{}),Object)==true then
|
|
12253
12524
|
IteratorFunction(Object,unpack(arg))
|
|
@@ -12262,7 +12533,6 @@ end
|
|
|
12262
12533
|
local co=CoRoutine
|
|
12263
12534
|
local function Schedule()
|
|
12264
12535
|
local status,res=co()
|
|
12265
|
-
self:T3({status,res})
|
|
12266
12536
|
if status==false then
|
|
12267
12537
|
error(res)
|
|
12268
12538
|
end
|
|
@@ -12275,7 +12545,6 @@ Schedule()
|
|
|
12275
12545
|
return self
|
|
12276
12546
|
end
|
|
12277
12547
|
function SET_BASE:ForSome(IteratorFunction,arg,Set,Function,FunctionArguments)
|
|
12278
|
-
self:F3(arg)
|
|
12279
12548
|
Set=Set or self:GetSet()
|
|
12280
12549
|
arg=arg or{}
|
|
12281
12550
|
local Limit=self:GetSomeIteratorLimit()
|
|
@@ -12283,7 +12552,6 @@ local function CoRoutine()
|
|
|
12283
12552
|
local Count=0
|
|
12284
12553
|
for ObjectID,ObjectData in pairs(Set)do
|
|
12285
12554
|
local Object=ObjectData
|
|
12286
|
-
self:T3(Object)
|
|
12287
12555
|
if Function then
|
|
12288
12556
|
if Function(unpack(FunctionArguments),Object)==true then
|
|
12289
12557
|
IteratorFunction(Object,unpack(arg))
|
|
@@ -12301,7 +12569,6 @@ end
|
|
|
12301
12569
|
local co=CoRoutine
|
|
12302
12570
|
local function Schedule()
|
|
12303
12571
|
local status,res=co()
|
|
12304
|
-
self:T3({status,res})
|
|
12305
12572
|
if status==false then
|
|
12306
12573
|
error(res)
|
|
12307
12574
|
end
|
|
@@ -12314,11 +12581,9 @@ Schedule()
|
|
|
12314
12581
|
return self
|
|
12315
12582
|
end
|
|
12316
12583
|
function SET_BASE:IsIncludeObject(Object)
|
|
12317
|
-
self:F3(Object)
|
|
12318
12584
|
return true
|
|
12319
12585
|
end
|
|
12320
12586
|
function SET_BASE:IsInSet(Object)
|
|
12321
|
-
self:F3(Object)
|
|
12322
12587
|
local outcome=false
|
|
12323
12588
|
local name=Object:GetName()
|
|
12324
12589
|
self:ForEach(
|
|
@@ -12331,11 +12596,9 @@ end
|
|
|
12331
12596
|
return outcome
|
|
12332
12597
|
end
|
|
12333
12598
|
function SET_BASE:IsNotInSet(Object)
|
|
12334
|
-
self:F3(Object)
|
|
12335
12599
|
return not self:IsInSet(Object)
|
|
12336
12600
|
end
|
|
12337
12601
|
function SET_BASE:GetObjectNames()
|
|
12338
|
-
self:F3()
|
|
12339
12602
|
local ObjectNames=""
|
|
12340
12603
|
for ObjectName,Object in pairs(self.Set)do
|
|
12341
12604
|
ObjectNames=ObjectNames..ObjectName..", "
|
|
@@ -12343,12 +12606,10 @@ end
|
|
|
12343
12606
|
return ObjectNames
|
|
12344
12607
|
end
|
|
12345
12608
|
function SET_BASE:Flush(MasterObject)
|
|
12346
|
-
self:F3()
|
|
12347
12609
|
local ObjectNames=""
|
|
12348
12610
|
for ObjectName,Object in pairs(self.Set)do
|
|
12349
12611
|
ObjectNames=ObjectNames..ObjectName..", "
|
|
12350
12612
|
end
|
|
12351
|
-
self:F({MasterObject=MasterObject and MasterObject:GetClassNameAndID(),"Objects in Set:",ObjectNames})
|
|
12352
12613
|
return ObjectNames
|
|
12353
12614
|
end
|
|
12354
12615
|
end
|
|
@@ -12385,7 +12646,6 @@ self:FilterActive(false)
|
|
|
12385
12646
|
return self
|
|
12386
12647
|
end
|
|
12387
12648
|
function SET_GROUP:GetAliveSet()
|
|
12388
|
-
self:F2()
|
|
12389
12649
|
local AliveSet=SET_GROUP:New()
|
|
12390
12650
|
for GroupName,GroupObject in pairs(self.Set)do
|
|
12391
12651
|
local GroupObject=GroupObject
|
|
@@ -12398,7 +12658,6 @@ end
|
|
|
12398
12658
|
return AliveSet.Set or{}
|
|
12399
12659
|
end
|
|
12400
12660
|
function SET_GROUP:GetUnitTypeNames()
|
|
12401
|
-
self:F2()
|
|
12402
12661
|
local MT={}
|
|
12403
12662
|
local UnitTypes={}
|
|
12404
12663
|
local ReportUnitTypes=REPORT:New()
|
|
@@ -12450,7 +12709,6 @@ local GroupFound=self.Set[GroupName]
|
|
|
12450
12709
|
return GroupFound
|
|
12451
12710
|
end
|
|
12452
12711
|
function SET_GROUP:FindNearestGroupFromPointVec2(PointVec2)
|
|
12453
|
-
self:F2(PointVec2)
|
|
12454
12712
|
local NearestGroup=nil
|
|
12455
12713
|
local ClosestDistance=nil
|
|
12456
12714
|
local Set=self:GetAliveSet()
|
|
@@ -12608,7 +12866,6 @@ end
|
|
|
12608
12866
|
return self
|
|
12609
12867
|
end
|
|
12610
12868
|
function SET_GROUP:_EventOnDeadOrCrash(Event)
|
|
12611
|
-
self:F({Event})
|
|
12612
12869
|
if Event.IniDCSUnit then
|
|
12613
12870
|
local ObjectName,Object=self:FindInDatabase(Event)
|
|
12614
12871
|
if ObjectName then
|
|
@@ -12623,36 +12880,29 @@ end
|
|
|
12623
12880
|
end
|
|
12624
12881
|
end
|
|
12625
12882
|
function SET_GROUP:AddInDatabase(Event)
|
|
12626
|
-
self:F3({Event})
|
|
12627
12883
|
if Event.IniObjectCategory==Object.Category.UNIT then
|
|
12628
12884
|
if not self.Database[Event.IniDCSGroupName]then
|
|
12629
12885
|
self.Database[Event.IniDCSGroupName]=GROUP:Register(Event.IniDCSGroupName)
|
|
12630
|
-
self:T3(self.Database[Event.IniDCSGroupName])
|
|
12631
12886
|
end
|
|
12632
12887
|
end
|
|
12633
12888
|
return Event.IniDCSGroupName,self.Database[Event.IniDCSGroupName]
|
|
12634
12889
|
end
|
|
12635
12890
|
function SET_GROUP:FindInDatabase(Event)
|
|
12636
|
-
self:F3({Event})
|
|
12637
12891
|
return Event.IniDCSGroupName,self.Database[Event.IniDCSGroupName]
|
|
12638
12892
|
end
|
|
12639
12893
|
function SET_GROUP:ForEachGroup(IteratorFunction,...)
|
|
12640
|
-
self:F2(arg)
|
|
12641
12894
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
12642
12895
|
return self
|
|
12643
12896
|
end
|
|
12644
12897
|
function SET_GROUP:ForSomeGroup(IteratorFunction,...)
|
|
12645
|
-
self:F2(arg)
|
|
12646
12898
|
self:ForSome(IteratorFunction,arg,self:GetSet())
|
|
12647
12899
|
return self
|
|
12648
12900
|
end
|
|
12649
12901
|
function SET_GROUP:ForEachGroupAlive(IteratorFunction,...)
|
|
12650
|
-
self:F2(arg)
|
|
12651
12902
|
self:ForEach(IteratorFunction,arg,self:GetAliveSet())
|
|
12652
12903
|
return self
|
|
12653
12904
|
end
|
|
12654
12905
|
function SET_GROUP:ForSomeGroupAlive(IteratorFunction,...)
|
|
12655
|
-
self:F2(arg)
|
|
12656
12906
|
self:ForSome(IteratorFunction,arg,self:GetAliveSet())
|
|
12657
12907
|
return self
|
|
12658
12908
|
end
|
|
@@ -12667,7 +12917,6 @@ end
|
|
|
12667
12917
|
return self
|
|
12668
12918
|
end
|
|
12669
12919
|
function SET_GROUP:ForEachGroupCompletelyInZone(ZoneObject,IteratorFunction,...)
|
|
12670
|
-
self:F2(arg)
|
|
12671
12920
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
12672
12921
|
function(ZoneObject,GroupObject)
|
|
12673
12922
|
if GroupObject:IsCompletelyInZone(ZoneObject)then
|
|
@@ -12679,7 +12928,6 @@ end,{ZoneObject})
|
|
|
12679
12928
|
return self
|
|
12680
12929
|
end
|
|
12681
12930
|
function SET_GROUP:ForEachGroupPartlyInZone(ZoneObject,IteratorFunction,...)
|
|
12682
|
-
self:F2(arg)
|
|
12683
12931
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
12684
12932
|
function(ZoneObject,GroupObject)
|
|
12685
12933
|
if GroupObject:IsPartlyInZone(ZoneObject)then
|
|
@@ -12691,7 +12939,6 @@ end,{ZoneObject})
|
|
|
12691
12939
|
return self
|
|
12692
12940
|
end
|
|
12693
12941
|
function SET_GROUP:ForEachGroupNotInZone(ZoneObject,IteratorFunction,...)
|
|
12694
|
-
self:F2(arg)
|
|
12695
12942
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
12696
12943
|
function(ZoneObject,GroupObject)
|
|
12697
12944
|
if GroupObject:IsNotInZone(ZoneObject)then
|
|
@@ -12703,7 +12950,6 @@ end,{ZoneObject})
|
|
|
12703
12950
|
return self
|
|
12704
12951
|
end
|
|
12705
12952
|
function SET_GROUP:AllCompletelyInZone(Zone)
|
|
12706
|
-
self:F2(Zone)
|
|
12707
12953
|
local Set=self:GetSet()
|
|
12708
12954
|
for GroupID,GroupData in pairs(Set)do
|
|
12709
12955
|
if not GroupData:IsCompletelyInZone(Zone)then
|
|
@@ -12713,7 +12959,6 @@ end
|
|
|
12713
12959
|
return true
|
|
12714
12960
|
end
|
|
12715
12961
|
function SET_GROUP:ForEachGroupAnyInZone(ZoneObject,IteratorFunction,...)
|
|
12716
|
-
self:F2(arg)
|
|
12717
12962
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
12718
12963
|
function(ZoneObject,GroupObject)
|
|
12719
12964
|
if GroupObject:IsAnyInZone(ZoneObject)then
|
|
@@ -12725,7 +12970,6 @@ end,{ZoneObject})
|
|
|
12725
12970
|
return self
|
|
12726
12971
|
end
|
|
12727
12972
|
function SET_GROUP:AnyCompletelyInZone(Zone)
|
|
12728
|
-
self:F2(Zone)
|
|
12729
12973
|
local Set=self:GetSet()
|
|
12730
12974
|
for GroupID,GroupData in pairs(Set)do
|
|
12731
12975
|
if GroupData:IsCompletelyInZone(Zone)then
|
|
@@ -12735,7 +12979,6 @@ end
|
|
|
12735
12979
|
return false
|
|
12736
12980
|
end
|
|
12737
12981
|
function SET_GROUP:AnyInZone(Zone)
|
|
12738
|
-
self:F2(Zone)
|
|
12739
12982
|
local Set=self:GetSet()
|
|
12740
12983
|
for GroupID,GroupData in pairs(Set)do
|
|
12741
12984
|
if GroupData:IsPartlyInZone(Zone)or GroupData:IsCompletelyInZone(Zone)then
|
|
@@ -12745,7 +12988,6 @@ end
|
|
|
12745
12988
|
return false
|
|
12746
12989
|
end
|
|
12747
12990
|
function SET_GROUP:AnyPartlyInZone(Zone)
|
|
12748
|
-
self:F2(Zone)
|
|
12749
12991
|
local IsPartlyInZone=false
|
|
12750
12992
|
local Set=self:GetSet()
|
|
12751
12993
|
for GroupID,GroupData in pairs(Set)do
|
|
@@ -12762,7 +13004,6 @@ return false
|
|
|
12762
13004
|
end
|
|
12763
13005
|
end
|
|
12764
13006
|
function SET_GROUP:NoneInZone(Zone)
|
|
12765
|
-
self:F2(Zone)
|
|
12766
13007
|
local Set=self:GetSet()
|
|
12767
13008
|
for GroupID,GroupData in pairs(Set)do
|
|
12768
13009
|
if not GroupData:IsNotInZone(Zone)then
|
|
@@ -12772,7 +13013,6 @@ end
|
|
|
12772
13013
|
return true
|
|
12773
13014
|
end
|
|
12774
13015
|
function SET_GROUP:CountInZone(Zone)
|
|
12775
|
-
self:F2(Zone)
|
|
12776
13016
|
local Count=0
|
|
12777
13017
|
local Set=self:GetSet()
|
|
12778
13018
|
for GroupID,GroupData in pairs(Set)do
|
|
@@ -12783,7 +13023,6 @@ end
|
|
|
12783
13023
|
return Count
|
|
12784
13024
|
end
|
|
12785
13025
|
function SET_GROUP:CountUnitInZone(Zone)
|
|
12786
|
-
self:F2(Zone)
|
|
12787
13026
|
local Count=0
|
|
12788
13027
|
local Set=self:GetSet()
|
|
12789
13028
|
for GroupID,GroupData in pairs(Set)do
|
|
@@ -12809,11 +13048,9 @@ end
|
|
|
12809
13048
|
return CountG,CountU
|
|
12810
13049
|
end
|
|
12811
13050
|
function SET_GROUP:IsIncludeObject(MGroup)
|
|
12812
|
-
self:F2(MGroup)
|
|
12813
13051
|
local MGroupInclude=true
|
|
12814
13052
|
if self.Filter.Alive==true then
|
|
12815
13053
|
local MGroupAlive=false
|
|
12816
|
-
self:F({Active=self.Filter.Active})
|
|
12817
13054
|
if MGroup and MGroup:IsAlive()then
|
|
12818
13055
|
MGroupAlive=true
|
|
12819
13056
|
end
|
|
@@ -12821,7 +13058,6 @@ MGroupInclude=MGroupInclude and MGroupAlive
|
|
|
12821
13058
|
end
|
|
12822
13059
|
if self.Filter.Active~=nil then
|
|
12823
13060
|
local MGroupActive=false
|
|
12824
|
-
self:F({Active=self.Filter.Active})
|
|
12825
13061
|
if self.Filter.Active==false or(self.Filter.Active==true and MGroup:IsActive()==true)then
|
|
12826
13062
|
MGroupActive=true
|
|
12827
13063
|
end
|
|
@@ -12830,7 +13066,6 @@ end
|
|
|
12830
13066
|
if self.Filter.Coalitions and MGroupInclude then
|
|
12831
13067
|
local MGroupCoalition=false
|
|
12832
13068
|
for CoalitionID,CoalitionName in pairs(self.Filter.Coalitions)do
|
|
12833
|
-
self:T3({"Coalition:",MGroup:GetCoalition(),self.FilterMeta.Coalitions[CoalitionName],CoalitionName})
|
|
12834
13069
|
if self.FilterMeta.Coalitions[CoalitionName]and self.FilterMeta.Coalitions[CoalitionName]==MGroup:GetCoalition()then
|
|
12835
13070
|
MGroupCoalition=true
|
|
12836
13071
|
end
|
|
@@ -12840,7 +13075,6 @@ end
|
|
|
12840
13075
|
if self.Filter.Categories and MGroupInclude then
|
|
12841
13076
|
local MGroupCategory=false
|
|
12842
13077
|
for CategoryID,CategoryName in pairs(self.Filter.Categories)do
|
|
12843
|
-
self:T3({"Category:",MGroup:GetCategory(),self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
12844
13078
|
if self.FilterMeta.Categories[CategoryName]and self.FilterMeta.Categories[CategoryName]==MGroup:GetCategory()then
|
|
12845
13079
|
MGroupCategory=true
|
|
12846
13080
|
end
|
|
@@ -12850,7 +13084,6 @@ end
|
|
|
12850
13084
|
if self.Filter.Countries and MGroupInclude then
|
|
12851
13085
|
local MGroupCountry=false
|
|
12852
13086
|
for CountryID,CountryName in pairs(self.Filter.Countries)do
|
|
12853
|
-
self:T3({"Country:",MGroup:GetCountry(),CountryName})
|
|
12854
13087
|
if country.id[CountryName]==MGroup:GetCountry()then
|
|
12855
13088
|
MGroupCountry=true
|
|
12856
13089
|
end
|
|
@@ -12860,8 +13093,7 @@ end
|
|
|
12860
13093
|
if self.Filter.GroupPrefixes and MGroupInclude then
|
|
12861
13094
|
local MGroupPrefix=false
|
|
12862
13095
|
for GroupPrefixId,GroupPrefix in pairs(self.Filter.GroupPrefixes)do
|
|
12863
|
-
|
|
12864
|
-
if string.find(MGroup:GetName(),GroupPrefix:gsub("-","%%-"),1)then
|
|
13096
|
+
if string.find(MGroup:GetName(),string.gsub(GroupPrefix,"-","%%-"),1)then
|
|
12865
13097
|
MGroupPrefix=true
|
|
12866
13098
|
end
|
|
12867
13099
|
end
|
|
@@ -12881,7 +13113,6 @@ local MGroupFunc=false
|
|
|
12881
13113
|
MGroupFunc=self:_EvalFilterFunctions(MGroup)
|
|
12882
13114
|
MGroupInclude=MGroupInclude and MGroupFunc
|
|
12883
13115
|
end
|
|
12884
|
-
self:T2(MGroupInclude)
|
|
12885
13116
|
return MGroupInclude
|
|
12886
13117
|
end
|
|
12887
13118
|
function SET_GROUP:GetClosestGroup(Coordinate,Coalitions)
|
|
@@ -12947,7 +13178,6 @@ self:FilterActive(false)
|
|
|
12947
13178
|
return self
|
|
12948
13179
|
end
|
|
12949
13180
|
function SET_UNIT:AddUnit(Unit)
|
|
12950
|
-
self:F2(Unit:GetName())
|
|
12951
13181
|
self:Add(Unit:GetName(),Unit)
|
|
12952
13182
|
if Unit:IsInstanceOf("UNIT")then
|
|
12953
13183
|
Unit:SetCargoBayWeightLimit()
|
|
@@ -12956,7 +13186,6 @@ return self
|
|
|
12956
13186
|
end
|
|
12957
13187
|
function SET_UNIT:AddUnitsByName(AddUnitNames)
|
|
12958
13188
|
local AddUnitNamesArray=(type(AddUnitNames)=="table")and AddUnitNames or{AddUnitNames}
|
|
12959
|
-
self:T(AddUnitNamesArray)
|
|
12960
13189
|
for AddUnitID,AddUnitName in pairs(AddUnitNamesArray)do
|
|
12961
13190
|
self:Add(AddUnitName,UNIT:FindByName(AddUnitName))
|
|
12962
13191
|
end
|
|
@@ -13145,17 +13374,14 @@ end
|
|
|
13145
13374
|
return self
|
|
13146
13375
|
end
|
|
13147
13376
|
function SET_UNIT:AddInDatabase(Event)
|
|
13148
|
-
self:F3({Event})
|
|
13149
13377
|
if Event.IniObjectCategory==Object.Category.UNIT then
|
|
13150
13378
|
if not self.Database[Event.IniDCSUnitName]then
|
|
13151
13379
|
self.Database[Event.IniDCSUnitName]=UNIT:Register(Event.IniDCSUnitName)
|
|
13152
|
-
self:T3(self.Database[Event.IniDCSUnitName])
|
|
13153
13380
|
end
|
|
13154
13381
|
end
|
|
13155
13382
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
13156
13383
|
end
|
|
13157
13384
|
function SET_UNIT:FindInDatabase(Event)
|
|
13158
|
-
self:F2({Event.IniDCSUnitName,self.Set[Event.IniDCSUnitName],Event})
|
|
13159
13385
|
return Event.IniDCSUnitName,self.Set[Event.IniDCSUnitName]
|
|
13160
13386
|
end
|
|
13161
13387
|
do
|
|
@@ -13163,10 +13389,8 @@ function SET_UNIT:IsPartiallyInZone(ZoneTest)
|
|
|
13163
13389
|
local IsPartiallyInZone=false
|
|
13164
13390
|
local function EvaluateZone(ZoneUnit)
|
|
13165
13391
|
local ZoneUnitName=ZoneUnit:GetName()
|
|
13166
|
-
self:F({ZoneUnitName=ZoneUnitName})
|
|
13167
13392
|
if self:FindUnit(ZoneUnitName)then
|
|
13168
13393
|
IsPartiallyInZone=true
|
|
13169
|
-
self:F({Found=true})
|
|
13170
13394
|
return false
|
|
13171
13395
|
end
|
|
13172
13396
|
return true
|
|
@@ -13189,12 +13413,10 @@ return IsNotInZone
|
|
|
13189
13413
|
end
|
|
13190
13414
|
end
|
|
13191
13415
|
function SET_UNIT:ForEachUnit(IteratorFunction,...)
|
|
13192
|
-
self:F2(arg)
|
|
13193
13416
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
13194
13417
|
return self
|
|
13195
13418
|
end
|
|
13196
13419
|
function SET_UNIT:GetSetPerThreatLevel(FromThreatLevel,ToThreatLevel)
|
|
13197
|
-
self:F2(arg)
|
|
13198
13420
|
local ThreatLevelSet={}
|
|
13199
13421
|
if self:Count()~=0 then
|
|
13200
13422
|
for UnitName,UnitObject in pairs(self.Set)do
|
|
@@ -13203,12 +13425,10 @@ local ThreatLevel=Unit:GetThreatLevel()
|
|
|
13203
13425
|
ThreatLevelSet[ThreatLevel]=ThreatLevelSet[ThreatLevel]or{}
|
|
13204
13426
|
ThreatLevelSet[ThreatLevel].Set=ThreatLevelSet[ThreatLevel].Set or{}
|
|
13205
13427
|
ThreatLevelSet[ThreatLevel].Set[UnitName]=UnitObject
|
|
13206
|
-
self:F({ThreatLevel=ThreatLevel,ThreatLevelSet=ThreatLevelSet[ThreatLevel].Set})
|
|
13207
13428
|
end
|
|
13208
13429
|
local OrderedPerThreatLevelSet={}
|
|
13209
13430
|
local ThreatLevelIncrement=FromThreatLevel<=ToThreatLevel and 1 or-1
|
|
13210
13431
|
for ThreatLevel=FromThreatLevel,ToThreatLevel,ThreatLevelIncrement do
|
|
13211
|
-
self:F({ThreatLevel=ThreatLevel})
|
|
13212
13432
|
local ThreatLevelItem=ThreatLevelSet[ThreatLevel]
|
|
13213
13433
|
if ThreatLevelItem then
|
|
13214
13434
|
for UnitName,UnitObject in pairs(ThreatLevelItem.Set)do
|
|
@@ -13220,7 +13440,6 @@ return OrderedPerThreatLevelSet
|
|
|
13220
13440
|
end
|
|
13221
13441
|
end
|
|
13222
13442
|
function SET_UNIT:ForEachUnitPerThreatLevel(FromThreatLevel,ToThreatLevel,IteratorFunction,...)
|
|
13223
|
-
self:F2(arg)
|
|
13224
13443
|
local ThreatLevelSet={}
|
|
13225
13444
|
if self:Count()~=0 then
|
|
13226
13445
|
for UnitName,UnitObject in pairs(self.Set)do
|
|
@@ -13229,11 +13448,9 @@ local ThreatLevel=Unit:GetThreatLevel()
|
|
|
13229
13448
|
ThreatLevelSet[ThreatLevel]=ThreatLevelSet[ThreatLevel]or{}
|
|
13230
13449
|
ThreatLevelSet[ThreatLevel].Set=ThreatLevelSet[ThreatLevel].Set or{}
|
|
13231
13450
|
ThreatLevelSet[ThreatLevel].Set[UnitName]=UnitObject
|
|
13232
|
-
self:F({ThreatLevel=ThreatLevel,ThreatLevelSet=ThreatLevelSet[ThreatLevel].Set})
|
|
13233
13451
|
end
|
|
13234
13452
|
local ThreatLevelIncrement=FromThreatLevel<=ToThreatLevel and 1 or-1
|
|
13235
13453
|
for ThreatLevel=FromThreatLevel,ToThreatLevel,ThreatLevelIncrement do
|
|
13236
|
-
self:F({ThreatLevel=ThreatLevel})
|
|
13237
13454
|
local ThreatLevelItem=ThreatLevelSet[ThreatLevel]
|
|
13238
13455
|
if ThreatLevelItem then
|
|
13239
13456
|
self:ForEach(IteratorFunction,arg,ThreatLevelItem.Set)
|
|
@@ -13243,7 +13460,6 @@ end
|
|
|
13243
13460
|
return self
|
|
13244
13461
|
end
|
|
13245
13462
|
function SET_UNIT:ForEachUnitCompletelyInZone(ZoneObject,IteratorFunction,...)
|
|
13246
|
-
self:F2(arg)
|
|
13247
13463
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
13248
13464
|
function(ZoneObject,UnitObject)
|
|
13249
13465
|
if UnitObject:IsInZone(ZoneObject)then
|
|
@@ -13255,7 +13471,6 @@ end,{ZoneObject})
|
|
|
13255
13471
|
return self
|
|
13256
13472
|
end
|
|
13257
13473
|
function SET_UNIT:ForEachUnitNotInZone(ZoneObject,IteratorFunction,...)
|
|
13258
|
-
self:F2(arg)
|
|
13259
13474
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
13260
13475
|
function(ZoneObject,UnitObject)
|
|
13261
13476
|
if UnitObject:IsNotInZone(ZoneObject)then
|
|
@@ -13267,7 +13482,6 @@ end,{ZoneObject})
|
|
|
13267
13482
|
return self
|
|
13268
13483
|
end
|
|
13269
13484
|
function SET_UNIT:GetUnitTypes()
|
|
13270
|
-
self:F2()
|
|
13271
13485
|
local MT={}
|
|
13272
13486
|
local UnitTypes={}
|
|
13273
13487
|
for UnitID,UnitData in pairs(self:GetSet())do
|
|
@@ -13287,7 +13501,6 @@ end
|
|
|
13287
13501
|
return UnitTypes
|
|
13288
13502
|
end
|
|
13289
13503
|
function SET_UNIT:GetUnitTypesText()
|
|
13290
|
-
self:F2()
|
|
13291
13504
|
local MT={}
|
|
13292
13505
|
local UnitTypes=self:GetUnitTypes()
|
|
13293
13506
|
for UnitTypeID,UnitType in pairs(UnitTypes)do
|
|
@@ -13296,7 +13509,6 @@ end
|
|
|
13296
13509
|
return table.concat(MT,", ")
|
|
13297
13510
|
end
|
|
13298
13511
|
function SET_UNIT:GetUnitThreatLevels()
|
|
13299
|
-
self:F2()
|
|
13300
13512
|
local UnitThreatLevels={}
|
|
13301
13513
|
for UnitID,UnitData in pairs(self:GetSet())do
|
|
13302
13514
|
local ThreatUnit=UnitData
|
|
@@ -13322,7 +13534,6 @@ MaxThreatLevelA2G=ThreatLevelA2G
|
|
|
13322
13534
|
MaxThreatText=ThreatText
|
|
13323
13535
|
end
|
|
13324
13536
|
end
|
|
13325
|
-
self:F({MaxThreatLevelA2G=MaxThreatLevelA2G,MaxThreatText=MaxThreatText})
|
|
13326
13537
|
return MaxThreatLevelA2G,MaxThreatText
|
|
13327
13538
|
end
|
|
13328
13539
|
function SET_UNIT:GetCoordinate()
|
|
@@ -13359,7 +13570,6 @@ local heading=self:GetHeading()or 0
|
|
|
13359
13570
|
local velocity=self:GetVelocity()or 0
|
|
13360
13571
|
Coordinate:SetHeading(heading)
|
|
13361
13572
|
Coordinate:SetVelocity(velocity)
|
|
13362
|
-
self:T(UTILS.PrintTableToLog(Coordinate))
|
|
13363
13573
|
end
|
|
13364
13574
|
return Coordinate
|
|
13365
13575
|
end
|
|
@@ -13374,7 +13584,6 @@ if Velocity~=0 then
|
|
|
13374
13584
|
MaxVelocity=(MaxVelocity<Velocity)and Velocity or MaxVelocity
|
|
13375
13585
|
end
|
|
13376
13586
|
end
|
|
13377
|
-
self:F({MaxVelocity=MaxVelocity})
|
|
13378
13587
|
return MaxVelocity
|
|
13379
13588
|
end
|
|
13380
13589
|
function SET_UNIT:GetHeading()
|
|
@@ -13401,7 +13610,6 @@ end
|
|
|
13401
13610
|
return HeadingSet
|
|
13402
13611
|
end
|
|
13403
13612
|
function SET_UNIT:HasRadar(RadarType)
|
|
13404
|
-
self:F2(RadarType)
|
|
13405
13613
|
local RadarCount=0
|
|
13406
13614
|
for UnitID,UnitData in pairs(self:GetSet())do
|
|
13407
13615
|
local UnitSensorTest=UnitData
|
|
@@ -13411,7 +13619,6 @@ HasSensors=UnitSensorTest:HasSensors(Unit.SensorType.RADAR,RadarType)
|
|
|
13411
13619
|
else
|
|
13412
13620
|
HasSensors=UnitSensorTest:HasSensors(Unit.SensorType.RADAR)
|
|
13413
13621
|
end
|
|
13414
|
-
self:T3(HasSensors)
|
|
13415
13622
|
if HasSensors then
|
|
13416
13623
|
RadarCount=RadarCount+1
|
|
13417
13624
|
end
|
|
@@ -13419,14 +13626,12 @@ end
|
|
|
13419
13626
|
return RadarCount
|
|
13420
13627
|
end
|
|
13421
13628
|
function SET_UNIT:HasSEAD()
|
|
13422
|
-
self:F2()
|
|
13423
13629
|
local SEADCount=0
|
|
13424
13630
|
for UnitID,UnitData in pairs(self:GetSet())do
|
|
13425
13631
|
local UnitSEAD=UnitData
|
|
13426
13632
|
if UnitSEAD:IsAlive()then
|
|
13427
13633
|
local UnitSEADAttributes=UnitSEAD:GetDesc().attributes
|
|
13428
13634
|
local HasSEAD=UnitSEAD:HasSEAD()
|
|
13429
|
-
self:T3(HasSEAD)
|
|
13430
13635
|
if HasSEAD then
|
|
13431
13636
|
SEADCount=SEADCount+1
|
|
13432
13637
|
end
|
|
@@ -13435,7 +13640,6 @@ end
|
|
|
13435
13640
|
return SEADCount
|
|
13436
13641
|
end
|
|
13437
13642
|
function SET_UNIT:HasGroundUnits()
|
|
13438
|
-
self:F2()
|
|
13439
13643
|
local GroundUnitCount=0
|
|
13440
13644
|
for UnitID,UnitData in pairs(self:GetSet())do
|
|
13441
13645
|
local UnitTest=UnitData
|
|
@@ -13446,7 +13650,6 @@ end
|
|
|
13446
13650
|
return GroundUnitCount
|
|
13447
13651
|
end
|
|
13448
13652
|
function SET_UNIT:HasAirUnits()
|
|
13449
|
-
self:F2()
|
|
13450
13653
|
local AirUnitCount=0
|
|
13451
13654
|
for UnitID,UnitData in pairs(self:GetSet())do
|
|
13452
13655
|
local UnitTest=UnitData
|
|
@@ -13457,7 +13660,6 @@ end
|
|
|
13457
13660
|
return AirUnitCount
|
|
13458
13661
|
end
|
|
13459
13662
|
function SET_UNIT:HasFriendlyUnits(FriendlyCoalition)
|
|
13460
|
-
self:F2()
|
|
13461
13663
|
local FriendlyUnitCount=0
|
|
13462
13664
|
for UnitID,UnitData in pairs(self:GetSet())do
|
|
13463
13665
|
local UnitTest=UnitData
|
|
@@ -13468,7 +13670,6 @@ end
|
|
|
13468
13670
|
return FriendlyUnitCount
|
|
13469
13671
|
end
|
|
13470
13672
|
function SET_UNIT:IsIncludeObject(MUnit)
|
|
13471
|
-
self:F2({MUnit})
|
|
13472
13673
|
local MUnitInclude=false
|
|
13473
13674
|
if MUnit:IsAlive()~=nil then
|
|
13474
13675
|
MUnitInclude=true
|
|
@@ -13482,7 +13683,6 @@ end
|
|
|
13482
13683
|
if self.Filter.Coalitions and MUnitInclude then
|
|
13483
13684
|
local MUnitCoalition=false
|
|
13484
13685
|
for CoalitionID,CoalitionName in pairs(self.Filter.Coalitions)do
|
|
13485
|
-
self:F({"Coalition:",MUnit:GetCoalition(),self.FilterMeta.Coalitions[CoalitionName],CoalitionName})
|
|
13486
13686
|
if self.FilterMeta.Coalitions[CoalitionName]and self.FilterMeta.Coalitions[CoalitionName]==MUnit:GetCoalition()then
|
|
13487
13687
|
MUnitCoalition=true
|
|
13488
13688
|
end
|
|
@@ -13492,7 +13692,6 @@ end
|
|
|
13492
13692
|
if self.Filter.Categories and MUnitInclude then
|
|
13493
13693
|
local MUnitCategory=false
|
|
13494
13694
|
for CategoryID,CategoryName in pairs(self.Filter.Categories)do
|
|
13495
|
-
self:T3({"Category:",MUnit:GetDesc().category,self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
13496
13695
|
if self.FilterMeta.Categories[CategoryName]and self.FilterMeta.Categories[CategoryName]==MUnit:GetDesc().category then
|
|
13497
13696
|
MUnitCategory=true
|
|
13498
13697
|
end
|
|
@@ -13502,7 +13701,6 @@ end
|
|
|
13502
13701
|
if self.Filter.Types and MUnitInclude then
|
|
13503
13702
|
local MUnitType=false
|
|
13504
13703
|
for TypeID,TypeName in pairs(self.Filter.Types)do
|
|
13505
|
-
self:T3({"Type:",MUnit:GetTypeName(),TypeName})
|
|
13506
13704
|
if TypeName==MUnit:GetTypeName()then
|
|
13507
13705
|
MUnitType=true
|
|
13508
13706
|
end
|
|
@@ -13512,7 +13710,6 @@ end
|
|
|
13512
13710
|
if self.Filter.Countries and MUnitInclude then
|
|
13513
13711
|
local MUnitCountry=false
|
|
13514
13712
|
for CountryID,CountryName in pairs(self.Filter.Countries)do
|
|
13515
|
-
self:T3({"Country:",MUnit:GetCountry(),CountryName})
|
|
13516
13713
|
if country.id[CountryName]==MUnit:GetCountry()then
|
|
13517
13714
|
MUnitCountry=true
|
|
13518
13715
|
end
|
|
@@ -13522,7 +13719,6 @@ end
|
|
|
13522
13719
|
if self.Filter.UnitPrefixes and MUnitInclude then
|
|
13523
13720
|
local MUnitPrefix=false
|
|
13524
13721
|
for UnitPrefixId,UnitPrefix in pairs(self.Filter.UnitPrefixes)do
|
|
13525
|
-
self:T3({"Prefix:",string.find(MUnit:GetName(),UnitPrefix,1),UnitPrefix})
|
|
13526
13722
|
if string.find(MUnit:GetName(),UnitPrefix,1)then
|
|
13527
13723
|
MUnitPrefix=true
|
|
13528
13724
|
end
|
|
@@ -13532,10 +13728,8 @@ end
|
|
|
13532
13728
|
if self.Filter.RadarTypes and MUnitInclude then
|
|
13533
13729
|
local MUnitRadar=false
|
|
13534
13730
|
for RadarTypeID,RadarType in pairs(self.Filter.RadarTypes)do
|
|
13535
|
-
self:T3({"Radar:",RadarType})
|
|
13536
13731
|
if MUnit:HasSensors(Unit.SensorType.RADAR,RadarType)==true then
|
|
13537
13732
|
if MUnit:GetRadar()==true then
|
|
13538
|
-
self:T3("RADAR Found")
|
|
13539
13733
|
end
|
|
13540
13734
|
MUnitRadar=true
|
|
13541
13735
|
end
|
|
@@ -13545,7 +13739,6 @@ end
|
|
|
13545
13739
|
if self.Filter.SEAD and MUnitInclude then
|
|
13546
13740
|
local MUnitSEAD=false
|
|
13547
13741
|
if MUnit:HasSEAD()==true then
|
|
13548
|
-
self:T3("SEAD Found")
|
|
13549
13742
|
MUnitSEAD=true
|
|
13550
13743
|
end
|
|
13551
13744
|
MUnitInclude=MUnitInclude and MUnitSEAD
|
|
@@ -13554,7 +13747,6 @@ end
|
|
|
13554
13747
|
if self.Filter.Zones and MUnitInclude then
|
|
13555
13748
|
local MGroupZone=false
|
|
13556
13749
|
for ZoneName,Zone in pairs(self.Filter.Zones)do
|
|
13557
|
-
self:T3("Zone:",ZoneName)
|
|
13558
13750
|
if MUnit:IsInZone(Zone)then
|
|
13559
13751
|
MGroupZone=true
|
|
13560
13752
|
end
|
|
@@ -13565,7 +13757,6 @@ if self.Filter.Functions and MUnitInclude then
|
|
|
13565
13757
|
local MUnitFunc=self:_EvalFilterFunctions(MUnit)
|
|
13566
13758
|
MUnitInclude=MUnitInclude and MUnitFunc
|
|
13567
13759
|
end
|
|
13568
|
-
self:T2(MUnitInclude)
|
|
13569
13760
|
return MUnitInclude
|
|
13570
13761
|
end
|
|
13571
13762
|
function SET_UNIT:GetTypeNames(Delimiter)
|
|
@@ -13621,13 +13812,11 @@ local self=BASE:Inherit(self,SET_BASE:New(_DATABASE.STATICS))
|
|
|
13621
13812
|
return self
|
|
13622
13813
|
end
|
|
13623
13814
|
function SET_STATIC:AddStatic(AddStatic)
|
|
13624
|
-
self:F2(AddStatic:GetName())
|
|
13625
13815
|
self:Add(AddStatic:GetName(),AddStatic)
|
|
13626
13816
|
return self
|
|
13627
13817
|
end
|
|
13628
13818
|
function SET_STATIC:AddStaticsByName(AddStaticNames)
|
|
13629
13819
|
local AddStaticNamesArray=(type(AddStaticNames)=="table")and AddStaticNames or{AddStaticNames}
|
|
13630
|
-
self:T(AddStaticNamesArray)
|
|
13631
13820
|
for AddStaticID,AddStaticName in pairs(AddStaticNamesArray)do
|
|
13632
13821
|
self:Add(AddStaticName,STATIC:FindByName(AddStaticName))
|
|
13633
13822
|
end
|
|
@@ -13728,7 +13917,7 @@ if _DATABASE then
|
|
|
13728
13917
|
self:_FilterStart()
|
|
13729
13918
|
self:HandleEvent(EVENTS.Birth,self._EventOnBirth)
|
|
13730
13919
|
self:HandleEvent(EVENTS.Dead,self._EventOnDeadOrCrash)
|
|
13731
|
-
self:HandleEvent(EVENTS.
|
|
13920
|
+
self:HandleEvent(EVENTS.UnitLost,self._EventOnDeadOrCrash)
|
|
13732
13921
|
end
|
|
13733
13922
|
return self
|
|
13734
13923
|
end
|
|
@@ -13743,17 +13932,14 @@ end
|
|
|
13743
13932
|
return CountU
|
|
13744
13933
|
end
|
|
13745
13934
|
function SET_STATIC:AddInDatabase(Event)
|
|
13746
|
-
self:F3({Event})
|
|
13747
13935
|
if Event.IniObjectCategory==Object.Category.STATIC then
|
|
13748
13936
|
if not self.Database[Event.IniDCSUnitName]then
|
|
13749
13937
|
self.Database[Event.IniDCSUnitName]=STATIC:Register(Event.IniDCSUnitName)
|
|
13750
|
-
self:T3(self.Database[Event.IniDCSUnitName])
|
|
13751
13938
|
end
|
|
13752
13939
|
end
|
|
13753
13940
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
13754
13941
|
end
|
|
13755
13942
|
function SET_STATIC:FindInDatabase(Event)
|
|
13756
|
-
self:F2({Event.IniDCSUnitName,self.Set[Event.IniDCSUnitName],Event})
|
|
13757
13943
|
return Event.IniDCSUnitName,self.Set[Event.IniDCSUnitName]
|
|
13758
13944
|
end
|
|
13759
13945
|
do
|
|
@@ -13783,18 +13969,15 @@ Zone:Search(EvaluateZone)
|
|
|
13783
13969
|
return IsNotInZone
|
|
13784
13970
|
end
|
|
13785
13971
|
function SET_STATIC:ForEachStaticInZone(IteratorFunction,...)
|
|
13786
|
-
self:F2(arg)
|
|
13787
13972
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
13788
13973
|
return self
|
|
13789
13974
|
end
|
|
13790
13975
|
end
|
|
13791
13976
|
function SET_STATIC:ForEachStatic(IteratorFunction,...)
|
|
13792
|
-
self:F2(arg)
|
|
13793
13977
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
13794
13978
|
return self
|
|
13795
13979
|
end
|
|
13796
13980
|
function SET_STATIC:ForEachStaticCompletelyInZone(ZoneObject,IteratorFunction,...)
|
|
13797
|
-
self:F2(arg)
|
|
13798
13981
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
13799
13982
|
function(ZoneObject,StaticObject)
|
|
13800
13983
|
if StaticObject:IsInZone(ZoneObject)then
|
|
@@ -13806,7 +13989,6 @@ end,{ZoneObject})
|
|
|
13806
13989
|
return self
|
|
13807
13990
|
end
|
|
13808
13991
|
function SET_STATIC:ForEachStaticNotInZone(ZoneObject,IteratorFunction,...)
|
|
13809
|
-
self:F2(arg)
|
|
13810
13992
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
13811
13993
|
function(ZoneObject,StaticObject)
|
|
13812
13994
|
if StaticObject:IsNotInZone(ZoneObject)then
|
|
@@ -13818,7 +14000,6 @@ end,{ZoneObject})
|
|
|
13818
14000
|
return self
|
|
13819
14001
|
end
|
|
13820
14002
|
function SET_STATIC:GetStaticTypes()
|
|
13821
|
-
self:F2()
|
|
13822
14003
|
local MT={}
|
|
13823
14004
|
local StaticTypes={}
|
|
13824
14005
|
for StaticID,StaticData in pairs(self:GetSet())do
|
|
@@ -13838,7 +14019,6 @@ end
|
|
|
13838
14019
|
return StaticTypes
|
|
13839
14020
|
end
|
|
13840
14021
|
function SET_STATIC:GetStaticTypesText()
|
|
13841
|
-
self:F2()
|
|
13842
14022
|
local MT={}
|
|
13843
14023
|
local StaticTypes=self:GetStaticTypes()
|
|
13844
14024
|
for StaticTypeID,StaticType in pairs(StaticTypes)do
|
|
@@ -13880,7 +14060,6 @@ Coordinate.y=(y2-y1)/2+y1
|
|
|
13880
14060
|
Coordinate.z=(z2-z1)/2+z1
|
|
13881
14061
|
Coordinate:SetHeading(AvgHeading)
|
|
13882
14062
|
Coordinate:SetVelocity(MaxVelocity)
|
|
13883
|
-
self:F({Coordinate=Coordinate})
|
|
13884
14063
|
return Coordinate
|
|
13885
14064
|
end
|
|
13886
14065
|
function SET_STATIC:GetVelocity()
|
|
@@ -13920,16 +14099,13 @@ MaxThreatLevelA2G=ThreatLevelA2G
|
|
|
13920
14099
|
MaxThreatText=ThreatText
|
|
13921
14100
|
end
|
|
13922
14101
|
end
|
|
13923
|
-
self:F({MaxThreatLevelA2G=MaxThreatLevelA2G,MaxThreatText=MaxThreatText})
|
|
13924
14102
|
return MaxThreatLevelA2G,MaxThreatText
|
|
13925
14103
|
end
|
|
13926
14104
|
function SET_STATIC:IsIncludeObject(MStatic)
|
|
13927
|
-
self:F2(MStatic)
|
|
13928
14105
|
local MStaticInclude=true
|
|
13929
14106
|
if self.Filter.Coalitions then
|
|
13930
14107
|
local MStaticCoalition=false
|
|
13931
14108
|
for CoalitionID,CoalitionName in pairs(self.Filter.Coalitions)do
|
|
13932
|
-
self:T3({"Coalition:",MStatic:GetCoalition(),self.FilterMeta.Coalitions[CoalitionName],CoalitionName})
|
|
13933
14109
|
if self.FilterMeta.Coalitions[CoalitionName]and self.FilterMeta.Coalitions[CoalitionName]==MStatic:GetCoalition()then
|
|
13934
14110
|
MStaticCoalition=true
|
|
13935
14111
|
end
|
|
@@ -13939,7 +14115,6 @@ end
|
|
|
13939
14115
|
if self.Filter.Categories then
|
|
13940
14116
|
local MStaticCategory=false
|
|
13941
14117
|
for CategoryID,CategoryName in pairs(self.Filter.Categories)do
|
|
13942
|
-
self:T3({"Category:",MStatic:GetDesc().category,self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
13943
14118
|
if self.FilterMeta.Categories[CategoryName]and self.FilterMeta.Categories[CategoryName]==MStatic:GetDesc().category then
|
|
13944
14119
|
MStaticCategory=true
|
|
13945
14120
|
end
|
|
@@ -13949,7 +14124,6 @@ end
|
|
|
13949
14124
|
if self.Filter.Types then
|
|
13950
14125
|
local MStaticType=false
|
|
13951
14126
|
for TypeID,TypeName in pairs(self.Filter.Types)do
|
|
13952
|
-
self:T3({"Type:",MStatic:GetTypeName(),TypeName})
|
|
13953
14127
|
if TypeName==MStatic:GetTypeName()then
|
|
13954
14128
|
MStaticType=true
|
|
13955
14129
|
end
|
|
@@ -13959,7 +14133,6 @@ end
|
|
|
13959
14133
|
if self.Filter.Countries then
|
|
13960
14134
|
local MStaticCountry=false
|
|
13961
14135
|
for CountryID,CountryName in pairs(self.Filter.Countries)do
|
|
13962
|
-
self:T3({"Country:",MStatic:GetCountry(),CountryName})
|
|
13963
14136
|
if country.id[CountryName]==MStatic:GetCountry()then
|
|
13964
14137
|
MStaticCountry=true
|
|
13965
14138
|
end
|
|
@@ -13969,7 +14142,6 @@ end
|
|
|
13969
14142
|
if self.Filter.StaticPrefixes then
|
|
13970
14143
|
local MStaticPrefix=false
|
|
13971
14144
|
for StaticPrefixId,StaticPrefix in pairs(self.Filter.StaticPrefixes)do
|
|
13972
|
-
self:T3({"Prefix:",string.find(MStatic:GetName(),StaticPrefix,1),StaticPrefix})
|
|
13973
14145
|
if string.find(MStatic:GetName(),StaticPrefix,1)then
|
|
13974
14146
|
MStaticPrefix=true
|
|
13975
14147
|
end
|
|
@@ -13979,14 +14151,12 @@ end
|
|
|
13979
14151
|
if self.Filter.Zones then
|
|
13980
14152
|
local MStaticZone=false
|
|
13981
14153
|
for ZoneName,Zone in pairs(self.Filter.Zones)do
|
|
13982
|
-
self:T3("Zone:",ZoneName)
|
|
13983
14154
|
if MStatic and MStatic:IsInZone(Zone)then
|
|
13984
14155
|
MStaticZone=true
|
|
13985
14156
|
end
|
|
13986
14157
|
end
|
|
13987
14158
|
MStaticInclude=MStaticInclude and MStaticZone
|
|
13988
14159
|
end
|
|
13989
|
-
self:T2(MStaticInclude)
|
|
13990
14160
|
return MStaticInclude
|
|
13991
14161
|
end
|
|
13992
14162
|
function SET_STATIC:GetTypeNames(Delimiter)
|
|
@@ -14234,11 +14404,9 @@ end
|
|
|
14234
14404
|
return self
|
|
14235
14405
|
end
|
|
14236
14406
|
function SET_CLIENT:_EventPlayerEnterUnit(Event)
|
|
14237
|
-
self:I("_EventPlayerEnterUnit")
|
|
14238
14407
|
if Event.IniDCSUnit then
|
|
14239
14408
|
if Event.IniObjectCategory==Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround()then
|
|
14240
14409
|
local ObjectName,Object=self:AddInDatabase(Event)
|
|
14241
|
-
self:T(ObjectName,UTILS.PrintTableToLog(Object))
|
|
14242
14410
|
if Object and self:IsIncludeObject(Object)then
|
|
14243
14411
|
self:Add(ObjectName,Object)
|
|
14244
14412
|
end
|
|
@@ -14247,7 +14415,6 @@ end
|
|
|
14247
14415
|
return self
|
|
14248
14416
|
end
|
|
14249
14417
|
function SET_CLIENT:_EventPlayerLeaveUnit(Event)
|
|
14250
|
-
self:I("_EventPlayerLeaveUnit")
|
|
14251
14418
|
if Event.IniDCSUnit then
|
|
14252
14419
|
if Event.IniObjectCategory==Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround()then
|
|
14253
14420
|
local ObjectName,Object=self:FindInDatabase(Event)
|
|
@@ -14259,20 +14426,16 @@ end
|
|
|
14259
14426
|
return self
|
|
14260
14427
|
end
|
|
14261
14428
|
function SET_CLIENT:AddInDatabase(Event)
|
|
14262
|
-
self:F3({Event})
|
|
14263
14429
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14264
14430
|
end
|
|
14265
14431
|
function SET_CLIENT:FindInDatabase(Event)
|
|
14266
|
-
self:F3({Event})
|
|
14267
14432
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14268
14433
|
end
|
|
14269
14434
|
function SET_CLIENT:ForEachClient(IteratorFunction,...)
|
|
14270
|
-
self:F2(arg)
|
|
14271
14435
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
14272
14436
|
return self
|
|
14273
14437
|
end
|
|
14274
14438
|
function SET_CLIENT:ForEachClientInZone(ZoneObject,IteratorFunction,...)
|
|
14275
|
-
self:F2(arg)
|
|
14276
14439
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
14277
14440
|
function(ZoneObject,ClientObject)
|
|
14278
14441
|
if ClientObject:IsInZone(ZoneObject)then
|
|
@@ -14284,7 +14447,6 @@ end,{ZoneObject})
|
|
|
14284
14447
|
return self
|
|
14285
14448
|
end
|
|
14286
14449
|
function SET_CLIENT:ForEachClientNotInZone(ZoneObject,IteratorFunction,...)
|
|
14287
|
-
self:F2(arg)
|
|
14288
14450
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
14289
14451
|
function(ZoneObject,ClientObject)
|
|
14290
14452
|
if ClientObject:IsNotInZone(ZoneObject)then
|
|
@@ -14316,7 +14478,6 @@ end
|
|
|
14316
14478
|
return AliveSet.Set or{}
|
|
14317
14479
|
end
|
|
14318
14480
|
function SET_CLIENT:IsIncludeObject(MClient)
|
|
14319
|
-
self:F2(MClient)
|
|
14320
14481
|
local MClientInclude=true
|
|
14321
14482
|
if MClient then
|
|
14322
14483
|
local MClientName=MClient.UnitName
|
|
@@ -14334,12 +14495,10 @@ local ClientCoalitionID=_DATABASE:GetCoalitionFromClientTemplate(MClientName)
|
|
|
14334
14495
|
if ClientCoalitionID==nil and MClient:IsAlive()~=nil then
|
|
14335
14496
|
ClientCoalitionID=MClient:GetCoalition()
|
|
14336
14497
|
end
|
|
14337
|
-
self:T3({"Coalition:",ClientCoalitionID,self.FilterMeta.Coalitions[CoalitionName],CoalitionName})
|
|
14338
14498
|
if self.FilterMeta.Coalitions[CoalitionName]and ClientCoalitionID and self.FilterMeta.Coalitions[CoalitionName]==ClientCoalitionID then
|
|
14339
14499
|
MClientCoalition=true
|
|
14340
14500
|
end
|
|
14341
14501
|
end
|
|
14342
|
-
self:T({"Evaluated Coalition",MClientCoalition})
|
|
14343
14502
|
MClientInclude=MClientInclude and MClientCoalition
|
|
14344
14503
|
end
|
|
14345
14504
|
if self.Filter.Categories and MClientInclude then
|
|
@@ -14349,29 +14508,24 @@ local ClientCategoryID=_DATABASE:GetCategoryFromClientTemplate(MClientName)
|
|
|
14349
14508
|
local UnitCategory=0
|
|
14350
14509
|
if ClientCategoryID==nil and MClient:IsExist()then
|
|
14351
14510
|
ClientCategoryID,UnitCategory=MClient:GetCategory()
|
|
14352
|
-
self:T3({"Category:",UnitCategory,self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
14353
14511
|
if self.FilterMeta.Categories[CategoryName]and UnitCategory and self.FilterMeta.Categories[CategoryName]==UnitCategory then
|
|
14354
14512
|
MClientCategory=true
|
|
14355
14513
|
end
|
|
14356
14514
|
else
|
|
14357
|
-
self:T3({"Category:",ClientCategoryID,self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
14358
14515
|
if self.FilterMeta.Categories[CategoryName]and ClientCategoryID and self.FilterMeta.Categories[CategoryName]==ClientCategoryID then
|
|
14359
14516
|
MClientCategory=true
|
|
14360
14517
|
end
|
|
14361
14518
|
end
|
|
14362
14519
|
end
|
|
14363
|
-
self:T({"Evaluated Category",MClientCategory})
|
|
14364
14520
|
MClientInclude=MClientInclude and MClientCategory
|
|
14365
14521
|
end
|
|
14366
14522
|
if self.Filter.Types and MClientInclude then
|
|
14367
14523
|
local MClientType=false
|
|
14368
14524
|
for TypeID,TypeName in pairs(self.Filter.Types)do
|
|
14369
|
-
self:T3({"Type:",MClient:GetTypeName(),TypeName})
|
|
14370
14525
|
if TypeName==MClient:GetTypeName()then
|
|
14371
14526
|
MClientType=true
|
|
14372
14527
|
end
|
|
14373
14528
|
end
|
|
14374
|
-
self:T({"Evaluated Type",MClientType})
|
|
14375
14529
|
MClientInclude=MClientInclude and MClientType
|
|
14376
14530
|
end
|
|
14377
14531
|
if self.Filter.Countries and MClientInclude then
|
|
@@ -14381,29 +14535,24 @@ local ClientCountryID=_DATABASE:GetCountryFromClientTemplate(MClientName)
|
|
|
14381
14535
|
if ClientCountryID==nil and MClient:IsAlive()~=nil then
|
|
14382
14536
|
ClientCountryID=MClient:GetCountry()
|
|
14383
14537
|
end
|
|
14384
|
-
self:T3({"Country:",ClientCountryID,country.id[CountryName],CountryName})
|
|
14385
14538
|
if country.id[CountryName]and ClientCountryID and country.id[CountryName]==ClientCountryID then
|
|
14386
14539
|
MClientCountry=true
|
|
14387
14540
|
end
|
|
14388
14541
|
end
|
|
14389
|
-
self:T({"Evaluated Country",MClientCountry})
|
|
14390
14542
|
MClientInclude=MClientInclude and MClientCountry
|
|
14391
14543
|
end
|
|
14392
14544
|
if self.Filter.ClientPrefixes and MClientInclude then
|
|
14393
14545
|
local MClientPrefix=false
|
|
14394
14546
|
for ClientPrefixId,ClientPrefix in pairs(self.Filter.ClientPrefixes)do
|
|
14395
|
-
self:T3({"Prefix:",string.find(MClient.UnitName,ClientPrefix,1),ClientPrefix})
|
|
14396
14547
|
if string.find(MClient.UnitName,ClientPrefix,1)then
|
|
14397
14548
|
MClientPrefix=true
|
|
14398
14549
|
end
|
|
14399
14550
|
end
|
|
14400
|
-
self:T({"Evaluated Prefix",MClientPrefix})
|
|
14401
14551
|
MClientInclude=MClientInclude and MClientPrefix
|
|
14402
14552
|
end
|
|
14403
14553
|
if self.Filter.Zones and MClientInclude then
|
|
14404
14554
|
local MClientZone=false
|
|
14405
14555
|
for ZoneName,Zone in pairs(self.Filter.Zones)do
|
|
14406
|
-
self:T3("Zone:",ZoneName)
|
|
14407
14556
|
local unit=MClient:GetClientGroupUnit()
|
|
14408
14557
|
if unit and unit:IsInZone(Zone)then
|
|
14409
14558
|
MClientZone=true
|
|
@@ -14419,7 +14568,6 @@ if playername and string.find(playername,_Playername)then
|
|
|
14419
14568
|
MClientPlayername=true
|
|
14420
14569
|
end
|
|
14421
14570
|
end
|
|
14422
|
-
self:T({"Evaluated Playername",MClientPlayername})
|
|
14423
14571
|
MClientInclude=MClientInclude and MClientPlayername
|
|
14424
14572
|
end
|
|
14425
14573
|
if self.Filter.Callsigns and MClientInclude then
|
|
@@ -14430,7 +14578,6 @@ if callsign and string.find(callsign,_Callsign,1,true)then
|
|
|
14430
14578
|
MClientCallsigns=true
|
|
14431
14579
|
end
|
|
14432
14580
|
end
|
|
14433
|
-
self:T({"Evaluated Callsign",MClientCallsigns})
|
|
14434
14581
|
MClientInclude=MClientInclude and MClientCallsigns
|
|
14435
14582
|
end
|
|
14436
14583
|
if self.Filter.Functions and MClientInclude then
|
|
@@ -14438,7 +14585,6 @@ local MClientFunc=self:_EvalFilterFunctions(MClient)
|
|
|
14438
14585
|
MClientInclude=MClientInclude and MClientFunc
|
|
14439
14586
|
end
|
|
14440
14587
|
end
|
|
14441
|
-
self:T2(MClientInclude)
|
|
14442
14588
|
return MClientInclude
|
|
14443
14589
|
end
|
|
14444
14590
|
end
|
|
@@ -14580,20 +14726,16 @@ end
|
|
|
14580
14726
|
return self
|
|
14581
14727
|
end
|
|
14582
14728
|
function SET_PLAYER:AddInDatabase(Event)
|
|
14583
|
-
self:F3({Event})
|
|
14584
14729
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14585
14730
|
end
|
|
14586
14731
|
function SET_PLAYER:FindInDatabase(Event)
|
|
14587
|
-
self:F3({Event})
|
|
14588
14732
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14589
14733
|
end
|
|
14590
14734
|
function SET_PLAYER:ForEachPlayer(IteratorFunction,...)
|
|
14591
|
-
self:F2(arg)
|
|
14592
14735
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
14593
14736
|
return self
|
|
14594
14737
|
end
|
|
14595
14738
|
function SET_PLAYER:ForEachPlayerInZone(ZoneObject,IteratorFunction,...)
|
|
14596
|
-
self:F2(arg)
|
|
14597
14739
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
14598
14740
|
function(ZoneObject,ClientObject)
|
|
14599
14741
|
if ClientObject:IsInZone(ZoneObject)then
|
|
@@ -14605,7 +14747,6 @@ end,{ZoneObject})
|
|
|
14605
14747
|
return self
|
|
14606
14748
|
end
|
|
14607
14749
|
function SET_PLAYER:ForEachPlayerNotInZone(ZoneObject,IteratorFunction,...)
|
|
14608
|
-
self:F2(arg)
|
|
14609
14750
|
self:ForEach(IteratorFunction,arg,self:GetSet(),
|
|
14610
14751
|
function(ZoneObject,ClientObject)
|
|
14611
14752
|
if ClientObject:IsNotInZone(ZoneObject)then
|
|
@@ -14617,7 +14758,6 @@ end,{ZoneObject})
|
|
|
14617
14758
|
return self
|
|
14618
14759
|
end
|
|
14619
14760
|
function SET_PLAYER:IsIncludeObject(MClient)
|
|
14620
|
-
self:F2(MClient)
|
|
14621
14761
|
local MClientInclude=true
|
|
14622
14762
|
if MClient then
|
|
14623
14763
|
local MClientName=MClient.UnitName
|
|
@@ -14628,12 +14768,10 @@ local ClientCoalitionID=_DATABASE:GetCoalitionFromClientTemplate(MClientName)
|
|
|
14628
14768
|
if ClientCoalitionID==nil and MClient:IsAlive()~=nil then
|
|
14629
14769
|
ClientCoalitionID=MClient:GetCoalition()
|
|
14630
14770
|
end
|
|
14631
|
-
self:T3({"Coalition:",ClientCoalitionID,self.FilterMeta.Coalitions[CoalitionName],CoalitionName})
|
|
14632
14771
|
if self.FilterMeta.Coalitions[CoalitionName]and ClientCoalitionID and self.FilterMeta.Coalitions[CoalitionName]==ClientCoalitionID then
|
|
14633
14772
|
MClientCoalition=true
|
|
14634
14773
|
end
|
|
14635
14774
|
end
|
|
14636
|
-
self:T({"Evaluated Coalition",MClientCoalition})
|
|
14637
14775
|
MClientInclude=MClientInclude and MClientCoalition
|
|
14638
14776
|
end
|
|
14639
14777
|
if self.Filter.Categories and MClientInclude then
|
|
@@ -14643,59 +14781,49 @@ local ClientCategoryID=_DATABASE:GetCategoryFromClientTemplate(MClientName)
|
|
|
14643
14781
|
local UnitCategory=0
|
|
14644
14782
|
if ClientCategoryID==nil and MClient:IsExist()then
|
|
14645
14783
|
ClientCategoryID,UnitCategory=MClient:GetCategory()
|
|
14646
|
-
self:T3({"Category:",UnitCategory,self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
14647
14784
|
if self.FilterMeta.Categories[CategoryName]and UnitCategory and self.FilterMeta.Categories[CategoryName]==UnitCategory then
|
|
14648
14785
|
MClientCategory=true
|
|
14649
14786
|
end
|
|
14650
14787
|
else
|
|
14651
|
-
self:T3({"Category:",ClientCategoryID,self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
14652
14788
|
if self.FilterMeta.Categories[CategoryName]and ClientCategoryID and self.FilterMeta.Categories[CategoryName]==ClientCategoryID then
|
|
14653
14789
|
MClientCategory=true
|
|
14654
14790
|
end
|
|
14655
14791
|
end
|
|
14656
14792
|
end
|
|
14657
|
-
self:T({"Evaluated Category",MClientCategory})
|
|
14658
14793
|
MClientInclude=MClientInclude and MClientCategory
|
|
14659
14794
|
end
|
|
14660
14795
|
if self.Filter.Types then
|
|
14661
14796
|
local MClientType=false
|
|
14662
14797
|
for TypeID,TypeName in pairs(self.Filter.Types)do
|
|
14663
|
-
self:T3({"Type:",MClient:GetTypeName(),TypeName})
|
|
14664
14798
|
if TypeName==MClient:GetTypeName()then
|
|
14665
14799
|
MClientType=true
|
|
14666
14800
|
end
|
|
14667
14801
|
end
|
|
14668
|
-
self:T({"Evaluated Type",MClientType})
|
|
14669
14802
|
MClientInclude=MClientInclude and MClientType
|
|
14670
14803
|
end
|
|
14671
14804
|
if self.Filter.Countries then
|
|
14672
14805
|
local MClientCountry=false
|
|
14673
14806
|
for CountryID,CountryName in pairs(self.Filter.Countries)do
|
|
14674
14807
|
local ClientCountryID=_DATABASE:GetCountryFromClientTemplate(MClientName)
|
|
14675
|
-
self:T3({"Country:",ClientCountryID,country.id[CountryName],CountryName})
|
|
14676
14808
|
if country.id[CountryName]and country.id[CountryName]==ClientCountryID then
|
|
14677
14809
|
MClientCountry=true
|
|
14678
14810
|
end
|
|
14679
14811
|
end
|
|
14680
|
-
self:T({"Evaluated Country",MClientCountry})
|
|
14681
14812
|
MClientInclude=MClientInclude and MClientCountry
|
|
14682
14813
|
end
|
|
14683
14814
|
if self.Filter.ClientPrefixes then
|
|
14684
14815
|
local MClientPrefix=false
|
|
14685
14816
|
for ClientPrefixId,ClientPrefix in pairs(self.Filter.ClientPrefixes)do
|
|
14686
|
-
self:T3({"Prefix:",string.find(MClient.UnitName,ClientPrefix,1),ClientPrefix})
|
|
14687
14817
|
if string.find(MClient.UnitName,ClientPrefix,1)then
|
|
14688
14818
|
MClientPrefix=true
|
|
14689
14819
|
end
|
|
14690
14820
|
end
|
|
14691
|
-
self:T({"Evaluated Prefix",MClientPrefix})
|
|
14692
14821
|
MClientInclude=MClientInclude and MClientPrefix
|
|
14693
14822
|
end
|
|
14694
14823
|
end
|
|
14695
14824
|
if self.Filter.Zones then
|
|
14696
14825
|
local MClientZone=false
|
|
14697
14826
|
for ZoneName,Zone in pairs(self.Filter.Zones)do
|
|
14698
|
-
self:T3("Zone:",ZoneName)
|
|
14699
14827
|
local unit=MClient:GetClientGroupUnit()
|
|
14700
14828
|
if unit and unit:IsInZone(Zone)then
|
|
14701
14829
|
MClientZone=true
|
|
@@ -14703,7 +14831,6 @@ end
|
|
|
14703
14831
|
end
|
|
14704
14832
|
MClientInclude=MClientInclude and MClientZone
|
|
14705
14833
|
end
|
|
14706
|
-
self:T2(MClientInclude)
|
|
14707
14834
|
return MClientInclude
|
|
14708
14835
|
end
|
|
14709
14836
|
end
|
|
@@ -14758,7 +14885,6 @@ local AirbaseFound=nil
|
|
|
14758
14885
|
for AirbaseName,AirbaseObject in pairs(self.Set)do
|
|
14759
14886
|
local AirbaseCoordinate=AirbaseObject:GetCoordinate()
|
|
14760
14887
|
local Distance=Coordinate:Get2DDistance(AirbaseCoordinate)
|
|
14761
|
-
self:F({Distance=Distance})
|
|
14762
14888
|
if Distance<=Range then
|
|
14763
14889
|
AirbaseFound=AirbaseObject
|
|
14764
14890
|
break
|
|
@@ -14827,21 +14953,17 @@ function SET_AIRBASE:AddInDatabase(Event)
|
|
|
14827
14953
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14828
14954
|
end
|
|
14829
14955
|
function SET_AIRBASE:FindInDatabase(Event)
|
|
14830
|
-
self:F3({Event})
|
|
14831
14956
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14832
14957
|
end
|
|
14833
14958
|
function SET_AIRBASE:ForEachAirbase(IteratorFunction,...)
|
|
14834
|
-
self:F2(arg)
|
|
14835
14959
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
14836
14960
|
return self
|
|
14837
14961
|
end
|
|
14838
14962
|
function SET_AIRBASE:FindNearestAirbaseFromPointVec2(PointVec2)
|
|
14839
|
-
self:F2(PointVec2)
|
|
14840
14963
|
local NearestAirbase=self:FindNearestObjectFromPointVec2(PointVec2)
|
|
14841
14964
|
return NearestAirbase
|
|
14842
14965
|
end
|
|
14843
14966
|
function SET_AIRBASE:IsIncludeObject(MAirbase)
|
|
14844
|
-
self:F2(MAirbase)
|
|
14845
14967
|
local MAirbaseInclude=true
|
|
14846
14968
|
if MAirbase then
|
|
14847
14969
|
local MAirbaseName=MAirbase:GetName()
|
|
@@ -14849,28 +14971,23 @@ if self.Filter.Coalitions then
|
|
|
14849
14971
|
local MAirbaseCoalition=false
|
|
14850
14972
|
for CoalitionID,CoalitionName in pairs(self.Filter.Coalitions)do
|
|
14851
14973
|
local AirbaseCoalitionID=_DATABASE:GetCoalitionFromAirbase(MAirbaseName)
|
|
14852
|
-
self:T3({"Coalition:",AirbaseCoalitionID,self.FilterMeta.Coalitions[CoalitionName],CoalitionName})
|
|
14853
14974
|
if self.FilterMeta.Coalitions[CoalitionName]and self.FilterMeta.Coalitions[CoalitionName]==AirbaseCoalitionID then
|
|
14854
14975
|
MAirbaseCoalition=true
|
|
14855
14976
|
end
|
|
14856
14977
|
end
|
|
14857
|
-
self:T({"Evaluated Coalition",MAirbaseCoalition})
|
|
14858
14978
|
MAirbaseInclude=MAirbaseInclude and MAirbaseCoalition
|
|
14859
14979
|
end
|
|
14860
14980
|
if self.Filter.Categories and MAirbaseInclude then
|
|
14861
14981
|
local MAirbaseCategory=false
|
|
14862
14982
|
for CategoryID,CategoryName in pairs(self.Filter.Categories)do
|
|
14863
14983
|
local AirbaseCategoryID=_DATABASE:GetCategoryFromAirbase(MAirbaseName)
|
|
14864
|
-
self:T3({"Category:",AirbaseCategoryID,self.FilterMeta.Categories[CategoryName],CategoryName})
|
|
14865
14984
|
if self.FilterMeta.Categories[CategoryName]and self.FilterMeta.Categories[CategoryName]==AirbaseCategoryID then
|
|
14866
14985
|
MAirbaseCategory=true
|
|
14867
14986
|
end
|
|
14868
14987
|
end
|
|
14869
|
-
self:T({"Evaluated Category",MAirbaseCategory})
|
|
14870
14988
|
MAirbaseInclude=MAirbaseInclude and MAirbaseCategory
|
|
14871
14989
|
end
|
|
14872
14990
|
end
|
|
14873
|
-
self:T2(MAirbaseInclude)
|
|
14874
14991
|
return MAirbaseInclude
|
|
14875
14992
|
end
|
|
14876
14993
|
end
|
|
@@ -14980,20 +15097,16 @@ self:UnHandleEvent(EVENTS.DeleteCargo)
|
|
|
14980
15097
|
return self
|
|
14981
15098
|
end
|
|
14982
15099
|
function SET_CARGO:AddInDatabase(Event)
|
|
14983
|
-
self:F3({Event})
|
|
14984
15100
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14985
15101
|
end
|
|
14986
15102
|
function SET_CARGO:FindInDatabase(Event)
|
|
14987
|
-
self:F3({Event})
|
|
14988
15103
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
14989
15104
|
end
|
|
14990
15105
|
function SET_CARGO:ForEachCargo(IteratorFunction,...)
|
|
14991
|
-
self:F2(arg)
|
|
14992
15106
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
14993
15107
|
return self
|
|
14994
15108
|
end
|
|
14995
15109
|
function SET_CARGO:FindNearestCargoFromPointVec2(PointVec2)
|
|
14996
|
-
self:F2(PointVec2)
|
|
14997
15110
|
local NearestCargo=self:FindNearestObjectFromPointVec2(PointVec2)
|
|
14998
15111
|
return NearestCargo
|
|
14999
15112
|
end
|
|
@@ -15034,7 +15147,6 @@ local FirstCargo=self:FirstCargoWithState("Deployed")
|
|
|
15034
15147
|
return FirstCargo
|
|
15035
15148
|
end
|
|
15036
15149
|
function SET_CARGO:IsIncludeObject(MCargo)
|
|
15037
|
-
self:F2(MCargo)
|
|
15038
15150
|
local MCargoInclude=true
|
|
15039
15151
|
if MCargo then
|
|
15040
15152
|
local MCargoName=MCargo:GetName()
|
|
@@ -15042,42 +15154,34 @@ if self.Filter.Coalitions then
|
|
|
15042
15154
|
local MCargoCoalition=false
|
|
15043
15155
|
for CoalitionID,CoalitionName in pairs(self.Filter.Coalitions)do
|
|
15044
15156
|
local CargoCoalitionID=MCargo:GetCoalition()
|
|
15045
|
-
self:T3({"Coalition:",CargoCoalitionID,self.FilterMeta.Coalitions[CoalitionName],CoalitionName})
|
|
15046
15157
|
if self.FilterMeta.Coalitions[CoalitionName]and self.FilterMeta.Coalitions[CoalitionName]==CargoCoalitionID then
|
|
15047
15158
|
MCargoCoalition=true
|
|
15048
15159
|
end
|
|
15049
15160
|
end
|
|
15050
|
-
self:F({"Evaluated Coalition",MCargoCoalition})
|
|
15051
15161
|
MCargoInclude=MCargoInclude and MCargoCoalition
|
|
15052
15162
|
end
|
|
15053
15163
|
if self.Filter.Types then
|
|
15054
15164
|
local MCargoType=false
|
|
15055
15165
|
for TypeID,TypeName in pairs(self.Filter.Types)do
|
|
15056
|
-
self:T3({"Type:",MCargo:GetType(),TypeName})
|
|
15057
15166
|
if TypeName==MCargo:GetType()then
|
|
15058
15167
|
MCargoType=true
|
|
15059
15168
|
end
|
|
15060
15169
|
end
|
|
15061
|
-
self:F({"Evaluated Type",MCargoType})
|
|
15062
15170
|
MCargoInclude=MCargoInclude and MCargoType
|
|
15063
15171
|
end
|
|
15064
15172
|
if self.Filter.CargoPrefixes then
|
|
15065
15173
|
local MCargoPrefix=false
|
|
15066
15174
|
for CargoPrefixId,CargoPrefix in pairs(self.Filter.CargoPrefixes)do
|
|
15067
|
-
self:T3({"Prefix:",string.find(MCargo.Name,CargoPrefix,1),CargoPrefix})
|
|
15068
15175
|
if string.find(MCargo.Name,CargoPrefix,1)then
|
|
15069
15176
|
MCargoPrefix=true
|
|
15070
15177
|
end
|
|
15071
15178
|
end
|
|
15072
|
-
self:F({"Evaluated Prefix",MCargoPrefix})
|
|
15073
15179
|
MCargoInclude=MCargoInclude and MCargoPrefix
|
|
15074
15180
|
end
|
|
15075
15181
|
end
|
|
15076
|
-
self:T2(MCargoInclude)
|
|
15077
15182
|
return MCargoInclude
|
|
15078
15183
|
end
|
|
15079
15184
|
function SET_CARGO:OnEventNewCargo(EventData)
|
|
15080
|
-
self:F({"New Cargo",EventData})
|
|
15081
15185
|
if EventData.Cargo then
|
|
15082
15186
|
if EventData.Cargo and self:IsIncludeObject(EventData.Cargo)then
|
|
15083
15187
|
self:Add(EventData.Cargo.Name,EventData.Cargo)
|
|
@@ -15085,11 +15189,9 @@ end
|
|
|
15085
15189
|
end
|
|
15086
15190
|
end
|
|
15087
15191
|
function SET_CARGO:OnEventDeleteCargo(EventData)
|
|
15088
|
-
self:F3({EventData})
|
|
15089
15192
|
if EventData.Cargo then
|
|
15090
15193
|
local Cargo=_DATABASE:FindCargo(EventData.Cargo.Name)
|
|
15091
15194
|
if Cargo and Cargo.Name then
|
|
15092
|
-
self:F({CargoNoDestroy=Cargo.NoDestroy})
|
|
15093
15195
|
if Cargo.NoDestroy then
|
|
15094
15196
|
else
|
|
15095
15197
|
self:Remove(Cargo.Name)
|
|
@@ -15186,15 +15288,12 @@ self:UnHandleEvent(EVENTS.DeleteZone)
|
|
|
15186
15288
|
return self
|
|
15187
15289
|
end
|
|
15188
15290
|
function SET_ZONE:AddInDatabase(Event)
|
|
15189
|
-
self:F3({Event})
|
|
15190
15291
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
15191
15292
|
end
|
|
15192
15293
|
function SET_ZONE:FindInDatabase(Event)
|
|
15193
|
-
self:F3({Event})
|
|
15194
15294
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
15195
15295
|
end
|
|
15196
15296
|
function SET_ZONE:ForEachZone(IteratorFunction,...)
|
|
15197
|
-
self:F2(arg)
|
|
15198
15297
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
15199
15298
|
return self
|
|
15200
15299
|
end
|
|
@@ -15225,27 +15324,22 @@ local coord=COORDINATE:New(x,y,z)
|
|
|
15225
15324
|
return coord
|
|
15226
15325
|
end
|
|
15227
15326
|
function SET_ZONE:IsIncludeObject(MZone)
|
|
15228
|
-
self:F2(MZone)
|
|
15229
15327
|
local MZoneInclude=true
|
|
15230
15328
|
if MZone then
|
|
15231
15329
|
local MZoneName=MZone:GetName()
|
|
15232
15330
|
if self.Filter.Prefixes then
|
|
15233
15331
|
local MZonePrefix=false
|
|
15234
15332
|
for ZonePrefixId,ZonePrefix in pairs(self.Filter.Prefixes)do
|
|
15235
|
-
self:T2({"Prefix:",string.find(MZoneName,ZonePrefix,1),ZonePrefix})
|
|
15236
15333
|
if string.find(MZoneName,ZonePrefix,1)then
|
|
15237
15334
|
MZonePrefix=true
|
|
15238
15335
|
end
|
|
15239
15336
|
end
|
|
15240
|
-
self:T({"Evaluated Prefix",MZonePrefix})
|
|
15241
15337
|
MZoneInclude=MZoneInclude and MZonePrefix
|
|
15242
15338
|
end
|
|
15243
15339
|
end
|
|
15244
|
-
self:T2(MZoneInclude)
|
|
15245
15340
|
return MZoneInclude
|
|
15246
15341
|
end
|
|
15247
15342
|
function SET_ZONE:OnEventNewZone(EventData)
|
|
15248
|
-
self:F({"New Zone",EventData})
|
|
15249
15343
|
if EventData.Zone then
|
|
15250
15344
|
if EventData.Zone and self:IsIncludeObject(EventData.Zone)then
|
|
15251
15345
|
self:Add(EventData.Zone.ZoneName,EventData.Zone)
|
|
@@ -15253,11 +15347,9 @@ end
|
|
|
15253
15347
|
end
|
|
15254
15348
|
end
|
|
15255
15349
|
function SET_ZONE:OnEventDeleteZone(EventData)
|
|
15256
|
-
self:F3({EventData})
|
|
15257
15350
|
if EventData.Zone then
|
|
15258
15351
|
local Zone=_DATABASE:FindZone(EventData.Zone.ZoneName)
|
|
15259
15352
|
if Zone and Zone.ZoneName then
|
|
15260
|
-
self:F({ZoneNoDestroy=Zone.NoDestroy})
|
|
15261
15353
|
if Zone.NoDestroy then
|
|
15262
15354
|
else
|
|
15263
15355
|
self:Remove(Zone.ZoneName)
|
|
@@ -15434,54 +15526,42 @@ self:UnHandleEvent(EVENTS.DeleteZoneGoal)
|
|
|
15434
15526
|
return self
|
|
15435
15527
|
end
|
|
15436
15528
|
function SET_ZONE_GOAL:AddInDatabase(Event)
|
|
15437
|
-
self:F3({Event})
|
|
15438
15529
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
15439
15530
|
end
|
|
15440
15531
|
function SET_ZONE_GOAL:FindInDatabase(Event)
|
|
15441
|
-
self:F3({Event})
|
|
15442
15532
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
15443
15533
|
end
|
|
15444
15534
|
function SET_ZONE_GOAL:ForEachZone(IteratorFunction,...)
|
|
15445
|
-
self:F2(arg)
|
|
15446
15535
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
15447
15536
|
return self
|
|
15448
15537
|
end
|
|
15449
15538
|
function SET_ZONE_GOAL:IsIncludeObject(MZone)
|
|
15450
|
-
self:F2(MZone)
|
|
15451
15539
|
local MZoneInclude=true
|
|
15452
15540
|
if MZone then
|
|
15453
15541
|
local MZoneName=MZone:GetName()
|
|
15454
15542
|
if self.Filter.Prefixes then
|
|
15455
15543
|
local MZonePrefix=false
|
|
15456
15544
|
for ZonePrefixId,ZonePrefix in pairs(self.Filter.Prefixes)do
|
|
15457
|
-
self:T3({"Prefix:",string.find(MZoneName,ZonePrefix,1),ZonePrefix})
|
|
15458
15545
|
if string.find(MZoneName,ZonePrefix,1)then
|
|
15459
15546
|
MZonePrefix=true
|
|
15460
15547
|
end
|
|
15461
15548
|
end
|
|
15462
|
-
self:T({"Evaluated Prefix",MZonePrefix})
|
|
15463
15549
|
MZoneInclude=MZoneInclude and MZonePrefix
|
|
15464
15550
|
end
|
|
15465
15551
|
end
|
|
15466
|
-
self:T2(MZoneInclude)
|
|
15467
15552
|
return MZoneInclude
|
|
15468
15553
|
end
|
|
15469
15554
|
function SET_ZONE_GOAL:OnEventNewZoneGoal(EventData)
|
|
15470
|
-
self:T({"New Zone Capture Coalition",EventData})
|
|
15471
|
-
self:T({"Zone Capture Coalition",EventData.ZoneGoal})
|
|
15472
15555
|
if EventData.ZoneGoal then
|
|
15473
15556
|
if EventData.ZoneGoal and self:IsIncludeObject(EventData.ZoneGoal)then
|
|
15474
|
-
self:T({"Adding Zone Capture Coalition",EventData.ZoneGoal.ZoneName,EventData.ZoneGoal})
|
|
15475
15557
|
self:Add(EventData.ZoneGoal.ZoneName,EventData.ZoneGoal)
|
|
15476
15558
|
end
|
|
15477
15559
|
end
|
|
15478
15560
|
end
|
|
15479
15561
|
function SET_ZONE_GOAL:OnEventDeleteZoneGoal(EventData)
|
|
15480
|
-
self:F3({EventData})
|
|
15481
15562
|
if EventData.ZoneGoal then
|
|
15482
15563
|
local Zone=_DATABASE:FindZone(EventData.ZoneGoal.ZoneName)
|
|
15483
15564
|
if Zone and Zone.ZoneName then
|
|
15484
|
-
self:F({ZoneNoDestroy=Zone.NoDestroy})
|
|
15485
15565
|
if Zone.NoDestroy then
|
|
15486
15566
|
else
|
|
15487
15567
|
self:Remove(Zone.ZoneName)
|
|
@@ -15605,33 +15685,27 @@ self:UnHandleEvent(EVENTS.DeleteZoneGoal)
|
|
|
15605
15685
|
return self
|
|
15606
15686
|
end
|
|
15607
15687
|
function SET_OPSZONE:AddInDatabase(Event)
|
|
15608
|
-
self:F3({Event})
|
|
15609
15688
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
15610
15689
|
end
|
|
15611
15690
|
function SET_OPSZONE:FindInDatabase(Event)
|
|
15612
|
-
self:F3({Event})
|
|
15613
15691
|
return Event.IniDCSUnitName,self.Database[Event.IniDCSUnitName]
|
|
15614
15692
|
end
|
|
15615
15693
|
function SET_OPSZONE:ForEachZone(IteratorFunction,...)
|
|
15616
|
-
self:F2(arg)
|
|
15617
15694
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
15618
15695
|
return self
|
|
15619
15696
|
end
|
|
15620
15697
|
function SET_OPSZONE:IsIncludeObject(MZone)
|
|
15621
|
-
self:F2(MZone)
|
|
15622
15698
|
local MZoneInclude=true
|
|
15623
15699
|
if MZone then
|
|
15624
15700
|
local MZoneName=MZone:GetName()
|
|
15625
15701
|
if self.Filter.Prefixes then
|
|
15626
15702
|
local MZonePrefix=false
|
|
15627
15703
|
for ZonePrefixId,ZonePrefix in pairs(self.Filter.Prefixes)do
|
|
15628
|
-
self:T3({"Prefix:",string.find(MZoneName,ZonePrefix,1),ZonePrefix})
|
|
15629
15704
|
if string.find(MZoneName,ZonePrefix,1)then
|
|
15630
15705
|
MZonePrefix=true
|
|
15631
15706
|
break
|
|
15632
15707
|
end
|
|
15633
15708
|
end
|
|
15634
|
-
self:T({"Evaluated Prefix",MZonePrefix})
|
|
15635
15709
|
MZoneInclude=MZoneInclude and MZonePrefix
|
|
15636
15710
|
end
|
|
15637
15711
|
if self.Filter.Coalitions then
|
|
@@ -15646,25 +15720,19 @@ end
|
|
|
15646
15720
|
MZoneInclude=MZoneInclude and MGroupCoalition
|
|
15647
15721
|
end
|
|
15648
15722
|
end
|
|
15649
|
-
self:T2(MZoneInclude)
|
|
15650
15723
|
return MZoneInclude
|
|
15651
15724
|
end
|
|
15652
15725
|
function SET_OPSZONE:OnEventNewZoneGoal(EventData)
|
|
15653
|
-
self:T({"New Zone Capture Coalition",EventData})
|
|
15654
|
-
self:T({"Zone Capture Coalition",EventData.ZoneGoal})
|
|
15655
15726
|
if EventData.ZoneGoal then
|
|
15656
15727
|
if EventData.ZoneGoal and self:IsIncludeObject(EventData.ZoneGoal)then
|
|
15657
|
-
self:T({"Adding Zone Capture Coalition",EventData.ZoneGoal.ZoneName,EventData.ZoneGoal})
|
|
15658
15728
|
self:Add(EventData.ZoneGoal.ZoneName,EventData.ZoneGoal)
|
|
15659
15729
|
end
|
|
15660
15730
|
end
|
|
15661
15731
|
end
|
|
15662
15732
|
function SET_OPSZONE:OnEventDeleteZoneGoal(EventData)
|
|
15663
|
-
self:F3({EventData})
|
|
15664
15733
|
if EventData.ZoneGoal then
|
|
15665
15734
|
local Zone=_DATABASE:FindZone(EventData.ZoneGoal.ZoneName)
|
|
15666
15735
|
if Zone and Zone.ZoneName then
|
|
15667
|
-
self:F({ZoneNoDestroy=Zone.NoDestroy})
|
|
15668
15736
|
if Zone.NoDestroy then
|
|
15669
15737
|
else
|
|
15670
15738
|
self:Remove(Zone.ZoneName)
|
|
@@ -15747,7 +15815,6 @@ end
|
|
|
15747
15815
|
return AliveSet.Set or{}
|
|
15748
15816
|
end
|
|
15749
15817
|
function SET_OPSGROUP:Add(ObjectName,Object)
|
|
15750
|
-
self:T({ObjectName=ObjectName,Object=Object})
|
|
15751
15818
|
if self.Set[ObjectName]then
|
|
15752
15819
|
self:Remove(ObjectName,true)
|
|
15753
15820
|
end
|
|
@@ -15907,7 +15974,6 @@ end
|
|
|
15907
15974
|
return self
|
|
15908
15975
|
end
|
|
15909
15976
|
function SET_OPSGROUP:_EventOnBirth(Event)
|
|
15910
|
-
self:F3({Event})
|
|
15911
15977
|
if Event.IniDCSUnit and Event.IniDCSGroup then
|
|
15912
15978
|
local DCSgroup=Event.IniDCSGroup
|
|
15913
15979
|
if DCSgroup:getInitialSize()==DCSgroup:getSize()then
|
|
@@ -15921,7 +15987,6 @@ end
|
|
|
15921
15987
|
end
|
|
15922
15988
|
end
|
|
15923
15989
|
function SET_OPSGROUP:_EventOnDeadOrCrash(Event)
|
|
15924
|
-
self:F({Event})
|
|
15925
15990
|
if Event.IniDCSUnit then
|
|
15926
15991
|
local ObjectName,Object=self:FindInDatabase(Event)
|
|
15927
15992
|
if ObjectName then
|
|
@@ -16010,7 +16075,6 @@ local self=BASE:Inherit(self,SET_BASE:New(zoneset))
|
|
|
16010
16075
|
local zonenames={}
|
|
16011
16076
|
if ZoneSet then
|
|
16012
16077
|
for _,_zone in pairs(ZoneSet.Set)do
|
|
16013
|
-
self:T("Zone type handed: "..tostring(_zone.ClassName))
|
|
16014
16078
|
table.insert(zonenames,_zone:GetName())
|
|
16015
16079
|
end
|
|
16016
16080
|
self:AddSceneryByName(zonenames)
|
|
@@ -16026,13 +16090,11 @@ zone:Scan({Object.Category.SCENERY})
|
|
|
16026
16090
|
return zone:GetScannedSetScenery()
|
|
16027
16091
|
end
|
|
16028
16092
|
function SET_SCENERY:AddScenery(AddScenery)
|
|
16029
|
-
self:F2(AddScenery:GetName())
|
|
16030
16093
|
self:Add(AddScenery:GetName(),AddScenery)
|
|
16031
16094
|
return self
|
|
16032
16095
|
end
|
|
16033
16096
|
function SET_SCENERY:AddSceneryByName(AddSceneryNames)
|
|
16034
16097
|
local AddSceneryNamesArray=(type(AddSceneryNames)=="table")and AddSceneryNames or{AddSceneryNames}
|
|
16035
|
-
self:T(AddSceneryNamesArray)
|
|
16036
16098
|
for AddSceneryID,AddSceneryName in pairs(AddSceneryNamesArray)do
|
|
16037
16099
|
self:Add(AddSceneryName,SCENERY:FindByZoneName(AddSceneryName))
|
|
16038
16100
|
end
|
|
@@ -16064,7 +16126,6 @@ zones=Zones
|
|
|
16064
16126
|
end
|
|
16065
16127
|
for _,Zone in pairs(zones)do
|
|
16066
16128
|
local zonename=Zone:GetName()
|
|
16067
|
-
self:T(zonename)
|
|
16068
16129
|
self.Filter.Zones[zonename]=Zone
|
|
16069
16130
|
end
|
|
16070
16131
|
return self
|
|
@@ -16104,7 +16165,6 @@ end
|
|
|
16104
16165
|
return CountU
|
|
16105
16166
|
end
|
|
16106
16167
|
function SET_SCENERY:GetAliveSet()
|
|
16107
|
-
self:F2()
|
|
16108
16168
|
local AliveSet=SET_SCENERY:New()
|
|
16109
16169
|
for GroupName,GroupObject in pairs(self.Set)do
|
|
16110
16170
|
local GroupObject=GroupObject
|
|
@@ -16117,7 +16177,6 @@ end
|
|
|
16117
16177
|
return AliveSet.Set or{},AliveSet
|
|
16118
16178
|
end
|
|
16119
16179
|
function SET_SCENERY:ForEachScenery(IteratorFunction,...)
|
|
16120
|
-
self:F2(arg)
|
|
16121
16180
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
16122
16181
|
return self
|
|
16123
16182
|
end
|
|
@@ -16146,23 +16205,19 @@ end
|
|
|
16146
16205
|
Coordinate.x=(x2-x1)/2+x1
|
|
16147
16206
|
Coordinate.y=(y2-y1)/2+y1
|
|
16148
16207
|
Coordinate.z=(z2-z1)/2+z1
|
|
16149
|
-
self:F({Coordinate=Coordinate})
|
|
16150
16208
|
return Coordinate
|
|
16151
16209
|
end
|
|
16152
16210
|
function SET_SCENERY:IsIncludeObject(MScenery)
|
|
16153
|
-
self:T(MScenery.SceneryName)
|
|
16154
16211
|
local MSceneryInclude=true
|
|
16155
16212
|
if MScenery then
|
|
16156
16213
|
local MSceneryName=MScenery:GetName()
|
|
16157
16214
|
if self.Filter.Prefixes then
|
|
16158
16215
|
local MSceneryPrefix=false
|
|
16159
16216
|
for ZonePrefixId,ZonePrefix in pairs(self.Filter.Prefixes)do
|
|
16160
|
-
self:T({"Prefix:",string.find(MSceneryName,ZonePrefix,1),ZonePrefix})
|
|
16161
16217
|
if string.find(MSceneryName,ZonePrefix,1)then
|
|
16162
16218
|
MSceneryPrefix=true
|
|
16163
16219
|
end
|
|
16164
16220
|
end
|
|
16165
|
-
self:T({"Evaluated Prefix",MSceneryPrefix})
|
|
16166
16221
|
MSceneryInclude=MSceneryInclude and MSceneryPrefix
|
|
16167
16222
|
end
|
|
16168
16223
|
if self.Filter.Zones then
|
|
@@ -16172,7 +16227,6 @@ local coord=MScenery:GetCoordinate()
|
|
|
16172
16227
|
if coord and Zone:IsCoordinateInZone(coord)then
|
|
16173
16228
|
MSceneryZone=true
|
|
16174
16229
|
end
|
|
16175
|
-
self:T({"Evaluated Zone",MSceneryZone})
|
|
16176
16230
|
end
|
|
16177
16231
|
MSceneryInclude=MSceneryInclude and MSceneryZone
|
|
16178
16232
|
end
|
|
@@ -16180,21 +16234,17 @@ if self.Filter.SceneryRoles then
|
|
|
16180
16234
|
local MSceneryRole=false
|
|
16181
16235
|
local Role=MScenery:GetProperty("ROLE")or"none"
|
|
16182
16236
|
for ZoneRoleId,ZoneRole in pairs(self.Filter.SceneryRoles)do
|
|
16183
|
-
self:T({"Role:",ZoneRole,Role})
|
|
16184
16237
|
if ZoneRole==Role then
|
|
16185
16238
|
MSceneryRole=true
|
|
16186
16239
|
end
|
|
16187
16240
|
end
|
|
16188
|
-
self:T({"Evaluated Role ",MSceneryRole})
|
|
16189
16241
|
MSceneryInclude=MSceneryInclude and MSceneryRole
|
|
16190
16242
|
end
|
|
16191
16243
|
end
|
|
16192
|
-
self:T2(MSceneryInclude)
|
|
16193
16244
|
return MSceneryInclude
|
|
16194
16245
|
end
|
|
16195
16246
|
function SET_SCENERY:FilterOnce()
|
|
16196
16247
|
for ObjectName,Object in pairs(self:GetSet())do
|
|
16197
|
-
self:T(ObjectName)
|
|
16198
16248
|
if self:IsIncludeObject(Object)then
|
|
16199
16249
|
self:Add(ObjectName,Object)
|
|
16200
16250
|
else
|
|
@@ -16226,12 +16276,313 @@ end
|
|
|
16226
16276
|
function SET_SCENERY:GetRelativeLife()
|
|
16227
16277
|
local life=self:GetLife()
|
|
16228
16278
|
local life0=self:GetLife0()
|
|
16229
|
-
self:T2(string.format("Set Lifepoints: %d life0 | %d life",life0,life))
|
|
16230
16279
|
local rlife=math.floor((life/life0)*100)
|
|
16231
16280
|
return rlife
|
|
16232
16281
|
end
|
|
16233
16282
|
end
|
|
16234
16283
|
do
|
|
16284
|
+
SET_DYNAMICCARGO={
|
|
16285
|
+
ClassName="SET_DYNAMICCARGO",
|
|
16286
|
+
Filter={},
|
|
16287
|
+
Set={},
|
|
16288
|
+
List={},
|
|
16289
|
+
Index={},
|
|
16290
|
+
Database=nil,
|
|
16291
|
+
CallScheduler=nil,
|
|
16292
|
+
Filter={
|
|
16293
|
+
Coalitions=nil,
|
|
16294
|
+
Types=nil,
|
|
16295
|
+
Countries=nil,
|
|
16296
|
+
StaticPrefixes=nil,
|
|
16297
|
+
Zones=nil,
|
|
16298
|
+
},
|
|
16299
|
+
FilterMeta={
|
|
16300
|
+
Coalitions={
|
|
16301
|
+
red=coalition.side.RED,
|
|
16302
|
+
blue=coalition.side.BLUE,
|
|
16303
|
+
neutral=coalition.side.NEUTRAL,
|
|
16304
|
+
}
|
|
16305
|
+
},
|
|
16306
|
+
ZoneTimerInterval=20,
|
|
16307
|
+
ZoneTimer=nil,
|
|
16308
|
+
}
|
|
16309
|
+
function SET_DYNAMICCARGO:New()
|
|
16310
|
+
local self=BASE:Inherit(self,SET_BASE:New(_DATABASE.DYNAMICCARGO))
|
|
16311
|
+
return self
|
|
16312
|
+
end
|
|
16313
|
+
function SET_DYNAMICCARGO:IsIncludeObject(DCargo)
|
|
16314
|
+
local DCargoInclude=true
|
|
16315
|
+
if self.Filter.Coalitions then
|
|
16316
|
+
local DCargoCoalition=false
|
|
16317
|
+
for CoalitionID,CoalitionName in pairs(self.Filter.Coalitions)do
|
|
16318
|
+
if self.FilterMeta.Coalitions[CoalitionName]and self.FilterMeta.Coalitions[CoalitionName]==DCargo:GetCoalition()then
|
|
16319
|
+
DCargoCoalition=true
|
|
16320
|
+
end
|
|
16321
|
+
end
|
|
16322
|
+
DCargoInclude=DCargoInclude and DCargoCoalition
|
|
16323
|
+
end
|
|
16324
|
+
if self.Filter.Types then
|
|
16325
|
+
local DCargoType=false
|
|
16326
|
+
for TypeID,TypeName in pairs(self.Filter.Types)do
|
|
16327
|
+
if TypeName==DCargo:GetTypeName()then
|
|
16328
|
+
DCargoType=true
|
|
16329
|
+
end
|
|
16330
|
+
end
|
|
16331
|
+
DCargoInclude=DCargoInclude and DCargoType
|
|
16332
|
+
end
|
|
16333
|
+
if self.Filter.Countries then
|
|
16334
|
+
local DCargoCountry=false
|
|
16335
|
+
for CountryID,CountryName in pairs(self.Filter.Countries)do
|
|
16336
|
+
if country.id[CountryName]==DCargo:GetCountry()then
|
|
16337
|
+
DCargoCountry=true
|
|
16338
|
+
end
|
|
16339
|
+
end
|
|
16340
|
+
DCargoInclude=DCargoInclude and DCargoCountry
|
|
16341
|
+
end
|
|
16342
|
+
if self.Filter.StaticPrefixes then
|
|
16343
|
+
local DCargoPrefix=false
|
|
16344
|
+
for StaticPrefixId,StaticPrefix in pairs(self.Filter.StaticPrefixes)do
|
|
16345
|
+
if string.find(DCargo:GetName(),StaticPrefix,1)then
|
|
16346
|
+
DCargoPrefix=true
|
|
16347
|
+
end
|
|
16348
|
+
end
|
|
16349
|
+
DCargoInclude=DCargoInclude and DCargoPrefix
|
|
16350
|
+
end
|
|
16351
|
+
if self.Filter.Zones then
|
|
16352
|
+
local DCargoZone=false
|
|
16353
|
+
for ZoneName,Zone in pairs(self.Filter.Zones)do
|
|
16354
|
+
if DCargo and DCargo:IsInZone(Zone)then
|
|
16355
|
+
DCargoZone=true
|
|
16356
|
+
end
|
|
16357
|
+
end
|
|
16358
|
+
DCargoInclude=DCargoInclude and DCargoZone
|
|
16359
|
+
end
|
|
16360
|
+
return DCargoInclude
|
|
16361
|
+
end
|
|
16362
|
+
function SET_DYNAMICCARGO:FilterCoalitions(Coalitions)
|
|
16363
|
+
if not self.Filter.Coalitions then
|
|
16364
|
+
self.Filter.Coalitions={}
|
|
16365
|
+
end
|
|
16366
|
+
if type(Coalitions)~="table"then
|
|
16367
|
+
Coalitions={Coalitions}
|
|
16368
|
+
end
|
|
16369
|
+
for CoalitionID,Coalition in pairs(Coalitions)do
|
|
16370
|
+
self.Filter.Coalitions[Coalition]=Coalition
|
|
16371
|
+
end
|
|
16372
|
+
return self
|
|
16373
|
+
end
|
|
16374
|
+
function SET_DYNAMICCARGO:FilterTypes(Types)
|
|
16375
|
+
if not self.Filter.Types then
|
|
16376
|
+
self.Filter.Types={}
|
|
16377
|
+
end
|
|
16378
|
+
if type(Types)~="table"then
|
|
16379
|
+
Types={Types}
|
|
16380
|
+
end
|
|
16381
|
+
for TypeID,Type in pairs(Types)do
|
|
16382
|
+
self.Filter.Types[Type]=Type
|
|
16383
|
+
end
|
|
16384
|
+
return self
|
|
16385
|
+
end
|
|
16386
|
+
function SET_DYNAMICCARGO:FilterCountries(Countries)
|
|
16387
|
+
if not self.Filter.Countries then
|
|
16388
|
+
self.Filter.Countries={}
|
|
16389
|
+
end
|
|
16390
|
+
if type(Countries)~="table"then
|
|
16391
|
+
Countries={Countries}
|
|
16392
|
+
end
|
|
16393
|
+
for CountryID,Country in pairs(Countries)do
|
|
16394
|
+
self.Filter.Countries[Country]=Country
|
|
16395
|
+
end
|
|
16396
|
+
return self
|
|
16397
|
+
end
|
|
16398
|
+
function SET_DYNAMICCARGO:FilterPrefixes(Prefixes)
|
|
16399
|
+
if not self.Filter.StaticPrefixes then
|
|
16400
|
+
self.Filter.StaticPrefixes={}
|
|
16401
|
+
end
|
|
16402
|
+
if type(Prefixes)~="table"then
|
|
16403
|
+
Prefixes={Prefixes}
|
|
16404
|
+
end
|
|
16405
|
+
for PrefixID,Prefix in pairs(Prefixes)do
|
|
16406
|
+
self.Filter.StaticPrefixes[Prefix]=Prefix
|
|
16407
|
+
end
|
|
16408
|
+
return self
|
|
16409
|
+
end
|
|
16410
|
+
function SET_DYNAMICCARGO:FilterNamePattern(Patterns)
|
|
16411
|
+
return self:FilterPrefixes(Patterns)
|
|
16412
|
+
end
|
|
16413
|
+
function SET_DYNAMICCARGO:FilterIsLoaded()
|
|
16414
|
+
self:FilterFunction(
|
|
16415
|
+
function(cargo)
|
|
16416
|
+
if cargo and cargo.CargoState and cargo.CargoState==DYNAMICCARGO.State.LOADED then
|
|
16417
|
+
return true
|
|
16418
|
+
else
|
|
16419
|
+
return false
|
|
16420
|
+
end
|
|
16421
|
+
end
|
|
16422
|
+
)
|
|
16423
|
+
return self
|
|
16424
|
+
end
|
|
16425
|
+
function SET_DYNAMICCARGO:FilterIsUnloaded()
|
|
16426
|
+
self:FilterFunction(
|
|
16427
|
+
function(cargo)
|
|
16428
|
+
if cargo and cargo.CargoState and cargo.CargoState==DYNAMICCARGO.State.UNLOADED then
|
|
16429
|
+
return true
|
|
16430
|
+
else
|
|
16431
|
+
return false
|
|
16432
|
+
end
|
|
16433
|
+
end
|
|
16434
|
+
)
|
|
16435
|
+
return self
|
|
16436
|
+
end
|
|
16437
|
+
function SET_DYNAMICCARGO:FilterIsNew()
|
|
16438
|
+
self:FilterFunction(
|
|
16439
|
+
function(cargo)
|
|
16440
|
+
if cargo and cargo.CargoState and cargo.CargoState==DYNAMICCARGO.State.NEW then
|
|
16441
|
+
return true
|
|
16442
|
+
else
|
|
16443
|
+
return false
|
|
16444
|
+
end
|
|
16445
|
+
end
|
|
16446
|
+
)
|
|
16447
|
+
return self
|
|
16448
|
+
end
|
|
16449
|
+
function SET_DYNAMICCARGO:FilterCurrentOwner(PlayerName)
|
|
16450
|
+
self:FilterFunction(
|
|
16451
|
+
function(cargo)
|
|
16452
|
+
if cargo and cargo.Owner and string.find(cargo.Owner,PlayerName,1,true)then
|
|
16453
|
+
return true
|
|
16454
|
+
else
|
|
16455
|
+
return false
|
|
16456
|
+
end
|
|
16457
|
+
end
|
|
16458
|
+
)
|
|
16459
|
+
return self
|
|
16460
|
+
end
|
|
16461
|
+
function SET_DYNAMICCARGO:FilterZones(Zones)
|
|
16462
|
+
if not self.Filter.Zones then
|
|
16463
|
+
self.Filter.Zones={}
|
|
16464
|
+
end
|
|
16465
|
+
local zones={}
|
|
16466
|
+
if Zones.ClassName and Zones.ClassName=="SET_ZONE"then
|
|
16467
|
+
zones=Zones.Set
|
|
16468
|
+
elseif type(Zones)~="table"or(type(Zones)=="table"and Zones.ClassName)then
|
|
16469
|
+
self:E("***** FilterZones needs either a table of ZONE Objects or a SET_ZONE as parameter!")
|
|
16470
|
+
return self
|
|
16471
|
+
else
|
|
16472
|
+
zones=Zones
|
|
16473
|
+
end
|
|
16474
|
+
for _,Zone in pairs(zones)do
|
|
16475
|
+
local zonename=Zone:GetName()
|
|
16476
|
+
self.Filter.Zones[zonename]=Zone
|
|
16477
|
+
end
|
|
16478
|
+
return self
|
|
16479
|
+
end
|
|
16480
|
+
function SET_DYNAMICCARGO:FilterStart()
|
|
16481
|
+
if _DATABASE then
|
|
16482
|
+
self:HandleEvent(EVENTS.NewDynamicCargo,self._EventHandlerDCAdd)
|
|
16483
|
+
self:HandleEvent(EVENTS.DynamicCargoRemoved,self._EventHandlerDCRemove)
|
|
16484
|
+
if self.Filter.Zones then
|
|
16485
|
+
self.ZoneTimer=TIMER:New(self._ContinousZoneFilter,self)
|
|
16486
|
+
local timing=self.ZoneTimerInterval or 30
|
|
16487
|
+
self.ZoneTimer:Start(timing,timing)
|
|
16488
|
+
end
|
|
16489
|
+
self:_FilterStart()
|
|
16490
|
+
end
|
|
16491
|
+
return self
|
|
16492
|
+
end
|
|
16493
|
+
function SET_DYNAMICCARGO:FilterStop()
|
|
16494
|
+
if _DATABASE then
|
|
16495
|
+
self:UnHandleEvent(EVENTS.NewDynamicCargo)
|
|
16496
|
+
self:UnHandleEvent(EVENTS.DynamicCargoRemoved)
|
|
16497
|
+
if self.ZoneTimer and self.ZoneTimer:IsRunning()then
|
|
16498
|
+
self.ZoneTimer:Stop()
|
|
16499
|
+
end
|
|
16500
|
+
end
|
|
16501
|
+
return self
|
|
16502
|
+
end
|
|
16503
|
+
function SET_DYNAMICCARGO:_ContinousZoneFilter()
|
|
16504
|
+
local Database=_DATABASE.DYNAMICCARGO
|
|
16505
|
+
for ObjectName,Object in pairs(Database)do
|
|
16506
|
+
if self:IsIncludeObject(Object)and self:IsNotInSet(Object)then
|
|
16507
|
+
self:Add(ObjectName,Object)
|
|
16508
|
+
elseif(not self:IsIncludeObject(Object))and self:IsInSet(Object)then
|
|
16509
|
+
self:Remove(ObjectName)
|
|
16510
|
+
end
|
|
16511
|
+
end
|
|
16512
|
+
return self
|
|
16513
|
+
end
|
|
16514
|
+
function SET_DYNAMICCARGO:_EventHandlerDCAdd(Event)
|
|
16515
|
+
if Event.IniDynamicCargo and Event.IniDynamicCargoName then
|
|
16516
|
+
if not _DATABASE.DYNAMICCARGO[Event.IniDynamicCargoName]then
|
|
16517
|
+
_DATABASE:AddDynamicCargo(Event.IniDynamicCargoName)
|
|
16518
|
+
end
|
|
16519
|
+
local ObjectName,Object=self:FindInDatabase(Event)
|
|
16520
|
+
if Object and self:IsIncludeObject(Object)then
|
|
16521
|
+
self:Add(ObjectName,Object)
|
|
16522
|
+
end
|
|
16523
|
+
end
|
|
16524
|
+
return self
|
|
16525
|
+
end
|
|
16526
|
+
function SET_DYNAMICCARGO:_EventHandlerDCRemove(Event)
|
|
16527
|
+
if Event.IniDCSUnitName then
|
|
16528
|
+
local ObjectName,Object=self:FindInDatabase(Event)
|
|
16529
|
+
if ObjectName then
|
|
16530
|
+
self:Remove(ObjectName)
|
|
16531
|
+
end
|
|
16532
|
+
end
|
|
16533
|
+
return self
|
|
16534
|
+
end
|
|
16535
|
+
function SET_DYNAMICCARGO:FindInDatabase(Event)
|
|
16536
|
+
return Event.IniDCSUnitName,self.Set[Event.IniDCSUnitName]
|
|
16537
|
+
end
|
|
16538
|
+
function SET_DYNAMICCARGO:FilterZoneTimer(Seconds)
|
|
16539
|
+
self.ZoneTimerInterval=Seconds or 30
|
|
16540
|
+
return self
|
|
16541
|
+
end
|
|
16542
|
+
function SET_DYNAMICCARGO:FilterDeads()
|
|
16543
|
+
return self
|
|
16544
|
+
end
|
|
16545
|
+
function SET_DYNAMICCARGO:FilterCrashes()
|
|
16546
|
+
return self
|
|
16547
|
+
end
|
|
16548
|
+
function SET_DYNAMICCARGO:GetOwnerNames()
|
|
16549
|
+
local owners={}
|
|
16550
|
+
self:ForEach(
|
|
16551
|
+
function(cargo)
|
|
16552
|
+
if cargo and cargo.Owner then
|
|
16553
|
+
table.insert(owners,cargo.Owner,cargo.Owner)
|
|
16554
|
+
end
|
|
16555
|
+
end
|
|
16556
|
+
)
|
|
16557
|
+
return owners
|
|
16558
|
+
end
|
|
16559
|
+
function SET_DYNAMICCARGO:GetStorageObjects()
|
|
16560
|
+
local owners={}
|
|
16561
|
+
self:ForEach(
|
|
16562
|
+
function(cargo)
|
|
16563
|
+
if cargo and cargo.warehouse then
|
|
16564
|
+
table.insert(owners,cargo.StaticName,cargo.warehouse)
|
|
16565
|
+
end
|
|
16566
|
+
end
|
|
16567
|
+
)
|
|
16568
|
+
return owners
|
|
16569
|
+
end
|
|
16570
|
+
function SET_DYNAMICCARGO:GetOwnerClientObjects()
|
|
16571
|
+
local owners={}
|
|
16572
|
+
self:ForEach(
|
|
16573
|
+
function(cargo)
|
|
16574
|
+
if cargo and cargo.Owner then
|
|
16575
|
+
local client=CLIENT:FindByPlayerName(cargo.Owner)
|
|
16576
|
+
if client then
|
|
16577
|
+
table.insert(owners,cargo.Owner,client)
|
|
16578
|
+
end
|
|
16579
|
+
end
|
|
16580
|
+
end
|
|
16581
|
+
)
|
|
16582
|
+
return owners
|
|
16583
|
+
end
|
|
16584
|
+
end
|
|
16585
|
+
do
|
|
16235
16586
|
COORDINATE={
|
|
16236
16587
|
ClassName="COORDINATE",
|
|
16237
16588
|
}
|
|
@@ -17448,7 +17799,7 @@ local Latitude,Longitude=self:GetLLDDM()
|
|
|
17448
17799
|
local Tdiff=UTILS.GMTToLocalTimeDifference()
|
|
17449
17800
|
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear,Latitude,Longitude,true,Tdiff)
|
|
17450
17801
|
local date=UTILS.GetDCSMissionDate()
|
|
17451
|
-
if InSeconds then
|
|
17802
|
+
if InSeconds or type(sunrise)=="string"then
|
|
17452
17803
|
return sunrise
|
|
17453
17804
|
else
|
|
17454
17805
|
return UTILS.SecondsToClock(sunrise,true)
|
|
@@ -17518,7 +17869,7 @@ local Latitude,Longitude=self:GetLLDDM()
|
|
|
17518
17869
|
local Tdiff=UTILS.GMTToLocalTimeDifference()
|
|
17519
17870
|
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear,Latitude,Longitude,false,Tdiff)
|
|
17520
17871
|
local date=UTILS.GetDCSMissionDate()
|
|
17521
|
-
if InSeconds then
|
|
17872
|
+
if InSeconds or type(sunrise)=="string"then
|
|
17522
17873
|
return sunrise
|
|
17523
17874
|
else
|
|
17524
17875
|
return UTILS.SecondsToClock(sunrise,true)
|
|
@@ -18180,6 +18531,7 @@ self.MessageCategory=""
|
|
|
18180
18531
|
end
|
|
18181
18532
|
if self.MessageDuration~=0 then
|
|
18182
18533
|
self:T(self.MessageCategory..self.MessageText:gsub("\n$",""):gsub("\n$","").." / "..self.MessageDuration)
|
|
18534
|
+
local ID=Unit:GetID()
|
|
18183
18535
|
trigger.action.outTextForUnit(Unit:GetID(),self.MessageCategory..self.MessageText:gsub("\n$",""):gsub("\n$",""),self.MessageDuration,self.ClearScreen)
|
|
18184
18536
|
end
|
|
18185
18537
|
end
|
|
@@ -18240,8 +18592,11 @@ self:ToCoalition(CoalitionSide)
|
|
|
18240
18592
|
end
|
|
18241
18593
|
return self
|
|
18242
18594
|
end
|
|
18243
|
-
function MESSAGE:ToAll(Settings)
|
|
18595
|
+
function MESSAGE:ToAll(Settings,Delay)
|
|
18244
18596
|
self:F()
|
|
18597
|
+
if Delay and Delay>0 then
|
|
18598
|
+
self:ScheduleOnce(Delay,MESSAGE.ToAll,self,Settings,0)
|
|
18599
|
+
else
|
|
18245
18600
|
if self.MessageType then
|
|
18246
18601
|
local Settings=Settings or _SETTINGS
|
|
18247
18602
|
self.MessageDuration=Settings:GetMessageTime(self.MessageType)
|
|
@@ -18251,6 +18606,7 @@ if self.MessageDuration~=0 then
|
|
|
18251
18606
|
self:T(self.MessageCategory..self.MessageText:gsub("\n$",""):gsub("\n$","").." / "..self.MessageDuration)
|
|
18252
18607
|
trigger.action.outText(self.MessageCategory..self.MessageText:gsub("\n$",""):gsub("\n$",""),self.MessageDuration,self.ClearScreen)
|
|
18253
18608
|
end
|
|
18609
|
+
end
|
|
18254
18610
|
return self
|
|
18255
18611
|
end
|
|
18256
18612
|
function MESSAGE:ToAllIf(Condition)
|
|
@@ -22084,7 +22440,7 @@ local CX=X/2
|
|
|
22084
22440
|
local CZ=Z/2
|
|
22085
22441
|
return math.max(math.max(CX,CZ),boxmin)
|
|
22086
22442
|
end
|
|
22087
|
-
BASE:
|
|
22443
|
+
BASE:T({"Cannot GetBoundingRadius",Positionable=self,Alive=self:IsAlive()})
|
|
22088
22444
|
return nil
|
|
22089
22445
|
end
|
|
22090
22446
|
function POSITIONABLE:GetAltitude()
|
|
@@ -22706,6 +23062,7 @@ POSITIONABLE.CargoBayCapacityValues={
|
|
|
22706
23062
|
["HL_KORD"]=6*POSITIONABLE.DefaultInfantryWeight,
|
|
22707
23063
|
["HL_DSHK"]=6*POSITIONABLE.DefaultInfantryWeight,
|
|
22708
23064
|
["CCKW_353"]=16*POSITIONABLE.DefaultInfantryWeight,
|
|
23065
|
+
["MaxxPro_MRAP"]=7*POSITIONABLE.DefaultInfantryWeight,
|
|
22709
23066
|
}
|
|
22710
23067
|
}
|
|
22711
23068
|
function POSITIONABLE:SetCargoBayWeightLimit(WeightLimit)
|
|
@@ -23338,10 +23695,10 @@ local DCSTask={
|
|
|
23338
23695
|
id='Strafing',
|
|
23339
23696
|
params={
|
|
23340
23697
|
point=Vec2,
|
|
23341
|
-
weaponType=WeaponType or
|
|
23698
|
+
weaponType=WeaponType or 805337088,
|
|
23342
23699
|
expend=WeaponExpend or"Auto",
|
|
23343
23700
|
attackQty=AttackQty or 1,
|
|
23344
|
-
attackQtyLimit=AttackQty
|
|
23701
|
+
attackQtyLimit=AttackQty~=nil and true or false,
|
|
23345
23702
|
direction=Direction and math.rad(Direction)or 0,
|
|
23346
23703
|
directionEnabled=Direction and true or false,
|
|
23347
23704
|
groupAttack=GroupAttack or false,
|
|
@@ -26145,13 +26502,16 @@ end
|
|
|
26145
26502
|
return nil
|
|
26146
26503
|
end
|
|
26147
26504
|
function GROUP:GetCoalition()
|
|
26148
|
-
self
|
|
26505
|
+
if self.GroupCoalition~=nil then
|
|
26506
|
+
return self.GroupCoalition
|
|
26507
|
+
else
|
|
26149
26508
|
local DCSGroup=self:GetDCSObject()
|
|
26150
26509
|
if DCSGroup then
|
|
26151
26510
|
local GroupCoalition=DCSGroup:getCoalition()
|
|
26152
|
-
self
|
|
26511
|
+
self.GroupCoalition=GroupCoalition
|
|
26153
26512
|
return GroupCoalition
|
|
26154
26513
|
end
|
|
26514
|
+
end
|
|
26155
26515
|
return nil
|
|
26156
26516
|
end
|
|
26157
26517
|
function GROUP:GetCountry()
|
|
@@ -28419,7 +28779,10 @@ end
|
|
|
28419
28779
|
function UNIT:GetSkill()
|
|
28420
28780
|
self:F2(self.UnitName)
|
|
28421
28781
|
local name=self.UnitName
|
|
28422
|
-
local skill=
|
|
28782
|
+
local skill="Random"
|
|
28783
|
+
if _DATABASE.Templates.Units[name]and _DATABASE.Templates.Units[name].Template and _DATABASE.Templates.Units[name].Template.skill then
|
|
28784
|
+
skill=_DATABASE.Templates.Units[name].Template.skill or"Random"
|
|
28785
|
+
end
|
|
28423
28786
|
return skill
|
|
28424
28787
|
end
|
|
28425
28788
|
function UNIT:GetSTN()
|
|
@@ -31195,18 +31558,6 @@ net.send_chat_to(Message,tonumber(PlayerId))
|
|
|
31195
31558
|
end
|
|
31196
31559
|
return self
|
|
31197
31560
|
end
|
|
31198
|
-
function NET:LoadMission(Path)
|
|
31199
|
-
local outcome=false
|
|
31200
|
-
if Path then
|
|
31201
|
-
outcome=net.load_mission(Path)
|
|
31202
|
-
end
|
|
31203
|
-
return outcome
|
|
31204
|
-
end
|
|
31205
|
-
function NET:LoadNextMission()
|
|
31206
|
-
local outcome=false
|
|
31207
|
-
outcome=net.load_next_mission()
|
|
31208
|
-
return outcome
|
|
31209
|
-
end
|
|
31210
31561
|
function NET:GetPlayerList()
|
|
31211
31562
|
local plist=nil
|
|
31212
31563
|
plist=net.get_player_list()
|
|
@@ -31389,6 +31740,15 @@ end
|
|
|
31389
31740
|
self.lid=string.format("STORAGE %s",StaticCargoName)
|
|
31390
31741
|
return self
|
|
31391
31742
|
end
|
|
31743
|
+
function STORAGE:NewFromDynamicCargo(DynamicCargoName)
|
|
31744
|
+
local self=BASE:Inherit(self,BASE:New())
|
|
31745
|
+
self.airbase=Unit.getByName(DynamicCargoName)
|
|
31746
|
+
if Airbase.getWarehouse then
|
|
31747
|
+
self.warehouse=Warehouse.getCargoAsWarehouse(self.airbase)
|
|
31748
|
+
end
|
|
31749
|
+
self.lid=string.format("STORAGE %s",DynamicCargoName)
|
|
31750
|
+
return self
|
|
31751
|
+
end
|
|
31392
31752
|
function STORAGE:FindByName(AirbaseName)
|
|
31393
31753
|
local storage=_DATABASE:FindStorage(AirbaseName)
|
|
31394
31754
|
return storage
|
|
@@ -31529,6 +31889,258 @@ function STORAGE:GetInventory(Item)
|
|
|
31529
31889
|
local inventory=self.warehouse:getInventory(Item)
|
|
31530
31890
|
return inventory.aircraft,inventory.liquids,inventory.weapon
|
|
31531
31891
|
end
|
|
31892
|
+
DYNAMICCARGO={
|
|
31893
|
+
ClassName="DYNAMICCARGO",
|
|
31894
|
+
verbose=0,
|
|
31895
|
+
testing=false,
|
|
31896
|
+
Interval=10,
|
|
31897
|
+
}
|
|
31898
|
+
DYNAMICCARGO.Liquid={
|
|
31899
|
+
JETFUEL=0,
|
|
31900
|
+
GASOLINE=1,
|
|
31901
|
+
MW50=2,
|
|
31902
|
+
DIESEL=3,
|
|
31903
|
+
}
|
|
31904
|
+
DYNAMICCARGO.LiquidName={
|
|
31905
|
+
GASOLINE="gasoline",
|
|
31906
|
+
DIESEL="diesel",
|
|
31907
|
+
MW50="methanol_mixture",
|
|
31908
|
+
JETFUEL="jet_fuel",
|
|
31909
|
+
}
|
|
31910
|
+
DYNAMICCARGO.Type={
|
|
31911
|
+
WEAPONS="weapons",
|
|
31912
|
+
LIQUIDS="liquids",
|
|
31913
|
+
AIRCRAFT="aircrafts",
|
|
31914
|
+
}
|
|
31915
|
+
DYNAMICCARGO.State={
|
|
31916
|
+
NEW="NEW",
|
|
31917
|
+
LOADED="LOADED",
|
|
31918
|
+
UNLOADED="UNLOADED",
|
|
31919
|
+
REMOVED="REMOVED",
|
|
31920
|
+
}
|
|
31921
|
+
DYNAMICCARGO.AircraftTypes={
|
|
31922
|
+
["CH-47Fbl1"]="CH-47Fbl1",
|
|
31923
|
+
}
|
|
31924
|
+
DYNAMICCARGO.AircraftDimensions={
|
|
31925
|
+
["CH-47Fbl1"]={
|
|
31926
|
+
["width"]=4,
|
|
31927
|
+
["height"]=6,
|
|
31928
|
+
["length"]=11,
|
|
31929
|
+
["ropelength"]=30,
|
|
31930
|
+
},
|
|
31931
|
+
}
|
|
31932
|
+
DYNAMICCARGO.version="0.0.5"
|
|
31933
|
+
function DYNAMICCARGO:Register(CargoName)
|
|
31934
|
+
local self=BASE:Inherit(self,POSITIONABLE:New(CargoName))
|
|
31935
|
+
self.StaticName=CargoName
|
|
31936
|
+
self.LastPosition=self:GetCoordinate()
|
|
31937
|
+
self.CargoState=DYNAMICCARGO.State.NEW
|
|
31938
|
+
self.Interval=DYNAMICCARGO.Interval or 10
|
|
31939
|
+
local DCSObject=self:GetDCSObject()
|
|
31940
|
+
if DCSObject then
|
|
31941
|
+
local warehouse=STORAGE:NewFromDynamicCargo(CargoName)
|
|
31942
|
+
self.warehouse=warehouse
|
|
31943
|
+
end
|
|
31944
|
+
self.lid=string.format("DYNAMICCARGO %s",CargoName)
|
|
31945
|
+
self.Owner=string.match(CargoName,"^(.+)|%d%d:%d%d|PKG%d+")or"None"
|
|
31946
|
+
self.timer=TIMER:New(DYNAMICCARGO._UpdatePosition,self)
|
|
31947
|
+
self.timer:Start(self.Interval,self.Interval)
|
|
31948
|
+
if not _DYNAMICCARGO_HELOS then
|
|
31949
|
+
_DYNAMICCARGO_HELOS=SET_CLIENT:New():FilterAlive():FilterFunction(DYNAMICCARGO._FilterHeloTypes):FilterStart()
|
|
31950
|
+
end
|
|
31951
|
+
if self.testing then
|
|
31952
|
+
BASE:TraceOn()
|
|
31953
|
+
BASE:TraceClass("DYNAMICCARGO")
|
|
31954
|
+
end
|
|
31955
|
+
return self
|
|
31956
|
+
end
|
|
31957
|
+
function DYNAMICCARGO:GetDCSObject()
|
|
31958
|
+
local DCSStatic=Unit.getByName(self.StaticName)
|
|
31959
|
+
if DCSStatic then
|
|
31960
|
+
return DCSStatic
|
|
31961
|
+
end
|
|
31962
|
+
return nil
|
|
31963
|
+
end
|
|
31964
|
+
function DYNAMICCARGO:GetLastOwner()
|
|
31965
|
+
return self.Owner
|
|
31966
|
+
end
|
|
31967
|
+
function DYNAMICCARGO:IsNew()
|
|
31968
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.NEW then
|
|
31969
|
+
return true
|
|
31970
|
+
else
|
|
31971
|
+
return false
|
|
31972
|
+
end
|
|
31973
|
+
end
|
|
31974
|
+
function DYNAMICCARGO:IsLoaded()
|
|
31975
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.LOADED then
|
|
31976
|
+
return true
|
|
31977
|
+
else
|
|
31978
|
+
return false
|
|
31979
|
+
end
|
|
31980
|
+
end
|
|
31981
|
+
function DYNAMICCARGO:IsUnloaded()
|
|
31982
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.REMOVED then
|
|
31983
|
+
return true
|
|
31984
|
+
else
|
|
31985
|
+
return false
|
|
31986
|
+
end
|
|
31987
|
+
end
|
|
31988
|
+
function DYNAMICCARGO:IsRemoved()
|
|
31989
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.UNLOADED then
|
|
31990
|
+
return true
|
|
31991
|
+
else
|
|
31992
|
+
return false
|
|
31993
|
+
end
|
|
31994
|
+
end
|
|
31995
|
+
function DYNAMICCARGO:GetCratesNeeded()
|
|
31996
|
+
return 1
|
|
31997
|
+
end
|
|
31998
|
+
function DYNAMICCARGO:WasDropped()
|
|
31999
|
+
return self.CargoState==DYNAMICCARGO.State.UNLOADED and true or false
|
|
32000
|
+
end
|
|
32001
|
+
function DYNAMICCARGO:GetType()
|
|
32002
|
+
return CTLD_CARGO.Enum.GCLOADABLE
|
|
32003
|
+
end
|
|
32004
|
+
function DYNAMICCARGO:GetLastPosition()
|
|
32005
|
+
return self.LastPosition
|
|
32006
|
+
end
|
|
32007
|
+
function DYNAMICCARGO:GetState()
|
|
32008
|
+
return self.CargoState
|
|
32009
|
+
end
|
|
32010
|
+
function DYNAMICCARGO:FindByName(Name)
|
|
32011
|
+
local storage=_DATABASE:FindDynamicCargo(Name)
|
|
32012
|
+
return storage
|
|
32013
|
+
end
|
|
32014
|
+
function DYNAMICCARGO:FindByMatching(Pattern)
|
|
32015
|
+
local GroupFound=nil
|
|
32016
|
+
for name,static in pairs(_DATABASE.DYNAMICCARGO)do
|
|
32017
|
+
if string.match(name,Pattern)then
|
|
32018
|
+
GroupFound=static
|
|
32019
|
+
break
|
|
32020
|
+
end
|
|
32021
|
+
end
|
|
32022
|
+
return GroupFound
|
|
32023
|
+
end
|
|
32024
|
+
function DYNAMICCARGO:FindAllByMatching(Pattern)
|
|
32025
|
+
local GroupsFound={}
|
|
32026
|
+
for name,static in pairs(_DATABASE.DYNAMICCARGO)do
|
|
32027
|
+
if string.match(name,Pattern)then
|
|
32028
|
+
GroupsFound[#GroupsFound+1]=static
|
|
32029
|
+
end
|
|
32030
|
+
end
|
|
32031
|
+
return GroupsFound
|
|
32032
|
+
end
|
|
32033
|
+
function DYNAMICCARGO:GetStorageObject()
|
|
32034
|
+
return self.warehouse
|
|
32035
|
+
end
|
|
32036
|
+
function DYNAMICCARGO:GetCargoWeight()
|
|
32037
|
+
local DCSObject=self:GetDCSObject()
|
|
32038
|
+
if DCSObject then
|
|
32039
|
+
local weight=DCSObject:getCargoWeight()
|
|
32040
|
+
return weight
|
|
32041
|
+
else
|
|
32042
|
+
return 0
|
|
32043
|
+
end
|
|
32044
|
+
end
|
|
32045
|
+
function DYNAMICCARGO:GetCargoDisplayName()
|
|
32046
|
+
local DCSObject=self:GetDCSObject()
|
|
32047
|
+
if DCSObject then
|
|
32048
|
+
local weight=DCSObject:getCargoDisplayName()
|
|
32049
|
+
return weight
|
|
32050
|
+
else
|
|
32051
|
+
return self.StaticName
|
|
32052
|
+
end
|
|
32053
|
+
end
|
|
32054
|
+
function DYNAMICCARGO:_GetPossibleHeloNearby(pos,loading)
|
|
32055
|
+
local set=_DYNAMICCARGO_HELOS:GetAliveSet()
|
|
32056
|
+
local success=false
|
|
32057
|
+
local Helo=nil
|
|
32058
|
+
local Playername=nil
|
|
32059
|
+
for _,_helo in pairs(set or{})do
|
|
32060
|
+
local helo=_helo
|
|
32061
|
+
local name=helo:GetPlayerName()or _DATABASE:_FindPlayerNameByUnitName(helo:GetName())or"None"
|
|
32062
|
+
self:T(self.lid.." Checking: "..name)
|
|
32063
|
+
local hpos=helo:GetCoordinate()
|
|
32064
|
+
local inair=helo:InAir()
|
|
32065
|
+
self:T(self.lid.." InAir: AGL/InAir: "..hpos.y-hpos:GetLandHeight().."/"..tostring(inair))
|
|
32066
|
+
local typename=helo:GetTypeName()
|
|
32067
|
+
if hpos and typename and inair==false then
|
|
32068
|
+
local dimensions=DYNAMICCARGO.AircraftDimensions[typename]
|
|
32069
|
+
if dimensions then
|
|
32070
|
+
local delta2D=hpos:Get2DDistance(pos)
|
|
32071
|
+
local delta3D=hpos:Get3DDistance(pos)
|
|
32072
|
+
if self.testing then
|
|
32073
|
+
self:T(string.format("Cargo relative position: 2D %dm | 3D %dm",delta2D,delta3D))
|
|
32074
|
+
self:T(string.format("Helo dimension: length %dm | width %dm | rope %dm",dimensions.length,dimensions.width,dimensions.ropelength))
|
|
32075
|
+
end
|
|
32076
|
+
if loading~=true and delta2D>dimensions.length or delta2D>dimensions.width or delta3D>dimensions.ropelength then
|
|
32077
|
+
success=true
|
|
32078
|
+
Helo=helo
|
|
32079
|
+
Playername=name
|
|
32080
|
+
end
|
|
32081
|
+
if loading==true and delta2D<dimensions.length or delta2D<dimensions.width or delta3D<dimensions.ropelength then
|
|
32082
|
+
success=true
|
|
32083
|
+
Helo=helo
|
|
32084
|
+
Playername=name
|
|
32085
|
+
end
|
|
32086
|
+
end
|
|
32087
|
+
end
|
|
32088
|
+
end
|
|
32089
|
+
return success,Helo,Playername
|
|
32090
|
+
end
|
|
32091
|
+
function DYNAMICCARGO:_UpdatePosition()
|
|
32092
|
+
self:T(self.lid.." _UpdatePositionAndState")
|
|
32093
|
+
if self:IsAlive()then
|
|
32094
|
+
local pos=self:GetCoordinate()
|
|
32095
|
+
if self.testing then
|
|
32096
|
+
self:T(string.format("Cargo position: x=%d, y=%d, z=%d",pos.x,pos.y,pos.z))
|
|
32097
|
+
self:T(string.format("Last position: x=%d, y=%d, z=%d",self.LastPosition.x,self.LastPosition.y,self.LastPosition.z))
|
|
32098
|
+
end
|
|
32099
|
+
if UTILS.Round(UTILS.VecDist3D(pos,self.LastPosition),2)>0.5 then
|
|
32100
|
+
if self.CargoState==DYNAMICCARGO.State.NEW then
|
|
32101
|
+
local isloaded,client,playername=self:_GetPossibleHeloNearby(pos,true)
|
|
32102
|
+
self:T(self.lid.." moved! NEW -> LOADED by "..tostring(playername))
|
|
32103
|
+
self.CargoState=DYNAMICCARGO.State.LOADED
|
|
32104
|
+
self.Owner=playername
|
|
32105
|
+
_DATABASE:CreateEventDynamicCargoLoaded(self)
|
|
32106
|
+
elseif self.CargoState==DYNAMICCARGO.State.LOADED then
|
|
32107
|
+
local count=_DYNAMICCARGO_HELOS:CountAlive()
|
|
32108
|
+
local landheight=pos:GetLandHeight()
|
|
32109
|
+
local agl=pos.y-landheight
|
|
32110
|
+
agl=UTILS.Round(agl,2)
|
|
32111
|
+
self:T(self.lid.." AGL: "..agl or-1)
|
|
32112
|
+
local isunloaded=true
|
|
32113
|
+
local client
|
|
32114
|
+
local playername
|
|
32115
|
+
if count>0 and(agl>0 or self.testing)then
|
|
32116
|
+
self:T(self.lid.." Possible alive helos: "..count or-1)
|
|
32117
|
+
if agl~=0 or self.testing then
|
|
32118
|
+
isunloaded,client,playername=self:_GetPossibleHeloNearby(pos,false)
|
|
32119
|
+
end
|
|
32120
|
+
if isunloaded then
|
|
32121
|
+
self:T(self.lid.." moved! LOADED -> UNLOADED by "..tostring(playername))
|
|
32122
|
+
self.CargoState=DYNAMICCARGO.State.UNLOADED
|
|
32123
|
+
self.Owner=playername
|
|
32124
|
+
_DATABASE:CreateEventDynamicCargoUnloaded(self)
|
|
32125
|
+
end
|
|
32126
|
+
end
|
|
32127
|
+
end
|
|
32128
|
+
self.LastPosition=pos
|
|
32129
|
+
end
|
|
32130
|
+
else
|
|
32131
|
+
if self.timer and self.timer:IsRunning()then self.timer:Stop()end
|
|
32132
|
+
self:T(self.lid.." dead! "..self.CargoState.."-> REMOVED")
|
|
32133
|
+
self.CargoState=DYNAMICCARGO.State.REMOVED
|
|
32134
|
+
_DATABASE:CreateEventDynamicCargoRemoved(self)
|
|
32135
|
+
end
|
|
32136
|
+
return self
|
|
32137
|
+
end
|
|
32138
|
+
function DYNAMICCARGO._FilterHeloTypes(client)
|
|
32139
|
+
if not client then return false end
|
|
32140
|
+
local typename=client:GetTypeName()
|
|
32141
|
+
local isinclude=DYNAMICCARGO.AircraftTypes[typename]~=nil and true or false
|
|
32142
|
+
return isinclude
|
|
32143
|
+
end
|
|
31532
32144
|
CARGOS={}
|
|
31533
32145
|
do
|
|
31534
32146
|
CARGO={
|
|
@@ -42269,7 +42881,7 @@ return self
|
|
|
42269
42881
|
end
|
|
42270
42882
|
function RANGE:SetSoundfilesPath(path)
|
|
42271
42883
|
self.soundpath=tostring(path or"Range Soundfiles/")
|
|
42272
|
-
self:
|
|
42884
|
+
self:T2(self.lid..string.format("Setting sound files path to %s",self.soundpath))
|
|
42273
42885
|
return self
|
|
42274
42886
|
end
|
|
42275
42887
|
function RANGE:SetSoundfilesInfo(csvfile)
|
|
@@ -42420,9 +43032,9 @@ if randommove==nil or _isstatic==true then
|
|
|
42420
43032
|
randommove=false
|
|
42421
43033
|
end
|
|
42422
43034
|
if _isstatic==true then
|
|
42423
|
-
self:
|
|
43035
|
+
self:T(self.lid..string.format("Adding STATIC bombing target %s with good hit range %d. Random move = %s.",name,goodhitrange,tostring(randommove)))
|
|
42424
43036
|
elseif _isstatic==false then
|
|
42425
|
-
self:
|
|
43037
|
+
self:T(self.lid..string.format("Adding UNIT bombing target %s with good hit range %d. Random move = %s.",name,goodhitrange,tostring(randommove)))
|
|
42426
43038
|
else
|
|
42427
43039
|
self:E(self.lid..string.format("ERROR! No bombing target with name %s could be found. Carefully check all UNIT and STATIC names defined in the mission editor!",name))
|
|
42428
43040
|
end
|
|
@@ -42461,7 +43073,7 @@ function RANGE:AddBombingTargetScenery(scenery,goodhitrange)
|
|
|
42461
43073
|
local name=scenery:GetName()
|
|
42462
43074
|
goodhitrange=goodhitrange or RANGE.Defaults.goodhitrange
|
|
42463
43075
|
if name then
|
|
42464
|
-
self:
|
|
43076
|
+
self:T(self.lid..string.format("Adding SCENERY bombing target %s with good hit range %d",name,goodhitrange))
|
|
42465
43077
|
else
|
|
42466
43078
|
self:E(self.lid..string.format("ERROR! No bombing target with name %s could be found!",name))
|
|
42467
43079
|
end
|
|
@@ -42524,7 +43136,7 @@ function RANGE:OnEventBirth(EventData)
|
|
|
42524
43136
|
self:F({eventbirth=EventData})
|
|
42525
43137
|
if not EventData.IniPlayerName then return end
|
|
42526
43138
|
local _unitName=EventData.IniUnitName
|
|
42527
|
-
local _unit,_playername=self:_GetPlayerUnitAndName(_unitName)
|
|
43139
|
+
local _unit,_playername=self:_GetPlayerUnitAndName(_unitName,EventData.IniPlayerName)
|
|
42528
43140
|
self:T3(self.lid.."BIRTH: unit = "..tostring(EventData.IniUnitName))
|
|
42529
43141
|
self:T3(self.lid.."BIRTH: group = "..tostring(EventData.IniGroupName))
|
|
42530
43142
|
self:T3(self.lid.."BIRTH: player = "..tostring(_playername))
|
|
@@ -42616,6 +43228,7 @@ end
|
|
|
42616
43228
|
end
|
|
42617
43229
|
end
|
|
42618
43230
|
function RANGE._OnImpact(weapon,self,playerData,attackHdg,attackAlt,attackVel)
|
|
43231
|
+
if not playerData then return end
|
|
42619
43232
|
local _closetTarget=nil
|
|
42620
43233
|
local _distance=nil
|
|
42621
43234
|
local _closeCoord=nil
|
|
@@ -42625,8 +43238,8 @@ local _playername=playerData.playername
|
|
|
42625
43238
|
local _unit=playerData.unit
|
|
42626
43239
|
local impactcoord=weapon:GetImpactCoordinate()
|
|
42627
43240
|
local insidezone=self.rangezone:IsCoordinateInZone(impactcoord)
|
|
42628
|
-
if playerData.smokebombimpact and insidezone then
|
|
42629
|
-
if playerData.delaysmoke then
|
|
43241
|
+
if playerData and playerData.smokebombimpact and insidezone then
|
|
43242
|
+
if playerData and playerData.delaysmoke then
|
|
42630
43243
|
timer.scheduleFunction(self._DelayedSmoke,{coord=impactcoord,color=playerData.smokecolor},timer.getTime()+self.TdelaySmoke)
|
|
42631
43244
|
else
|
|
42632
43245
|
impactcoord:Smoke(playerData.smokecolor)
|
|
@@ -42709,14 +43322,15 @@ end
|
|
|
42709
43322
|
local weapon=WEAPON:New(EventData.weapon)
|
|
42710
43323
|
local _track=(weapon:IsBomb()and self.trackbombs)or(weapon:IsRocket()and self.trackrockets)or(weapon:IsMissile()and self.trackmissiles)
|
|
42711
43324
|
local _unitName=EventData.IniUnitName
|
|
42712
|
-
local _unit,_playername=self:_GetPlayerUnitAndName(_unitName)
|
|
43325
|
+
local _unit,_playername=self:_GetPlayerUnitAndName(_unitName,EventData.IniPlayerName)
|
|
42713
43326
|
local dPR=self.BombtrackThreshold*2
|
|
42714
43327
|
if _unit and _playername then
|
|
42715
43328
|
dPR=_unit:GetCoordinate():Get2DDistance(self.location)
|
|
42716
43329
|
self:T(self.lid..string.format("Range %s, player %s, player-range distance = %d km.",self.rangename,_playername,dPR/1000))
|
|
42717
43330
|
end
|
|
42718
|
-
if _track and dPR<=self.BombtrackThreshold and _unit and _playername then
|
|
43331
|
+
if _track and dPR<=self.BombtrackThreshold and _unit and _playername and self.PlayerSettings[_playername]then
|
|
42719
43332
|
local playerData=self.PlayerSettings[_playername]
|
|
43333
|
+
if not playerData then return end
|
|
42720
43334
|
local attackHdg=_unit:GetHeading()
|
|
42721
43335
|
local attackAlt=_unit:GetHeight()
|
|
42722
43336
|
attackAlt=UTILS.MetersToFeet(attackAlt)
|
|
@@ -42751,7 +43365,7 @@ end
|
|
|
42751
43365
|
end
|
|
42752
43366
|
text=text..string.format(", Control %.3f MHz (Relay=%s alive=%s)",self.rangecontrolfreq,tostring(self.rangecontrolrelayname),alive)
|
|
42753
43367
|
end
|
|
42754
|
-
self:
|
|
43368
|
+
self:T(self.lid..text)
|
|
42755
43369
|
end
|
|
42756
43370
|
self:_CheckPlayers()
|
|
42757
43371
|
self:__Status(-10)
|
|
@@ -42862,7 +43476,7 @@ local f=io.open(filename,"wb")
|
|
|
42862
43476
|
if f then
|
|
42863
43477
|
f:write(data)
|
|
42864
43478
|
f:close()
|
|
42865
|
-
self:
|
|
43479
|
+
self:T(self.lid..string.format("Saving player results to file %s",tostring(filename)))
|
|
42866
43480
|
else
|
|
42867
43481
|
self:E(self.lid..string.format("ERROR: Could not save results to file %s",tostring(filename)))
|
|
42868
43482
|
end
|
|
@@ -42909,7 +43523,7 @@ end
|
|
|
42909
43523
|
local path=self.targetpath or lfs.writedir()..[[Logs\]]
|
|
42910
43524
|
local filename=path..string.format("RANGE-%s_BombingResults.csv",self.rangename)
|
|
42911
43525
|
local text=string.format("Loading player bomb results from file %s",filename)
|
|
42912
|
-
self:
|
|
43526
|
+
self:T(self.lid..text)
|
|
42913
43527
|
local data=_loadfile(filename)
|
|
42914
43528
|
if data then
|
|
42915
43529
|
local results=UTILS.Split(data,"\n")
|
|
@@ -43106,7 +43720,6 @@ function RANGE:_DisplayRangeInfo(_unitname)
|
|
|
43106
43720
|
self:F(_unitname)
|
|
43107
43721
|
local unit,playername,_multiplayer=self:_GetPlayerUnitAndName(_unitname)
|
|
43108
43722
|
if unit and playername then
|
|
43109
|
-
self:I(playername)
|
|
43110
43723
|
local text=""
|
|
43111
43724
|
local coord=unit:GetCoordinate()
|
|
43112
43725
|
if self.location then
|
|
@@ -43868,13 +44481,12 @@ self:T({speed=speed})
|
|
|
43868
44481
|
end
|
|
43869
44482
|
return speed
|
|
43870
44483
|
end
|
|
43871
|
-
function RANGE:_GetPlayerUnitAndName(_unitName)
|
|
43872
|
-
self:F2(_unitName)
|
|
44484
|
+
function RANGE:_GetPlayerUnitAndName(_unitName,PlayerName)
|
|
43873
44485
|
if _unitName~=nil then
|
|
43874
44486
|
local multiplayer=false
|
|
43875
44487
|
local DCSunit=Unit.getByName(_unitName)
|
|
43876
|
-
if DCSunit then
|
|
43877
|
-
local playername=DCSunit:getPlayerName()
|
|
44488
|
+
if DCSunit and DCSunit.getPlayerName then
|
|
44489
|
+
local playername=DCSunit:getPlayerName()or PlayerName or"None"
|
|
43878
44490
|
local unit=UNIT:Find(DCSunit)
|
|
43879
44491
|
self:T2({DCSunit=DCSunit,unit=unit,playername=playername})
|
|
43880
44492
|
if DCSunit and unit and playername then
|
|
@@ -54011,6 +54623,7 @@ end
|
|
|
54011
54623
|
CLIENTWATCH={}
|
|
54012
54624
|
CLIENTWATCH.ClassName="CLIENTWATCH"
|
|
54013
54625
|
CLIENTWATCH.Debug=false
|
|
54626
|
+
CLIENTWATCH.DebugEventData=false
|
|
54014
54627
|
CLIENTWATCH.lid=nil
|
|
54015
54628
|
CLIENTWATCHTools={}
|
|
54016
54629
|
CLIENTWATCH.version="1.0.1"
|
|
@@ -54018,21 +54631,45 @@ function CLIENTWATCH:New(client)
|
|
|
54018
54631
|
local self=BASE:Inherit(self,FSM:New())
|
|
54019
54632
|
self:SetStartState("Idle")
|
|
54020
54633
|
self:AddTransition("*","Spawn","*")
|
|
54021
|
-
|
|
54634
|
+
self.FilterCoalition=nil
|
|
54635
|
+
self.FilterCategory=nil
|
|
54636
|
+
if not client then
|
|
54637
|
+
if self.Debug then self:I({"New client instance created. ClientType = All clients"})end
|
|
54638
|
+
self:HandleEvent(EVENTS.Birth)
|
|
54639
|
+
function self:OnEventBirth(eventdata)
|
|
54640
|
+
if(eventdata.IniCategory==0 or eventdata.IniCategory==1)and eventdata.IniPlayerName
|
|
54641
|
+
and(not self.FilterCoalition or self.FilterCoalition==eventdata.IniCoalition)
|
|
54642
|
+
and(not self.FilterCategory or self.FilterCategory==eventdata.IniCategory)then
|
|
54643
|
+
if self.Debug then
|
|
54644
|
+
self:I({"Client spawned in.",IniCategory=eventdata.IniCategory})
|
|
54645
|
+
end
|
|
54646
|
+
local clientWatchDebug=self.Debug
|
|
54647
|
+
local clientObject=CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
54648
|
+
self:Spawn(clientObject,eventdata)
|
|
54649
|
+
end
|
|
54650
|
+
end
|
|
54651
|
+
elseif type(client)=="table"or type(client)=="string"then
|
|
54022
54652
|
if type(client)=="table"then
|
|
54023
54653
|
if client.ClassName=="CLIENT"then
|
|
54654
|
+
if self.Debug then self:I({"New client instance created. ClientType = Wrapper.CLIENT",client})end
|
|
54024
54655
|
self.ClientName=client:GetName()
|
|
54025
54656
|
self:HandleEvent(EVENTS.Birth)
|
|
54026
54657
|
function self:OnEventBirth(eventdata)
|
|
54027
|
-
if
|
|
54028
|
-
|
|
54658
|
+
if(eventdata.IniCategory==0 or eventdata.IniCategory==1)and eventdata.IniPlayerName
|
|
54659
|
+
and(not self.FilterCoalition or self.FilterCoalition==eventdata.IniCoalition)
|
|
54660
|
+
and(not self.FilterCategory or self.FilterCategory==eventdata.IniCategory)then
|
|
54029
54661
|
if self.ClientName==eventdata.IniUnitName then
|
|
54030
|
-
|
|
54031
|
-
self:
|
|
54662
|
+
if self.Debug then
|
|
54663
|
+
self:I({"Client spawned in.",IniCategory=eventdata.IniCategory})
|
|
54664
|
+
end
|
|
54665
|
+
local clientWatchDebug=self.Debug
|
|
54666
|
+
local clientObject=CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
54667
|
+
self:Spawn(clientObject,eventdata)
|
|
54032
54668
|
end
|
|
54033
54669
|
end
|
|
54034
54670
|
end
|
|
54035
54671
|
else
|
|
54672
|
+
if self.Debug then self:I({"New client instance created. ClientType = Multiple Prefixes",client})end
|
|
54036
54673
|
local tableValid=true
|
|
54037
54674
|
for _,entry in pairs(client)do
|
|
54038
54675
|
if type(entry)~="string"then
|
|
@@ -54044,12 +54681,17 @@ end
|
|
|
54044
54681
|
if tableValid then
|
|
54045
54682
|
self:HandleEvent(EVENTS.Birth)
|
|
54046
54683
|
function self:OnEventBirth(eventdata)
|
|
54047
|
-
if self.Debug then UTILS.PrintTableToLog(eventdata)end
|
|
54048
54684
|
for _,entry in pairs(client)do
|
|
54049
|
-
if
|
|
54685
|
+
if(eventdata.IniCategory==0 or eventdata.IniCategory==1)and eventdata.IniPlayerName
|
|
54686
|
+
and(not self.FilterCoalition or self.FilterCoalition==eventdata.IniCoalition)
|
|
54687
|
+
and(not self.FilterCategory or self.FilterCategory==eventdata.IniCategory)then
|
|
54050
54688
|
if string.match(eventdata.IniUnitName,entry)or string.match(eventdata.IniGroupName,entry)then
|
|
54051
|
-
|
|
54052
|
-
self:
|
|
54689
|
+
if self.Debug then
|
|
54690
|
+
self:I({"Client spawned in.",IniCategory=eventdata.IniCategory})
|
|
54691
|
+
end
|
|
54692
|
+
local clientWatchDebug=self.Debug
|
|
54693
|
+
local clientObject=CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
54694
|
+
self:Spawn(clientObject,eventdata)
|
|
54053
54695
|
break
|
|
54054
54696
|
end
|
|
54055
54697
|
end
|
|
@@ -54058,13 +54700,19 @@ end
|
|
|
54058
54700
|
end
|
|
54059
54701
|
end
|
|
54060
54702
|
else
|
|
54703
|
+
if self.Debug then self:I({"New client instance created. ClientType = Single Prefix",client})end
|
|
54061
54704
|
self:HandleEvent(EVENTS.Birth)
|
|
54062
54705
|
function self:OnEventBirth(eventdata)
|
|
54063
|
-
if
|
|
54064
|
-
|
|
54706
|
+
if(eventdata.IniCategory==0 or eventdata.IniCategory==1)and eventdata.IniPlayerName
|
|
54707
|
+
and(not self.FilterCoalition or self.FilterCoalition==eventdata.IniCoalition)
|
|
54708
|
+
and(not self.FilterCategory or self.FilterCategory==eventdata.IniCategory)then
|
|
54065
54709
|
if string.match(eventdata.IniUnitName,client)or string.match(eventdata.IniGroupName,client)then
|
|
54066
|
-
|
|
54067
|
-
self:
|
|
54710
|
+
if self.Debug then
|
|
54711
|
+
self:I({"Client spawned in.",IniCategory=eventdata.IniCategory})
|
|
54712
|
+
end
|
|
54713
|
+
local clientWatchDebug=self.Debug
|
|
54714
|
+
local clientObject=CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
54715
|
+
self:Spawn(clientObject,eventdata)
|
|
54068
54716
|
end
|
|
54069
54717
|
end
|
|
54070
54718
|
end
|
|
@@ -54075,7 +54723,23 @@ return nil
|
|
|
54075
54723
|
end
|
|
54076
54724
|
return self
|
|
54077
54725
|
end
|
|
54078
|
-
function
|
|
54726
|
+
function CLIENTWATCH:FilterByCoalition(value)
|
|
54727
|
+
if value==1 or value=="red"then
|
|
54728
|
+
self.FilterCoalition=1
|
|
54729
|
+
else
|
|
54730
|
+
self.FilterCoalition=2
|
|
54731
|
+
end
|
|
54732
|
+
return self
|
|
54733
|
+
end
|
|
54734
|
+
function CLIENTWATCH:FilterByCategory(value)
|
|
54735
|
+
if value==1 or value=="helicopter"then
|
|
54736
|
+
self.FilterCategory=1
|
|
54737
|
+
else
|
|
54738
|
+
self.FilterCategory=0
|
|
54739
|
+
end
|
|
54740
|
+
return self
|
|
54741
|
+
end
|
|
54742
|
+
function CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
54079
54743
|
local self=BASE:Inherit(self,FSM:New())
|
|
54080
54744
|
self:SetStartState("Alive")
|
|
54081
54745
|
self:AddTransition("Alive","Despawn","Dead")
|
|
@@ -54139,102 +54803,159 @@ self:HandleEvent(EVENTS.WeaponDrop)
|
|
|
54139
54803
|
self:HandleEvent(EVENTS.WeaponRearm)
|
|
54140
54804
|
function self:OnEventHit(EventData)
|
|
54141
54805
|
if EventData.TgtUnitName==self.UnitName then
|
|
54806
|
+
if clientWatchDebug then
|
|
54807
|
+
self:I({"Client triggered hit event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54808
|
+
end
|
|
54142
54809
|
self:Hit(EventData)
|
|
54143
54810
|
end
|
|
54144
54811
|
end
|
|
54145
54812
|
function self:OnEventKill(EventData)
|
|
54146
54813
|
if EventData.IniUnitName==self.UnitName then
|
|
54814
|
+
if clientWatchDebug then
|
|
54815
|
+
self:I({"Client triggered kill event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54816
|
+
end
|
|
54147
54817
|
self:Kill(EventData)
|
|
54148
54818
|
end
|
|
54149
54819
|
end
|
|
54150
54820
|
function self:OnEventScore(EventData)
|
|
54151
54821
|
if EventData.IniUnitName==self.UnitName then
|
|
54822
|
+
if clientWatchDebug then
|
|
54823
|
+
self:I({"Client triggered score event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54824
|
+
end
|
|
54152
54825
|
self:Score(EventData)
|
|
54153
54826
|
end
|
|
54154
54827
|
end
|
|
54155
54828
|
function self:OnEventShot(EventData)
|
|
54156
54829
|
if EventData.IniUnitName==self.UnitName then
|
|
54830
|
+
if clientWatchDebug then
|
|
54831
|
+
self:I({"Client triggered shot event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54832
|
+
end
|
|
54157
54833
|
self:Shot(EventData)
|
|
54158
54834
|
end
|
|
54159
54835
|
end
|
|
54160
54836
|
function self:OnEventShootingStart(EventData)
|
|
54161
54837
|
if EventData.IniUnitName==self.UnitName then
|
|
54838
|
+
if clientWatchDebug then
|
|
54839
|
+
self:I({"Client triggered shooting start event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54840
|
+
end
|
|
54162
54841
|
self:ShootingStart(EventData)
|
|
54163
54842
|
end
|
|
54164
54843
|
end
|
|
54165
54844
|
function self:OnEventShootingEnd(EventData)
|
|
54166
54845
|
if EventData.IniUnitName==self.UnitName then
|
|
54846
|
+
if clientWatchDebug then
|
|
54847
|
+
self:I({"Client triggered shooting end event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54848
|
+
end
|
|
54167
54849
|
self:ShootingEnd(EventData)
|
|
54168
54850
|
end
|
|
54169
54851
|
end
|
|
54170
54852
|
function self:OnEventLand(EventData)
|
|
54171
54853
|
if EventData.IniUnitName==self.UnitName then
|
|
54854
|
+
if clientWatchDebug then
|
|
54855
|
+
self:I({"Client triggered land event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54856
|
+
end
|
|
54172
54857
|
self:Land(EventData)
|
|
54173
54858
|
end
|
|
54174
54859
|
end
|
|
54175
54860
|
function self:OnEventTakeoff(EventData)
|
|
54176
54861
|
if EventData.IniUnitName==self.UnitName then
|
|
54862
|
+
if clientWatchDebug then
|
|
54863
|
+
self:I({"Client triggered takeoff event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54864
|
+
end
|
|
54177
54865
|
self:Takeoff(EventData)
|
|
54178
54866
|
end
|
|
54179
54867
|
end
|
|
54180
54868
|
function self:OnEventRunwayTakeoff(EventData)
|
|
54181
54869
|
if EventData.IniUnitName==self.UnitName then
|
|
54870
|
+
if clientWatchDebug then
|
|
54871
|
+
self:I({"Client triggered runway takeoff event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54872
|
+
end
|
|
54182
54873
|
self:RunwayTakeoff(EventData)
|
|
54183
54874
|
end
|
|
54184
54875
|
end
|
|
54185
54876
|
function self:OnEventRunwayTouch(EventData)
|
|
54186
54877
|
if EventData.IniUnitName==self.UnitName then
|
|
54878
|
+
if clientWatchDebug then
|
|
54879
|
+
self:I({"Client triggered runway touch event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54880
|
+
end
|
|
54187
54881
|
self:RunwayTouch(EventData)
|
|
54188
54882
|
end
|
|
54189
54883
|
end
|
|
54190
54884
|
function self:OnEventRefueling(EventData)
|
|
54191
54885
|
if EventData.IniUnitName==self.UnitName then
|
|
54886
|
+
if clientWatchDebug then
|
|
54887
|
+
self:I({"Client triggered refueling event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54888
|
+
end
|
|
54192
54889
|
self:Refueling(EventData)
|
|
54193
54890
|
end
|
|
54194
54891
|
end
|
|
54195
54892
|
function self:OnEventRefuelingStop(EventData)
|
|
54196
54893
|
if EventData.IniUnitName==self.UnitName then
|
|
54894
|
+
if clientWatchDebug then
|
|
54895
|
+
self:I({"Client triggered refueling event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54896
|
+
end
|
|
54197
54897
|
self:RefuelingStop(EventData)
|
|
54198
54898
|
end
|
|
54199
54899
|
end
|
|
54200
54900
|
function self:OnEventPlayerLeaveUnit(EventData)
|
|
54201
54901
|
if EventData.IniUnitName==self.UnitName then
|
|
54902
|
+
if clientWatchDebug then
|
|
54903
|
+
self:I({"Client triggered leave unit event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54904
|
+
end
|
|
54202
54905
|
self:PlayerLeaveUnit(EventData)
|
|
54203
54906
|
self._deadRoutine()
|
|
54204
54907
|
end
|
|
54205
54908
|
end
|
|
54206
54909
|
function self:OnEventCrash(EventData)
|
|
54207
54910
|
if EventData.IniUnitName==self.UnitName then
|
|
54911
|
+
if clientWatchDebug then
|
|
54912
|
+
self:I({"Client triggered crash event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54913
|
+
end
|
|
54208
54914
|
self:Crash(EventData)
|
|
54209
54915
|
self._deadRoutine()
|
|
54210
54916
|
end
|
|
54211
54917
|
end
|
|
54212
54918
|
function self:OnEventDead(EventData)
|
|
54213
54919
|
if EventData.IniUnitName==self.UnitName then
|
|
54920
|
+
if clientWatchDebug then
|
|
54921
|
+
self:I({"Client triggered dead event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54922
|
+
end
|
|
54214
54923
|
self:Dead(EventData)
|
|
54215
54924
|
self._deadRoutine()
|
|
54216
54925
|
end
|
|
54217
54926
|
end
|
|
54218
54927
|
function self:OnEventPilotDead(EventData)
|
|
54219
54928
|
if EventData.IniUnitName==self.UnitName then
|
|
54929
|
+
if clientWatchDebug then
|
|
54930
|
+
self:I({"Client triggered pilot dead event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54931
|
+
end
|
|
54220
54932
|
self:PilotDead(EventData)
|
|
54221
54933
|
self._deadRoutine()
|
|
54222
54934
|
end
|
|
54223
54935
|
end
|
|
54224
54936
|
function self:OnEventUnitLost(EventData)
|
|
54225
54937
|
if EventData.IniUnitName==self.UnitName then
|
|
54938
|
+
if clientWatchDebug then
|
|
54939
|
+
self:I({"Client triggered unit lost event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54940
|
+
end
|
|
54226
54941
|
self:UnitLost(EventData)
|
|
54227
54942
|
self._deadRoutine()
|
|
54228
54943
|
end
|
|
54229
54944
|
end
|
|
54230
54945
|
function self:OnEventEjection(EventData)
|
|
54231
54946
|
if EventData.IniUnitName==self.UnitName then
|
|
54947
|
+
if clientWatchDebug then
|
|
54948
|
+
self:I({"Client triggered ejection event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54949
|
+
end
|
|
54232
54950
|
self:Ejection(EventData)
|
|
54233
54951
|
self._deadRoutine()
|
|
54234
54952
|
end
|
|
54235
54953
|
end
|
|
54236
54954
|
function self:OnEventHumanFailure(EventData)
|
|
54237
54955
|
if EventData.IniUnitName==self.UnitName then
|
|
54956
|
+
if clientWatchDebug then
|
|
54957
|
+
self:I({"Client triggered human failure event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54958
|
+
end
|
|
54238
54959
|
self:HumanFailure(EventData)
|
|
54239
54960
|
if not self.Unit:IsAlive()then
|
|
54240
54961
|
self._deadRoutine()
|
|
@@ -54243,46 +54964,71 @@ end
|
|
|
54243
54964
|
end
|
|
54244
54965
|
function self:OnEventHumanAircraftRepairFinish(EventData)
|
|
54245
54966
|
if EventData.IniUnitName==self.UnitName then
|
|
54967
|
+
if clientWatchDebug then
|
|
54968
|
+
self:I({"Client triggered repair finished event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54969
|
+
end
|
|
54246
54970
|
self:HumanAircraftRepairFinish(EventData)
|
|
54247
54971
|
end
|
|
54248
54972
|
end
|
|
54249
54973
|
function self:OnEventHumanAircraftRepairStart(EventData)
|
|
54250
54974
|
if EventData.IniUnitName==self.UnitName then
|
|
54975
|
+
if clientWatchDebug then
|
|
54976
|
+
self:I({"Client triggered repair start event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54977
|
+
end
|
|
54251
54978
|
self:HumanAircraftRepairStart(EventData)
|
|
54252
54979
|
end
|
|
54253
54980
|
end
|
|
54254
54981
|
function self:OnEventEngineShutdown(EventData)
|
|
54255
54982
|
if EventData.IniUnitName==self.UnitName then
|
|
54983
|
+
if clientWatchDebug then
|
|
54984
|
+
self:I({"Client triggered engine shutdown event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54985
|
+
end
|
|
54256
54986
|
self:EngineShutdown(EventData)
|
|
54257
54987
|
end
|
|
54258
54988
|
end
|
|
54259
54989
|
function self:OnEventEngineStartup(EventData)
|
|
54260
54990
|
if EventData.IniUnitName==self.UnitName then
|
|
54991
|
+
if clientWatchDebug then
|
|
54992
|
+
self:I({"Client triggered engine startup event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
54993
|
+
end
|
|
54261
54994
|
self:EngineStartup(EventData)
|
|
54262
54995
|
end
|
|
54263
54996
|
end
|
|
54264
54997
|
function self:OnEventWeaponAdd(EventData)
|
|
54265
54998
|
if EventData.IniUnitName==self.UnitName then
|
|
54999
|
+
if clientWatchDebug then
|
|
55000
|
+
self:I({"Client triggered weapon add event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
55001
|
+
end
|
|
54266
55002
|
self:WeaponAdd(EventData)
|
|
54267
55003
|
end
|
|
54268
55004
|
end
|
|
54269
55005
|
function self:OnEventWeaponDrop(EventData)
|
|
54270
55006
|
if EventData.IniUnitName==self.UnitName then
|
|
55007
|
+
if clientWatchDebug then
|
|
55008
|
+
self:I({"Client triggered weapon drop event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
55009
|
+
end
|
|
54271
55010
|
self:WeaponDrop(EventData)
|
|
54272
55011
|
end
|
|
54273
55012
|
end
|
|
54274
55013
|
function self:OnEventWeaponRearm(EventData)
|
|
54275
55014
|
if EventData.IniUnitName==self.UnitName then
|
|
55015
|
+
if clientWatchDebug then
|
|
55016
|
+
self:I({"Client triggered weapon rearm event.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
55017
|
+
end
|
|
54276
55018
|
self:WeaponRearm(EventData)
|
|
54277
55019
|
end
|
|
54278
55020
|
end
|
|
54279
55021
|
self.FallbackTimer=TIMER:New(function()
|
|
54280
55022
|
if not self.Unit:IsAlive()then
|
|
55023
|
+
if clientWatchDebug then
|
|
55024
|
+
self:I({"Client is registered as dead without an event trigger. Running fallback dead routine.",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})
|
|
55025
|
+
end
|
|
54281
55026
|
self._deadRoutine()
|
|
54282
55027
|
end
|
|
54283
55028
|
end)
|
|
54284
55029
|
self.FallbackTimer:Start(5,5)
|
|
54285
55030
|
function self._deadRoutine()
|
|
55031
|
+
if clientWatchDebug then self:I({"Client dead routine triggered. Shutting down tracking...",Player=self.PlayerName,Group=self.GroupName,Unit=self.UnitName})end
|
|
54286
55032
|
self:UnHandleEvent(EVENTS.Hit)
|
|
54287
55033
|
self:UnHandleEvent(EVENTS.Kill)
|
|
54288
55034
|
self:UnHandleEvent(EVENTS.Score)
|
|
@@ -54312,7 +55058,7 @@ self:UnHandleEvent(EVENTS.WeaponRearm)
|
|
|
54312
55058
|
self.FallbackTimer:Stop()
|
|
54313
55059
|
self:Despawn()
|
|
54314
55060
|
end
|
|
54315
|
-
self:I({"
|
|
55061
|
+
self:I({"Detected client spawn and applied internal functions and events.",PlayerName=self.PlayerName,UnitName=self.UnitName,GroupName=self.GroupName})
|
|
54316
55062
|
return self
|
|
54317
55063
|
end
|
|
54318
55064
|
AIRBOSS={
|
|
@@ -61374,7 +62120,7 @@ else
|
|
|
61374
62120
|
self:E(self.lid..string.format("ERROR: Unknown radio sender %s!",tostring(sender)))
|
|
61375
62121
|
return
|
|
61376
62122
|
end
|
|
61377
|
-
local numbers=_split(number)
|
|
62123
|
+
local numbers=_split(tostring(number))
|
|
61378
62124
|
local wait=0
|
|
61379
62125
|
for i=1,#numbers do
|
|
61380
62126
|
local n=numbers[i]
|
|
@@ -61410,7 +62156,7 @@ if Sender==""then
|
|
|
61410
62156
|
self:E(self.lid..string.format("ERROR: Sender unknown!"))
|
|
61411
62157
|
return
|
|
61412
62158
|
end
|
|
61413
|
-
local numbers=_split(number)
|
|
62159
|
+
local numbers=_split(tostring(number))
|
|
61414
62160
|
local wait=0
|
|
61415
62161
|
for i=1,#numbers do
|
|
61416
62162
|
local n=numbers[i]
|
|
@@ -62635,7 +63381,7 @@ if math.abs(self.holdingoffset)>0 then
|
|
|
62635
63381
|
self:_GetZoneArcIn(case):FlareZone(FLARECOLOR.White,45)
|
|
62636
63382
|
text=text.."\n* arc turn in with WHITE flares"
|
|
62637
63383
|
self:_GetZoneArcOut(case):FlareZone(FLARECOLOR.White,45)
|
|
62638
|
-
text=text.."\n* arc
|
|
63384
|
+
text=text.."\n* arc turn out with WHITE flares"
|
|
62639
63385
|
end
|
|
62640
63386
|
end
|
|
62641
63387
|
if case==3 then
|
|
@@ -62668,7 +63414,7 @@ if math.abs(self.holdingoffset)>0 then
|
|
|
62668
63414
|
self:_GetZoneArcIn(case):SmokeZone(SMOKECOLOR.Blue,45)
|
|
62669
63415
|
text=text.."\n* arc turn in with BLUE smoke"
|
|
62670
63416
|
self:_GetZoneArcOut(case):SmokeZone(SMOKECOLOR.Blue,45)
|
|
62671
|
-
text=text.."\n* arc
|
|
63417
|
+
text=text.."\n* arc turn out with BLUE smoke"
|
|
62672
63418
|
end
|
|
62673
63419
|
end
|
|
62674
63420
|
if case==3 then
|
|
@@ -64365,6 +65111,65 @@ TACAN="Tacan",
|
|
|
64365
65111
|
FARP="Farp",
|
|
64366
65112
|
DELIMITER="Punto",
|
|
64367
65113
|
},
|
|
65114
|
+
FR={
|
|
65115
|
+
HOURS="Heures",
|
|
65116
|
+
TIME="Temps",
|
|
65117
|
+
NOCLOUDINFO="Informations sur la couverture nuageuse non disponibles",
|
|
65118
|
+
OVERCAST="Ciel couvert",
|
|
65119
|
+
BROKEN="Nuages fragmentés",
|
|
65120
|
+
SCATTERED="Nuages épars",
|
|
65121
|
+
FEWCLOUDS="Nuages rares",
|
|
65122
|
+
NOCLOUDS="Clair",
|
|
65123
|
+
AIRPORT="Aéroport",
|
|
65124
|
+
INFORMATION="Information",
|
|
65125
|
+
SUNRISEAT="Levé du soleil à %s heure locale",
|
|
65126
|
+
SUNSETAT="Couché du soleil à %s heure locale",
|
|
65127
|
+
WINDFROMMS="Vent du %s pour %s mètres par seconde",
|
|
65128
|
+
WINDFROMKNOTS="Vent du %s pour %s noeuds",
|
|
65129
|
+
GUSTING="Rafale de vent",
|
|
65130
|
+
VISIKM="Visibilité %s kilomètres",
|
|
65131
|
+
VISISM="Visibilité %s Miles",
|
|
65132
|
+
RAIN="Pluie",
|
|
65133
|
+
TSTORM="Orage",
|
|
65134
|
+
SNOW="Neige",
|
|
65135
|
+
SSTROM="Tempête de neige",
|
|
65136
|
+
FOG="Brouillard",
|
|
65137
|
+
DUST="Poussière",
|
|
65138
|
+
PHENOMENA="Phénomène météorologique",
|
|
65139
|
+
CLOUDBASEM="Couverture nuageuse de %s à %s mètres",
|
|
65140
|
+
CLOUDBASEFT="Couverture nuageuse de %s à %s pieds",
|
|
65141
|
+
TEMPERATURE="Température",
|
|
65142
|
+
DEWPOINT="Point de rosée",
|
|
65143
|
+
ALTIMETER="Altimètre",
|
|
65144
|
+
ACTIVERUN="Décollages piste",
|
|
65145
|
+
ACTIVELANDING="Atterrissages piste",
|
|
65146
|
+
LEFT="Gauche",
|
|
65147
|
+
RIGHT="Droite",
|
|
65148
|
+
RWYLENGTH="Longueur de piste",
|
|
65149
|
+
METERS="Mètre",
|
|
65150
|
+
FEET="Pieds",
|
|
65151
|
+
ELEVATION="Hauteur",
|
|
65152
|
+
TOWERFREQ="Fréquences de la tour",
|
|
65153
|
+
ILSFREQ="Fréquences ILS",
|
|
65154
|
+
OUTERNDB="Fréquences Outer NDB",
|
|
65155
|
+
INNERNDB="Fréquences Inner NDB",
|
|
65156
|
+
VORFREQ="Fréquences VOR",
|
|
65157
|
+
VORFREQTTS="Fréquences V O R",
|
|
65158
|
+
TACANCH="Canal TACAN %d",
|
|
65159
|
+
RSBNCH="Canal RSBN",
|
|
65160
|
+
PRMGCH="Canal PRMG",
|
|
65161
|
+
ADVISE="Informez le contrôle que vous avez copié l'information",
|
|
65162
|
+
STATUTE="Statute Miles",
|
|
65163
|
+
DEGREES="Degré celcius",
|
|
65164
|
+
FAHRENHEIT="Degré Fahrenheit",
|
|
65165
|
+
INCHHG="Pouces de mercure",
|
|
65166
|
+
MMHG="Millimètres de mercure",
|
|
65167
|
+
HECTO="Hectopascals",
|
|
65168
|
+
METERSPER="Mètres par seconde",
|
|
65169
|
+
TACAN="TAKAN",
|
|
65170
|
+
FARP="FARPE",
|
|
65171
|
+
DELIMITER="Décimal",
|
|
65172
|
+
}
|
|
64368
65173
|
}
|
|
64369
65174
|
ATIS.locale="en"
|
|
64370
65175
|
_ATIS={}
|
|
@@ -64404,7 +65209,7 @@ return self
|
|
|
64404
65209
|
end
|
|
64405
65210
|
function ATIS:_InitLocalization()
|
|
64406
65211
|
self:T(self.lid.."_InitLocalization")
|
|
64407
|
-
self.gettext=TEXTANDSOUND:New("
|
|
65212
|
+
self.gettext=TEXTANDSOUND:New("ATIS","en")
|
|
64408
65213
|
self.locale="en"
|
|
64409
65214
|
for locale,table in pairs(self.Messages)do
|
|
64410
65215
|
local Locale=string.lower(tostring(locale))
|
|
@@ -64898,17 +65703,23 @@ self:T3(string.format("ZULU =%s",tostring(ZULU)))
|
|
|
64898
65703
|
self:T3(string.format("NATO =%s",tostring(NATO)))
|
|
64899
65704
|
local hours=self.gettext:GetEntry("HOURS",self.locale)
|
|
64900
65705
|
local sunrise=coord:GetSunrise()
|
|
65706
|
+
local SUNRISE="no time"
|
|
65707
|
+
if tostring(sunrise)~="N/S"and tostring(sunrise)~="N/R"then
|
|
64901
65708
|
sunrise=UTILS.Split(sunrise,":")
|
|
64902
|
-
|
|
65709
|
+
SUNRISE=string.format("%s%s",sunrise[1],sunrise[2])
|
|
64903
65710
|
if self.useSRS then
|
|
64904
65711
|
SUNRISE=string.format("%s %s %s",sunrise[1],sunrise[2],hours)
|
|
64905
65712
|
end
|
|
65713
|
+
end
|
|
64906
65714
|
local sunset=coord:GetSunset()
|
|
65715
|
+
local SUNSET="no time"
|
|
65716
|
+
if tostring(sunset)~="N/S"and tostring(sunset)~="N/R"then
|
|
64907
65717
|
sunset=UTILS.Split(sunset,":")
|
|
64908
|
-
|
|
65718
|
+
SUNSET=string.format("%s%s",sunset[1],sunset[2])
|
|
64909
65719
|
if self.useSRS then
|
|
64910
65720
|
SUNSET=string.format("%s %s %s",sunset[1],sunset[2],hours)
|
|
64911
65721
|
end
|
|
65722
|
+
end
|
|
64912
65723
|
local temperature=coord:GetTemperature(height+5)
|
|
64913
65724
|
local dewpoint=temperature-(100-self.relHumidity)/5
|
|
64914
65725
|
if self.TDegF then
|
|
@@ -64975,6 +65786,34 @@ precepitation=1
|
|
|
64975
65786
|
else
|
|
64976
65787
|
precepitation=3
|
|
64977
65788
|
end
|
|
65789
|
+
elseif cloudspreset:find("RainyPreset4")then
|
|
65790
|
+
clouddens=5
|
|
65791
|
+
if temperature>5 then
|
|
65792
|
+
precepitation=1
|
|
65793
|
+
else
|
|
65794
|
+
precepitation=3
|
|
65795
|
+
end
|
|
65796
|
+
elseif cloudspreset:find("RainyPreset5")then
|
|
65797
|
+
clouddens=5
|
|
65798
|
+
if temperature>5 then
|
|
65799
|
+
precepitation=1
|
|
65800
|
+
else
|
|
65801
|
+
precepitation=3
|
|
65802
|
+
end
|
|
65803
|
+
elseif cloudspreset:find("RainyPreset6")then
|
|
65804
|
+
clouddens=5
|
|
65805
|
+
if temperature>5 then
|
|
65806
|
+
precepitation=1
|
|
65807
|
+
else
|
|
65808
|
+
precepitation=3
|
|
65809
|
+
end
|
|
65810
|
+
elseif cloudspreset:find("NEWRAINPRESET4")then
|
|
65811
|
+
clouddens=5
|
|
65812
|
+
if temperature>5 then
|
|
65813
|
+
precepitation=1
|
|
65814
|
+
else
|
|
65815
|
+
precepitation=3
|
|
65816
|
+
end
|
|
64978
65817
|
elseif cloudspreset:find("RainyPreset")then
|
|
64979
65818
|
clouddens=9
|
|
64980
65819
|
if temperature>5 then
|
|
@@ -65821,6 +66660,7 @@ CRATE="Crate",
|
|
|
65821
66660
|
REPAIR="Repair",
|
|
65822
66661
|
ENGINEERS="Engineers",
|
|
65823
66662
|
STATIC="Static",
|
|
66663
|
+
GCLOADABLE="GC_Loadable",
|
|
65824
66664
|
}
|
|
65825
66665
|
function CTLD_CARGO:New(ID,Name,Templates,Sorte,HasBeenMoved,LoadDirectly,CratesNeeded,Positionable,Dropped,PerCrateMass,Stock,Subcategory,DontShowInMenu,Location)
|
|
65826
66666
|
local self=BASE:Inherit(self,BASE:New())
|
|
@@ -65840,12 +66680,42 @@ self.Mark=nil
|
|
|
65840
66680
|
self.Subcategory=Subcategory or"Other"
|
|
65841
66681
|
self.DontShowInMenu=DontShowInMenu or false
|
|
65842
66682
|
self.ResourceMap=nil
|
|
66683
|
+
self.StaticType="container_cargo"
|
|
66684
|
+
self.StaticShape=nil
|
|
66685
|
+
self.TypeNames=nil
|
|
66686
|
+
self.StaticCategory="Cargos"
|
|
65843
66687
|
if type(Location)=="string"then
|
|
65844
66688
|
Location=ZONE:New(Location)
|
|
65845
66689
|
end
|
|
65846
66690
|
self.Location=Location
|
|
65847
66691
|
return self
|
|
65848
66692
|
end
|
|
66693
|
+
function CTLD_CARGO:SetStaticTypeAndShape(Category,TypeName,ShapeName)
|
|
66694
|
+
self.StaticCategory=Category or"Cargos"
|
|
66695
|
+
self.StaticType=TypeName or"container_cargo"
|
|
66696
|
+
self.StaticShape=ShapeName
|
|
66697
|
+
return self
|
|
66698
|
+
end
|
|
66699
|
+
function CTLD_CARGO:GetStaticTypeAndShape()
|
|
66700
|
+
return self.StaticCategory,self.StaticType,self.StaticShape
|
|
66701
|
+
end
|
|
66702
|
+
function CTLD_CARGO:AddUnitTypeName(UnitTypes)
|
|
66703
|
+
if not self.TypeNames then self.TypeNames={}end
|
|
66704
|
+
if type(UnitTypes)~="table"then UnitTypes={UnitTypes}end
|
|
66705
|
+
for _,_singletype in pairs(UnitTypes or{})do
|
|
66706
|
+
self.TypeNames[_singletype]=_singletype
|
|
66707
|
+
end
|
|
66708
|
+
return self
|
|
66709
|
+
end
|
|
66710
|
+
function CTLD_CARGO:UnitCanCarry(Unit)
|
|
66711
|
+
if self.TypeNames==nil then return true end
|
|
66712
|
+
local typename=Unit:GetTypeName()or"none"
|
|
66713
|
+
if self.TypeNames[typename]then
|
|
66714
|
+
return true
|
|
66715
|
+
else
|
|
66716
|
+
return false
|
|
66717
|
+
end
|
|
66718
|
+
end
|
|
65849
66719
|
function CTLD_CARGO:SetStaticResourceMap(ResourceMap)
|
|
65850
66720
|
self.ResourceMap=ResourceMap
|
|
65851
66721
|
return self
|
|
@@ -66139,6 +67009,10 @@ debug=false,
|
|
|
66139
67009
|
wpZones={},
|
|
66140
67010
|
dropOffZones={},
|
|
66141
67011
|
pickupZones={},
|
|
67012
|
+
DynamicCargo={},
|
|
67013
|
+
ChinookTroopCircleRadius=5,
|
|
67014
|
+
TroopUnloadDistGround=5,
|
|
67015
|
+
TroopUnloadDistHover=1.5,
|
|
66142
67016
|
}
|
|
66143
67017
|
CTLD.RadioModulation={
|
|
66144
67018
|
AM=0,
|
|
@@ -66171,9 +67045,9 @@ CTLD.UnitTypeCapabilities={
|
|
|
66171
67045
|
["Bronco-OV-10A"]={type="Bronco-OV-10A",crates=false,troops=true,cratelimit=0,trooplimit=5,length=13,cargoweightlimit=1450},
|
|
66172
67046
|
["OH-6A"]={type="OH-6A",crates=false,troops=true,cratelimit=0,trooplimit=4,length=7,cargoweightlimit=550},
|
|
66173
67047
|
["OH-58D"]={type="OH58D",crates=false,troops=false,cratelimit=0,trooplimit=0,length=14,cargoweightlimit=400},
|
|
66174
|
-
["CH-47Fbl1"]={type="CH-47Fbl1",crates=true,troops=true,cratelimit=4,trooplimit=31,length=20,cargoweightlimit=
|
|
67048
|
+
["CH-47Fbl1"]={type="CH-47Fbl1",crates=true,troops=true,cratelimit=4,trooplimit=31,length=20,cargoweightlimit=10800},
|
|
66175
67049
|
}
|
|
66176
|
-
CTLD.version="1.
|
|
67050
|
+
CTLD.version="1.1.17"
|
|
66177
67051
|
function CTLD:New(Coalition,Prefixes,Alias)
|
|
66178
67052
|
local self=BASE:Inherit(self,FSM:New())
|
|
66179
67053
|
BASE:T({Coalition,Prefixes,Alias})
|
|
@@ -66364,7 +67238,7 @@ self.PlayerTaskQueue:Push(PlayerTask,PlayerTask.PlayerTaskNr)
|
|
|
66364
67238
|
return self
|
|
66365
67239
|
end
|
|
66366
67240
|
function CTLD:_EventHandler(EventData)
|
|
66367
|
-
self:
|
|
67241
|
+
self:T(string.format("%s Event = %d",self.lid,EventData.id))
|
|
66368
67242
|
local event=EventData
|
|
66369
67243
|
if event.id==EVENTS.PlayerEnterAircraft or event.id==EVENTS.PlayerEnterUnit then
|
|
66370
67244
|
local _coalition=event.IniCoalition
|
|
@@ -66391,24 +67265,71 @@ local unitname=event.IniUnitName or"none"
|
|
|
66391
67265
|
self.CtldUnits[unitname]=nil
|
|
66392
67266
|
self.Loaded_Cargo[unitname]=nil
|
|
66393
67267
|
self.MenusDone[unitname]=nil
|
|
66394
|
-
elseif event.id==EVENTS.
|
|
66395
|
-
|
|
66396
|
-
|
|
66397
|
-
|
|
66398
|
-
|
|
66399
|
-
local
|
|
66400
|
-
local
|
|
66401
|
-
|
|
66402
|
-
|
|
66403
|
-
|
|
66404
|
-
|
|
66405
|
-
|
|
66406
|
-
|
|
66407
|
-
|
|
66408
|
-
|
|
67268
|
+
elseif event.id==EVENTS.NewDynamicCargo then
|
|
67269
|
+
self:T(self.lid.."GC New Event "..event.IniDynamicCargoName)
|
|
67270
|
+
self.DynamicCargo[event.IniDynamicCargoName]=event.IniDynamicCargo
|
|
67271
|
+
elseif event.id==EVENTS.DynamicCargoLoaded then
|
|
67272
|
+
self:T(self.lid.."GC Loaded Event "..event.IniDynamicCargoName)
|
|
67273
|
+
local dcargo=event.IniDynamicCargo
|
|
67274
|
+
local client=CLIENT:FindByPlayerName(dcargo.Owner)
|
|
67275
|
+
if client and client:IsAlive()then
|
|
67276
|
+
local unitname=client:GetName()or"none"
|
|
67277
|
+
local loaded={}
|
|
67278
|
+
if self.Loaded_Cargo[unitname]then
|
|
67279
|
+
loaded=self.Loaded_Cargo[unitname]
|
|
67280
|
+
else
|
|
67281
|
+
loaded={}
|
|
67282
|
+
loaded.Troopsloaded=0
|
|
67283
|
+
loaded.Cratesloaded=0
|
|
67284
|
+
loaded.Cargo={}
|
|
66409
67285
|
end
|
|
67286
|
+
loaded.Cratesloaded=loaded.Cratesloaded+1
|
|
67287
|
+
table.insert(loaded.Cargo,dcargo)
|
|
67288
|
+
self.Loaded_Cargo[unitname]=nil
|
|
67289
|
+
self.Loaded_Cargo[unitname]=loaded
|
|
67290
|
+
local Group=client:GetGroup()
|
|
67291
|
+
self:_SendMessage(string.format("Crate %s loaded by ground crew!",event.IniDynamicCargoName),10,false,Group)
|
|
67292
|
+
self:__CratesPickedUp(1,Group,client,dcargo)
|
|
67293
|
+
end
|
|
67294
|
+
elseif event.id==EVENTS.DynamicCargoUnloaded then
|
|
67295
|
+
self:T(self.lid.."GC Unload Event "..event.IniDynamicCargoName)
|
|
67296
|
+
local dcargo=event.IniDynamicCargo
|
|
67297
|
+
local client=CLIENT:FindByPlayerName(dcargo.Owner)
|
|
67298
|
+
if client and client:IsAlive()then
|
|
67299
|
+
local unitname=client:GetName()or"none"
|
|
67300
|
+
local loaded={}
|
|
67301
|
+
if self.Loaded_Cargo[unitname]then
|
|
67302
|
+
loaded=self.Loaded_Cargo[unitname]
|
|
67303
|
+
loaded.Cratesloaded=loaded.Cratesloaded-1
|
|
67304
|
+
if loaded.Cratesloaded<0 then loaded.Cratesloaded=0 end
|
|
67305
|
+
local Loaded={}
|
|
67306
|
+
for _,_item in pairs(loaded.Cargo or{})do
|
|
67307
|
+
self:T(self.lid.."UNLOAD checking: ".._item:GetName())
|
|
67308
|
+
self:T(self.lid.."UNLOAD state: "..tostring(_item:WasDropped()))
|
|
67309
|
+
if _item and _item:GetType()==CTLD_CARGO.Enum.GCLOADABLE and event.IniDynamicCargoName and event.IniDynamicCargoName~=_item:GetName()and not _item:WasDropped()then
|
|
67310
|
+
table.insert(Loaded,_item)
|
|
67311
|
+
else
|
|
67312
|
+
table.insert(Loaded,_item)
|
|
67313
|
+
end
|
|
67314
|
+
end
|
|
67315
|
+
loaded.Cargo=nil
|
|
67316
|
+
loaded.Cargo=Loaded
|
|
67317
|
+
self.Loaded_Cargo[unitname]=nil
|
|
67318
|
+
self.Loaded_Cargo[unitname]=loaded
|
|
67319
|
+
else
|
|
67320
|
+
loaded={}
|
|
67321
|
+
loaded.Troopsloaded=0
|
|
67322
|
+
loaded.Cratesloaded=0
|
|
67323
|
+
loaded.Cargo={}
|
|
67324
|
+
self.Loaded_Cargo[unitname]=loaded
|
|
66410
67325
|
end
|
|
66411
|
-
|
|
67326
|
+
local Group=client:GetGroup()
|
|
67327
|
+
self:_SendMessage(string.format("Crate %s unloaded by ground crew!",event.IniDynamicCargoName),10,false,Group)
|
|
67328
|
+
self:__CratesDropped(1,Group,client,{dcargo})
|
|
67329
|
+
end
|
|
67330
|
+
elseif event.id==EVENTS.DynamicCargoRemoved then
|
|
67331
|
+
self:T(self.lid.."GC Remove Event "..event.IniDynamicCargoName)
|
|
67332
|
+
self.DynamicCargo[event.IniDynamicCargoName]=nil
|
|
66412
67333
|
end
|
|
66413
67334
|
return self
|
|
66414
67335
|
end
|
|
@@ -66833,7 +67754,7 @@ end
|
|
|
66833
67754
|
local capabilities=self:_GetUnitCapabilities(Unit)
|
|
66834
67755
|
local canloadcratesno=capabilities.cratelimit
|
|
66835
67756
|
local loaddist=self.CrateDistance or 35
|
|
66836
|
-
local nearcrates,numbernearby=self:_FindCratesNearby(Group,Unit,loaddist,true)
|
|
67757
|
+
local nearcrates,numbernearby=self:_FindCratesNearby(Group,Unit,loaddist,true,true)
|
|
66837
67758
|
if numbernearby>=canloadcratesno and not drop then
|
|
66838
67759
|
self:_SendMessage("There are enough crates nearby already! Take care of those first!",10,false,Group)
|
|
66839
67760
|
return self
|
|
@@ -66863,35 +67784,37 @@ local addon=0
|
|
|
66863
67784
|
if IsHerc or IsHook then
|
|
66864
67785
|
addon=180
|
|
66865
67786
|
end
|
|
67787
|
+
heading=(heading+addon)%360
|
|
67788
|
+
local row=1
|
|
67789
|
+
local column=1
|
|
67790
|
+
local initialdist=IsHerc and 16 or(capabilities.length+2)
|
|
67791
|
+
local startpos=position:Translate(initialdist,heading)
|
|
67792
|
+
if self.placeCratesAhead==true then
|
|
67793
|
+
cratedistance=initialdist
|
|
67794
|
+
end
|
|
67795
|
+
local cratecoord=nil
|
|
66866
67796
|
for i=1,number do
|
|
66867
67797
|
local cratealias=string.format("%s-%s-%d",cratename,cratetemplate,math.random(1,100000))
|
|
66868
|
-
if not self.placeCratesAhead then
|
|
67798
|
+
if not self.placeCratesAhead or drop==true then
|
|
66869
67799
|
cratedistance=(i-1)*2.5+capabilities.length
|
|
66870
67800
|
if cratedistance>self.CrateDistance then cratedistance=self.CrateDistance end
|
|
66871
67801
|
rheading=UTILS.RandomGaussian(0,30,-90,90,100)
|
|
66872
|
-
rheading=math.fmod((heading+rheading
|
|
66873
|
-
|
|
66874
|
-
local initialSpacing=IsHerc and 16 or(capabilities.length+2)
|
|
66875
|
-
local crateSpacing=4
|
|
66876
|
-
local lateralSpacing=4
|
|
66877
|
-
local nrSideBySideCrates=3
|
|
66878
|
-
if cratesneeded==1 then
|
|
66879
|
-
cratedistance=initialSpacing
|
|
66880
|
-
rheading=heading
|
|
66881
|
-
else
|
|
66882
|
-
if(i-1)%nrSideBySideCrates==0 then
|
|
66883
|
-
cratedistance=i==1 and initialSpacing or cratedistance+crateSpacing
|
|
66884
|
-
angleOffNose=math.ceil(math.deg(math.atan(lateralSpacing/cratedistance)))
|
|
66885
|
-
rheading=heading-angleOffNose
|
|
67802
|
+
rheading=math.fmod((heading+rheading),360)
|
|
67803
|
+
cratecoord=position:Translate(cratedistance,rheading)
|
|
66886
67804
|
else
|
|
66887
|
-
|
|
67805
|
+
cratedistance=(row-1)*6
|
|
67806
|
+
rheading=90
|
|
67807
|
+
row=row+1
|
|
67808
|
+
cratecoord=startpos:Translate(cratedistance,rheading)
|
|
67809
|
+
if row>4 then
|
|
67810
|
+
row=1
|
|
67811
|
+
startpos:Translate(6,heading,nil,true)
|
|
66888
67812
|
end
|
|
66889
67813
|
end
|
|
66890
|
-
end
|
|
66891
|
-
local cratecoord=position:Translate(cratedistance,rheading)
|
|
66892
|
-
local cratevec2=cratecoord:GetVec2()
|
|
66893
67814
|
self.CrateCounter=self.CrateCounter+1
|
|
66894
|
-
local
|
|
67815
|
+
local CCat,CType,CShape=Cargo:GetStaticTypeAndShape()
|
|
67816
|
+
local basetype=CType or self.basetype or"container_cargo"
|
|
67817
|
+
CCat=CCat or"Cargos"
|
|
66895
67818
|
if isstatic then
|
|
66896
67819
|
basetype=cratetemplate
|
|
66897
67820
|
end
|
|
@@ -66904,20 +67827,26 @@ local dist=shipcoord:Get2DDistance(unitcoord)
|
|
|
66904
67827
|
dist=dist-(20+math.random(1,10))
|
|
66905
67828
|
local width=width/2
|
|
66906
67829
|
local Offy=math.random(-width,width)
|
|
66907
|
-
local spawnstatic=SPAWNSTATIC:NewFromType(basetype,
|
|
67830
|
+
local spawnstatic=SPAWNSTATIC:NewFromType(basetype,CCat,self.cratecountry)
|
|
66908
67831
|
:InitCargoMass(cgomass)
|
|
66909
67832
|
:InitCargo(self.enableslingload)
|
|
66910
67833
|
:InitLinkToUnit(Ship,dist,Offy,0)
|
|
67834
|
+
if CShape then
|
|
67835
|
+
spawnstatic:InitShape(CShape)
|
|
67836
|
+
end
|
|
66911
67837
|
if isstatic then
|
|
66912
67838
|
local map=cargotype:GetStaticResourceMap()
|
|
66913
67839
|
spawnstatic.TemplateStaticUnit.resourcePayload=map
|
|
66914
67840
|
end
|
|
66915
67841
|
self.Spawned_Crates[self.CrateCounter]=spawnstatic:Spawn(270,cratealias)
|
|
66916
67842
|
else
|
|
66917
|
-
local spawnstatic=SPAWNSTATIC:NewFromType(basetype,
|
|
67843
|
+
local spawnstatic=SPAWNSTATIC:NewFromType(basetype,CCat,self.cratecountry)
|
|
66918
67844
|
:InitCoordinate(cratecoord)
|
|
66919
67845
|
:InitCargoMass(cgomass)
|
|
66920
67846
|
:InitCargo(self.enableslingload)
|
|
67847
|
+
if CShape then
|
|
67848
|
+
spawnstatic:InitShape(CShape)
|
|
67849
|
+
end
|
|
66921
67850
|
if isstatic then
|
|
66922
67851
|
local map=cargotype:GetStaticResourceMap()
|
|
66923
67852
|
spawnstatic.TemplateStaticUnit.resourcePayload=map
|
|
@@ -66933,12 +67862,22 @@ if drop then
|
|
|
66933
67862
|
realcargo=CTLD_CARGO:New(self.CargoCounter,cratename,templ,sorte,true,false,cratesneeded,self.Spawned_Crates[self.CrateCounter],true,cargotype.PerCrateMass,nil,subcat)
|
|
66934
67863
|
local map=cargotype:GetStaticResourceMap()
|
|
66935
67864
|
realcargo:SetStaticResourceMap(map)
|
|
67865
|
+
local CCat,CType,CShape=cargotype:GetStaticTypeAndShape()
|
|
67866
|
+
realcargo:SetStaticTypeAndShape(CCat,CType,CShape)
|
|
67867
|
+
if cargotype.TypeNames then
|
|
67868
|
+
realcargo.TypeNames=UTILS.DeepCopy(cargotype.TypeNames)
|
|
67869
|
+
end
|
|
66936
67870
|
table.insert(droppedcargo,realcargo)
|
|
66937
67871
|
else
|
|
66938
67872
|
realcargo=CTLD_CARGO:New(self.CargoCounter,cratename,templ,sorte,false,false,cratesneeded,self.Spawned_Crates[self.CrateCounter],false,cargotype.PerCrateMass,nil,subcat)
|
|
66939
67873
|
local map=cargotype:GetStaticResourceMap()
|
|
66940
67874
|
realcargo:SetStaticResourceMap(map)
|
|
67875
|
+
if cargotype.TypeNames then
|
|
67876
|
+
realcargo.TypeNames=UTILS.DeepCopy(cargotype.TypeNames)
|
|
66941
67877
|
end
|
|
67878
|
+
end
|
|
67879
|
+
local CCat,CType,CShape=cargotype:GetStaticTypeAndShape()
|
|
67880
|
+
realcargo:SetStaticTypeAndShape(CCat,CType,CShape)
|
|
66942
67881
|
table.insert(self.Spawned_Cargo,realcargo)
|
|
66943
67882
|
end
|
|
66944
67883
|
if not(drop or pack)then
|
|
@@ -66952,7 +67891,7 @@ end
|
|
|
66952
67891
|
self:_SendMessage(text,10,false,Group)
|
|
66953
67892
|
return self
|
|
66954
67893
|
end
|
|
66955
|
-
function CTLD:InjectStatics(Zone,Cargo,RandomCoord)
|
|
67894
|
+
function CTLD:InjectStatics(Zone,Cargo,RandomCoord,FromLoad)
|
|
66956
67895
|
self:T(self.lid.." InjectStatics")
|
|
66957
67896
|
local cratecoord=Zone:GetCoordinate()
|
|
66958
67897
|
if RandomCoord then
|
|
@@ -66968,21 +67907,29 @@ local cratetemplate="Container"
|
|
|
66968
67907
|
local cratename=cargotype:GetName()
|
|
66969
67908
|
local cgotype=cargotype:GetType()
|
|
66970
67909
|
local cgomass=cargotype:GetMass()
|
|
67910
|
+
local cratenumber=cargotype:GetCratesNeeded()or 1
|
|
67911
|
+
if FromLoad==true then cratenumber=1 end
|
|
67912
|
+
for i=1,cratenumber do
|
|
66971
67913
|
local cratealias=string.format("%s-%s-%d",cratename,cratetemplate,math.random(1,100000))
|
|
66972
67914
|
local isstatic=false
|
|
66973
67915
|
if cgotype==CTLD_CARGO.Enum.STATIC then
|
|
66974
67916
|
cratetemplate=cargotype:GetTemplates()
|
|
66975
67917
|
isstatic=true
|
|
66976
67918
|
end
|
|
66977
|
-
local
|
|
67919
|
+
local CCat,CType,CShape=cargotype:GetStaticTypeAndShape()
|
|
67920
|
+
local basetype=CType or self.basetype or"container_cargo"
|
|
67921
|
+
CCat=CCat or"Cargos"
|
|
66978
67922
|
if isstatic then
|
|
66979
67923
|
basetype=cratetemplate
|
|
66980
67924
|
end
|
|
66981
67925
|
self.CrateCounter=self.CrateCounter+1
|
|
66982
|
-
local spawnstatic=SPAWNSTATIC:NewFromType(basetype,
|
|
67926
|
+
local spawnstatic=SPAWNSTATIC:NewFromType(basetype,CCat,self.cratecountry)
|
|
66983
67927
|
:InitCargoMass(cgomass)
|
|
66984
67928
|
:InitCargo(self.enableslingload)
|
|
66985
67929
|
:InitCoordinate(cratecoord)
|
|
67930
|
+
if CShape then
|
|
67931
|
+
spawnstatic:InitShape(CShape)
|
|
67932
|
+
end
|
|
66986
67933
|
if isstatic then
|
|
66987
67934
|
local map=cargotype:GetStaticResourceMap()
|
|
66988
67935
|
spawnstatic.TemplateStaticUnit.resourcePayload=map
|
|
@@ -66992,18 +67939,19 @@ local templ=cargotype:GetTemplates()
|
|
|
66992
67939
|
local sorte=cargotype:GetType()
|
|
66993
67940
|
cargotype.Positionable=self.Spawned_Crates[self.CrateCounter]
|
|
66994
67941
|
table.insert(self.Spawned_Cargo,cargotype)
|
|
67942
|
+
end
|
|
66995
67943
|
return self
|
|
66996
67944
|
end
|
|
66997
67945
|
function CTLD:InjectStaticFromTemplate(Zone,Template,Mass)
|
|
66998
67946
|
self:T(self.lid.." InjectStaticFromTemplate")
|
|
66999
67947
|
local cargotype=self:GetStaticsCargoFromTemplate(Template,Mass)
|
|
67000
|
-
self:InjectStatics(Zone,cargotype,true)
|
|
67948
|
+
self:InjectStatics(Zone,cargotype,true,true)
|
|
67001
67949
|
return self
|
|
67002
67950
|
end
|
|
67003
67951
|
function CTLD:_ListCratesNearby(_group,_unit)
|
|
67004
67952
|
self:T(self.lid.." _ListCratesNearby")
|
|
67005
67953
|
local finddist=self.CrateDistance or 35
|
|
67006
|
-
local crates,number,loadedbygc,indexgc=self:_FindCratesNearby(_group,_unit,finddist,true)
|
|
67954
|
+
local crates,number,loadedbygc,indexgc=self:_FindCratesNearby(_group,_unit,finddist,true,true)
|
|
67007
67955
|
if number>0 or indexgc>0 then
|
|
67008
67956
|
local text=REPORT:New("Crates Found Nearby:")
|
|
67009
67957
|
text:Add("------------------------------------------------------------")
|
|
@@ -67022,7 +67970,7 @@ text:Add(" N O N E")
|
|
|
67022
67970
|
end
|
|
67023
67971
|
text:Add("------------------------------------------------------------")
|
|
67024
67972
|
if indexgc>0 then
|
|
67025
|
-
text:Add("Probably ground crew
|
|
67973
|
+
text:Add("Probably ground crew loadable (F8)")
|
|
67026
67974
|
for _,_entry in pairs(loadedbygc)do
|
|
67027
67975
|
local entry=_entry
|
|
67028
67976
|
local name=entry:GetName()
|
|
@@ -67043,7 +67991,7 @@ end
|
|
|
67043
67991
|
function CTLD:_RemoveCratesNearby(_group,_unit)
|
|
67044
67992
|
self:T(self.lid.." _RemoveCratesNearby")
|
|
67045
67993
|
local finddist=self.CrateDistance or 35
|
|
67046
|
-
local crates,number=self:_FindCratesNearby(_group,_unit,finddist,true)
|
|
67994
|
+
local crates,number=self:_FindCratesNearby(_group,_unit,finddist,true,true)
|
|
67047
67995
|
if number>0 then
|
|
67048
67996
|
local text=REPORT:New("Removing Crates Found Nearby:")
|
|
67049
67997
|
text:Add("------------------------------------------------------------")
|
|
@@ -67088,7 +68036,7 @@ self:E({_point1,_point2})
|
|
|
67088
68036
|
return-1
|
|
67089
68037
|
end
|
|
67090
68038
|
end
|
|
67091
|
-
function CTLD:_FindCratesNearby(_group,_unit,_dist,_ignoreweight)
|
|
68039
|
+
function CTLD:_FindCratesNearby(_group,_unit,_dist,_ignoreweight,ignoretype)
|
|
67092
68040
|
self:T(self.lid.." _FindCratesNearby")
|
|
67093
68041
|
local finddist=_dist
|
|
67094
68042
|
local location=_group:GetCoordinate()
|
|
@@ -67100,53 +68048,31 @@ local LoadedbyGC={}
|
|
|
67100
68048
|
local loadedmass=0
|
|
67101
68049
|
local unittype="none"
|
|
67102
68050
|
local capabilities={}
|
|
67103
|
-
local maxmass=2000
|
|
67104
68051
|
local maxloadable=2000
|
|
67105
|
-
local
|
|
68052
|
+
local IsHook=self:IsHook(_unit)
|
|
67106
68053
|
if not _ignoreweight then
|
|
67107
68054
|
maxloadable=self:_GetMaxLoadableMass(_unit)
|
|
67108
68055
|
end
|
|
67109
|
-
self:
|
|
68056
|
+
self:T2(self.lid.." Max loadable mass: "..maxloadable)
|
|
67110
68057
|
for _,_cargoobject in pairs(existingcrates)do
|
|
67111
68058
|
local cargo=_cargoobject
|
|
67112
68059
|
local static=cargo:GetPositionable()
|
|
67113
68060
|
local weight=cargo:GetMass()
|
|
67114
68061
|
local staticid=cargo:GetID()
|
|
67115
|
-
self:
|
|
67116
|
-
|
|
67117
|
-
local
|
|
67118
|
-
local
|
|
67119
|
-
|
|
67120
|
-
|
|
67121
|
-
|
|
67122
|
-
|
|
67123
|
-
end
|
|
67124
|
-
if cargoalive==true then
|
|
67125
|
-
local dcsvec3=dcsunit:getPoint()or dcsunit:getPosition().p or{x=0,y=0,z=0}
|
|
67126
|
-
self:T({dcsvec3=dcsunit:getPoint(),dcspos=dcsunit:getPosition().p})
|
|
67127
|
-
if dcsvec3 then
|
|
67128
|
-
dcsunitpos=COORDINATE:New(dcsvec3.x,dcsvec3.z,dcsvec3.y)
|
|
67129
|
-
end
|
|
67130
|
-
end
|
|
67131
|
-
end
|
|
67132
|
-
if static and(static:IsAlive()or cargoalive)then
|
|
67133
|
-
local staticpos=static:GetCoordinate()or dcsunitpos
|
|
67134
|
-
local landheight=staticpos:GetLandHeight()
|
|
67135
|
-
local agl=staticpos.y-landheight
|
|
67136
|
-
agl=UTILS.Round(agl,2)
|
|
67137
|
-
local GCloaded=agl>0 and true or false
|
|
67138
|
-
if IsNoHook==true then GCloaded=false end
|
|
68062
|
+
self:T2(self.lid.." Found cargo mass: "..weight)
|
|
68063
|
+
if static and static:IsAlive()then
|
|
68064
|
+
local restricthooktononstatics=self.enableChinookGCLoading and IsHook
|
|
68065
|
+
local cargoisstatic=cargo:GetType()==CTLD_CARGO.Enum.STATIC and true or false
|
|
68066
|
+
local restricted=cargoisstatic and restricthooktononstatics
|
|
68067
|
+
local staticpos=static:GetCoordinate()
|
|
68068
|
+
local cando=cargo:UnitCanCarry(_unit)
|
|
68069
|
+
if ignoretype==true then cando=true end
|
|
67139
68070
|
local distance=self:_GetDistance(location,staticpos)
|
|
67140
|
-
|
|
67141
|
-
if(not GCloaded)and distance<=finddist and static and(weight<=maxloadable or _ignoreweight)then
|
|
68071
|
+
if distance<=finddist and(weight<=maxloadable or _ignoreweight)and restricted==false and cando==true then
|
|
67142
68072
|
index=index+1
|
|
67143
68073
|
table.insert(found,staticid,cargo)
|
|
67144
68074
|
maxloadable=maxloadable-weight
|
|
67145
68075
|
end
|
|
67146
|
-
if GCloaded==true and distance<10 and static then
|
|
67147
|
-
indexg=indexg+1
|
|
67148
|
-
table.insert(LoadedbyGC,staticid,cargo)
|
|
67149
|
-
end
|
|
67150
68076
|
end
|
|
67151
68077
|
end
|
|
67152
68078
|
return found,index,LoadedbyGC,indexg
|
|
@@ -67187,15 +68113,15 @@ loaded.Cratesloaded=0
|
|
|
67187
68113
|
loaded.Cargo={}
|
|
67188
68114
|
end
|
|
67189
68115
|
local finddist=self.CrateDistance or 35
|
|
67190
|
-
local nearcrates,number=self:_FindCratesNearby(Group,Unit,finddist,false)
|
|
68116
|
+
local nearcrates,number=self:_FindCratesNearby(Group,Unit,finddist,false,false)
|
|
67191
68117
|
self:T(self.lid.." Crates found: "..number)
|
|
67192
68118
|
if number==0 and self.hoverautoloading then
|
|
67193
68119
|
return self
|
|
67194
68120
|
elseif number==0 then
|
|
67195
|
-
self:_SendMessage("Sorry no loadable crates nearby or max cargo weight reached!",10,false,Group)
|
|
68121
|
+
self:_SendMessage("Sorry, no loadable crates nearby or max cargo weight reached!",10,false,Group)
|
|
67196
68122
|
return self
|
|
67197
68123
|
elseif numberonboard==cratelimit then
|
|
67198
|
-
self:_SendMessage("Sorry
|
|
68124
|
+
self:_SendMessage("Sorry, we are fully loaded!",10,false,Group)
|
|
67199
68125
|
return self
|
|
67200
68126
|
else
|
|
67201
68127
|
local capacity=cratelimit-numberonboard
|
|
@@ -67274,9 +68200,13 @@ local type=cargo:GetType()
|
|
|
67274
68200
|
if(type==CTLD_CARGO.Enum.TROOPS or type==CTLD_CARGO.Enum.ENGINEERS)and not cargo:WasDropped()then
|
|
67275
68201
|
loadedmass=loadedmass+(cargo.PerCrateMass*cargo:GetCratesNeeded())
|
|
67276
68202
|
end
|
|
67277
|
-
if type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS and not cargo:WasDropped()then
|
|
68203
|
+
if type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS and type~=CTLD_CARGO.Enum.GCLOADABLE and not cargo:WasDropped()then
|
|
67278
68204
|
loadedmass=loadedmass+cargo.PerCrateMass
|
|
67279
68205
|
end
|
|
68206
|
+
if type==CTLD_CARGO.Enum.GCLOADABLE then
|
|
68207
|
+
local mass=cargo:GetCargoWeight()
|
|
68208
|
+
loadedmass=loadedmass+mass
|
|
68209
|
+
end
|
|
67280
68210
|
end
|
|
67281
68211
|
end
|
|
67282
68212
|
return loadedmass
|
|
@@ -67308,8 +68238,7 @@ local loadedcargo=self.Loaded_Cargo[unitname]or{}
|
|
|
67308
68238
|
local loadedmass=self:_GetUnitCargoMass(Unit)
|
|
67309
68239
|
local maxloadable=self:_GetMaxLoadableMass(Unit)
|
|
67310
68240
|
local finddist=self.CrateDistance or 35
|
|
67311
|
-
|
|
67312
|
-
if self.Loaded_Cargo[unitname]or loadedno>0 then
|
|
68241
|
+
if self.Loaded_Cargo[unitname]then
|
|
67313
68242
|
local no_troops=loadedcargo.Troopsloaded or 0
|
|
67314
68243
|
local no_crates=loadedcargo.Cratesloaded or 0
|
|
67315
68244
|
local cargotable=loadedcargo.Cargo or{}
|
|
@@ -67334,26 +68263,18 @@ local cratecount=0
|
|
|
67334
68263
|
for _,_cargo in pairs(cargotable or{})do
|
|
67335
68264
|
local cargo=_cargo
|
|
67336
68265
|
local type=cargo:GetType()
|
|
67337
|
-
if(type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS)and(not cargo:WasDropped()or self.allowcratepickupagain)then
|
|
68266
|
+
if(type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS and type~=CTLD_CARGO.Enum.GCLOADABLE)and(not cargo:WasDropped()or self.allowcratepickupagain)then
|
|
67338
68267
|
report:Add(string.format("Crate: %s size 1",cargo:GetName()))
|
|
67339
68268
|
cratecount=cratecount+1
|
|
67340
68269
|
end
|
|
68270
|
+
if type==CTLD_CARGO.Enum.GCLOADABLE and not cargo:WasDropped()then
|
|
68271
|
+
report:Add(string.format("GC loaded Crate: %s size 1",cargo:GetName()))
|
|
68272
|
+
cratecount=cratecount+1
|
|
68273
|
+
end
|
|
67341
68274
|
end
|
|
67342
68275
|
if cratecount==0 then
|
|
67343
68276
|
report:Add(" N O N E")
|
|
67344
68277
|
end
|
|
67345
|
-
if loadedno>0 then
|
|
67346
|
-
report:Add("------------------------------------------------------------")
|
|
67347
|
-
report:Add(" -- CRATES loaded via F8 --")
|
|
67348
|
-
for _,_cargo in pairs(loadedgc or{})do
|
|
67349
|
-
local cargo=_cargo
|
|
67350
|
-
local type=cargo:GetType()
|
|
67351
|
-
if(type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS)then
|
|
67352
|
-
report:Add(string.format("Crate: %s size 1",cargo:GetName()))
|
|
67353
|
-
loadedmass=loadedmass+cargo:GetMass()
|
|
67354
|
-
end
|
|
67355
|
-
end
|
|
67356
|
-
end
|
|
67357
68278
|
report:Add("------------------------------------------------------------")
|
|
67358
68279
|
report:Add("Total Mass: "..loadedmass.." kg. Loadable: "..maxloadable.." kg.")
|
|
67359
68280
|
local text=report:Text()
|
|
@@ -67454,7 +68375,7 @@ return false
|
|
|
67454
68375
|
end
|
|
67455
68376
|
end
|
|
67456
68377
|
function CTLD:IsHook(Unit)
|
|
67457
|
-
if string.find(Unit:GetTypeName(),"CH.47")then
|
|
68378
|
+
if Unit and string.find(Unit:GetTypeName(),"CH.47")then
|
|
67458
68379
|
return true
|
|
67459
68380
|
else
|
|
67460
68381
|
return false
|
|
@@ -67525,10 +68446,12 @@ local heading=Group:GetHeading()or 0
|
|
|
67525
68446
|
if hoverunload or grounded then
|
|
67526
68447
|
randomcoord=Group:GetCoordinate()
|
|
67527
68448
|
local Angle=(heading+270)%360
|
|
67528
|
-
local offset=hoverunload and
|
|
68449
|
+
local offset=hoverunload and self.TroopUnloadDistHover or self.TroopUnloadDistGround
|
|
67529
68450
|
randomcoord:Translate(offset,Angle,nil,true)
|
|
67530
68451
|
end
|
|
67531
68452
|
local tempcount=0
|
|
68453
|
+
local ishook=self:IsHook(Unit)
|
|
68454
|
+
if ishook then tempcount=self.ChinookTroopCircleRadius or 5 end
|
|
67532
68455
|
for _,_template in pairs(temptable)do
|
|
67533
68456
|
self.TroopCounter=self.TroopCounter+1
|
|
67534
68457
|
tempcount=tempcount+1
|
|
@@ -67623,7 +68546,7 @@ local cargotable=loadedcargo.Cargo
|
|
|
67623
68546
|
for _,_cargo in pairs(cargotable)do
|
|
67624
68547
|
local cargo=_cargo
|
|
67625
68548
|
local type=cargo:GetType()
|
|
67626
|
-
if type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS and(not cargo:WasDropped()or self.allowcratepickupagain)then
|
|
68549
|
+
if type~=CTLD_CARGO.Enum.TROOPS and type~=CTLD_CARGO.Enum.ENGINEERS and type~=CTLD_CARGO.Enum.GCLOADABLE and(not cargo:WasDropped()or self.allowcratepickupagain)then
|
|
67627
68550
|
self:_GetCrates(Group,Unit,cargo,1,true)
|
|
67628
68551
|
cargo:SetWasDropped(true)
|
|
67629
68552
|
cargo:SetHasMoved(true)
|
|
@@ -67641,6 +68564,10 @@ if type==CTLD_CARGO.Enum.TROOPS or type==CTLD_CARGO.Enum.ENGINEERS then
|
|
|
67641
68564
|
table.insert(loaded.Cargo,_cargo)
|
|
67642
68565
|
loaded.Troopsloaded=loaded.Troopsloaded+size
|
|
67643
68566
|
end
|
|
68567
|
+
if type==CTLD_CARGO.Enum.GCLOADABLE and not cargo:WasDropped()then
|
|
68568
|
+
table.insert(loaded.Cargo,_cargo)
|
|
68569
|
+
loaded.Cratesloaded=loaded.Cratesloaded+size
|
|
68570
|
+
end
|
|
67644
68571
|
end
|
|
67645
68572
|
self.Loaded_Cargo[unitname]=nil
|
|
67646
68573
|
self.Loaded_Cargo[unitname]=loaded
|
|
@@ -67671,7 +68598,7 @@ return self
|
|
|
67671
68598
|
end
|
|
67672
68599
|
end
|
|
67673
68600
|
local finddist=self.CrateDistance or 35
|
|
67674
|
-
local crates,number=self:_FindCratesNearby(Group,Unit,finddist,true)
|
|
68601
|
+
local crates,number=self:_FindCratesNearby(Group,Unit,finddist,true,true)
|
|
67675
68602
|
local buildables={}
|
|
67676
68603
|
local foundbuilds=false
|
|
67677
68604
|
local canbuild=false
|
|
@@ -67776,7 +68703,7 @@ end
|
|
|
67776
68703
|
function CTLD:_RepairCrates(Group,Unit,Engineering)
|
|
67777
68704
|
self:T(self.lid.." _RepairCrates")
|
|
67778
68705
|
local finddist=self.CrateDistance or 35
|
|
67779
|
-
local crates,number=self:_FindCratesNearby(Group,Unit,finddist,true)
|
|
68706
|
+
local crates,number=self:_FindCratesNearby(Group,Unit,finddist,true,true)
|
|
67780
68707
|
local buildables={}
|
|
67781
68708
|
local foundbuilds=false
|
|
67782
68709
|
local canbuild=false
|
|
@@ -67987,7 +68914,7 @@ local capabilities=self:_GetUnitCapabilities(_unit)
|
|
|
67987
68914
|
local cantroops=capabilities.troops
|
|
67988
68915
|
local cancrates=capabilities.crates
|
|
67989
68916
|
local isHook=self:IsHook(_unit)
|
|
67990
|
-
local nohookswitch=
|
|
68917
|
+
local nohookswitch=true
|
|
67991
68918
|
local topmenu=MENU_GROUP:New(_group,"CTLD",nil)
|
|
67992
68919
|
local toptroops=nil
|
|
67993
68920
|
local topcrates=nil
|
|
@@ -68161,7 +69088,7 @@ local cargo=CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,true,NoTr
|
|
|
68161
69088
|
table.insert(self.Cargo_Troops,cargo)
|
|
68162
69089
|
return self
|
|
68163
69090
|
end
|
|
68164
|
-
function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
|
69091
|
+
function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location,UnitTypes,Category,TypeName,ShapeName)
|
|
68165
69092
|
self:T(self.lid.." AddCratesCargo")
|
|
68166
69093
|
if not self:_CheckTemplates(Templates)then
|
|
68167
69094
|
self:E(self.lid.."Crates Cargo for "..Name.." has missing template(s)!")
|
|
@@ -68169,6 +69096,13 @@ return self
|
|
|
68169
69096
|
end
|
|
68170
69097
|
self.CargoCounter=self.CargoCounter+1
|
|
68171
69098
|
local cargo=CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
|
69099
|
+
if UnitTypes then
|
|
69100
|
+
cargo:AddUnitTypeName(UnitTypes)
|
|
69101
|
+
end
|
|
69102
|
+
cargo:SetStaticTypeAndShape("Cargos",self.basetype)
|
|
69103
|
+
if TypeName then
|
|
69104
|
+
cargo:SetStaticTypeAndShape(Category,TypeName,ShapeName)
|
|
69105
|
+
end
|
|
68172
69106
|
table.insert(self.Cargo_Crates,cargo)
|
|
68173
69107
|
return self
|
|
68174
69108
|
end
|
|
@@ -68201,7 +69135,7 @@ local cargo=CTLD_CARGO:New(self.CargoCounter,Name,template,type,false,false,1,ni
|
|
|
68201
69135
|
cargo:SetStaticResourceMap(ResourceMap)
|
|
68202
69136
|
return cargo
|
|
68203
69137
|
end
|
|
68204
|
-
function CTLD:AddCratesRepair(Name,Template,Type,NoCrates,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
|
69138
|
+
function CTLD:AddCratesRepair(Name,Template,Type,NoCrates,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location,UnitTypes,Category,TypeName,ShapeName)
|
|
68205
69139
|
self:T(self.lid.." AddCratesRepair")
|
|
68206
69140
|
if not self:_CheckTemplates(Template)then
|
|
68207
69141
|
self:E(self.lid.."Repair Cargo for "..Name.." has a missing template!")
|
|
@@ -68209,6 +69143,13 @@ return self
|
|
|
68209
69143
|
end
|
|
68210
69144
|
self.CargoCounter=self.CargoCounter+1
|
|
68211
69145
|
local cargo=CTLD_CARGO:New(self.CargoCounter,Name,Template,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
|
69146
|
+
if UnitTypes then
|
|
69147
|
+
cargo:AddUnitTypeName(UnitTypes)
|
|
69148
|
+
end
|
|
69149
|
+
cargo:SetStaticTypeAndShape("cargos",self.basetype)
|
|
69150
|
+
if TypeName then
|
|
69151
|
+
cargo:SetStaticTypeAndShape(Category,TypeName,ShapeName)
|
|
69152
|
+
end
|
|
68212
69153
|
table.insert(self.Cargo_Crates,cargo)
|
|
68213
69154
|
return self
|
|
68214
69155
|
end
|
|
@@ -68950,7 +69891,7 @@ local wrenches=engineers.Group
|
|
|
68950
69891
|
self:T(_engineers.lid.._engineers:GetStatus())
|
|
68951
69892
|
if wrenches and wrenches:IsAlive()then
|
|
68952
69893
|
if engineers:IsStatus("Running")or engineers:IsStatus("Searching")then
|
|
68953
|
-
local crates,number=self:_FindCratesNearby(wrenches,nil,self.EngineerSearch,true)
|
|
69894
|
+
local crates,number=self:_FindCratesNearby(wrenches,nil,self.EngineerSearch,true,true)
|
|
68954
69895
|
engineers:Search(crates,number)
|
|
68955
69896
|
elseif engineers:IsStatus("Moving")then
|
|
68956
69897
|
engineers:Move()
|
|
@@ -69172,7 +70113,10 @@ self:HandleEvent(EVENTS.PlayerEnterAircraft,self._EventHandler)
|
|
|
69172
70113
|
self:HandleEvent(EVENTS.PlayerEnterUnit,self._EventHandler)
|
|
69173
70114
|
self:HandleEvent(EVENTS.PlayerLeaveUnit,self._EventHandler)
|
|
69174
70115
|
self:HandleEvent(EVENTS.UnitLost,self._EventHandler)
|
|
69175
|
-
self:HandleEvent(EVENTS.
|
|
70116
|
+
self:HandleEvent(EVENTS.NewDynamicCargo,self._EventHandler)
|
|
70117
|
+
self:HandleEvent(EVENTS.DynamicCargoLoaded,self._EventHandler)
|
|
70118
|
+
self:HandleEvent(EVENTS.DynamicCargoUnloaded,self._EventHandler)
|
|
70119
|
+
self:HandleEvent(EVENTS.DynamicCargoRemoved,self._EventHandler)
|
|
69176
70120
|
self:__Status(-5)
|
|
69177
70121
|
if self.enableLoadSave then
|
|
69178
70122
|
local interval=self.saveinterval
|
|
@@ -69231,9 +70175,11 @@ return self
|
|
|
69231
70175
|
end
|
|
69232
70176
|
function CTLD:onafterStop(From,Event,To)
|
|
69233
70177
|
self:T({From,Event,To})
|
|
69234
|
-
self:
|
|
69235
|
-
self:
|
|
69236
|
-
self:
|
|
70178
|
+
self:UnHandleEvent(EVENTS.PlayerEnterAircraft)
|
|
70179
|
+
self:UnHandleEvent(EVENTS.PlayerEnterUnit)
|
|
70180
|
+
self:UnHandleEvent(EVENTS.PlayerLeaveUnit)
|
|
70181
|
+
self:UnHandleEvent(EVENTS.UnitLost)
|
|
70182
|
+
self:UnHandleEvent(EVENTS.Shot)
|
|
69237
70183
|
return self
|
|
69238
70184
|
end
|
|
69239
70185
|
function CTLD:onbeforeTroopsPickedUp(From,Event,To,Group,Unit,Cargo)
|
|
@@ -69566,7 +70512,7 @@ local map=cargotype:GetStaticResourceMap()
|
|
|
69566
70512
|
injectstatic:SetStaticResourceMap(map)
|
|
69567
70513
|
end
|
|
69568
70514
|
if injectstatic then
|
|
69569
|
-
self:InjectStatics(dropzone,injectstatic)
|
|
70515
|
+
self:InjectStatics(dropzone,injectstatic,false,true)
|
|
69570
70516
|
end
|
|
69571
70517
|
end
|
|
69572
70518
|
end
|
|
@@ -69749,7 +70695,7 @@ local position=Cargo_Drop_Position:GetVec2()
|
|
|
69749
70695
|
local Zone=ZONE_RADIUS:New("Cargo Static "..math.random(1,10000),position,100)
|
|
69750
70696
|
if not dead then
|
|
69751
70697
|
local injectstatic=CTLD_CARGO:New(nil,"Cargo Static Group "..math.random(1,10000),"iso_container",CTLD_CARGO.Enum.STATIC,true,false,1,nil,true,4500,1)
|
|
69752
|
-
self.CTLD:InjectStatics(Zone,injectstatic,true)
|
|
70698
|
+
self.CTLD:InjectStatics(Zone,injectstatic,true,true)
|
|
69753
70699
|
end
|
|
69754
70700
|
return self
|
|
69755
70701
|
end
|
|
@@ -69757,13 +70703,17 @@ function CTLD_HERCULES:Cargo_SpawnDroppedAsCargo(_name,_pos)
|
|
|
69757
70703
|
local theCargo=self.CTLD:_FindCratesCargoObject(_name)
|
|
69758
70704
|
if theCargo then
|
|
69759
70705
|
self.CTLD.CrateCounter=self.CTLD.CrateCounter+1
|
|
69760
|
-
|
|
69761
|
-
local basetype=self.CTLD.basetype or"container_cargo"
|
|
69762
|
-
|
|
70706
|
+
local CCat,CType,CShape=theCargo:GetStaticTypeAndShape()
|
|
70707
|
+
local basetype=CType or self.CTLD.basetype or"container_cargo"
|
|
70708
|
+
CCat=CCat or"Cargos"
|
|
70709
|
+
local theStatic=SPAWNSTATIC:NewFromType(basetype,CCat,self.cratecountry)
|
|
69763
70710
|
:InitCargoMass(theCargo.PerCrateMass)
|
|
69764
70711
|
:InitCargo(self.CTLD.enableslingload)
|
|
69765
70712
|
:InitCoordinate(_pos)
|
|
69766
|
-
|
|
70713
|
+
if CShape then
|
|
70714
|
+
theStatic:InitShape(CShape)
|
|
70715
|
+
end
|
|
70716
|
+
theStatic:Spawn(270,_name.."-Container-"..math.random(1,100000))
|
|
69767
70717
|
self.CTLD.Spawned_Crates[self.CTLD.CrateCounter]=theStatic
|
|
69768
70718
|
local newCargo=CTLD_CARGO:New(self.CTLD.CargoCounter,theCargo.Name,theCargo.Templates,theCargo.CargoType,true,false,theCargo.CratesNeeded,self.CTLD.Spawned_Crates[self.CTLD.CrateCounter],true,theCargo.PerCrateMass,nil,theCargo.Subcategory)
|
|
69769
70719
|
local map=theCargo:GetStaticResourceMap()
|
|
@@ -70020,6 +70970,7 @@ allheligroupset=nil,
|
|
|
70020
70970
|
topmenuname="CSAR",
|
|
70021
70971
|
ADFRadioPwr=1000,
|
|
70022
70972
|
PilotWeight=80,
|
|
70973
|
+
CreateRadioBeacons=true,
|
|
70023
70974
|
}
|
|
70024
70975
|
CSAR.AircraftType={}
|
|
70025
70976
|
CSAR.AircraftType["SA342Mistral"]=2
|
|
@@ -70039,7 +70990,7 @@ CSAR.AircraftType["MH-60R"]=10
|
|
|
70039
70990
|
CSAR.AircraftType["OH-6A"]=2
|
|
70040
70991
|
CSAR.AircraftType["OH-58D"]=2
|
|
70041
70992
|
CSAR.AircraftType["CH-47Fbl1"]=31
|
|
70042
|
-
CSAR.version="1.0.
|
|
70993
|
+
CSAR.version="1.0.27"
|
|
70043
70994
|
function CSAR:New(Coalition,Template,Alias)
|
|
70044
70995
|
local self=BASE:Inherit(self,FSM:New())
|
|
70045
70996
|
BASE:T({Coalition,Template,Alias})
|
|
@@ -71004,7 +71955,7 @@ distancetext=string.format("%.1fnm",UTILS.MetersToNM(_distance))
|
|
|
71004
71955
|
else
|
|
71005
71956
|
distancetext=string.format("%.1fkm",_distance/1000.0)
|
|
71006
71957
|
end
|
|
71007
|
-
if _value.frequency==0 then
|
|
71958
|
+
if _value.frequency==0 or self.CreateRadioBeacons==false then
|
|
71008
71959
|
table.insert(_csarList,{dist=_distance,msg=string.format("%s at %s - %s ",_value.desc,_coordinatesText,distancetext)})
|
|
71009
71960
|
else
|
|
71010
71961
|
table.insert(_csarList,{dist=_distance,msg=string.format("%s at %s - %.2f KHz ADF - %s ",_value.desc,_coordinatesText,_value.frequency/1000,distancetext)})
|
|
@@ -71291,6 +72242,7 @@ return clock
|
|
|
71291
72242
|
end
|
|
71292
72243
|
function CSAR:_AddBeaconToGroup(_group,_freq)
|
|
71293
72244
|
self:T(self.lid.." _AddBeaconToGroup")
|
|
72245
|
+
if self.CreateRadioBeacons==false then return end
|
|
71294
72246
|
local _group=_group
|
|
71295
72247
|
if _group==nil then
|
|
71296
72248
|
for _i,_current in ipairs(self.UsedVHFFrequencies)do
|
|
@@ -71316,6 +72268,7 @@ return self
|
|
|
71316
72268
|
end
|
|
71317
72269
|
function CSAR:_RefreshRadioBeacons()
|
|
71318
72270
|
self:T(self.lid.." _RefreshRadioBeacons")
|
|
72271
|
+
if self.CreateRadioBeacons==false then return end
|
|
71319
72272
|
if self:_CountActiveDownedPilots()>0 then
|
|
71320
72273
|
local PilotTable=self.downedPilots
|
|
71321
72274
|
for _,_pilot in pairs(PilotTable)do
|
|
@@ -82087,11 +83040,11 @@ Microsoft={
|
|
|
82087
83040
|
["David"]="Microsoft David Desktop",
|
|
82088
83041
|
["Zira"]="Microsoft Zira Desktop",
|
|
82089
83042
|
["Hortense"]="Microsoft Hortense Desktop",
|
|
82090
|
-
["
|
|
82091
|
-
["
|
|
82092
|
-
["
|
|
82093
|
-
["
|
|
82094
|
-
["
|
|
83043
|
+
["de_DE_Hedda"]="Microsoft Hedda Desktop",
|
|
83044
|
+
["en_GB_Hazel"]="Microsoft Hazel Desktop",
|
|
83045
|
+
["en_US_David"]="Microsoft David Desktop",
|
|
83046
|
+
["en_US_Zira"]="Microsoft Zira Desktop",
|
|
83047
|
+
["fr_FR_Hortense"]="Microsoft Hortense Desktop",
|
|
82095
83048
|
},
|
|
82096
83049
|
MicrosoftGRPC={
|
|
82097
83050
|
["Hazel"]="Hazel",
|
|
@@ -82597,7 +83550,7 @@ end
|
|
|
82597
83550
|
function MSRS:PlayTextExt(Text,Delay,Frequencies,Modulations,Gender,Culture,Voice,Volume,Label,Coordinate)
|
|
82598
83551
|
self:T({Text,Delay,Frequencies,Modulations,Gender,Culture,Voice,Volume,Label,Coordinate})
|
|
82599
83552
|
if Delay and Delay>0 then
|
|
82600
|
-
self:ScheduleOnce(Delay,
|
|
83553
|
+
self:ScheduleOnce(Delay,self.PlayTextExt,self,Text,0,Frequencies,Modulations,Gender,Culture,Voice,Volume,Label,Coordinate)
|
|
82601
83554
|
else
|
|
82602
83555
|
Frequencies=Frequencies or self:GetFrequencies()
|
|
82603
83556
|
Modulations=Modulations or self:GetModulations()
|
|
@@ -82732,8 +83685,8 @@ end
|
|
|
82732
83685
|
return res
|
|
82733
83686
|
end
|
|
82734
83687
|
function MSRS:_DCSgRPCtts(Text,Frequencies,Gender,Culture,Voice,Volume,Label,Coordinate)
|
|
82735
|
-
self:
|
|
82736
|
-
self:
|
|
83688
|
+
self:T("MSRS_BACKEND_DCSGRPC:_DCSgRPCtts()")
|
|
83689
|
+
self:T({Text,Frequencies,Gender,Culture,Voice,Volume,Label,Coordinate})
|
|
82737
83690
|
local options={}
|
|
82738
83691
|
local ssml=Text or''
|
|
82739
83692
|
Frequencies=UTILS.EnsureTable(Frequencies,true)or self:GetFrequencies()
|
|
@@ -82745,7 +83698,6 @@ options.position.lat,options.position.lon,options.position.alt=self:_GetLatLongA
|
|
|
82745
83698
|
end
|
|
82746
83699
|
options.coalition=UTILS.GetCoalitionName(self.coalition):lower()
|
|
82747
83700
|
local provider=self.provider or MSRS.Provider.WINDOWS
|
|
82748
|
-
self:F({provider=provider})
|
|
82749
83701
|
options.provider={}
|
|
82750
83702
|
options.provider[provider]=self:GetProviderOptions(provider)
|
|
82751
83703
|
Voice=Voice or self:GetVoice(self.provider)or self.voice
|