@jtff/miztemplate-lib 3.7.1 → 3.7.3
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 +3469 -1621
- package/lua/lib/Moose_.lua +312 -264
- package/lua/lib/{Splash_Damage_3.0.lua → Splash_Damage_main.lua} +485 -50
- package/lua/src/120-tankers.lua +9 -2
- package/package.json +4 -4
- package/scripts/inject-scripts.js +9 -9
package/lua/lib/Moose_.lua
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
env.info('*** MOOSE GITHUB Commit Hash ID: 2025-
|
|
1
|
+
env.info('*** MOOSE GITHUB Commit Hash ID: 2025-04-03T14:21:58+02:00-b7b6c1ea19b5fe0685a71aa1ac72f69c9c46f696 ***')
|
|
2
2
|
if not MOOSE_DEVELOPMENT_FOLDER then
|
|
3
3
|
MOOSE_DEVELOPMENT_FOLDER='Scripts'
|
|
4
4
|
end
|
|
@@ -8752,7 +8752,7 @@ return nil
|
|
|
8752
8752
|
end
|
|
8753
8753
|
function ZONE_BASE:GetPointVec2()
|
|
8754
8754
|
local Vec2=self:GetVec2()
|
|
8755
|
-
local PointVec2=
|
|
8755
|
+
local PointVec2=COORDINATE:NewFromVec2(Vec2)
|
|
8756
8756
|
return PointVec2
|
|
8757
8757
|
end
|
|
8758
8758
|
function ZONE_BASE:GetVec3(Height)
|
|
@@ -8763,7 +8763,7 @@ return Vec3
|
|
|
8763
8763
|
end
|
|
8764
8764
|
function ZONE_BASE:GetPointVec3(Height)
|
|
8765
8765
|
local Vec3=self:GetVec3(Height)
|
|
8766
|
-
local PointVec3=
|
|
8766
|
+
local PointVec3=COORDINATE:NewFromVec3(Vec3)
|
|
8767
8767
|
return PointVec3
|
|
8768
8768
|
end
|
|
8769
8769
|
function ZONE_BASE:GetCoordinate(Height)
|
|
@@ -9093,7 +9093,7 @@ for Angle=0,360,360/Points do
|
|
|
9093
9093
|
local Radial=(Angle+AngleOffset)*RadialBase/360
|
|
9094
9094
|
Point.x=Vec2.x+math.cos(Radial)*self:GetRadius()
|
|
9095
9095
|
Point.y=Vec2.y+math.sin(Radial)*self:GetRadius()
|
|
9096
|
-
|
|
9096
|
+
COORDINATE:New(Point.x,AddHeight,Point.y):Smoke(SmokeColor)
|
|
9097
9097
|
end
|
|
9098
9098
|
return self
|
|
9099
9099
|
end
|
|
@@ -9108,7 +9108,7 @@ for Angle=0,360,360/Points do
|
|
|
9108
9108
|
local Radial=Angle*RadialBase/360
|
|
9109
9109
|
Point.x=Vec2.x+math.cos(Radial)*self:GetRadius()
|
|
9110
9110
|
Point.y=Vec2.y+math.sin(Radial)*self:GetRadius()
|
|
9111
|
-
|
|
9111
|
+
COORDINATE:New(Point.x,AddHeight,Point.y):Flare(FlareColor,Azimuth)
|
|
9112
9112
|
end
|
|
9113
9113
|
return self
|
|
9114
9114
|
end
|
|
@@ -9363,7 +9363,7 @@ end
|
|
|
9363
9363
|
return point
|
|
9364
9364
|
end
|
|
9365
9365
|
function ZONE_RADIUS:GetRandomPointVec2(inner,outer)
|
|
9366
|
-
local PointVec2=
|
|
9366
|
+
local PointVec2=COORDINATE:NewFromVec2(self:GetRandomVec2(inner,outer))
|
|
9367
9367
|
return PointVec2
|
|
9368
9368
|
end
|
|
9369
9369
|
function ZONE_RADIUS:GetRandomVec3(inner,outer)
|
|
@@ -9371,7 +9371,7 @@ local Vec2=self:GetRandomVec2(inner,outer)
|
|
|
9371
9371
|
return{x=Vec2.x,y=self.y,z=Vec2.y}
|
|
9372
9372
|
end
|
|
9373
9373
|
function ZONE_RADIUS:GetRandomPointVec3(inner,outer)
|
|
9374
|
-
local PointVec3=
|
|
9374
|
+
local PointVec3=COORDINATE:NewFromVec2(self:GetRandomVec2(inner,outer))
|
|
9375
9375
|
return PointVec3
|
|
9376
9376
|
end
|
|
9377
9377
|
function ZONE_RADIUS:GetRandomCoordinate(inner,outer,surfacetypes)
|
|
@@ -9574,7 +9574,7 @@ Point.y=Vec2.y+math.sin(angle)*math.random()*self:GetRadius();
|
|
|
9574
9574
|
return Point
|
|
9575
9575
|
end
|
|
9576
9576
|
function ZONE_GROUP:GetRandomPointVec2(inner,outer)
|
|
9577
|
-
local PointVec2=
|
|
9577
|
+
local PointVec2=COORDINATE:NewFromVec2(self:GetRandomVec2())
|
|
9578
9578
|
return PointVec2
|
|
9579
9579
|
end
|
|
9580
9580
|
_ZONE_TRIANGLE={
|
|
@@ -9972,7 +9972,7 @@ local DeltaY=self._.Polygon[j].y-self._.Polygon[i].y
|
|
|
9972
9972
|
for Segment=0,Segments do
|
|
9973
9973
|
local PointX=self._.Polygon[i].x+(Segment*DeltaX/Segments)
|
|
9974
9974
|
local PointY=self._.Polygon[i].y+(Segment*DeltaY/Segments)
|
|
9975
|
-
|
|
9975
|
+
COORDINATE:New(PointX,0,PointY):Smoke(SmokeColor)
|
|
9976
9976
|
end
|
|
9977
9977
|
j=i
|
|
9978
9978
|
i=i+1
|
|
@@ -9990,7 +9990,7 @@ local DeltaY=self._.Polygon[j].y-self._.Polygon[i].y
|
|
|
9990
9990
|
for Segment=0,Segments do
|
|
9991
9991
|
local PointX=self._.Polygon[i].x+(Segment*DeltaX/Segments)
|
|
9992
9992
|
local PointY=self._.Polygon[i].y+(Segment*DeltaY/Segments)
|
|
9993
|
-
|
|
9993
|
+
COORDINATE:New(PointX,AddHeight,PointY):Flare(FlareColor,Azimuth)
|
|
9994
9994
|
end
|
|
9995
9995
|
j=i
|
|
9996
9996
|
i=i+1
|
|
@@ -10035,11 +10035,11 @@ end
|
|
|
10035
10035
|
end
|
|
10036
10036
|
end
|
|
10037
10037
|
function ZONE_POLYGON_BASE:GetRandomPointVec2()
|
|
10038
|
-
local PointVec2=
|
|
10038
|
+
local PointVec2=COORDINATE:NewFromVec2(self:GetRandomVec2())
|
|
10039
10039
|
return PointVec2
|
|
10040
10040
|
end
|
|
10041
10041
|
function ZONE_POLYGON_BASE:GetRandomPointVec3()
|
|
10042
|
-
local PointVec3=
|
|
10042
|
+
local PointVec3=COORDINATE:NewFromVec2(self:GetRandomVec2())
|
|
10043
10043
|
return PointVec3
|
|
10044
10044
|
end
|
|
10045
10045
|
function ZONE_POLYGON_BASE:GetRandomCoordinate()
|
|
@@ -10549,10 +10549,10 @@ local ry=(x_e*math.sin(theta)+y_e*math.cos(theta))+self.CenterVec2.y
|
|
|
10549
10549
|
return{x=rx,y=ry}
|
|
10550
10550
|
end
|
|
10551
10551
|
function ZONE_OVAL:GetRandomPointVec2()
|
|
10552
|
-
return
|
|
10552
|
+
return COORDINATE:NewFromVec2(self:GetRandomVec2())
|
|
10553
10553
|
end
|
|
10554
10554
|
function ZONE_OVAL:GetRandomPointVec3()
|
|
10555
|
-
return
|
|
10555
|
+
return COORDINATE:NewFromVec3(self:GetRandomVec2())
|
|
10556
10556
|
end
|
|
10557
10557
|
function ZONE_OVAL:DrawZone(Coalition,Color,Alpha,FillColor,FillAlpha,LineType)
|
|
10558
10558
|
Coalition=Coalition or self:GetDrawCoalition()
|
|
@@ -10618,7 +10618,7 @@ end
|
|
|
10618
10618
|
return ZoneVec2
|
|
10619
10619
|
end
|
|
10620
10620
|
function ZONE_AIRBASE:GetRandomPointVec2(inner,outer)
|
|
10621
|
-
local PointVec2=
|
|
10621
|
+
local PointVec2=COORDINATE:NewFromVec2(self:GetRandomVec2())
|
|
10622
10622
|
return PointVec2
|
|
10623
10623
|
end
|
|
10624
10624
|
end
|
|
@@ -10674,7 +10674,7 @@ for Angle=0,360,360/Points do
|
|
|
10674
10674
|
local Radial=(Angle+AngleOffset)*RadialBase/360
|
|
10675
10675
|
Point.x=Vec2.x+math.cos(Radial)*self:GetRadius()
|
|
10676
10676
|
Point.y=Vec2.y+math.sin(Radial)*self:GetRadius()
|
|
10677
|
-
|
|
10677
|
+
COORDINATE:New(Point.x,AddHeight,Point.y):Smoke(SmokeColor)
|
|
10678
10678
|
end
|
|
10679
10679
|
return self
|
|
10680
10680
|
end
|
|
@@ -10690,7 +10690,7 @@ for Angle=0,360,360/Points do
|
|
|
10690
10690
|
local Radial=Angle*RadialBase/360
|
|
10691
10691
|
Point.x=Vec2.x+math.cos(Radial)*self:GetRadius()
|
|
10692
10692
|
Point.y=Vec2.y+math.sin(Radial)*self:GetRadius()
|
|
10693
|
-
|
|
10693
|
+
COORDINATE:New(Point.x,AddHeight,Point.y):Flare(FlareColor,Azimuth)
|
|
10694
10694
|
end
|
|
10695
10695
|
return self
|
|
10696
10696
|
end
|
|
@@ -12212,15 +12212,15 @@ self:UnHandleEvent(EVENTS.Dead)
|
|
|
12212
12212
|
self:UnHandleEvent(EVENTS.Crash)
|
|
12213
12213
|
return self
|
|
12214
12214
|
end
|
|
12215
|
-
function SET_BASE:FindNearestObjectFromPointVec2(
|
|
12215
|
+
function SET_BASE:FindNearestObjectFromPointVec2(Coordinate)
|
|
12216
12216
|
local NearestObject=nil
|
|
12217
12217
|
local ClosestDistance=nil
|
|
12218
12218
|
for ObjectID,ObjectData in pairs(self.Set)do
|
|
12219
12219
|
if NearestObject==nil then
|
|
12220
12220
|
NearestObject=ObjectData
|
|
12221
|
-
ClosestDistance=
|
|
12221
|
+
ClosestDistance=Coordinate:DistanceFromPointVec2(ObjectData:GetCoordinate())
|
|
12222
12222
|
else
|
|
12223
|
-
local Distance=
|
|
12223
|
+
local Distance=Coordinate:DistanceFromPointVec2(ObjectData:GetCoordinate())
|
|
12224
12224
|
if Distance<ClosestDistance then
|
|
12225
12225
|
NearestObject=ObjectData
|
|
12226
12226
|
ClosestDistance=Distance
|
|
@@ -12441,16 +12441,16 @@ function SET_GROUP:FindGroup(GroupName)
|
|
|
12441
12441
|
local GroupFound=self.Set[GroupName]
|
|
12442
12442
|
return GroupFound
|
|
12443
12443
|
end
|
|
12444
|
-
function SET_GROUP:FindNearestGroupFromPointVec2(
|
|
12444
|
+
function SET_GROUP:FindNearestGroupFromPointVec2(Coordinate)
|
|
12445
12445
|
local NearestGroup=nil
|
|
12446
12446
|
local ClosestDistance=nil
|
|
12447
12447
|
local Set=self:GetAliveSet()
|
|
12448
12448
|
for ObjectID,ObjectData in pairs(Set)do
|
|
12449
12449
|
if NearestGroup==nil then
|
|
12450
12450
|
NearestGroup=ObjectData
|
|
12451
|
-
ClosestDistance=
|
|
12451
|
+
ClosestDistance=Coordinate:DistanceFromPointVec2(ObjectData:GetCoordinate())
|
|
12452
12452
|
else
|
|
12453
|
-
local Distance=
|
|
12453
|
+
local Distance=Coordinate:DistanceFromPointVec2(ObjectData:GetCoordinate())
|
|
12454
12454
|
if Distance<ClosestDistance then
|
|
12455
12455
|
NearestGroup=ObjectData
|
|
12456
12456
|
ClosestDistance=Distance
|
|
@@ -14736,8 +14736,8 @@ function SET_AIRBASE:ForEachAirbase(IteratorFunction,...)
|
|
|
14736
14736
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
14737
14737
|
return self
|
|
14738
14738
|
end
|
|
14739
|
-
function SET_AIRBASE:FindNearestAirbaseFromPointVec2(
|
|
14740
|
-
local NearestAirbase=self:FindNearestObjectFromPointVec2(
|
|
14739
|
+
function SET_AIRBASE:FindNearestAirbaseFromPointVec2(Coordinate)
|
|
14740
|
+
local NearestAirbase=self:FindNearestObjectFromPointVec2(Coordinate)
|
|
14741
14741
|
return NearestAirbase
|
|
14742
14742
|
end
|
|
14743
14743
|
function SET_AIRBASE:IsIncludeObject(MAirbase)
|
|
@@ -14897,8 +14897,8 @@ function SET_CARGO:ForEachCargo(IteratorFunction,...)
|
|
|
14897
14897
|
self:ForEach(IteratorFunction,arg,self:GetSet())
|
|
14898
14898
|
return self
|
|
14899
14899
|
end
|
|
14900
|
-
function SET_CARGO:FindNearestCargoFromPointVec2(
|
|
14901
|
-
local NearestCargo=self:FindNearestObjectFromPointVec2(
|
|
14900
|
+
function SET_CARGO:FindNearestCargoFromPointVec2(Coordinate)
|
|
14901
|
+
local NearestCargo=self:FindNearestObjectFromPointVec2(Coordinate)
|
|
14902
14902
|
return NearestCargo
|
|
14903
14903
|
end
|
|
14904
14904
|
function SET_CARGO:FirstCargoWithState(State)
|
|
@@ -16877,6 +16877,79 @@ local point={x=self.x,y=math.max(height or self.y,landheight),z=self.z}
|
|
|
16877
16877
|
local vec3=atmosphere.getWindWithTurbulence(point)
|
|
16878
16878
|
return vec3
|
|
16879
16879
|
end
|
|
16880
|
+
function COORDINATE:GetX()
|
|
16881
|
+
return self.x
|
|
16882
|
+
end
|
|
16883
|
+
function COORDINATE:GetY()
|
|
16884
|
+
if self:IsInstanceOf("POINT_VEC2")then
|
|
16885
|
+
return self.z
|
|
16886
|
+
end
|
|
16887
|
+
return self.y
|
|
16888
|
+
end
|
|
16889
|
+
function COORDINATE:GetZ()
|
|
16890
|
+
return self.z
|
|
16891
|
+
end
|
|
16892
|
+
function COORDINATE:SetX(x)
|
|
16893
|
+
self.x=x
|
|
16894
|
+
return self
|
|
16895
|
+
end
|
|
16896
|
+
function COORDINATE:SetY(y)
|
|
16897
|
+
if self:IsInstanceOf("POINT_VEC2")then
|
|
16898
|
+
self.z=y
|
|
16899
|
+
else
|
|
16900
|
+
self.y=y
|
|
16901
|
+
end
|
|
16902
|
+
return self
|
|
16903
|
+
end
|
|
16904
|
+
function COORDINATE:SetZ(z)
|
|
16905
|
+
self.z=z
|
|
16906
|
+
return self
|
|
16907
|
+
end
|
|
16908
|
+
function COORDINATE:AddX(x)
|
|
16909
|
+
self.x=self.x+x
|
|
16910
|
+
return self
|
|
16911
|
+
end
|
|
16912
|
+
function COORDINATE:GetLat()
|
|
16913
|
+
return self.x
|
|
16914
|
+
end
|
|
16915
|
+
function COORDINATE:SetLat(x)
|
|
16916
|
+
self.x=x
|
|
16917
|
+
return self
|
|
16918
|
+
end
|
|
16919
|
+
function COORDINATE:GetLon()
|
|
16920
|
+
return self.z
|
|
16921
|
+
end
|
|
16922
|
+
function COORDINATE:SetLon(z)
|
|
16923
|
+
self.z=z
|
|
16924
|
+
return self
|
|
16925
|
+
end
|
|
16926
|
+
function COORDINATE:GetAlt()
|
|
16927
|
+
return self.y~=0 or land.getHeight({x=self.x,y=self.z})
|
|
16928
|
+
end
|
|
16929
|
+
function COORDINATE:SetAlt(Altitude)
|
|
16930
|
+
self.y=Altitude or land.getHeight({x=self.x,y=self.z})
|
|
16931
|
+
return self
|
|
16932
|
+
end
|
|
16933
|
+
function COORDINATE:AddAlt(Altitude)
|
|
16934
|
+
self.y=land.getHeight({x=self.x,y=self.z})+Altitude or 0
|
|
16935
|
+
return self
|
|
16936
|
+
end
|
|
16937
|
+
function COORDINATE:GetRandomPointVec2InRadius(OuterRadius,InnerRadius)
|
|
16938
|
+
self:F2({OuterRadius,InnerRadius})
|
|
16939
|
+
return COORDINATE:NewFromVec2(self:GetRandomVec2InRadius(OuterRadius,InnerRadius))
|
|
16940
|
+
end
|
|
16941
|
+
function COORDINATE:AddY(y)
|
|
16942
|
+
if self:IsInstanceOf("POINT_VEC2")then
|
|
16943
|
+
return self:AddZ(y)
|
|
16944
|
+
else
|
|
16945
|
+
self.y=self.y+y
|
|
16946
|
+
end
|
|
16947
|
+
return self
|
|
16948
|
+
end
|
|
16949
|
+
function COORDINATE:AddZ(z)
|
|
16950
|
+
self.z=self.z+z
|
|
16951
|
+
return self
|
|
16952
|
+
end
|
|
16880
16953
|
function COORDINATE:GetWindText(height,Settings)
|
|
16881
16954
|
local Direction,Strength=self:GetWind(height)
|
|
16882
16955
|
local Settings=Settings or _SETTINGS
|
|
@@ -18036,6 +18109,9 @@ local steep,elev=self:IsInSteepArea(Radius,Minelevation)
|
|
|
18036
18109
|
local flat=not steep
|
|
18037
18110
|
return flat,elev
|
|
18038
18111
|
end
|
|
18112
|
+
function COORDINATE:GetRandomPointVec3InRadius(OuterRadius,InnerRadius)
|
|
18113
|
+
return COORDINATE:NewFromVec3(self:GetRandomVec3InRadius(OuterRadius,InnerRadius))
|
|
18114
|
+
end
|
|
18039
18115
|
end
|
|
18040
18116
|
do
|
|
18041
18117
|
POINT_VEC3={
|
|
@@ -18058,52 +18134,6 @@ local self=BASE:Inherit(self,COORDINATE:New(x,y,z))
|
|
|
18058
18134
|
self:F2(self)
|
|
18059
18135
|
return self
|
|
18060
18136
|
end
|
|
18061
|
-
function POINT_VEC3:NewFromVec2(Vec2,LandHeightAdd)
|
|
18062
|
-
local self=BASE:Inherit(self,COORDINATE:NewFromVec2(Vec2,LandHeightAdd))
|
|
18063
|
-
self:F2(self)
|
|
18064
|
-
return self
|
|
18065
|
-
end
|
|
18066
|
-
function POINT_VEC3:NewFromVec3(Vec3)
|
|
18067
|
-
local self=BASE:Inherit(self,COORDINATE:NewFromVec3(Vec3))
|
|
18068
|
-
self:F2(self)
|
|
18069
|
-
return self
|
|
18070
|
-
end
|
|
18071
|
-
function POINT_VEC3:GetX()
|
|
18072
|
-
return self.x
|
|
18073
|
-
end
|
|
18074
|
-
function POINT_VEC3:GetY()
|
|
18075
|
-
return self.y
|
|
18076
|
-
end
|
|
18077
|
-
function POINT_VEC3:GetZ()
|
|
18078
|
-
return self.z
|
|
18079
|
-
end
|
|
18080
|
-
function POINT_VEC3:SetX(x)
|
|
18081
|
-
self.x=x
|
|
18082
|
-
return self
|
|
18083
|
-
end
|
|
18084
|
-
function POINT_VEC3:SetY(y)
|
|
18085
|
-
self.y=y
|
|
18086
|
-
return self
|
|
18087
|
-
end
|
|
18088
|
-
function POINT_VEC3:SetZ(z)
|
|
18089
|
-
self.z=z
|
|
18090
|
-
return self
|
|
18091
|
-
end
|
|
18092
|
-
function POINT_VEC3:AddX(x)
|
|
18093
|
-
self.x=self.x+x
|
|
18094
|
-
return self
|
|
18095
|
-
end
|
|
18096
|
-
function POINT_VEC3:AddY(y)
|
|
18097
|
-
self.y=self.y+y
|
|
18098
|
-
return self
|
|
18099
|
-
end
|
|
18100
|
-
function POINT_VEC3:AddZ(z)
|
|
18101
|
-
self.z=self.z+z
|
|
18102
|
-
return self
|
|
18103
|
-
end
|
|
18104
|
-
function POINT_VEC3:GetRandomPointVec3InRadius(OuterRadius,InnerRadius)
|
|
18105
|
-
return POINT_VEC3:NewFromVec3(self:GetRandomVec3InRadius(OuterRadius,InnerRadius))
|
|
18106
|
-
end
|
|
18107
18137
|
end
|
|
18108
18138
|
do
|
|
18109
18139
|
POINT_VEC2={
|
|
@@ -18117,76 +18147,6 @@ local self=BASE:Inherit(self,COORDINATE:New(x,LandHeight,y))
|
|
|
18117
18147
|
self:F2(self)
|
|
18118
18148
|
return self
|
|
18119
18149
|
end
|
|
18120
|
-
function POINT_VEC2:NewFromVec2(Vec2,LandHeightAdd)
|
|
18121
|
-
local LandHeight=land.getHeight(Vec2)
|
|
18122
|
-
LandHeightAdd=LandHeightAdd or 0
|
|
18123
|
-
LandHeight=LandHeight+LandHeightAdd
|
|
18124
|
-
local self=BASE:Inherit(self,COORDINATE:NewFromVec2(Vec2,LandHeightAdd))
|
|
18125
|
-
self:F2(self)
|
|
18126
|
-
return self
|
|
18127
|
-
end
|
|
18128
|
-
function POINT_VEC2:NewFromVec3(Vec3)
|
|
18129
|
-
local self=BASE:Inherit(self,COORDINATE:NewFromVec3(Vec3))
|
|
18130
|
-
self:F2(self)
|
|
18131
|
-
return self
|
|
18132
|
-
end
|
|
18133
|
-
function POINT_VEC2:GetX()
|
|
18134
|
-
return self.x
|
|
18135
|
-
end
|
|
18136
|
-
function POINT_VEC2:GetY()
|
|
18137
|
-
return self.z
|
|
18138
|
-
end
|
|
18139
|
-
function POINT_VEC2:SetX(x)
|
|
18140
|
-
self.x=x
|
|
18141
|
-
return self
|
|
18142
|
-
end
|
|
18143
|
-
function POINT_VEC2:SetY(y)
|
|
18144
|
-
self.z=y
|
|
18145
|
-
return self
|
|
18146
|
-
end
|
|
18147
|
-
function POINT_VEC2:GetLat()
|
|
18148
|
-
return self.x
|
|
18149
|
-
end
|
|
18150
|
-
function POINT_VEC2:SetLat(x)
|
|
18151
|
-
self.x=x
|
|
18152
|
-
return self
|
|
18153
|
-
end
|
|
18154
|
-
function POINT_VEC2:GetLon()
|
|
18155
|
-
return self.z
|
|
18156
|
-
end
|
|
18157
|
-
function POINT_VEC2:SetLon(z)
|
|
18158
|
-
self.z=z
|
|
18159
|
-
return self
|
|
18160
|
-
end
|
|
18161
|
-
function POINT_VEC2:GetAlt()
|
|
18162
|
-
return self.y~=0 or land.getHeight({x=self.x,y=self.z})
|
|
18163
|
-
end
|
|
18164
|
-
function POINT_VEC2:SetAlt(Altitude)
|
|
18165
|
-
self.y=Altitude or land.getHeight({x=self.x,y=self.z})
|
|
18166
|
-
return self
|
|
18167
|
-
end
|
|
18168
|
-
function POINT_VEC2:AddX(x)
|
|
18169
|
-
self.x=self.x+x
|
|
18170
|
-
return self
|
|
18171
|
-
end
|
|
18172
|
-
function POINT_VEC2:AddY(y)
|
|
18173
|
-
self.z=self.z+y
|
|
18174
|
-
return self
|
|
18175
|
-
end
|
|
18176
|
-
function POINT_VEC2:AddAlt(Altitude)
|
|
18177
|
-
self.y=land.getHeight({x=self.x,y=self.z})+Altitude or 0
|
|
18178
|
-
return self
|
|
18179
|
-
end
|
|
18180
|
-
function POINT_VEC2:GetRandomPointVec2InRadius(OuterRadius,InnerRadius)
|
|
18181
|
-
self:F2({OuterRadius,InnerRadius})
|
|
18182
|
-
return POINT_VEC2:NewFromVec2(self:GetRandomVec2InRadius(OuterRadius,InnerRadius))
|
|
18183
|
-
end
|
|
18184
|
-
function POINT_VEC2:DistanceFromPointVec2(PointVec2Reference)
|
|
18185
|
-
self:F2(PointVec2Reference)
|
|
18186
|
-
local Distance=((PointVec2Reference.x-self.x)^2+(PointVec2Reference.z-self.z)^2)^0.5
|
|
18187
|
-
self:T2(Distance)
|
|
18188
|
-
return Distance
|
|
18189
|
-
end
|
|
18190
18150
|
end
|
|
18191
18151
|
do
|
|
18192
18152
|
VELOCITY={
|
|
@@ -19549,7 +19509,7 @@ else
|
|
|
19549
19509
|
local SpawnTemplate=self.SpawnGroups[self.SpawnIndex].SpawnTemplate
|
|
19550
19510
|
local SpawnZone=self.SpawnGroups[self.SpawnIndex].SpawnZone
|
|
19551
19511
|
if SpawnTemplate then
|
|
19552
|
-
local PointVec3=
|
|
19512
|
+
local PointVec3=COORDINATE:New(SpawnTemplate.route.points[1].x,SpawnTemplate.route.points[1].alt,SpawnTemplate.route.points[1].y)
|
|
19553
19513
|
if self.SpawnRandomizePosition then
|
|
19554
19514
|
local RandomVec2=PointVec3:GetRandomVec2InRadius(self.SpawnRandomizePositionOuterRadius,self.SpawnRandomizePositionInnerRadius)
|
|
19555
19515
|
local CurrentX=SpawnTemplate.units[1].x
|
|
@@ -19787,13 +19747,14 @@ SpawnPoint.helipadId=nil
|
|
|
19787
19747
|
SpawnPoint.airdromeId=nil
|
|
19788
19748
|
local AirbaseID=SpawnAirbase:GetID()
|
|
19789
19749
|
local AirbaseCategory=SpawnAirbase:GetAirbaseCategory()
|
|
19790
|
-
SpawnPoint.airdromeId=AirbaseID
|
|
19791
19750
|
if AirbaseCategory==Airbase.Category.SHIP then
|
|
19792
19751
|
SpawnPoint.linkUnit=AirbaseID
|
|
19793
19752
|
SpawnPoint.helipadId=AirbaseID
|
|
19794
19753
|
elseif AirbaseCategory==Airbase.Category.HELIPAD then
|
|
19795
19754
|
SpawnPoint.linkUnit=AirbaseID
|
|
19796
19755
|
SpawnPoint.helipadId=AirbaseID
|
|
19756
|
+
else
|
|
19757
|
+
SpawnPoint.airdromeId=AirbaseID
|
|
19797
19758
|
end
|
|
19798
19759
|
SpawnPoint.alt=0
|
|
19799
19760
|
SpawnPoint.type=GROUPTEMPLATE.Takeoff[Takeoff][1]
|
|
@@ -20176,7 +20137,7 @@ self:SetSpawnIndex(0)
|
|
|
20176
20137
|
return nil
|
|
20177
20138
|
end
|
|
20178
20139
|
function SPAWN:SpawnFromVec3(Vec3,SpawnIndex)
|
|
20179
|
-
local PointVec3=
|
|
20140
|
+
local PointVec3=COORDINATE:NewFromVec3(Vec3)
|
|
20180
20141
|
if SpawnIndex then
|
|
20181
20142
|
else
|
|
20182
20143
|
SpawnIndex=self.SpawnIndex+1
|
|
@@ -22001,10 +21962,10 @@ self:F2(self.PositionableName)
|
|
|
22001
21962
|
local DCSPositionable=self:GetDCSObject()
|
|
22002
21963
|
if DCSPositionable then
|
|
22003
21964
|
local PositionableVec3=DCSPositionable:getPosition().p
|
|
22004
|
-
local PositionablePointVec2=
|
|
21965
|
+
local PositionablePointVec2=COORDINATE:NewFromVec3(PositionableVec3)
|
|
22005
21966
|
return PositionablePointVec2
|
|
22006
21967
|
end
|
|
22007
|
-
self:E({"Cannot
|
|
21968
|
+
self:E({"Cannot Coordinate",Positionable=self,Alive=self:IsAlive()})
|
|
22008
21969
|
return nil
|
|
22009
21970
|
end
|
|
22010
21971
|
function POSITIONABLE:GetPointVec3()
|
|
@@ -22016,7 +21977,7 @@ self.pointvec3.x=PositionableVec3.x
|
|
|
22016
21977
|
self.pointvec3.y=PositionableVec3.y
|
|
22017
21978
|
self.pointvec3.z=PositionableVec3.z
|
|
22018
21979
|
else
|
|
22019
|
-
self.pointvec3=
|
|
21980
|
+
self.pointvec3=COORDINATE:NewFromVec3(PositionableVec3)
|
|
22020
21981
|
end
|
|
22021
21982
|
return self.pointvec3
|
|
22022
21983
|
end
|
|
@@ -23370,6 +23331,49 @@ self:SetCommand(CommandSetFrequencyForUnit)
|
|
|
23370
23331
|
end
|
|
23371
23332
|
return self
|
|
23372
23333
|
end
|
|
23334
|
+
function CONTROLLABLE:CommandSmokeOnOff(OnOff,Delay)
|
|
23335
|
+
local switch=(OnOff==nil)and true or OnOff
|
|
23336
|
+
local command={
|
|
23337
|
+
id='SMOKE_ON_OFF',
|
|
23338
|
+
params={
|
|
23339
|
+
value=switch
|
|
23340
|
+
}
|
|
23341
|
+
}
|
|
23342
|
+
if Delay and Delay>0 then
|
|
23343
|
+
SCHEDULER:New(nil,self.CommandSmokeOnOff,{self,switch},Delay)
|
|
23344
|
+
else
|
|
23345
|
+
self:SetCommand(command)
|
|
23346
|
+
end
|
|
23347
|
+
return self
|
|
23348
|
+
end
|
|
23349
|
+
function CONTROLLABLE:CommandSmokeON(Delay)
|
|
23350
|
+
local command={
|
|
23351
|
+
id='SMOKE_ON_OFF',
|
|
23352
|
+
params={
|
|
23353
|
+
value=true
|
|
23354
|
+
}
|
|
23355
|
+
}
|
|
23356
|
+
if Delay and Delay>0 then
|
|
23357
|
+
SCHEDULER:New(nil,self.CommandSmokeON,{self},Delay)
|
|
23358
|
+
else
|
|
23359
|
+
self:SetCommand(command)
|
|
23360
|
+
end
|
|
23361
|
+
return self
|
|
23362
|
+
end
|
|
23363
|
+
function CONTROLLABLE:CommandSmokeOFF(Delay)
|
|
23364
|
+
local command={
|
|
23365
|
+
id='SMOKE_ON_OFF',
|
|
23366
|
+
params={
|
|
23367
|
+
value=false
|
|
23368
|
+
}
|
|
23369
|
+
}
|
|
23370
|
+
if Delay and Delay>0 then
|
|
23371
|
+
SCHEDULER:New(nil,self.CommandSmokeOFF,{self},Delay)
|
|
23372
|
+
else
|
|
23373
|
+
self:SetCommand(command)
|
|
23374
|
+
end
|
|
23375
|
+
return self
|
|
23376
|
+
end
|
|
23373
23377
|
function CONTROLLABLE:TaskEPLRS(SwitchOnOff,idx)
|
|
23374
23378
|
if SwitchOnOff==nil then
|
|
23375
23379
|
SwitchOnOff=true
|
|
@@ -26717,7 +26721,7 @@ if FirstUnit then
|
|
|
26717
26721
|
local FirstUnitPointVec2=FirstUnit:GetPointVec2()
|
|
26718
26722
|
return FirstUnitPointVec2
|
|
26719
26723
|
end
|
|
26720
|
-
BASE:E({"Cannot
|
|
26724
|
+
BASE:E({"Cannot get COORDINATE",Group=self,Alive=self:IsAlive()})
|
|
26721
26725
|
return nil
|
|
26722
26726
|
end
|
|
26723
26727
|
function GROUP:GetAverageCoordinate()
|
|
@@ -27178,7 +27182,7 @@ if self.InitRespawnRandomizePositionZone then
|
|
|
27178
27182
|
GroupUnitVec3=Zone:GetRandomVec3()
|
|
27179
27183
|
else
|
|
27180
27184
|
if self.InitRespawnRandomizePositionInner and self.InitRespawnRandomizePositionOuter then
|
|
27181
|
-
GroupUnitVec3=
|
|
27185
|
+
GroupUnitVec3=COORDINATE:NewFromVec3(From):GetRandomVec3InRadius(self.InitRespawnRandomizePositionsOuter,self.InitRespawnRandomizePositionsInner)
|
|
27182
27186
|
else
|
|
27183
27187
|
GroupUnitVec3=Zone:GetVec3()
|
|
27184
27188
|
end
|
|
@@ -27208,7 +27212,7 @@ if self.InitRespawnRandomizePositionZone then
|
|
|
27208
27212
|
GroupUnitVec3=Zone:GetRandomVec3()
|
|
27209
27213
|
else
|
|
27210
27214
|
if self.InitRespawnRandomizePositionInner and self.InitRespawnRandomizePositionOuter then
|
|
27211
|
-
GroupUnitVec3=
|
|
27215
|
+
GroupUnitVec3=COORDINATE:NewFromVec2(From):GetRandomPointVec3InRadius(self.InitRespawnRandomizePositionsOuter,self.InitRespawnRandomizePositionsInner)
|
|
27212
27216
|
else
|
|
27213
27217
|
GroupUnitVec3=Zone:GetVec3()
|
|
27214
27218
|
end
|
|
@@ -32096,7 +32100,7 @@ DYNAMICCARGO.AircraftDimensions={
|
|
|
32096
32100
|
["ropelength"]=30,
|
|
32097
32101
|
},
|
|
32098
32102
|
}
|
|
32099
|
-
DYNAMICCARGO.version="0.0.
|
|
32103
|
+
DYNAMICCARGO.version="0.0.7"
|
|
32100
32104
|
function DYNAMICCARGO:Register(CargoName)
|
|
32101
32105
|
local self=BASE:Inherit(self,POSITIONABLE:New(CargoName))
|
|
32102
32106
|
self.StaticName=CargoName
|
|
@@ -32122,7 +32126,7 @@ end
|
|
|
32122
32126
|
return self
|
|
32123
32127
|
end
|
|
32124
32128
|
function DYNAMICCARGO:GetDCSObject()
|
|
32125
|
-
local DCSStatic=Unit.getByName(self.StaticName)
|
|
32129
|
+
local DCSStatic=StaticObject.getByName(self.StaticName)or Unit.getByName(self.StaticName)
|
|
32126
32130
|
if DCSStatic then
|
|
32127
32131
|
return DCSStatic
|
|
32128
32132
|
end
|
|
@@ -32146,14 +32150,14 @@ return false
|
|
|
32146
32150
|
end
|
|
32147
32151
|
end
|
|
32148
32152
|
function DYNAMICCARGO:IsUnloaded()
|
|
32149
|
-
if self.CargoState and self.CargoState==DYNAMICCARGO.State.
|
|
32153
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.UNLOADED then
|
|
32150
32154
|
return true
|
|
32151
32155
|
else
|
|
32152
32156
|
return false
|
|
32153
32157
|
end
|
|
32154
32158
|
end
|
|
32155
32159
|
function DYNAMICCARGO:IsRemoved()
|
|
32156
|
-
if self.CargoState and self.CargoState==DYNAMICCARGO.State.
|
|
32160
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.REMOVED then
|
|
32157
32161
|
return true
|
|
32158
32162
|
else
|
|
32159
32163
|
return false
|
|
@@ -32218,6 +32222,27 @@ else
|
|
|
32218
32222
|
return self.StaticName
|
|
32219
32223
|
end
|
|
32220
32224
|
end
|
|
32225
|
+
function DYNAMICCARGO:_HeloHovering(Unit,ropelength)
|
|
32226
|
+
local DCSUnit=Unit:GetDCSObject()
|
|
32227
|
+
local hovering=false
|
|
32228
|
+
local Height=0
|
|
32229
|
+
if DCSUnit then
|
|
32230
|
+
local UnitInAir=DCSUnit:inAir()
|
|
32231
|
+
local UnitCategory=DCSUnit:getDesc().category
|
|
32232
|
+
if UnitInAir==true and UnitCategory==1 then
|
|
32233
|
+
local VelocityVec3=DCSUnit:getVelocity()
|
|
32234
|
+
local Velocity=UTILS.VecNorm(VelocityVec3)
|
|
32235
|
+
local Coordinate=DCSUnit:getPoint()
|
|
32236
|
+
local LandHeight=land.getHeight({x=Coordinate.x,y=Coordinate.z})
|
|
32237
|
+
Height=Coordinate.y-LandHeight
|
|
32238
|
+
if Velocity<1 and Height<=ropelength and Height>6 then
|
|
32239
|
+
hovering=true
|
|
32240
|
+
end
|
|
32241
|
+
end
|
|
32242
|
+
return hovering,Height
|
|
32243
|
+
end
|
|
32244
|
+
return false
|
|
32245
|
+
end
|
|
32221
32246
|
function DYNAMICCARGO:_GetPossibleHeloNearby(pos,loading)
|
|
32222
32247
|
local set=_DYNAMICCARGO_HELOS:GetAliveSet()
|
|
32223
32248
|
local success=false
|
|
@@ -32228,28 +32253,33 @@ local helo=_helo
|
|
|
32228
32253
|
local name=helo:GetPlayerName()or _DATABASE:_FindPlayerNameByUnitName(helo:GetName())or"None"
|
|
32229
32254
|
self:T(self.lid.." Checking: "..name)
|
|
32230
32255
|
local hpos=helo:GetCoordinate()
|
|
32231
|
-
local inair=helo:InAir()
|
|
32232
|
-
self:T(self.lid.." InAir: AGL/InAir: "..hpos.y-hpos:GetLandHeight().."/"..tostring(inair))
|
|
32233
32256
|
local typename=helo:GetTypeName()
|
|
32234
|
-
if hpos and typename and inair==false then
|
|
32235
32257
|
local dimensions=DYNAMICCARGO.AircraftDimensions[typename]
|
|
32236
|
-
|
|
32258
|
+
local hovering,height=self:_HeloHovering(helo,dimensions.ropelength)
|
|
32259
|
+
local helolanded=not helo:InAir()
|
|
32260
|
+
self:T(self.lid.." InAir: AGL/Hovering: "..hpos.y-hpos:GetLandHeight().."/"..tostring(hovering))
|
|
32261
|
+
if hpos and typename and dimensions then
|
|
32237
32262
|
local delta2D=hpos:Get2DDistance(pos)
|
|
32238
32263
|
local delta3D=hpos:Get3DDistance(pos)
|
|
32239
32264
|
if self.testing then
|
|
32240
32265
|
self:T(string.format("Cargo relative position: 2D %dm | 3D %dm",delta2D,delta3D))
|
|
32241
32266
|
self:T(string.format("Helo dimension: length %dm | width %dm | rope %dm",dimensions.length,dimensions.width,dimensions.ropelength))
|
|
32267
|
+
self:T(string.format("Helo hovering: %s at %dm",tostring(hovering),height))
|
|
32242
32268
|
end
|
|
32243
|
-
if loading~=true and
|
|
32269
|
+
if loading~=true and(delta2D>dimensions.length or delta2D>dimensions.width)and helolanded then
|
|
32244
32270
|
success=true
|
|
32245
32271
|
Helo=helo
|
|
32246
32272
|
Playername=name
|
|
32247
32273
|
end
|
|
32248
|
-
if loading
|
|
32274
|
+
if loading~=true and delta3D>dimensions.ropelength then
|
|
32249
32275
|
success=true
|
|
32250
32276
|
Helo=helo
|
|
32251
32277
|
Playername=name
|
|
32252
32278
|
end
|
|
32279
|
+
if loading==true and((delta2D<dimensions.length and delta2D<dimensions.width and helolanded)or(delta3D==dimensions.ropelength and helo:InAir()))then
|
|
32280
|
+
success=true
|
|
32281
|
+
Helo=helo
|
|
32282
|
+
Playername=name
|
|
32253
32283
|
end
|
|
32254
32284
|
end
|
|
32255
32285
|
end
|
|
@@ -32264,12 +32294,13 @@ self:T(string.format("Cargo position: x=%d, y=%d, z=%d",pos.x,pos.y,pos.z))
|
|
|
32264
32294
|
self:T(string.format("Last position: x=%d, y=%d, z=%d",self.LastPosition.x,self.LastPosition.y,self.LastPosition.z))
|
|
32265
32295
|
end
|
|
32266
32296
|
if UTILS.Round(UTILS.VecDist3D(pos,self.LastPosition),2)>0.5 then
|
|
32267
|
-
if self.CargoState==DYNAMICCARGO.State.NEW then
|
|
32297
|
+
if self.CargoState==DYNAMICCARGO.State.NEW or self.CargoState==DYNAMICCARGO.State.UNLOADED then
|
|
32268
32298
|
local isloaded,client,playername=self:_GetPossibleHeloNearby(pos,true)
|
|
32269
32299
|
self:T(self.lid.." moved! NEW -> LOADED by "..tostring(playername))
|
|
32270
32300
|
self.CargoState=DYNAMICCARGO.State.LOADED
|
|
32271
32301
|
self.Owner=playername
|
|
32272
32302
|
_DATABASE:CreateEventDynamicCargoLoaded(self)
|
|
32303
|
+
end
|
|
32273
32304
|
elseif self.CargoState==DYNAMICCARGO.State.LOADED then
|
|
32274
32305
|
local count=_DYNAMICCARGO_HELOS:CountAlive()
|
|
32275
32306
|
local landheight=pos:GetLandHeight()
|
|
@@ -32279,26 +32310,18 @@ self:T(self.lid.." AGL: "..agl or-1)
|
|
|
32279
32310
|
local isunloaded=true
|
|
32280
32311
|
local client
|
|
32281
32312
|
local playername=self.Owner
|
|
32282
|
-
if count>0
|
|
32313
|
+
if count>0 then
|
|
32283
32314
|
self:T(self.lid.." Possible alive helos: "..count or-1)
|
|
32284
|
-
if agl~=0 or self.testing then
|
|
32285
32315
|
isunloaded,client,playername=self:_GetPossibleHeloNearby(pos,false)
|
|
32286
|
-
end
|
|
32287
32316
|
if isunloaded then
|
|
32288
32317
|
self:T(self.lid.." moved! LOADED -> UNLOADED by "..tostring(playername))
|
|
32289
32318
|
self.CargoState=DYNAMICCARGO.State.UNLOADED
|
|
32290
32319
|
self.Owner=playername
|
|
32291
32320
|
_DATABASE:CreateEventDynamicCargoUnloaded(self)
|
|
32292
32321
|
end
|
|
32293
|
-
elseif count>0 and agl==0 then
|
|
32294
|
-
self:T(self.lid.." moved! LOADED -> UNLOADED by "..tostring(playername))
|
|
32295
|
-
self.CargoState=DYNAMICCARGO.State.UNLOADED
|
|
32296
|
-
self.Owner=playername
|
|
32297
|
-
_DATABASE:CreateEventDynamicCargoUnloaded(self)
|
|
32298
32322
|
end
|
|
32299
32323
|
end
|
|
32300
32324
|
self.LastPosition=pos
|
|
32301
|
-
end
|
|
32302
32325
|
else
|
|
32303
32326
|
if self.timer and self.timer:IsRunning()then self.timer:Stop()end
|
|
32304
32327
|
self:T(self.lid.." dead! "..self.CargoState.."-> REMOVED")
|
|
@@ -36037,7 +36060,6 @@ end
|
|
|
36037
36060
|
function ESCORT:_ReportTargetsScheduler()
|
|
36038
36061
|
self:F(self.EscortGroup:GetName())
|
|
36039
36062
|
if self.EscortGroup:IsAlive()and self.EscortClient:IsAlive()then
|
|
36040
|
-
if true then
|
|
36041
36063
|
local EscortGroupName=self.EscortGroup:GetName()
|
|
36042
36064
|
self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
|
36043
36065
|
if self.EscortMenuTargetAssistance then
|
|
@@ -36088,8 +36110,6 @@ else
|
|
|
36088
36110
|
self.EscortGroup:MessageToClient("No targets detected.",10,self.EscortClient)
|
|
36089
36111
|
end
|
|
36090
36112
|
return true
|
|
36091
|
-
else
|
|
36092
|
-
end
|
|
36093
36113
|
end
|
|
36094
36114
|
return false
|
|
36095
36115
|
end
|
|
@@ -54629,7 +54649,7 @@ shootandscoot=false,
|
|
|
54629
54649
|
SkateNumber=3,
|
|
54630
54650
|
SkateZones=nil,
|
|
54631
54651
|
minscootdist=100,
|
|
54632
|
-
|
|
54652
|
+
maxscootdist=3000,
|
|
54633
54653
|
scootrandomcoord=false,
|
|
54634
54654
|
}
|
|
54635
54655
|
do
|
|
@@ -67544,8 +67564,14 @@ CTLD.UnitTypeCapabilities={
|
|
|
67544
67564
|
["OH-6A"]={type="OH-6A",crates=false,troops=true,cratelimit=0,trooplimit=4,length=7,cargoweightlimit=550},
|
|
67545
67565
|
["OH58D"]={type="OH58D",crates=false,troops=false,cratelimit=0,trooplimit=0,length=14,cargoweightlimit=400},
|
|
67546
67566
|
["CH-47Fbl1"]={type="CH-47Fbl1",crates=true,troops=true,cratelimit=4,trooplimit=31,length=20,cargoweightlimit=10800},
|
|
67567
|
+
["MosquitoFBMkVI"]={type="MosquitoFBMkVI",crates=true,troops=false,cratelimit=2,trooplimit=0,length=13,cargoweightlimit=1800},
|
|
67547
67568
|
}
|
|
67548
|
-
CTLD.
|
|
67569
|
+
CTLD.FixedWingTypes={
|
|
67570
|
+
["Hercules"]="Hercules",
|
|
67571
|
+
["Bronco"]="Bronco",
|
|
67572
|
+
["Mosquito"]="Mosquito",
|
|
67573
|
+
}
|
|
67574
|
+
CTLD.version="1.1.31"
|
|
67549
67575
|
function CTLD:New(Coalition,Prefixes,Alias)
|
|
67550
67576
|
local self=BASE:Inherit(self,FSM:New())
|
|
67551
67577
|
BASE:T({Coalition,Prefixes,Alias})
|
|
@@ -67648,9 +67674,10 @@ self.movetroopstowpzone=true
|
|
|
67648
67674
|
self.movetroopsdistance=5000
|
|
67649
67675
|
self.troopdropzoneradius=100
|
|
67650
67676
|
self.enableHercules=false
|
|
67651
|
-
self.
|
|
67652
|
-
self.
|
|
67653
|
-
self.
|
|
67677
|
+
self.enableFixedWing=false
|
|
67678
|
+
self.FixedMinAngels=165
|
|
67679
|
+
self.FixedMaxAngels=2000
|
|
67680
|
+
self.FixedMaxSpeed=77
|
|
67654
67681
|
self.suppressmessages=false
|
|
67655
67682
|
self.repairtime=300
|
|
67656
67683
|
self.buildtime=300
|
|
@@ -67759,7 +67786,7 @@ local unitname=event.IniUnitName or"none"
|
|
|
67759
67786
|
self.Loaded_Cargo[unitname]=nil
|
|
67760
67787
|
self:_RefreshF10Menus()
|
|
67761
67788
|
end
|
|
67762
|
-
if self:
|
|
67789
|
+
if self:IsFixedWing(_unit)and self.enableFixedWing then
|
|
67763
67790
|
local unitname=event.IniUnitName or"none"
|
|
67764
67791
|
self.Loaded_Cargo[unitname]=nil
|
|
67765
67792
|
self:_RefreshF10Menus()
|
|
@@ -67878,6 +67905,17 @@ end
|
|
|
67878
67905
|
end
|
|
67879
67906
|
return nil
|
|
67880
67907
|
end
|
|
67908
|
+
function CTLD:AddAllowedFixedWingType(typename)
|
|
67909
|
+
if type(typename)=="string"then
|
|
67910
|
+
self.FixedWingTypes[typename]=typename
|
|
67911
|
+
elseif typename and typename.ClassName and typename:IsInstanceOf("UNIT")then
|
|
67912
|
+
local TypeName=typename:GetTypeName()or"none"
|
|
67913
|
+
self.FixedWingTypes[TypeName]=TypeName
|
|
67914
|
+
else
|
|
67915
|
+
self:E(self.lid.."No valid typename or no UNIT handed!")
|
|
67916
|
+
end
|
|
67917
|
+
return self
|
|
67918
|
+
end
|
|
67881
67919
|
function CTLD:PreloadTroops(Unit,Troopname)
|
|
67882
67920
|
self:T(self.lid.." PreloadTroops")
|
|
67883
67921
|
local name=Troopname or"Unknown"
|
|
@@ -68290,7 +68328,7 @@ if numbernearby>=canloadcratesno and not drop then
|
|
|
68290
68328
|
self:_SendMessage("There are enough crates nearby already! Take care of those first!",10,false,Group)
|
|
68291
68329
|
return self
|
|
68292
68330
|
end
|
|
68293
|
-
local IsHerc=self:
|
|
68331
|
+
local IsHerc=self:IsFixedWing(Unit)
|
|
68294
68332
|
local IsHook=self:IsHook(Unit)
|
|
68295
68333
|
local cargotype=Cargo
|
|
68296
68334
|
local number=number or cargotype:GetCratesNeeded()
|
|
@@ -68601,6 +68639,7 @@ local staticpos=static:GetCoordinate()
|
|
|
68601
68639
|
local cando=cargo:UnitCanCarry(_unit)
|
|
68602
68640
|
if ignoretype==true then cando=true end
|
|
68603
68641
|
local distance=self:_GetDistance(location,staticpos)
|
|
68642
|
+
self:T(self.lid..string.format("Dist %dm/%dm | weight %dkg | maxloadable %dkg",distance,finddist,weight,maxloadable))
|
|
68604
68643
|
if distance<=finddist and(weight<=maxloadable or _ignoreweight)and restricted==false and cando==true then
|
|
68605
68644
|
index=index+1
|
|
68606
68645
|
table.insert(found,staticid,cargo)
|
|
@@ -68925,13 +68964,15 @@ self:_SendMessage(string.format("Nothing in stock!"),10,false,Group)
|
|
|
68925
68964
|
end
|
|
68926
68965
|
return self
|
|
68927
68966
|
end
|
|
68928
|
-
function CTLD:
|
|
68929
|
-
|
|
68967
|
+
function CTLD:IsFixedWing(Unit)
|
|
68968
|
+
local typename=Unit:GetTypeName()or"none"
|
|
68969
|
+
for _,_name in pairs(self.FixedWingTypes or{})do
|
|
68970
|
+
if typename==_name or string.find(typename,_name,1,true)then
|
|
68930
68971
|
return true
|
|
68931
|
-
else
|
|
68932
|
-
return false
|
|
68933
68972
|
end
|
|
68934
68973
|
end
|
|
68974
|
+
return false
|
|
68975
|
+
end
|
|
68935
68976
|
function CTLD:IsHook(Unit)
|
|
68936
68977
|
if Unit and string.find(Unit:GetTypeName(),"CH.47")then
|
|
68937
68978
|
return true
|
|
@@ -68974,7 +69015,7 @@ if inzone then
|
|
|
68974
69015
|
droppingatbase=true
|
|
68975
69016
|
end
|
|
68976
69017
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
68977
|
-
local IsHerc=self:
|
|
69018
|
+
local IsHerc=self:IsFixedWing(Unit)
|
|
68978
69019
|
local IsHook=self:IsHook(Unit)
|
|
68979
69020
|
if IsHerc and(not IsHook)then
|
|
68980
69021
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -69101,7 +69142,7 @@ self:_SendMessage("You need to open the door(s) to drop cargo!",10,false,Group)
|
|
|
69101
69142
|
if not self.debug then return self end
|
|
69102
69143
|
end
|
|
69103
69144
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
69104
|
-
local IsHerc=self:
|
|
69145
|
+
local IsHerc=self:IsFixedWing(Unit)
|
|
69105
69146
|
local IsHook=self:IsHook(Unit)
|
|
69106
69147
|
if IsHerc and(not IsHook)then
|
|
69107
69148
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -69152,7 +69193,7 @@ return self
|
|
|
69152
69193
|
end
|
|
69153
69194
|
function CTLD:_BuildCrates(Group,Unit,Engineering)
|
|
69154
69195
|
self:T(self.lid.." _BuildCrates")
|
|
69155
|
-
if self:
|
|
69196
|
+
if self:IsFixedWing(Unit)and self.enableFixedWing and not Engineering then
|
|
69156
69197
|
local speed=Unit:GetVelocityKMH()
|
|
69157
69198
|
if speed>1 then
|
|
69158
69199
|
self:_SendMessage("You need to land / stop to build something, Pilot!",10,false,Group)
|
|
@@ -69442,7 +69483,7 @@ for _,groupObj in pairs(PlayerTable)do
|
|
|
69442
69483
|
local firstUnit=groupObj:GetFirstUnitAlive()
|
|
69443
69484
|
if firstUnit then
|
|
69444
69485
|
if firstUnit:IsPlayer()then
|
|
69445
|
-
if firstUnit:IsHelicopter()or(self.
|
|
69486
|
+
if firstUnit:IsHelicopter()or(self.enableFixedWing and self:IsFixedWing(firstUnit))then
|
|
69446
69487
|
local _unit=firstUnit:GetName()
|
|
69447
69488
|
_UnitList[_unit]=_unit
|
|
69448
69489
|
end
|
|
@@ -69629,7 +69670,7 @@ MENU_GROUP_COMMAND:New(_group,"White smoke",smokeself,self.SmokePositionNow,self
|
|
|
69629
69670
|
MENU_GROUP_COMMAND:New(_group,"Flare zones nearby",smoketopmenu,self.SmokeZoneNearBy,self,_unit,true)
|
|
69630
69671
|
MENU_GROUP_COMMAND:New(_group,"Fire flare now",smoketopmenu,self.SmokePositionNow,self,_unit,true)
|
|
69631
69672
|
MENU_GROUP_COMMAND:New(_group,"Drop beacon now",smoketopmenu,self.DropBeaconNow,self,_unit):Refresh()
|
|
69632
|
-
if self:
|
|
69673
|
+
if self:IsFixedWing(_unit)then
|
|
69633
69674
|
MENU_GROUP_COMMAND:New(_group,"Show flight parameters",topmenu,self._ShowFlightParams,self,_group,_unit):Refresh()
|
|
69634
69675
|
else
|
|
69635
69676
|
MENU_GROUP_COMMAND:New(_group,"Show hover parameters",topmenu,self._ShowHoverParams,self,_group,_unit):Refresh()
|
|
@@ -69804,7 +69845,7 @@ return self
|
|
|
69804
69845
|
end
|
|
69805
69846
|
local grounded=not self:IsUnitInAir(Unit)
|
|
69806
69847
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
69807
|
-
local isHerc=self:
|
|
69848
|
+
local isHerc=self:IsFixedWing(Unit)
|
|
69808
69849
|
local isHook=self:IsHook(Unit)
|
|
69809
69850
|
if isHerc and not isHook then
|
|
69810
69851
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -69934,7 +69975,7 @@ self:_SendMessage("You need to open the door(s) to unload troops!",10,false,Grou
|
|
|
69934
69975
|
if not self.debug then return self end
|
|
69935
69976
|
end
|
|
69936
69977
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
69937
|
-
local isHerc=self:
|
|
69978
|
+
local isHerc=self:IsFixedWing(Unit)
|
|
69938
69979
|
local isHook=self:IsHook(Unit)
|
|
69939
69980
|
if isHerc and not isHook then
|
|
69940
69981
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -70063,7 +70104,7 @@ self.Loaded_Cargo[unitName].Troopsloaded=troopsLoaded
|
|
|
70063
70104
|
self.Loaded_Cargo[unitName].Cratesloaded=cratesLoaded
|
|
70064
70105
|
self:_RefreshDropTroopsMenu(Group,Unit)
|
|
70065
70106
|
else
|
|
70066
|
-
local isHerc=self:
|
|
70107
|
+
local isHerc=self:IsFixedWing(Unit)
|
|
70067
70108
|
if isHerc then
|
|
70068
70109
|
self:_SendMessage("Nothing loaded or not within airdrop parameters!",10,false,Group)
|
|
70069
70110
|
else
|
|
@@ -70685,9 +70726,9 @@ return false
|
|
|
70685
70726
|
end
|
|
70686
70727
|
local gheight=ucoord:GetLandHeight()
|
|
70687
70728
|
local aheight=uheight-gheight
|
|
70688
|
-
local minh=self.
|
|
70689
|
-
local maxh=self.
|
|
70690
|
-
local maxspeed=self.
|
|
70729
|
+
local minh=self.FixedMinAngels
|
|
70730
|
+
local maxh=self.FixedMaxAngels
|
|
70731
|
+
local maxspeed=self.FixedMaxSpeed
|
|
70691
70732
|
local kmspeed=uspeed*3.6
|
|
70692
70733
|
local knspeed=kmspeed/1.86
|
|
70693
70734
|
self:T(string.format("%s Unit parameters: at %dm AGL with %dmps | %dkph | %dkn",self.lid,aheight,uspeed,kmspeed,knspeed))
|
|
@@ -70718,12 +70759,12 @@ local htxt="true"
|
|
|
70718
70759
|
if not inhover then htxt="false"end
|
|
70719
70760
|
local text=""
|
|
70720
70761
|
if _SETTINGS:IsImperial()then
|
|
70721
|
-
local minheight=UTILS.MetersToFeet(self.
|
|
70722
|
-
local maxheight=UTILS.MetersToFeet(self.
|
|
70762
|
+
local minheight=UTILS.MetersToFeet(self.FixedMinAngels)
|
|
70763
|
+
local maxheight=UTILS.MetersToFeet(self.FixedMaxAngels)
|
|
70723
70764
|
text=string.format("Flight parameters (airdrop):\n - Min height %dft \n - Max height %dft \n - In parameter: %s",minheight,maxheight,htxt)
|
|
70724
70765
|
else
|
|
70725
|
-
local minheight=self.
|
|
70726
|
-
local maxheight=self.
|
|
70766
|
+
local minheight=self.FixedMinAngels
|
|
70767
|
+
local maxheight=self.FixedMaxAngels
|
|
70727
70768
|
text=string.format("Flight parameters (airdrop):\n - Min height %dm \n - Max height %dm \n - In parameter: %s",minheight,maxheight,htxt)
|
|
70728
70769
|
end
|
|
70729
70770
|
self:_SendMessage(text,10,false,Group)
|
|
@@ -70731,7 +70772,7 @@ return self
|
|
|
70731
70772
|
end
|
|
70732
70773
|
function CTLD:CanHoverLoad(Unit)
|
|
70733
70774
|
self:T(self.lid.." CanHoverLoad")
|
|
70734
|
-
if self:
|
|
70775
|
+
if self:IsFixedWing(Unit)then return false end
|
|
70735
70776
|
local outcome=self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)and self:IsCorrectHover(Unit)
|
|
70736
70777
|
if not outcome then
|
|
70737
70778
|
outcome=self:IsUnitInZone(Unit,CTLD.CargoZoneType.SHIP)
|
|
@@ -70740,7 +70781,7 @@ return outcome
|
|
|
70740
70781
|
end
|
|
70741
70782
|
function CTLD:IsUnitInAir(Unit)
|
|
70742
70783
|
local minheight=self.minimumHoverHeight
|
|
70743
|
-
if self.
|
|
70784
|
+
if self.enableFixedWing and self:IsFixedWing(Unit)then
|
|
70744
70785
|
minheight=5.1
|
|
70745
70786
|
end
|
|
70746
70787
|
local uheight=Unit:GetHeight()
|
|
@@ -71373,11 +71414,12 @@ end
|
|
|
71373
71414
|
function CTLD:onafterStart(From,Event,To)
|
|
71374
71415
|
self:T({From,Event,To})
|
|
71375
71416
|
self:I(self.lid.."Started ("..self.version..")")
|
|
71417
|
+
if self.enableHercules then self.enableFixedWing=true end
|
|
71376
71418
|
if self.UserSetGroup then
|
|
71377
71419
|
self.PilotGroups=self.UserSetGroup
|
|
71378
|
-
elseif self.useprefix or self.
|
|
71420
|
+
elseif self.useprefix or self.enableFixedWing then
|
|
71379
71421
|
local prefix=self.prefixes
|
|
71380
|
-
if self.
|
|
71422
|
+
if self.enableFixedWing then
|
|
71381
71423
|
self.PilotGroups=SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefix):FilterStart()
|
|
71382
71424
|
else
|
|
71383
71425
|
self.PilotGroups=SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefix):FilterCategories("helicopter"):FilterStart()
|
|
@@ -74111,7 +74153,7 @@ local SwitchWayPointCommand=AIGroup:CommandSwitchWayPoint(1,WayPointCount,1)
|
|
|
74111
74153
|
AIGroup:SetCommand(SwitchWayPointCommand)
|
|
74112
74154
|
AIGroup:MessageToRed("Returning to home base ...",30)
|
|
74113
74155
|
else
|
|
74114
|
-
local PointVec2=
|
|
74156
|
+
local PointVec2=COORDINATE:New(AIGroup:GetVec2().x,0,AIGroup:GetVec2().y)
|
|
74115
74157
|
local ClosestAirbase=self.ReturnAirbaseSet:FindNearestAirbaseFromPointVec2(PointVec2)
|
|
74116
74158
|
self:T(ClosestAirbase.AirbaseName)
|
|
74117
74159
|
AIGroup:RouteRTB(ClosestAirbase)
|
|
@@ -74396,15 +74438,15 @@ return
|
|
|
74396
74438
|
end
|
|
74397
74439
|
local FromRTBRoutePoint=FromCoord:WaypointAir(
|
|
74398
74440
|
self.PatrolAltType,
|
|
74399
|
-
|
|
74400
|
-
|
|
74441
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
74442
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
74401
74443
|
RTBSpeed,
|
|
74402
74444
|
true
|
|
74403
74445
|
)
|
|
74404
74446
|
local ToRTBRoutePoint=ToAirbaseCoord:WaypointAir(
|
|
74405
74447
|
self.PatrolAltType,
|
|
74406
|
-
|
|
74407
|
-
|
|
74448
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
74449
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
74408
74450
|
RTBSpeed,
|
|
74409
74451
|
true
|
|
74410
74452
|
)
|
|
@@ -74453,8 +74495,8 @@ local RefuelRoute={}
|
|
|
74453
74495
|
local FromRefuelCoord=AIGroup:GetCoordinate()
|
|
74454
74496
|
local ToRefuelCoord=Tanker:GetCoordinate()
|
|
74455
74497
|
local ToRefuelSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
74456
|
-
local FromRefuelRoutePoint=FromRefuelCoord:WaypointAir(self.PatrolAltType,
|
|
74457
|
-
local ToRefuelRoutePoint=Tanker:GetCoordinate():WaypointAir(self.PatrolAltType,
|
|
74498
|
+
local FromRefuelRoutePoint=FromRefuelCoord:WaypointAir(self.PatrolAltType,COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,ToRefuelSpeed,true)
|
|
74499
|
+
local ToRefuelRoutePoint=Tanker:GetCoordinate():WaypointAir(self.PatrolAltType,COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,ToRefuelSpeed,true)
|
|
74458
74500
|
self:F({ToRefuelSpeed=ToRefuelSpeed})
|
|
74459
74501
|
RefuelRoute[#RefuelRoute+1]=FromRefuelRoutePoint
|
|
74460
74502
|
RefuelRoute[#RefuelRoute+1]=ToRefuelRoutePoint
|
|
@@ -74564,7 +74606,7 @@ ToTargetCoord:SetAlt(altitude)
|
|
|
74564
74606
|
self:SetTargetDistance(ToTargetCoord)
|
|
74565
74607
|
local ToTargetSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
74566
74608
|
local speedkmh=ToTargetSpeed
|
|
74567
|
-
local FromWP=CurrentCoord:WaypointAir(self.PatrolAltType or"RADIO",
|
|
74609
|
+
local FromWP=CurrentCoord:WaypointAir(self.PatrolAltType or"RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,ToTargetSpeed,true)
|
|
74568
74610
|
PatrolRoute[#PatrolRoute+1]=FromWP
|
|
74569
74611
|
if self.racetrack then
|
|
74570
74612
|
local heading=math.random(self.racetrackheadingmin,self.racetrackheadingmax)
|
|
@@ -74587,7 +74629,7 @@ local taskCond=AIPatrol:TaskCondition(nil,nil,nil,nil,duration,nil)
|
|
|
74587
74629
|
local taskCont=AIPatrol:TaskControlled(taskOrbit,taskCond)
|
|
74588
74630
|
PatrolRoute[2]=c1:WaypointAirTurningPoint(self.PatrolAltType,speedkmh,{taskCont,taskPatrol},"CAP Orbit")
|
|
74589
74631
|
else
|
|
74590
|
-
local ToWP=ToTargetCoord:WaypointAir(self.PatrolAltType,
|
|
74632
|
+
local ToWP=ToTargetCoord:WaypointAir(self.PatrolAltType,COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,ToTargetSpeed,true)
|
|
74591
74633
|
PatrolRoute[#PatrolRoute+1]=ToWP
|
|
74592
74634
|
local Tasks={}
|
|
74593
74635
|
Tasks[#Tasks+1]=AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute",self)
|
|
@@ -74690,12 +74732,12 @@ self:__Engage(0.1,AttackSetUnit)
|
|
|
74690
74732
|
else
|
|
74691
74733
|
local EngageRoute={}
|
|
74692
74734
|
local AttackTasks={}
|
|
74693
|
-
local FromWP=DefenderCoord:WaypointAir(self.PatrolAltType or"RADIO",
|
|
74735
|
+
local FromWP=DefenderCoord:WaypointAir(self.PatrolAltType or"RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,EngageSpeed,true)
|
|
74694
74736
|
EngageRoute[#EngageRoute+1]=FromWP
|
|
74695
74737
|
self:SetTargetDistance(TargetCoord)
|
|
74696
74738
|
local FromEngageAngle=DefenderCoord:GetAngleDegrees(DefenderCoord:GetDirectionVec3(TargetCoord))
|
|
74697
74739
|
local ToCoord=DefenderCoord:Translate(EngageDistance,FromEngageAngle,true)
|
|
74698
|
-
local ToWP=ToCoord:WaypointAir(self.PatrolAltType or"RADIO",
|
|
74740
|
+
local ToWP=ToCoord:WaypointAir(self.PatrolAltType or"RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,EngageSpeed,true)
|
|
74699
74741
|
EngageRoute[#EngageRoute+1]=ToWP
|
|
74700
74742
|
AttackTasks[#AttackTasks+1]=DefenderGroup:TaskFunction("AI_AIR_ENGAGE.___EngageRoute",self,AttackSetUnit)
|
|
74701
74743
|
EngageRoute[#EngageRoute].task=DefenderGroup:TaskCombo(AttackTasks)
|
|
@@ -74738,12 +74780,12 @@ local TargetDistance=DefenderCoord:Get2DDistance(TargetCoord)
|
|
|
74738
74780
|
local EngageDistance=(DefenderGroup:IsHelicopter()and 5000)or(DefenderGroup:IsAirPlane()and 10000)
|
|
74739
74781
|
local EngageRoute={}
|
|
74740
74782
|
local AttackTasks={}
|
|
74741
|
-
local FromWP=DefenderCoord:WaypointAir(self.EngageAltType or"RADIO",
|
|
74783
|
+
local FromWP=DefenderCoord:WaypointAir(self.EngageAltType or"RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,EngageSpeed,true)
|
|
74742
74784
|
EngageRoute[#EngageRoute+1]=FromWP
|
|
74743
74785
|
self:SetTargetDistance(TargetCoord)
|
|
74744
74786
|
local FromEngageAngle=DefenderCoord:GetAngleDegrees(DefenderCoord:GetDirectionVec3(TargetCoord))
|
|
74745
74787
|
local ToCoord=DefenderCoord:Translate(EngageDistance,FromEngageAngle,true)
|
|
74746
|
-
local ToWP=ToCoord:WaypointAir(self.EngageAltType or"RADIO",
|
|
74788
|
+
local ToWP=ToCoord:WaypointAir(self.EngageAltType or"RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,EngageSpeed,true)
|
|
74747
74789
|
EngageRoute[#EngageRoute+1]=ToWP
|
|
74748
74790
|
if TargetDistance<=EngageDistance*9 then
|
|
74749
74791
|
local AttackUnitTasks=self:CreateAttackUnitTasks(AttackSetUnit,DefenderGroup,EngageAltitude)
|
|
@@ -78290,12 +78332,12 @@ self:T("Not in the air, finding route path within PatrolZone")
|
|
|
78290
78332
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78291
78333
|
if not CurrentVec2 then return end
|
|
78292
78334
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78293
|
-
local CurrentPointVec3=
|
|
78335
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78294
78336
|
local ToPatrolZoneSpeed=self.PatrolMaxSpeed
|
|
78295
78337
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78296
78338
|
self.PatrolAltType,
|
|
78297
|
-
|
|
78298
|
-
|
|
78339
|
+
COORDINATE.WaypointType.TakeOffParking,
|
|
78340
|
+
COORDINATE.WaypointAction.FromParkingArea,
|
|
78299
78341
|
ToPatrolZoneSpeed,
|
|
78300
78342
|
true
|
|
78301
78343
|
)
|
|
@@ -78305,12 +78347,12 @@ self:T("In the air, finding route path within PatrolZone")
|
|
|
78305
78347
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78306
78348
|
if not CurrentVec2 then return end
|
|
78307
78349
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78308
|
-
local CurrentPointVec3=
|
|
78350
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78309
78351
|
local ToPatrolZoneSpeed=self.PatrolMaxSpeed
|
|
78310
78352
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78311
78353
|
self.PatrolAltType,
|
|
78312
|
-
|
|
78313
|
-
|
|
78354
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78355
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78314
78356
|
ToPatrolZoneSpeed,
|
|
78315
78357
|
true
|
|
78316
78358
|
)
|
|
@@ -78321,11 +78363,11 @@ self:T2(ToTargetVec2)
|
|
|
78321
78363
|
local ToTargetAltitude=math.random(self.PatrolFloorAltitude,self.PatrolCeilingAltitude)
|
|
78322
78364
|
local ToTargetSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
78323
78365
|
self:T2({self.PatrolMinSpeed,self.PatrolMaxSpeed,ToTargetSpeed})
|
|
78324
|
-
local ToTargetPointVec3=
|
|
78366
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,ToTargetAltitude,ToTargetVec2.y)
|
|
78325
78367
|
local ToTargetRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78326
78368
|
self.PatrolAltType,
|
|
78327
|
-
|
|
78328
|
-
|
|
78369
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78370
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78329
78371
|
ToTargetSpeed,
|
|
78330
78372
|
true
|
|
78331
78373
|
)
|
|
@@ -78351,13 +78393,21 @@ local OrbitTask=OldAIControllable:TaskOrbitCircle(math.random(self.PatrolFloorAl
|
|
|
78351
78393
|
local TimedOrbitTask=OldAIControllable:TaskControlled(OrbitTask,OldAIControllable:TaskCondition(nil,nil,nil,nil,self.PatrolOutOfFuelOrbitTime,nil))
|
|
78352
78394
|
OldAIControllable:SetTask(TimedOrbitTask,10)
|
|
78353
78395
|
RTB=true
|
|
78354
|
-
else
|
|
78355
78396
|
end
|
|
78356
78397
|
local Damage=self.Controllable:GetLife()
|
|
78357
78398
|
if Damage<=self.PatrolDamageThreshold then
|
|
78358
78399
|
self:T(self.Controllable:GetName().." is damaged:"..Damage..", RTB!")
|
|
78359
78400
|
RTB=true
|
|
78360
78401
|
end
|
|
78402
|
+
if self:IsInstanceOf("AI_CAS")or self:IsInstanceOf("AI_BAI")then
|
|
78403
|
+
local atotal,shells,rockets,bombs,missiles=self.Controllable:GetAmmunition()
|
|
78404
|
+
local arelevant=rockets+bombs
|
|
78405
|
+
if arelevant==0 or missiles==0 then
|
|
78406
|
+
RTB=true
|
|
78407
|
+
self:T({total=atotal,shells=shells,rockets=rockets,bombs=bombs,missiles=missiles})
|
|
78408
|
+
self:T(self.Controllable:GetName().." is out of ammo, RTB!")
|
|
78409
|
+
end
|
|
78410
|
+
end
|
|
78361
78411
|
if RTB==true then
|
|
78362
78412
|
self:RTB()
|
|
78363
78413
|
else
|
|
@@ -78374,12 +78424,12 @@ local PatrolRoute={}
|
|
|
78374
78424
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78375
78425
|
if not CurrentVec2 then return end
|
|
78376
78426
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78377
|
-
local CurrentPointVec3=
|
|
78427
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78378
78428
|
local ToPatrolZoneSpeed=self.PatrolMaxSpeed
|
|
78379
78429
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78380
78430
|
self.PatrolAltType,
|
|
78381
|
-
|
|
78382
|
-
|
|
78431
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78432
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78383
78433
|
ToPatrolZoneSpeed,
|
|
78384
78434
|
true
|
|
78385
78435
|
)
|
|
@@ -78481,12 +78531,12 @@ local EngageRoute={}
|
|
|
78481
78531
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78482
78532
|
if not CurrentVec2 then return self end
|
|
78483
78533
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78484
|
-
local CurrentPointVec3=
|
|
78534
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78485
78535
|
local ToEngageZoneSpeed=self.PatrolMaxSpeed
|
|
78486
78536
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78487
78537
|
self.PatrolAltType,
|
|
78488
|
-
|
|
78489
|
-
|
|
78538
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78539
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78490
78540
|
ToEngageZoneSpeed,
|
|
78491
78541
|
true
|
|
78492
78542
|
)
|
|
@@ -78496,11 +78546,11 @@ self:T2(ToTargetVec2)
|
|
|
78496
78546
|
local ToTargetAltitude=math.random(self.EngageFloorAltitude,self.EngageCeilingAltitude)
|
|
78497
78547
|
local ToTargetSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
78498
78548
|
self:T2({self.PatrolMinSpeed,self.PatrolMaxSpeed,ToTargetSpeed})
|
|
78499
|
-
local ToTargetPointVec3=
|
|
78549
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,ToTargetAltitude,ToTargetVec2.y)
|
|
78500
78550
|
local ToPatrolRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78501
78551
|
self.PatrolAltType,
|
|
78502
|
-
|
|
78503
|
-
|
|
78552
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78553
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78504
78554
|
ToTargetSpeed,
|
|
78505
78555
|
true
|
|
78506
78556
|
)
|
|
@@ -78644,12 +78694,12 @@ Controllable:OptionROTVertical()
|
|
|
78644
78694
|
local EngageRoute={}
|
|
78645
78695
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78646
78696
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78647
|
-
local CurrentPointVec3=
|
|
78697
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78648
78698
|
local ToEngageZoneSpeed=self.PatrolMaxSpeed
|
|
78649
78699
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78650
78700
|
self.PatrolAltType,
|
|
78651
|
-
|
|
78652
|
-
|
|
78701
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78702
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78653
78703
|
self.EngageSpeed,
|
|
78654
78704
|
true
|
|
78655
78705
|
)
|
|
@@ -78676,11 +78726,11 @@ AttackTasks[#AttackTasks+1]=Controllable:TaskFunction("AI_CAS_ZONE.EngageRoute",
|
|
|
78676
78726
|
EngageRoute[#EngageRoute].task=Controllable:TaskCombo(AttackTasks)
|
|
78677
78727
|
local ToTargetVec2=self.EngageZone:GetRandomVec2()
|
|
78678
78728
|
self:T2(ToTargetVec2)
|
|
78679
|
-
local ToTargetPointVec3=
|
|
78729
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,self.EngageAltitude,ToTargetVec2.y)
|
|
78680
78730
|
local ToTargetRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78681
78731
|
self.PatrolAltType,
|
|
78682
|
-
|
|
78683
|
-
|
|
78732
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78733
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78684
78734
|
self.EngageSpeed,
|
|
78685
78735
|
true
|
|
78686
78736
|
)
|
|
@@ -78815,12 +78865,12 @@ if Controllable:IsAlive()then
|
|
|
78815
78865
|
local EngageRoute={}
|
|
78816
78866
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78817
78867
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78818
|
-
local CurrentPointVec3=
|
|
78868
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78819
78869
|
local ToEngageZoneSpeed=self.PatrolMaxSpeed
|
|
78820
78870
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78821
78871
|
self.PatrolAltType,
|
|
78822
|
-
|
|
78823
|
-
|
|
78872
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78873
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78824
78874
|
self.EngageSpeed,
|
|
78825
78875
|
true
|
|
78826
78876
|
)
|
|
@@ -78860,11 +78910,11 @@ end
|
|
|
78860
78910
|
EngageRoute[#EngageRoute].task=Controllable:TaskCombo(AttackTasks)
|
|
78861
78911
|
local ToTargetVec2=self.EngageZone:GetRandomVec2()
|
|
78862
78912
|
self:T2(ToTargetVec2)
|
|
78863
|
-
local ToTargetPointVec3=
|
|
78913
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,self.EngageAltitude,ToTargetVec2.y)
|
|
78864
78914
|
local ToTargetRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78865
78915
|
self.PatrolAltType,
|
|
78866
|
-
|
|
78867
|
-
|
|
78916
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78917
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78868
78918
|
self.EngageSpeed,
|
|
78869
78919
|
true
|
|
78870
78920
|
)
|
|
@@ -78992,7 +79042,7 @@ FollowGroupSet:Flush(self)
|
|
|
78992
79042
|
local FollowSet=FollowGroupSet:GetSet()
|
|
78993
79043
|
local i=1
|
|
78994
79044
|
for FollowID,FollowGroup in pairs(FollowSet)do
|
|
78995
|
-
local PointVec3=
|
|
79045
|
+
local PointVec3=COORDINATE:New()
|
|
78996
79046
|
PointVec3:SetX(XStart+i*XSpace)
|
|
78997
79047
|
PointVec3:SetY(YStart+i*YSpace)
|
|
78998
79048
|
PointVec3:SetZ(ZStart+i*ZSpace)
|
|
@@ -79031,7 +79081,7 @@ function AI_FORMATION:onafterFormationCenterWing(FollowGroupSet,From,Event,To,XS
|
|
|
79031
79081
|
local FollowSet=FollowGroupSet:GetSet()
|
|
79032
79082
|
local i=0
|
|
79033
79083
|
for FollowID,FollowGroup in pairs(FollowSet)do
|
|
79034
|
-
local PointVec3=
|
|
79084
|
+
local PointVec3=COORDINATE:New()
|
|
79035
79085
|
local Side=(i%2==0)and 1 or-1
|
|
79036
79086
|
local Row=i/2+1
|
|
79037
79087
|
PointVec3:SetX(XStart+Row*XSpace)
|
|
@@ -79052,7 +79102,7 @@ function AI_FORMATION:onafterFormationBox(FollowGroupSet,From,Event,To,XStart,XS
|
|
|
79052
79102
|
local FollowSet=FollowGroupSet:GetSet()
|
|
79053
79103
|
local i=0
|
|
79054
79104
|
for FollowID,FollowGroup in pairs(FollowSet)do
|
|
79055
|
-
local PointVec3=
|
|
79105
|
+
local PointVec3=COORDINATE:New()
|
|
79056
79106
|
local ZIndex=i%ZLevels
|
|
79057
79107
|
local XIndex=math.floor(i/ZLevels)
|
|
79058
79108
|
local YIndex=math.floor(i/ZLevels)
|
|
@@ -81245,8 +81295,8 @@ local landheight=CoordinateTo:GetLandHeight()
|
|
|
81245
81295
|
CoordinateTo.y=landheight+50
|
|
81246
81296
|
local WaypointTo=CoordinateTo:WaypointAir(
|
|
81247
81297
|
"RADIO",
|
|
81248
|
-
|
|
81249
|
-
|
|
81298
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
81299
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
81250
81300
|
50,
|
|
81251
81301
|
true
|
|
81252
81302
|
)
|
|
@@ -81272,7 +81322,7 @@ local Route={}
|
|
|
81272
81322
|
local CoordinateTo=Coordinate
|
|
81273
81323
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81274
81324
|
CoordinateTo.y=landheight+50
|
|
81275
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81325
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,50,true)
|
|
81276
81326
|
Route[#Route+1]=WaypointTo
|
|
81277
81327
|
local Tasks={}
|
|
81278
81328
|
Tasks[#Tasks+1]=Helicopter:TaskOrbitCircle(math.random(30,80),150,CoordinateTo:GetRandomCoordinateInRadius(800,500))
|
|
@@ -81300,11 +81350,11 @@ Coordinate.y=Height
|
|
|
81300
81350
|
local _speed=Speed or Helicopter:GetSpeedMax()*0.5
|
|
81301
81351
|
local Route={}
|
|
81302
81352
|
local CoordinateFrom=Helicopter:GetCoordinate()
|
|
81303
|
-
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",
|
|
81353
|
+
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81304
81354
|
local CoordinateTo=Coordinate
|
|
81305
81355
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81306
81356
|
CoordinateTo.y=landheight+50
|
|
81307
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81357
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81308
81358
|
Route[#Route+1]=WaypointFrom
|
|
81309
81359
|
Route[#Route+1]=WaypointTo
|
|
81310
81360
|
Helicopter:WayPointInitialize(Route)
|
|
@@ -81328,13 +81378,13 @@ local Route={}
|
|
|
81328
81378
|
Coordinate.y=Height
|
|
81329
81379
|
local _speed=Speed or Helicopter:GetSpeedMax()*0.5
|
|
81330
81380
|
local CoordinateFrom=Helicopter:GetCoordinate()
|
|
81331
|
-
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",
|
|
81381
|
+
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81332
81382
|
Route[#Route+1]=WaypointFrom
|
|
81333
81383
|
Route[#Route+1]=WaypointFrom
|
|
81334
81384
|
local CoordinateTo=Coordinate
|
|
81335
81385
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81336
81386
|
CoordinateTo.y=landheight+50
|
|
81337
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81387
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81338
81388
|
Route[#Route+1]=WaypointTo
|
|
81339
81389
|
Route[#Route+1]=WaypointTo
|
|
81340
81390
|
Helicopter:WayPointInitialize(Route)
|
|
@@ -81355,12 +81405,12 @@ local Route={}
|
|
|
81355
81405
|
Height=Height or 50
|
|
81356
81406
|
Speed=Speed or Helicopter:GetSpeedMax()*0.5
|
|
81357
81407
|
local CoordinateFrom=Helicopter:GetCoordinate()
|
|
81358
|
-
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",
|
|
81408
|
+
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,Speed,true)
|
|
81359
81409
|
Route[#Route+1]=WaypointFrom
|
|
81360
81410
|
local CoordinateTo=Coordinate
|
|
81361
81411
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81362
81412
|
CoordinateTo.y=landheight+Height
|
|
81363
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81413
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,Speed,true)
|
|
81364
81414
|
Route[#Route+1]=WaypointTo
|
|
81365
81415
|
Helicopter:WayPointInitialize(Route)
|
|
81366
81416
|
local Tasks={}
|
|
@@ -81513,7 +81563,7 @@ return
|
|
|
81513
81563
|
end
|
|
81514
81564
|
local Points={}
|
|
81515
81565
|
local AirbasePointVec2=Airbase:GetPointVec2()
|
|
81516
|
-
local ToWaypoint=AirbasePointVec2:WaypointAir(
|
|
81566
|
+
local ToWaypoint=AirbasePointVec2:WaypointAir(COORDINATE.WaypointAltType.BARO,"Land","Landing",Speed or Airplane:GetSpeedMax()*0.8,true,Airbase)
|
|
81517
81567
|
if self.Airbase then
|
|
81518
81568
|
Template.route.points[2]=ToWaypoint
|
|
81519
81569
|
Airplane:RespawnAtCurrentAirbase(Template,Takeoff,Uncontrolled)
|
|
@@ -84011,7 +84061,6 @@ local sender=self:_GetRadioSender()
|
|
|
84011
84061
|
local filename=string.format("%s%s",transmission.path,transmission.filename)
|
|
84012
84062
|
if sender then
|
|
84013
84063
|
self:T(self.lid..string.format("Broadcasting from aircraft %s",sender:GetName()))
|
|
84014
|
-
if not self.senderinit then
|
|
84015
84064
|
local commandFrequency={
|
|
84016
84065
|
id="SetFrequency",
|
|
84017
84066
|
params={
|
|
@@ -84020,7 +84069,6 @@ modulation=self.modulation,
|
|
|
84020
84069
|
}}
|
|
84021
84070
|
sender:SetCommand(commandFrequency)
|
|
84022
84071
|
self.senderinit=true
|
|
84023
|
-
end
|
|
84024
84072
|
local subtitle=nil
|
|
84025
84073
|
local duration=nil
|
|
84026
84074
|
if transmission.subtitle and transmission.subduration and transmission.subduration>0 then
|