@jtff/miztemplate-lib 3.7.2 → 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 +310 -263
- package/lua/lib/{Splash_Damage_3.0.lua → Splash_Damage_main.lua} +485 -50
- package/package.json +4 -4
- package/scripts/inject-scripts.js +2 -2
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
|
|
@@ -20177,7 +20137,7 @@ self:SetSpawnIndex(0)
|
|
|
20177
20137
|
return nil
|
|
20178
20138
|
end
|
|
20179
20139
|
function SPAWN:SpawnFromVec3(Vec3,SpawnIndex)
|
|
20180
|
-
local PointVec3=
|
|
20140
|
+
local PointVec3=COORDINATE:NewFromVec3(Vec3)
|
|
20181
20141
|
if SpawnIndex then
|
|
20182
20142
|
else
|
|
20183
20143
|
SpawnIndex=self.SpawnIndex+1
|
|
@@ -22002,10 +21962,10 @@ self:F2(self.PositionableName)
|
|
|
22002
21962
|
local DCSPositionable=self:GetDCSObject()
|
|
22003
21963
|
if DCSPositionable then
|
|
22004
21964
|
local PositionableVec3=DCSPositionable:getPosition().p
|
|
22005
|
-
local PositionablePointVec2=
|
|
21965
|
+
local PositionablePointVec2=COORDINATE:NewFromVec3(PositionableVec3)
|
|
22006
21966
|
return PositionablePointVec2
|
|
22007
21967
|
end
|
|
22008
|
-
self:E({"Cannot
|
|
21968
|
+
self:E({"Cannot Coordinate",Positionable=self,Alive=self:IsAlive()})
|
|
22009
21969
|
return nil
|
|
22010
21970
|
end
|
|
22011
21971
|
function POSITIONABLE:GetPointVec3()
|
|
@@ -22017,7 +21977,7 @@ self.pointvec3.x=PositionableVec3.x
|
|
|
22017
21977
|
self.pointvec3.y=PositionableVec3.y
|
|
22018
21978
|
self.pointvec3.z=PositionableVec3.z
|
|
22019
21979
|
else
|
|
22020
|
-
self.pointvec3=
|
|
21980
|
+
self.pointvec3=COORDINATE:NewFromVec3(PositionableVec3)
|
|
22021
21981
|
end
|
|
22022
21982
|
return self.pointvec3
|
|
22023
21983
|
end
|
|
@@ -23371,6 +23331,49 @@ self:SetCommand(CommandSetFrequencyForUnit)
|
|
|
23371
23331
|
end
|
|
23372
23332
|
return self
|
|
23373
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
|
|
23374
23377
|
function CONTROLLABLE:TaskEPLRS(SwitchOnOff,idx)
|
|
23375
23378
|
if SwitchOnOff==nil then
|
|
23376
23379
|
SwitchOnOff=true
|
|
@@ -26718,7 +26721,7 @@ if FirstUnit then
|
|
|
26718
26721
|
local FirstUnitPointVec2=FirstUnit:GetPointVec2()
|
|
26719
26722
|
return FirstUnitPointVec2
|
|
26720
26723
|
end
|
|
26721
|
-
BASE:E({"Cannot
|
|
26724
|
+
BASE:E({"Cannot get COORDINATE",Group=self,Alive=self:IsAlive()})
|
|
26722
26725
|
return nil
|
|
26723
26726
|
end
|
|
26724
26727
|
function GROUP:GetAverageCoordinate()
|
|
@@ -27179,7 +27182,7 @@ if self.InitRespawnRandomizePositionZone then
|
|
|
27179
27182
|
GroupUnitVec3=Zone:GetRandomVec3()
|
|
27180
27183
|
else
|
|
27181
27184
|
if self.InitRespawnRandomizePositionInner and self.InitRespawnRandomizePositionOuter then
|
|
27182
|
-
GroupUnitVec3=
|
|
27185
|
+
GroupUnitVec3=COORDINATE:NewFromVec3(From):GetRandomVec3InRadius(self.InitRespawnRandomizePositionsOuter,self.InitRespawnRandomizePositionsInner)
|
|
27183
27186
|
else
|
|
27184
27187
|
GroupUnitVec3=Zone:GetVec3()
|
|
27185
27188
|
end
|
|
@@ -27209,7 +27212,7 @@ if self.InitRespawnRandomizePositionZone then
|
|
|
27209
27212
|
GroupUnitVec3=Zone:GetRandomVec3()
|
|
27210
27213
|
else
|
|
27211
27214
|
if self.InitRespawnRandomizePositionInner and self.InitRespawnRandomizePositionOuter then
|
|
27212
|
-
GroupUnitVec3=
|
|
27215
|
+
GroupUnitVec3=COORDINATE:NewFromVec2(From):GetRandomPointVec3InRadius(self.InitRespawnRandomizePositionsOuter,self.InitRespawnRandomizePositionsInner)
|
|
27213
27216
|
else
|
|
27214
27217
|
GroupUnitVec3=Zone:GetVec3()
|
|
27215
27218
|
end
|
|
@@ -32097,7 +32100,7 @@ DYNAMICCARGO.AircraftDimensions={
|
|
|
32097
32100
|
["ropelength"]=30,
|
|
32098
32101
|
},
|
|
32099
32102
|
}
|
|
32100
|
-
DYNAMICCARGO.version="0.0.
|
|
32103
|
+
DYNAMICCARGO.version="0.0.7"
|
|
32101
32104
|
function DYNAMICCARGO:Register(CargoName)
|
|
32102
32105
|
local self=BASE:Inherit(self,POSITIONABLE:New(CargoName))
|
|
32103
32106
|
self.StaticName=CargoName
|
|
@@ -32123,7 +32126,7 @@ end
|
|
|
32123
32126
|
return self
|
|
32124
32127
|
end
|
|
32125
32128
|
function DYNAMICCARGO:GetDCSObject()
|
|
32126
|
-
local DCSStatic=Unit.getByName(self.StaticName)
|
|
32129
|
+
local DCSStatic=StaticObject.getByName(self.StaticName)or Unit.getByName(self.StaticName)
|
|
32127
32130
|
if DCSStatic then
|
|
32128
32131
|
return DCSStatic
|
|
32129
32132
|
end
|
|
@@ -32147,14 +32150,14 @@ return false
|
|
|
32147
32150
|
end
|
|
32148
32151
|
end
|
|
32149
32152
|
function DYNAMICCARGO:IsUnloaded()
|
|
32150
|
-
if self.CargoState and self.CargoState==DYNAMICCARGO.State.
|
|
32153
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.UNLOADED then
|
|
32151
32154
|
return true
|
|
32152
32155
|
else
|
|
32153
32156
|
return false
|
|
32154
32157
|
end
|
|
32155
32158
|
end
|
|
32156
32159
|
function DYNAMICCARGO:IsRemoved()
|
|
32157
|
-
if self.CargoState and self.CargoState==DYNAMICCARGO.State.
|
|
32160
|
+
if self.CargoState and self.CargoState==DYNAMICCARGO.State.REMOVED then
|
|
32158
32161
|
return true
|
|
32159
32162
|
else
|
|
32160
32163
|
return false
|
|
@@ -32219,6 +32222,27 @@ else
|
|
|
32219
32222
|
return self.StaticName
|
|
32220
32223
|
end
|
|
32221
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
|
|
32222
32246
|
function DYNAMICCARGO:_GetPossibleHeloNearby(pos,loading)
|
|
32223
32247
|
local set=_DYNAMICCARGO_HELOS:GetAliveSet()
|
|
32224
32248
|
local success=false
|
|
@@ -32229,28 +32253,33 @@ local helo=_helo
|
|
|
32229
32253
|
local name=helo:GetPlayerName()or _DATABASE:_FindPlayerNameByUnitName(helo:GetName())or"None"
|
|
32230
32254
|
self:T(self.lid.." Checking: "..name)
|
|
32231
32255
|
local hpos=helo:GetCoordinate()
|
|
32232
|
-
local inair=helo:InAir()
|
|
32233
|
-
self:T(self.lid.." InAir: AGL/InAir: "..hpos.y-hpos:GetLandHeight().."/"..tostring(inair))
|
|
32234
32256
|
local typename=helo:GetTypeName()
|
|
32235
|
-
if hpos and typename and inair==false then
|
|
32236
32257
|
local dimensions=DYNAMICCARGO.AircraftDimensions[typename]
|
|
32237
|
-
|
|
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
|
|
32238
32262
|
local delta2D=hpos:Get2DDistance(pos)
|
|
32239
32263
|
local delta3D=hpos:Get3DDistance(pos)
|
|
32240
32264
|
if self.testing then
|
|
32241
32265
|
self:T(string.format("Cargo relative position: 2D %dm | 3D %dm",delta2D,delta3D))
|
|
32242
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))
|
|
32243
32268
|
end
|
|
32244
|
-
if loading~=true and
|
|
32269
|
+
if loading~=true and(delta2D>dimensions.length or delta2D>dimensions.width)and helolanded then
|
|
32245
32270
|
success=true
|
|
32246
32271
|
Helo=helo
|
|
32247
32272
|
Playername=name
|
|
32248
32273
|
end
|
|
32249
|
-
if loading
|
|
32274
|
+
if loading~=true and delta3D>dimensions.ropelength then
|
|
32250
32275
|
success=true
|
|
32251
32276
|
Helo=helo
|
|
32252
32277
|
Playername=name
|
|
32253
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
|
|
32254
32283
|
end
|
|
32255
32284
|
end
|
|
32256
32285
|
end
|
|
@@ -32265,12 +32294,13 @@ self:T(string.format("Cargo position: x=%d, y=%d, z=%d",pos.x,pos.y,pos.z))
|
|
|
32265
32294
|
self:T(string.format("Last position: x=%d, y=%d, z=%d",self.LastPosition.x,self.LastPosition.y,self.LastPosition.z))
|
|
32266
32295
|
end
|
|
32267
32296
|
if UTILS.Round(UTILS.VecDist3D(pos,self.LastPosition),2)>0.5 then
|
|
32268
|
-
if self.CargoState==DYNAMICCARGO.State.NEW then
|
|
32297
|
+
if self.CargoState==DYNAMICCARGO.State.NEW or self.CargoState==DYNAMICCARGO.State.UNLOADED then
|
|
32269
32298
|
local isloaded,client,playername=self:_GetPossibleHeloNearby(pos,true)
|
|
32270
32299
|
self:T(self.lid.." moved! NEW -> LOADED by "..tostring(playername))
|
|
32271
32300
|
self.CargoState=DYNAMICCARGO.State.LOADED
|
|
32272
32301
|
self.Owner=playername
|
|
32273
32302
|
_DATABASE:CreateEventDynamicCargoLoaded(self)
|
|
32303
|
+
end
|
|
32274
32304
|
elseif self.CargoState==DYNAMICCARGO.State.LOADED then
|
|
32275
32305
|
local count=_DYNAMICCARGO_HELOS:CountAlive()
|
|
32276
32306
|
local landheight=pos:GetLandHeight()
|
|
@@ -32280,26 +32310,18 @@ self:T(self.lid.." AGL: "..agl or-1)
|
|
|
32280
32310
|
local isunloaded=true
|
|
32281
32311
|
local client
|
|
32282
32312
|
local playername=self.Owner
|
|
32283
|
-
if count>0
|
|
32313
|
+
if count>0 then
|
|
32284
32314
|
self:T(self.lid.." Possible alive helos: "..count or-1)
|
|
32285
|
-
if agl~=0 or self.testing then
|
|
32286
32315
|
isunloaded,client,playername=self:_GetPossibleHeloNearby(pos,false)
|
|
32287
|
-
end
|
|
32288
32316
|
if isunloaded then
|
|
32289
32317
|
self:T(self.lid.." moved! LOADED -> UNLOADED by "..tostring(playername))
|
|
32290
32318
|
self.CargoState=DYNAMICCARGO.State.UNLOADED
|
|
32291
32319
|
self.Owner=playername
|
|
32292
32320
|
_DATABASE:CreateEventDynamicCargoUnloaded(self)
|
|
32293
32321
|
end
|
|
32294
|
-
elseif count>0 and agl==0 then
|
|
32295
|
-
self:T(self.lid.." moved! LOADED -> UNLOADED by "..tostring(playername))
|
|
32296
|
-
self.CargoState=DYNAMICCARGO.State.UNLOADED
|
|
32297
|
-
self.Owner=playername
|
|
32298
|
-
_DATABASE:CreateEventDynamicCargoUnloaded(self)
|
|
32299
32322
|
end
|
|
32300
32323
|
end
|
|
32301
32324
|
self.LastPosition=pos
|
|
32302
|
-
end
|
|
32303
32325
|
else
|
|
32304
32326
|
if self.timer and self.timer:IsRunning()then self.timer:Stop()end
|
|
32305
32327
|
self:T(self.lid.." dead! "..self.CargoState.."-> REMOVED")
|
|
@@ -36038,7 +36060,6 @@ end
|
|
|
36038
36060
|
function ESCORT:_ReportTargetsScheduler()
|
|
36039
36061
|
self:F(self.EscortGroup:GetName())
|
|
36040
36062
|
if self.EscortGroup:IsAlive()and self.EscortClient:IsAlive()then
|
|
36041
|
-
if true then
|
|
36042
36063
|
local EscortGroupName=self.EscortGroup:GetName()
|
|
36043
36064
|
self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
|
36044
36065
|
if self.EscortMenuTargetAssistance then
|
|
@@ -36089,8 +36110,6 @@ else
|
|
|
36089
36110
|
self.EscortGroup:MessageToClient("No targets detected.",10,self.EscortClient)
|
|
36090
36111
|
end
|
|
36091
36112
|
return true
|
|
36092
|
-
else
|
|
36093
|
-
end
|
|
36094
36113
|
end
|
|
36095
36114
|
return false
|
|
36096
36115
|
end
|
|
@@ -54630,7 +54649,7 @@ shootandscoot=false,
|
|
|
54630
54649
|
SkateNumber=3,
|
|
54631
54650
|
SkateZones=nil,
|
|
54632
54651
|
minscootdist=100,
|
|
54633
|
-
|
|
54652
|
+
maxscootdist=3000,
|
|
54634
54653
|
scootrandomcoord=false,
|
|
54635
54654
|
}
|
|
54636
54655
|
do
|
|
@@ -67545,8 +67564,14 @@ CTLD.UnitTypeCapabilities={
|
|
|
67545
67564
|
["OH-6A"]={type="OH-6A",crates=false,troops=true,cratelimit=0,trooplimit=4,length=7,cargoweightlimit=550},
|
|
67546
67565
|
["OH58D"]={type="OH58D",crates=false,troops=false,cratelimit=0,trooplimit=0,length=14,cargoweightlimit=400},
|
|
67547
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},
|
|
67548
67568
|
}
|
|
67549
|
-
CTLD.
|
|
67569
|
+
CTLD.FixedWingTypes={
|
|
67570
|
+
["Hercules"]="Hercules",
|
|
67571
|
+
["Bronco"]="Bronco",
|
|
67572
|
+
["Mosquito"]="Mosquito",
|
|
67573
|
+
}
|
|
67574
|
+
CTLD.version="1.1.31"
|
|
67550
67575
|
function CTLD:New(Coalition,Prefixes,Alias)
|
|
67551
67576
|
local self=BASE:Inherit(self,FSM:New())
|
|
67552
67577
|
BASE:T({Coalition,Prefixes,Alias})
|
|
@@ -67649,9 +67674,10 @@ self.movetroopstowpzone=true
|
|
|
67649
67674
|
self.movetroopsdistance=5000
|
|
67650
67675
|
self.troopdropzoneradius=100
|
|
67651
67676
|
self.enableHercules=false
|
|
67652
|
-
self.
|
|
67653
|
-
self.
|
|
67654
|
-
self.
|
|
67677
|
+
self.enableFixedWing=false
|
|
67678
|
+
self.FixedMinAngels=165
|
|
67679
|
+
self.FixedMaxAngels=2000
|
|
67680
|
+
self.FixedMaxSpeed=77
|
|
67655
67681
|
self.suppressmessages=false
|
|
67656
67682
|
self.repairtime=300
|
|
67657
67683
|
self.buildtime=300
|
|
@@ -67760,7 +67786,7 @@ local unitname=event.IniUnitName or"none"
|
|
|
67760
67786
|
self.Loaded_Cargo[unitname]=nil
|
|
67761
67787
|
self:_RefreshF10Menus()
|
|
67762
67788
|
end
|
|
67763
|
-
if self:
|
|
67789
|
+
if self:IsFixedWing(_unit)and self.enableFixedWing then
|
|
67764
67790
|
local unitname=event.IniUnitName or"none"
|
|
67765
67791
|
self.Loaded_Cargo[unitname]=nil
|
|
67766
67792
|
self:_RefreshF10Menus()
|
|
@@ -67879,6 +67905,17 @@ end
|
|
|
67879
67905
|
end
|
|
67880
67906
|
return nil
|
|
67881
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
|
|
67882
67919
|
function CTLD:PreloadTroops(Unit,Troopname)
|
|
67883
67920
|
self:T(self.lid.." PreloadTroops")
|
|
67884
67921
|
local name=Troopname or"Unknown"
|
|
@@ -68291,7 +68328,7 @@ if numbernearby>=canloadcratesno and not drop then
|
|
|
68291
68328
|
self:_SendMessage("There are enough crates nearby already! Take care of those first!",10,false,Group)
|
|
68292
68329
|
return self
|
|
68293
68330
|
end
|
|
68294
|
-
local IsHerc=self:
|
|
68331
|
+
local IsHerc=self:IsFixedWing(Unit)
|
|
68295
68332
|
local IsHook=self:IsHook(Unit)
|
|
68296
68333
|
local cargotype=Cargo
|
|
68297
68334
|
local number=number or cargotype:GetCratesNeeded()
|
|
@@ -68602,6 +68639,7 @@ local staticpos=static:GetCoordinate()
|
|
|
68602
68639
|
local cando=cargo:UnitCanCarry(_unit)
|
|
68603
68640
|
if ignoretype==true then cando=true end
|
|
68604
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))
|
|
68605
68643
|
if distance<=finddist and(weight<=maxloadable or _ignoreweight)and restricted==false and cando==true then
|
|
68606
68644
|
index=index+1
|
|
68607
68645
|
table.insert(found,staticid,cargo)
|
|
@@ -68926,13 +68964,15 @@ self:_SendMessage(string.format("Nothing in stock!"),10,false,Group)
|
|
|
68926
68964
|
end
|
|
68927
68965
|
return self
|
|
68928
68966
|
end
|
|
68929
|
-
function CTLD:
|
|
68930
|
-
|
|
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
|
|
68931
68971
|
return true
|
|
68932
|
-
else
|
|
68933
|
-
return false
|
|
68934
68972
|
end
|
|
68935
68973
|
end
|
|
68974
|
+
return false
|
|
68975
|
+
end
|
|
68936
68976
|
function CTLD:IsHook(Unit)
|
|
68937
68977
|
if Unit and string.find(Unit:GetTypeName(),"CH.47")then
|
|
68938
68978
|
return true
|
|
@@ -68975,7 +69015,7 @@ if inzone then
|
|
|
68975
69015
|
droppingatbase=true
|
|
68976
69016
|
end
|
|
68977
69017
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
68978
|
-
local IsHerc=self:
|
|
69018
|
+
local IsHerc=self:IsFixedWing(Unit)
|
|
68979
69019
|
local IsHook=self:IsHook(Unit)
|
|
68980
69020
|
if IsHerc and(not IsHook)then
|
|
68981
69021
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -69102,7 +69142,7 @@ self:_SendMessage("You need to open the door(s) to drop cargo!",10,false,Group)
|
|
|
69102
69142
|
if not self.debug then return self end
|
|
69103
69143
|
end
|
|
69104
69144
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
69105
|
-
local IsHerc=self:
|
|
69145
|
+
local IsHerc=self:IsFixedWing(Unit)
|
|
69106
69146
|
local IsHook=self:IsHook(Unit)
|
|
69107
69147
|
if IsHerc and(not IsHook)then
|
|
69108
69148
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -69153,7 +69193,7 @@ return self
|
|
|
69153
69193
|
end
|
|
69154
69194
|
function CTLD:_BuildCrates(Group,Unit,Engineering)
|
|
69155
69195
|
self:T(self.lid.." _BuildCrates")
|
|
69156
|
-
if self:
|
|
69196
|
+
if self:IsFixedWing(Unit)and self.enableFixedWing and not Engineering then
|
|
69157
69197
|
local speed=Unit:GetVelocityKMH()
|
|
69158
69198
|
if speed>1 then
|
|
69159
69199
|
self:_SendMessage("You need to land / stop to build something, Pilot!",10,false,Group)
|
|
@@ -69443,7 +69483,7 @@ for _,groupObj in pairs(PlayerTable)do
|
|
|
69443
69483
|
local firstUnit=groupObj:GetFirstUnitAlive()
|
|
69444
69484
|
if firstUnit then
|
|
69445
69485
|
if firstUnit:IsPlayer()then
|
|
69446
|
-
if firstUnit:IsHelicopter()or(self.
|
|
69486
|
+
if firstUnit:IsHelicopter()or(self.enableFixedWing and self:IsFixedWing(firstUnit))then
|
|
69447
69487
|
local _unit=firstUnit:GetName()
|
|
69448
69488
|
_UnitList[_unit]=_unit
|
|
69449
69489
|
end
|
|
@@ -69630,7 +69670,7 @@ MENU_GROUP_COMMAND:New(_group,"White smoke",smokeself,self.SmokePositionNow,self
|
|
|
69630
69670
|
MENU_GROUP_COMMAND:New(_group,"Flare zones nearby",smoketopmenu,self.SmokeZoneNearBy,self,_unit,true)
|
|
69631
69671
|
MENU_GROUP_COMMAND:New(_group,"Fire flare now",smoketopmenu,self.SmokePositionNow,self,_unit,true)
|
|
69632
69672
|
MENU_GROUP_COMMAND:New(_group,"Drop beacon now",smoketopmenu,self.DropBeaconNow,self,_unit):Refresh()
|
|
69633
|
-
if self:
|
|
69673
|
+
if self:IsFixedWing(_unit)then
|
|
69634
69674
|
MENU_GROUP_COMMAND:New(_group,"Show flight parameters",topmenu,self._ShowFlightParams,self,_group,_unit):Refresh()
|
|
69635
69675
|
else
|
|
69636
69676
|
MENU_GROUP_COMMAND:New(_group,"Show hover parameters",topmenu,self._ShowHoverParams,self,_group,_unit):Refresh()
|
|
@@ -69805,7 +69845,7 @@ return self
|
|
|
69805
69845
|
end
|
|
69806
69846
|
local grounded=not self:IsUnitInAir(Unit)
|
|
69807
69847
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
69808
|
-
local isHerc=self:
|
|
69848
|
+
local isHerc=self:IsFixedWing(Unit)
|
|
69809
69849
|
local isHook=self:IsHook(Unit)
|
|
69810
69850
|
if isHerc and not isHook then
|
|
69811
69851
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -69935,7 +69975,7 @@ self:_SendMessage("You need to open the door(s) to unload troops!",10,false,Grou
|
|
|
69935
69975
|
if not self.debug then return self end
|
|
69936
69976
|
end
|
|
69937
69977
|
local hoverunload=self:IsCorrectHover(Unit)
|
|
69938
|
-
local isHerc=self:
|
|
69978
|
+
local isHerc=self:IsFixedWing(Unit)
|
|
69939
69979
|
local isHook=self:IsHook(Unit)
|
|
69940
69980
|
if isHerc and not isHook then
|
|
69941
69981
|
hoverunload=self:IsCorrectFlightParameters(Unit)
|
|
@@ -70064,7 +70104,7 @@ self.Loaded_Cargo[unitName].Troopsloaded=troopsLoaded
|
|
|
70064
70104
|
self.Loaded_Cargo[unitName].Cratesloaded=cratesLoaded
|
|
70065
70105
|
self:_RefreshDropTroopsMenu(Group,Unit)
|
|
70066
70106
|
else
|
|
70067
|
-
local isHerc=self:
|
|
70107
|
+
local isHerc=self:IsFixedWing(Unit)
|
|
70068
70108
|
if isHerc then
|
|
70069
70109
|
self:_SendMessage("Nothing loaded or not within airdrop parameters!",10,false,Group)
|
|
70070
70110
|
else
|
|
@@ -70686,9 +70726,9 @@ return false
|
|
|
70686
70726
|
end
|
|
70687
70727
|
local gheight=ucoord:GetLandHeight()
|
|
70688
70728
|
local aheight=uheight-gheight
|
|
70689
|
-
local minh=self.
|
|
70690
|
-
local maxh=self.
|
|
70691
|
-
local maxspeed=self.
|
|
70729
|
+
local minh=self.FixedMinAngels
|
|
70730
|
+
local maxh=self.FixedMaxAngels
|
|
70731
|
+
local maxspeed=self.FixedMaxSpeed
|
|
70692
70732
|
local kmspeed=uspeed*3.6
|
|
70693
70733
|
local knspeed=kmspeed/1.86
|
|
70694
70734
|
self:T(string.format("%s Unit parameters: at %dm AGL with %dmps | %dkph | %dkn",self.lid,aheight,uspeed,kmspeed,knspeed))
|
|
@@ -70719,12 +70759,12 @@ local htxt="true"
|
|
|
70719
70759
|
if not inhover then htxt="false"end
|
|
70720
70760
|
local text=""
|
|
70721
70761
|
if _SETTINGS:IsImperial()then
|
|
70722
|
-
local minheight=UTILS.MetersToFeet(self.
|
|
70723
|
-
local maxheight=UTILS.MetersToFeet(self.
|
|
70762
|
+
local minheight=UTILS.MetersToFeet(self.FixedMinAngels)
|
|
70763
|
+
local maxheight=UTILS.MetersToFeet(self.FixedMaxAngels)
|
|
70724
70764
|
text=string.format("Flight parameters (airdrop):\n - Min height %dft \n - Max height %dft \n - In parameter: %s",minheight,maxheight,htxt)
|
|
70725
70765
|
else
|
|
70726
|
-
local minheight=self.
|
|
70727
|
-
local maxheight=self.
|
|
70766
|
+
local minheight=self.FixedMinAngels
|
|
70767
|
+
local maxheight=self.FixedMaxAngels
|
|
70728
70768
|
text=string.format("Flight parameters (airdrop):\n - Min height %dm \n - Max height %dm \n - In parameter: %s",minheight,maxheight,htxt)
|
|
70729
70769
|
end
|
|
70730
70770
|
self:_SendMessage(text,10,false,Group)
|
|
@@ -70732,7 +70772,7 @@ return self
|
|
|
70732
70772
|
end
|
|
70733
70773
|
function CTLD:CanHoverLoad(Unit)
|
|
70734
70774
|
self:T(self.lid.." CanHoverLoad")
|
|
70735
|
-
if self:
|
|
70775
|
+
if self:IsFixedWing(Unit)then return false end
|
|
70736
70776
|
local outcome=self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD)and self:IsCorrectHover(Unit)
|
|
70737
70777
|
if not outcome then
|
|
70738
70778
|
outcome=self:IsUnitInZone(Unit,CTLD.CargoZoneType.SHIP)
|
|
@@ -70741,7 +70781,7 @@ return outcome
|
|
|
70741
70781
|
end
|
|
70742
70782
|
function CTLD:IsUnitInAir(Unit)
|
|
70743
70783
|
local minheight=self.minimumHoverHeight
|
|
70744
|
-
if self.
|
|
70784
|
+
if self.enableFixedWing and self:IsFixedWing(Unit)then
|
|
70745
70785
|
minheight=5.1
|
|
70746
70786
|
end
|
|
70747
70787
|
local uheight=Unit:GetHeight()
|
|
@@ -71374,11 +71414,12 @@ end
|
|
|
71374
71414
|
function CTLD:onafterStart(From,Event,To)
|
|
71375
71415
|
self:T({From,Event,To})
|
|
71376
71416
|
self:I(self.lid.."Started ("..self.version..")")
|
|
71417
|
+
if self.enableHercules then self.enableFixedWing=true end
|
|
71377
71418
|
if self.UserSetGroup then
|
|
71378
71419
|
self.PilotGroups=self.UserSetGroup
|
|
71379
|
-
elseif self.useprefix or self.
|
|
71420
|
+
elseif self.useprefix or self.enableFixedWing then
|
|
71380
71421
|
local prefix=self.prefixes
|
|
71381
|
-
if self.
|
|
71422
|
+
if self.enableFixedWing then
|
|
71382
71423
|
self.PilotGroups=SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefix):FilterStart()
|
|
71383
71424
|
else
|
|
71384
71425
|
self.PilotGroups=SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefix):FilterCategories("helicopter"):FilterStart()
|
|
@@ -74112,7 +74153,7 @@ local SwitchWayPointCommand=AIGroup:CommandSwitchWayPoint(1,WayPointCount,1)
|
|
|
74112
74153
|
AIGroup:SetCommand(SwitchWayPointCommand)
|
|
74113
74154
|
AIGroup:MessageToRed("Returning to home base ...",30)
|
|
74114
74155
|
else
|
|
74115
|
-
local PointVec2=
|
|
74156
|
+
local PointVec2=COORDINATE:New(AIGroup:GetVec2().x,0,AIGroup:GetVec2().y)
|
|
74116
74157
|
local ClosestAirbase=self.ReturnAirbaseSet:FindNearestAirbaseFromPointVec2(PointVec2)
|
|
74117
74158
|
self:T(ClosestAirbase.AirbaseName)
|
|
74118
74159
|
AIGroup:RouteRTB(ClosestAirbase)
|
|
@@ -74397,15 +74438,15 @@ return
|
|
|
74397
74438
|
end
|
|
74398
74439
|
local FromRTBRoutePoint=FromCoord:WaypointAir(
|
|
74399
74440
|
self.PatrolAltType,
|
|
74400
|
-
|
|
74401
|
-
|
|
74441
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
74442
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
74402
74443
|
RTBSpeed,
|
|
74403
74444
|
true
|
|
74404
74445
|
)
|
|
74405
74446
|
local ToRTBRoutePoint=ToAirbaseCoord:WaypointAir(
|
|
74406
74447
|
self.PatrolAltType,
|
|
74407
|
-
|
|
74408
|
-
|
|
74448
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
74449
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
74409
74450
|
RTBSpeed,
|
|
74410
74451
|
true
|
|
74411
74452
|
)
|
|
@@ -74454,8 +74495,8 @@ local RefuelRoute={}
|
|
|
74454
74495
|
local FromRefuelCoord=AIGroup:GetCoordinate()
|
|
74455
74496
|
local ToRefuelCoord=Tanker:GetCoordinate()
|
|
74456
74497
|
local ToRefuelSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
74457
|
-
local FromRefuelRoutePoint=FromRefuelCoord:WaypointAir(self.PatrolAltType,
|
|
74458
|
-
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)
|
|
74459
74500
|
self:F({ToRefuelSpeed=ToRefuelSpeed})
|
|
74460
74501
|
RefuelRoute[#RefuelRoute+1]=FromRefuelRoutePoint
|
|
74461
74502
|
RefuelRoute[#RefuelRoute+1]=ToRefuelRoutePoint
|
|
@@ -74565,7 +74606,7 @@ ToTargetCoord:SetAlt(altitude)
|
|
|
74565
74606
|
self:SetTargetDistance(ToTargetCoord)
|
|
74566
74607
|
local ToTargetSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
74567
74608
|
local speedkmh=ToTargetSpeed
|
|
74568
|
-
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)
|
|
74569
74610
|
PatrolRoute[#PatrolRoute+1]=FromWP
|
|
74570
74611
|
if self.racetrack then
|
|
74571
74612
|
local heading=math.random(self.racetrackheadingmin,self.racetrackheadingmax)
|
|
@@ -74588,7 +74629,7 @@ local taskCond=AIPatrol:TaskCondition(nil,nil,nil,nil,duration,nil)
|
|
|
74588
74629
|
local taskCont=AIPatrol:TaskControlled(taskOrbit,taskCond)
|
|
74589
74630
|
PatrolRoute[2]=c1:WaypointAirTurningPoint(self.PatrolAltType,speedkmh,{taskCont,taskPatrol},"CAP Orbit")
|
|
74590
74631
|
else
|
|
74591
|
-
local ToWP=ToTargetCoord:WaypointAir(self.PatrolAltType,
|
|
74632
|
+
local ToWP=ToTargetCoord:WaypointAir(self.PatrolAltType,COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,ToTargetSpeed,true)
|
|
74592
74633
|
PatrolRoute[#PatrolRoute+1]=ToWP
|
|
74593
74634
|
local Tasks={}
|
|
74594
74635
|
Tasks[#Tasks+1]=AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute",self)
|
|
@@ -74691,12 +74732,12 @@ self:__Engage(0.1,AttackSetUnit)
|
|
|
74691
74732
|
else
|
|
74692
74733
|
local EngageRoute={}
|
|
74693
74734
|
local AttackTasks={}
|
|
74694
|
-
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)
|
|
74695
74736
|
EngageRoute[#EngageRoute+1]=FromWP
|
|
74696
74737
|
self:SetTargetDistance(TargetCoord)
|
|
74697
74738
|
local FromEngageAngle=DefenderCoord:GetAngleDegrees(DefenderCoord:GetDirectionVec3(TargetCoord))
|
|
74698
74739
|
local ToCoord=DefenderCoord:Translate(EngageDistance,FromEngageAngle,true)
|
|
74699
|
-
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)
|
|
74700
74741
|
EngageRoute[#EngageRoute+1]=ToWP
|
|
74701
74742
|
AttackTasks[#AttackTasks+1]=DefenderGroup:TaskFunction("AI_AIR_ENGAGE.___EngageRoute",self,AttackSetUnit)
|
|
74702
74743
|
EngageRoute[#EngageRoute].task=DefenderGroup:TaskCombo(AttackTasks)
|
|
@@ -74739,12 +74780,12 @@ local TargetDistance=DefenderCoord:Get2DDistance(TargetCoord)
|
|
|
74739
74780
|
local EngageDistance=(DefenderGroup:IsHelicopter()and 5000)or(DefenderGroup:IsAirPlane()and 10000)
|
|
74740
74781
|
local EngageRoute={}
|
|
74741
74782
|
local AttackTasks={}
|
|
74742
|
-
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)
|
|
74743
74784
|
EngageRoute[#EngageRoute+1]=FromWP
|
|
74744
74785
|
self:SetTargetDistance(TargetCoord)
|
|
74745
74786
|
local FromEngageAngle=DefenderCoord:GetAngleDegrees(DefenderCoord:GetDirectionVec3(TargetCoord))
|
|
74746
74787
|
local ToCoord=DefenderCoord:Translate(EngageDistance,FromEngageAngle,true)
|
|
74747
|
-
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)
|
|
74748
74789
|
EngageRoute[#EngageRoute+1]=ToWP
|
|
74749
74790
|
if TargetDistance<=EngageDistance*9 then
|
|
74750
74791
|
local AttackUnitTasks=self:CreateAttackUnitTasks(AttackSetUnit,DefenderGroup,EngageAltitude)
|
|
@@ -78291,12 +78332,12 @@ self:T("Not in the air, finding route path within PatrolZone")
|
|
|
78291
78332
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78292
78333
|
if not CurrentVec2 then return end
|
|
78293
78334
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78294
|
-
local CurrentPointVec3=
|
|
78335
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78295
78336
|
local ToPatrolZoneSpeed=self.PatrolMaxSpeed
|
|
78296
78337
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78297
78338
|
self.PatrolAltType,
|
|
78298
|
-
|
|
78299
|
-
|
|
78339
|
+
COORDINATE.WaypointType.TakeOffParking,
|
|
78340
|
+
COORDINATE.WaypointAction.FromParkingArea,
|
|
78300
78341
|
ToPatrolZoneSpeed,
|
|
78301
78342
|
true
|
|
78302
78343
|
)
|
|
@@ -78306,12 +78347,12 @@ self:T("In the air, finding route path within PatrolZone")
|
|
|
78306
78347
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78307
78348
|
if not CurrentVec2 then return end
|
|
78308
78349
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78309
|
-
local CurrentPointVec3=
|
|
78350
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78310
78351
|
local ToPatrolZoneSpeed=self.PatrolMaxSpeed
|
|
78311
78352
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78312
78353
|
self.PatrolAltType,
|
|
78313
|
-
|
|
78314
|
-
|
|
78354
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78355
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78315
78356
|
ToPatrolZoneSpeed,
|
|
78316
78357
|
true
|
|
78317
78358
|
)
|
|
@@ -78322,11 +78363,11 @@ self:T2(ToTargetVec2)
|
|
|
78322
78363
|
local ToTargetAltitude=math.random(self.PatrolFloorAltitude,self.PatrolCeilingAltitude)
|
|
78323
78364
|
local ToTargetSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
78324
78365
|
self:T2({self.PatrolMinSpeed,self.PatrolMaxSpeed,ToTargetSpeed})
|
|
78325
|
-
local ToTargetPointVec3=
|
|
78366
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,ToTargetAltitude,ToTargetVec2.y)
|
|
78326
78367
|
local ToTargetRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78327
78368
|
self.PatrolAltType,
|
|
78328
|
-
|
|
78329
|
-
|
|
78369
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78370
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78330
78371
|
ToTargetSpeed,
|
|
78331
78372
|
true
|
|
78332
78373
|
)
|
|
@@ -78352,13 +78393,21 @@ local OrbitTask=OldAIControllable:TaskOrbitCircle(math.random(self.PatrolFloorAl
|
|
|
78352
78393
|
local TimedOrbitTask=OldAIControllable:TaskControlled(OrbitTask,OldAIControllable:TaskCondition(nil,nil,nil,nil,self.PatrolOutOfFuelOrbitTime,nil))
|
|
78353
78394
|
OldAIControllable:SetTask(TimedOrbitTask,10)
|
|
78354
78395
|
RTB=true
|
|
78355
|
-
else
|
|
78356
78396
|
end
|
|
78357
78397
|
local Damage=self.Controllable:GetLife()
|
|
78358
78398
|
if Damage<=self.PatrolDamageThreshold then
|
|
78359
78399
|
self:T(self.Controllable:GetName().." is damaged:"..Damage..", RTB!")
|
|
78360
78400
|
RTB=true
|
|
78361
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
|
|
78362
78411
|
if RTB==true then
|
|
78363
78412
|
self:RTB()
|
|
78364
78413
|
else
|
|
@@ -78375,12 +78424,12 @@ local PatrolRoute={}
|
|
|
78375
78424
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78376
78425
|
if not CurrentVec2 then return end
|
|
78377
78426
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78378
|
-
local CurrentPointVec3=
|
|
78427
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78379
78428
|
local ToPatrolZoneSpeed=self.PatrolMaxSpeed
|
|
78380
78429
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78381
78430
|
self.PatrolAltType,
|
|
78382
|
-
|
|
78383
|
-
|
|
78431
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78432
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78384
78433
|
ToPatrolZoneSpeed,
|
|
78385
78434
|
true
|
|
78386
78435
|
)
|
|
@@ -78482,12 +78531,12 @@ local EngageRoute={}
|
|
|
78482
78531
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78483
78532
|
if not CurrentVec2 then return self end
|
|
78484
78533
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78485
|
-
local CurrentPointVec3=
|
|
78534
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78486
78535
|
local ToEngageZoneSpeed=self.PatrolMaxSpeed
|
|
78487
78536
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78488
78537
|
self.PatrolAltType,
|
|
78489
|
-
|
|
78490
|
-
|
|
78538
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78539
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78491
78540
|
ToEngageZoneSpeed,
|
|
78492
78541
|
true
|
|
78493
78542
|
)
|
|
@@ -78497,11 +78546,11 @@ self:T2(ToTargetVec2)
|
|
|
78497
78546
|
local ToTargetAltitude=math.random(self.EngageFloorAltitude,self.EngageCeilingAltitude)
|
|
78498
78547
|
local ToTargetSpeed=math.random(self.PatrolMinSpeed,self.PatrolMaxSpeed)
|
|
78499
78548
|
self:T2({self.PatrolMinSpeed,self.PatrolMaxSpeed,ToTargetSpeed})
|
|
78500
|
-
local ToTargetPointVec3=
|
|
78549
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,ToTargetAltitude,ToTargetVec2.y)
|
|
78501
78550
|
local ToPatrolRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78502
78551
|
self.PatrolAltType,
|
|
78503
|
-
|
|
78504
|
-
|
|
78552
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78553
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78505
78554
|
ToTargetSpeed,
|
|
78506
78555
|
true
|
|
78507
78556
|
)
|
|
@@ -78645,12 +78694,12 @@ Controllable:OptionROTVertical()
|
|
|
78645
78694
|
local EngageRoute={}
|
|
78646
78695
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78647
78696
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78648
|
-
local CurrentPointVec3=
|
|
78697
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78649
78698
|
local ToEngageZoneSpeed=self.PatrolMaxSpeed
|
|
78650
78699
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78651
78700
|
self.PatrolAltType,
|
|
78652
|
-
|
|
78653
|
-
|
|
78701
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78702
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78654
78703
|
self.EngageSpeed,
|
|
78655
78704
|
true
|
|
78656
78705
|
)
|
|
@@ -78677,11 +78726,11 @@ AttackTasks[#AttackTasks+1]=Controllable:TaskFunction("AI_CAS_ZONE.EngageRoute",
|
|
|
78677
78726
|
EngageRoute[#EngageRoute].task=Controllable:TaskCombo(AttackTasks)
|
|
78678
78727
|
local ToTargetVec2=self.EngageZone:GetRandomVec2()
|
|
78679
78728
|
self:T2(ToTargetVec2)
|
|
78680
|
-
local ToTargetPointVec3=
|
|
78729
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,self.EngageAltitude,ToTargetVec2.y)
|
|
78681
78730
|
local ToTargetRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78682
78731
|
self.PatrolAltType,
|
|
78683
|
-
|
|
78684
|
-
|
|
78732
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78733
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78685
78734
|
self.EngageSpeed,
|
|
78686
78735
|
true
|
|
78687
78736
|
)
|
|
@@ -78816,12 +78865,12 @@ if Controllable:IsAlive()then
|
|
|
78816
78865
|
local EngageRoute={}
|
|
78817
78866
|
local CurrentVec2=self.Controllable:GetVec2()
|
|
78818
78867
|
local CurrentAltitude=self.Controllable:GetAltitude()
|
|
78819
|
-
local CurrentPointVec3=
|
|
78868
|
+
local CurrentPointVec3=COORDINATE:New(CurrentVec2.x,CurrentAltitude,CurrentVec2.y)
|
|
78820
78869
|
local ToEngageZoneSpeed=self.PatrolMaxSpeed
|
|
78821
78870
|
local CurrentRoutePoint=CurrentPointVec3:WaypointAir(
|
|
78822
78871
|
self.PatrolAltType,
|
|
78823
|
-
|
|
78824
|
-
|
|
78872
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78873
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78825
78874
|
self.EngageSpeed,
|
|
78826
78875
|
true
|
|
78827
78876
|
)
|
|
@@ -78861,11 +78910,11 @@ end
|
|
|
78861
78910
|
EngageRoute[#EngageRoute].task=Controllable:TaskCombo(AttackTasks)
|
|
78862
78911
|
local ToTargetVec2=self.EngageZone:GetRandomVec2()
|
|
78863
78912
|
self:T2(ToTargetVec2)
|
|
78864
|
-
local ToTargetPointVec3=
|
|
78913
|
+
local ToTargetPointVec3=COORDINATE:New(ToTargetVec2.x,self.EngageAltitude,ToTargetVec2.y)
|
|
78865
78914
|
local ToTargetRoutePoint=ToTargetPointVec3:WaypointAir(
|
|
78866
78915
|
self.PatrolAltType,
|
|
78867
|
-
|
|
78868
|
-
|
|
78916
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
78917
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
78869
78918
|
self.EngageSpeed,
|
|
78870
78919
|
true
|
|
78871
78920
|
)
|
|
@@ -78993,7 +79042,7 @@ FollowGroupSet:Flush(self)
|
|
|
78993
79042
|
local FollowSet=FollowGroupSet:GetSet()
|
|
78994
79043
|
local i=1
|
|
78995
79044
|
for FollowID,FollowGroup in pairs(FollowSet)do
|
|
78996
|
-
local PointVec3=
|
|
79045
|
+
local PointVec3=COORDINATE:New()
|
|
78997
79046
|
PointVec3:SetX(XStart+i*XSpace)
|
|
78998
79047
|
PointVec3:SetY(YStart+i*YSpace)
|
|
78999
79048
|
PointVec3:SetZ(ZStart+i*ZSpace)
|
|
@@ -79032,7 +79081,7 @@ function AI_FORMATION:onafterFormationCenterWing(FollowGroupSet,From,Event,To,XS
|
|
|
79032
79081
|
local FollowSet=FollowGroupSet:GetSet()
|
|
79033
79082
|
local i=0
|
|
79034
79083
|
for FollowID,FollowGroup in pairs(FollowSet)do
|
|
79035
|
-
local PointVec3=
|
|
79084
|
+
local PointVec3=COORDINATE:New()
|
|
79036
79085
|
local Side=(i%2==0)and 1 or-1
|
|
79037
79086
|
local Row=i/2+1
|
|
79038
79087
|
PointVec3:SetX(XStart+Row*XSpace)
|
|
@@ -79053,7 +79102,7 @@ function AI_FORMATION:onafterFormationBox(FollowGroupSet,From,Event,To,XStart,XS
|
|
|
79053
79102
|
local FollowSet=FollowGroupSet:GetSet()
|
|
79054
79103
|
local i=0
|
|
79055
79104
|
for FollowID,FollowGroup in pairs(FollowSet)do
|
|
79056
|
-
local PointVec3=
|
|
79105
|
+
local PointVec3=COORDINATE:New()
|
|
79057
79106
|
local ZIndex=i%ZLevels
|
|
79058
79107
|
local XIndex=math.floor(i/ZLevels)
|
|
79059
79108
|
local YIndex=math.floor(i/ZLevels)
|
|
@@ -81246,8 +81295,8 @@ local landheight=CoordinateTo:GetLandHeight()
|
|
|
81246
81295
|
CoordinateTo.y=landheight+50
|
|
81247
81296
|
local WaypointTo=CoordinateTo:WaypointAir(
|
|
81248
81297
|
"RADIO",
|
|
81249
|
-
|
|
81250
|
-
|
|
81298
|
+
COORDINATE.WaypointType.TurningPoint,
|
|
81299
|
+
COORDINATE.WaypointAction.TurningPoint,
|
|
81251
81300
|
50,
|
|
81252
81301
|
true
|
|
81253
81302
|
)
|
|
@@ -81273,7 +81322,7 @@ local Route={}
|
|
|
81273
81322
|
local CoordinateTo=Coordinate
|
|
81274
81323
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81275
81324
|
CoordinateTo.y=landheight+50
|
|
81276
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81325
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,50,true)
|
|
81277
81326
|
Route[#Route+1]=WaypointTo
|
|
81278
81327
|
local Tasks={}
|
|
81279
81328
|
Tasks[#Tasks+1]=Helicopter:TaskOrbitCircle(math.random(30,80),150,CoordinateTo:GetRandomCoordinateInRadius(800,500))
|
|
@@ -81301,11 +81350,11 @@ Coordinate.y=Height
|
|
|
81301
81350
|
local _speed=Speed or Helicopter:GetSpeedMax()*0.5
|
|
81302
81351
|
local Route={}
|
|
81303
81352
|
local CoordinateFrom=Helicopter:GetCoordinate()
|
|
81304
|
-
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",
|
|
81353
|
+
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81305
81354
|
local CoordinateTo=Coordinate
|
|
81306
81355
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81307
81356
|
CoordinateTo.y=landheight+50
|
|
81308
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81357
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81309
81358
|
Route[#Route+1]=WaypointFrom
|
|
81310
81359
|
Route[#Route+1]=WaypointTo
|
|
81311
81360
|
Helicopter:WayPointInitialize(Route)
|
|
@@ -81329,13 +81378,13 @@ local Route={}
|
|
|
81329
81378
|
Coordinate.y=Height
|
|
81330
81379
|
local _speed=Speed or Helicopter:GetSpeedMax()*0.5
|
|
81331
81380
|
local CoordinateFrom=Helicopter:GetCoordinate()
|
|
81332
|
-
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",
|
|
81381
|
+
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81333
81382
|
Route[#Route+1]=WaypointFrom
|
|
81334
81383
|
Route[#Route+1]=WaypointFrom
|
|
81335
81384
|
local CoordinateTo=Coordinate
|
|
81336
81385
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81337
81386
|
CoordinateTo.y=landheight+50
|
|
81338
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81387
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,_speed,true)
|
|
81339
81388
|
Route[#Route+1]=WaypointTo
|
|
81340
81389
|
Route[#Route+1]=WaypointTo
|
|
81341
81390
|
Helicopter:WayPointInitialize(Route)
|
|
@@ -81356,12 +81405,12 @@ local Route={}
|
|
|
81356
81405
|
Height=Height or 50
|
|
81357
81406
|
Speed=Speed or Helicopter:GetSpeedMax()*0.5
|
|
81358
81407
|
local CoordinateFrom=Helicopter:GetCoordinate()
|
|
81359
|
-
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",
|
|
81408
|
+
local WaypointFrom=CoordinateFrom:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,Speed,true)
|
|
81360
81409
|
Route[#Route+1]=WaypointFrom
|
|
81361
81410
|
local CoordinateTo=Coordinate
|
|
81362
81411
|
local landheight=CoordinateTo:GetLandHeight()
|
|
81363
81412
|
CoordinateTo.y=landheight+Height
|
|
81364
|
-
local WaypointTo=CoordinateTo:WaypointAir("RADIO",
|
|
81413
|
+
local WaypointTo=CoordinateTo:WaypointAir("RADIO",COORDINATE.WaypointType.TurningPoint,COORDINATE.WaypointAction.TurningPoint,Speed,true)
|
|
81365
81414
|
Route[#Route+1]=WaypointTo
|
|
81366
81415
|
Helicopter:WayPointInitialize(Route)
|
|
81367
81416
|
local Tasks={}
|
|
@@ -81514,7 +81563,7 @@ return
|
|
|
81514
81563
|
end
|
|
81515
81564
|
local Points={}
|
|
81516
81565
|
local AirbasePointVec2=Airbase:GetPointVec2()
|
|
81517
|
-
local ToWaypoint=AirbasePointVec2:WaypointAir(
|
|
81566
|
+
local ToWaypoint=AirbasePointVec2:WaypointAir(COORDINATE.WaypointAltType.BARO,"Land","Landing",Speed or Airplane:GetSpeedMax()*0.8,true,Airbase)
|
|
81518
81567
|
if self.Airbase then
|
|
81519
81568
|
Template.route.points[2]=ToWaypoint
|
|
81520
81569
|
Airplane:RespawnAtCurrentAirbase(Template,Takeoff,Uncontrolled)
|
|
@@ -84012,7 +84061,6 @@ local sender=self:_GetRadioSender()
|
|
|
84012
84061
|
local filename=string.format("%s%s",transmission.path,transmission.filename)
|
|
84013
84062
|
if sender then
|
|
84014
84063
|
self:T(self.lid..string.format("Broadcasting from aircraft %s",sender:GetName()))
|
|
84015
|
-
if not self.senderinit then
|
|
84016
84064
|
local commandFrequency={
|
|
84017
84065
|
id="SetFrequency",
|
|
84018
84066
|
params={
|
|
@@ -84021,7 +84069,6 @@ modulation=self.modulation,
|
|
|
84021
84069
|
}}
|
|
84022
84070
|
sender:SetCommand(commandFrequency)
|
|
84023
84071
|
self.senderinit=true
|
|
84024
|
-
end
|
|
84025
84072
|
local subtitle=nil
|
|
84026
84073
|
local duration=nil
|
|
84027
84074
|
if transmission.subtitle and transmission.subduration and transmission.subduration>0 then
|