Merge remote-tracking branch 'refs/remotes/origin/master' into FlightControl

# Conflicts:
#	Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua
#	Moose Mission Setup/Moose.lua
This commit is contained in:
FlightControl
2017-03-05 09:37:06 +01:00
9 changed files with 179 additions and 10 deletions

View File

@@ -542,8 +542,14 @@ function DATABASE:_EventOnBirth( Event )
self:F2( { Event } )
if Event.IniDCSUnit then
self:AddUnit( Event.IniDCSUnitName )
self:AddGroup( Event.IniDCSGroupName )
if Event.IniObjectCategory == 3 then
self:AddStatic( Event.IniDCSUnitName )
else
if Event.IniObjectCategory == 1 then
self:AddUnit( Event.IniDCSUnitName )
self:AddGroup( Event.IniDCSGroupName )
end
end
self:_EventOnPlayerEnterUnit( Event )
end
end

View File

@@ -680,7 +680,7 @@ function EVENT:onEvent( Event )
Event.IniDCSUnit = Event.initiator
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName
Event.IniUnit = STATIC:FindByName( Event.IniDCSUnitName )
Event.IniUnit = STATIC:FindByName( Event.IniDCSUnitName, false )
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
Event.IniCategory = Event.IniDCSUnit:getDesc().category
Event.IniTypeName = Event.IniDCSUnit:getTypeName()

View File

@@ -119,7 +119,6 @@
--- The POINT_VEC3 class
-- @type POINT_VEC3
-- @extends Core.Base#BASE
-- @field #number x The x coordinate in 3D space.
-- @field #number y The y coordinate in 3D space.
-- @field #number z The z coordiante in 3D space.
@@ -128,6 +127,7 @@
-- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
-- @field #POINT_VEC3.RoutePointType RoutePointType
-- @field #POINT_VEC3.RoutePointAction RoutePointAction
-- @extends Core.Base#BASE
POINT_VEC3 = {
ClassName = "POINT_VEC3",
Metric = true,
@@ -146,9 +146,9 @@ POINT_VEC3 = {
--- The POINT_VEC2 class
-- @type POINT_VEC2
-- @extends #POINT_VEC3
-- @field Dcs.DCSTypes#Distance x The x coordinate in meters.
-- @field Dcs.DCSTypes#Distance y the y coordinate in meters.
-- @extends Core.Point#POINT_VEC3
POINT_VEC2 = {
ClassName = "POINT_VEC2",
}

View File

@@ -171,7 +171,6 @@
-- ===
--
-- @module Zone
-- @author FlightControl
--- The ZONE_BASE class
@@ -327,6 +326,12 @@ function ZONE_BASE:GetBoundingSquare()
return nil
end
--- Bound the zone boundaries with a tires.
-- @param #ZONE_BASE self
function ZONE_BASE:BoundZone()
self:F2()
end
--- Smokes the zone boundaries in a color.
-- @param #ZONE_BASE self
@@ -387,7 +392,7 @@ ZONE_RADIUS = {
-- @param Dcs.DCSTypes#Distance Radius The radius of the zone.
-- @return #ZONE_RADIUS self
function ZONE_RADIUS:New( ZoneName, Vec2, Radius )
local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) )
local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) ) -- #ZONE_RADIUS
self:F( { ZoneName, Vec2, Radius } )
self.Radius = Radius
@@ -396,6 +401,48 @@ function ZONE_RADIUS:New( ZoneName, Vec2, Radius )
return self
end
--- Bounds the zone with tires.
-- @param #ZONE_RADIUS self
-- @param #number Points (optional) The amount of points in the circle.
-- @return #ZONE_RADIUS self
function ZONE_RADIUS:BoundZone( Points )
local Point = {}
local Vec2 = self:GetVec2()
Points = Points and Points or 360
local Angle
local RadialBase = math.pi*2
--
for Angle = 0, 360, (360 / Points ) do
local Radial = Angle * RadialBase / 360
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
local Tire = {
["country"] = "USA",
["category"] = "Fortifications",
["canCargo"] = false,
["shape_name"] = "H-tyre_B_WF",
["type"] = "Black_Tyre_WF",
--["unitId"] = Angle + 10000,
["y"] = Point.y,
["x"] = Point.x,
["name"] = string.format( "%s-Tire #%0d", self:GetName(), Angle ),
["heading"] = 0,
} -- end of ["group"]
self:E( Tire )
coalition.addStaticObject( country.id.USA, Tire )
end
return self
end
--- Smokes the zone boundaries in a color.
-- @param #ZONE_RADIUS self
-- @param Utilities.Utils#SMOKECOLOR SmokeColor The smoke color.
@@ -820,6 +867,52 @@ function ZONE_POLYGON_BASE:Flush()
return self
end
--- Smokes the zone boundaries in a color.
-- @param #ZONE_POLYGON_BASE self
-- @return #ZONE_POLYGON_BASE self
function ZONE_POLYGON_BASE:BoundZone( )
local i
local j
local Segments = 10
i = 1
j = #self.Polygon
while i <= #self.Polygon do
self:T( { i, j, self.Polygon[i], self.Polygon[j] } )
local DeltaX = self.Polygon[j].x - self.Polygon[i].x
local DeltaY = self.Polygon[j].y - self.Polygon[i].y
for Segment = 0, Segments do -- We divide each line in 5 segments and smoke a point on the line.
local PointX = self.Polygon[i].x + ( Segment * DeltaX / Segments )
local PointY = self.Polygon[i].y + ( Segment * DeltaY / Segments )
local Tire = {
["country"] = "USA",
["category"] = "Fortifications",
["canCargo"] = false,
["shape_name"] = "H-tyre_B_WF",
["type"] = "Black_Tyre_WF",
["y"] = PointY,
["x"] = PointX,
["name"] = string.format( "%s-Tire #%0d", self:GetName(), ((i - 1) * Segments) + Segment ),
["heading"] = 0,
} -- end of ["group"]
self:E( Tire )
coalition.addStaticObject( country.id.USA, Tire )
end
j = i
i = i + 1
end
return self
end
--- Smokes the zone boundaries in a color.
-- @param #ZONE_POLYGON_BASE self