Merge branch 'master' into issue437

This commit is contained in:
Grey-Echo
2017-04-22 15:21:43 +02:00
23 changed files with 1056 additions and 240 deletions

View File

@@ -1,4 +1,4 @@
--- **Core** -- Management of CARGO logistics, that can be transported from and to transportation carriers.
--- **(R2.1) Core** -- Management of CARGO logistics, that can be transported from and to transportation carriers.
--
-- ![Banner Image](..\Presentations\CARGO\Dia1.JPG)
--
@@ -165,7 +165,7 @@ do -- CARGO
-- @field #boolean Representable This flag defines if the cargo can be represented by a DCS Unit.
-- @field #boolean Containable This flag defines if the cargo can be contained within a DCS Unit.
--- # CARGO class, extends @{Fsm#FSM_PROCESS}
--- # (R2.1) CARGO class, extends @{Fsm#FSM_PROCESS}
--
-- The CARGO class defines the core functions that defines a cargo object within MOOSE.
-- A cargo is a logical object defined that is available for transport, and has a life status within a simulation.
@@ -224,7 +224,7 @@ do -- CARGO
-- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
--- CARGO Constructor. This class is an abstract class and should not be instantiated.
--- (R2.1) CARGO Constructor. This class is an abstract class and should not be instantiated.
-- @param #CARGO self
-- @param #string Type
-- @param #string Name
@@ -266,7 +266,7 @@ function CARGO:New( Type, Name, Weight )
return self
end
--- Get the name of the Cargo.
--- (R2.1) Get the name of the Cargo.
-- @param #CARGO self
-- @return #string The name of the Cargo.
function CARGO:GetName()

View File

@@ -789,6 +789,25 @@ function POINT_VEC3:FlareRed( Azimuth )
self:Flare( FLARECOLOR.Red, Azimuth )
end
--- (R2.1) Returns if a PointVec3 has Line of Sight (LOS) with the ToPointVec3.
-- @param #POINT_VEC3 self
-- @param #POINT_VEC3 ToPointVec3
-- @return #boolean true If the ToPointVec3 has LOS with the PointVec3, otherwise false.
function POINT_VEC3:IsLOS( ToPointVec3 )
-- Measurement of visibility should not be from the ground, so Adding a hypotethical 2 meters to each PointVec3.
local FromVec3 = self:GetVec3()
FromVec3.y = FromVec3.y + 2
local ToVec3 = ToPointVec3:GetVec3()
ToVec3.y = ToVec3.y + 2
local IsLOS = land.isVisible( FromVec3, ToVec3 )
return IsLOS
end
end
do -- POINT_VEC2

View File

@@ -2619,7 +2619,7 @@ end
--- @type SET_CARGO
-- @extends Core.Set#SET_BASE
--- # SET_CARGO class, extends @{Set#SET_BASE}
--- # (R2.1) SET_CARGO class, extends @{Set#SET_BASE}
--
-- Mission designers can use the @{Set#SET_CARGO} class to build sets of cargos optionally belonging to certain:
--
@@ -2681,7 +2681,7 @@ SET_CARGO = {
}
--- Creates a new SET_CARGO object, building a set of cargos belonging to a coalitions and categories.
--- (R2.1) Creates a new SET_CARGO object, building a set of cargos belonging to a coalitions and categories.
-- @param #SET_CARGO self
-- @return #SET_CARGO self
-- @usage
@@ -2694,7 +2694,7 @@ function SET_CARGO:New()
return self
end
--- Add CARGOs to SET_CARGO.
--- (R2.1) Add CARGOs to SET_CARGO.
-- @param Core.Set#SET_CARGO self
-- @param #string AddCargoNames A single name or an array of CARGO names.
-- @return self
@@ -2709,7 +2709,7 @@ function SET_CARGO:AddCargosByName( AddCargoNames )
return self
end
--- Remove CARGOs from SET_CARGO.
--- (R2.1) Remove CARGOs from SET_CARGO.
-- @param Core.Set#SET_CARGO self
-- @param Wrapper.Cargo#CARGO RemoveCargoNames A single name or an array of CARGO names.
-- @return self
@@ -2725,7 +2725,7 @@ function SET_CARGO:RemoveCargosByName( RemoveCargoNames )
end
--- Finds a Cargo based on the Cargo Name.
--- (R2.1) Finds a Cargo based on the Cargo Name.
-- @param #SET_CARGO self
-- @param #string CargoName
-- @return Wrapper.Cargo#CARGO The found Cargo.
@@ -2737,7 +2737,7 @@ end
--- Builds a set of cargos of coalitions.
--- (R2.1) Builds a set of cargos of coalitions.
-- Possible current coalitions are red, blue and neutral.
-- @param #SET_CARGO self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
@@ -2755,7 +2755,7 @@ function SET_CARGO:FilterCoalitions( Coalitions )
return self
end
--- Builds a set of cargos of defined cargo types.
--- (R2.1) Builds a set of cargos of defined cargo types.
-- Possible current types are those types known within DCS world.
-- @param #SET_CARGO self
-- @param #string Types Can take those type strings known within DCS world.
@@ -2774,7 +2774,7 @@ function SET_CARGO:FilterTypes( Types )
end
--- Builds a set of cargos of defined countries.
--- (R2.1) Builds a set of cargos of defined countries.
-- Possible current countries are those known within DCS world.
-- @param #SET_CARGO self
-- @param #string Countries Can take those country strings known within DCS world.
@@ -2793,7 +2793,7 @@ function SET_CARGO:FilterCountries( Countries )
end
--- Builds a set of cargos of defined cargo prefixes.
--- (R2.1) Builds a set of cargos of defined cargo prefixes.
-- All the cargos starting with the given prefixes will be included within the set.
-- @param #SET_CARGO self
-- @param #string Prefixes The prefix of which the cargo name starts with.
@@ -2813,7 +2813,7 @@ end
--- Starts the filtering.
--- (R2.1) Starts the filtering.
-- @param #SET_CARGO self
-- @return #SET_CARGO self
function SET_CARGO:FilterStart()
@@ -2829,7 +2829,7 @@ function SET_CARGO:FilterStart()
end
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
--- (R2.1) Handles the Database to check on an event (birth) that the Object was added in the Database.
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
-- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA Event
@@ -2841,7 +2841,7 @@ function SET_CARGO:AddInDatabase( Event )
return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName]
end
--- Handles the Database to check on any event that Object exists in the Database.
--- (R2.1) Handles the Database to check on any event that Object exists in the Database.
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
-- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA Event
@@ -2853,7 +2853,7 @@ function SET_CARGO:FindInDatabase( Event )
return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName]
end
--- Iterate the SET_CARGO and call an interator function for each CARGO, providing the CARGO and optional parameters.
--- (R2.1) Iterate the SET_CARGO and call an interator function for each CARGO, providing the CARGO and optional parameters.
-- @param #SET_CARGO self
-- @param #function IteratorFunction The function that will be called when there is an alive CARGO in the SET_CARGO. The function needs to accept a CARGO parameter.
-- @return #SET_CARGO self
@@ -2865,7 +2865,7 @@ function SET_CARGO:ForEachCargo( IteratorFunction, ... )
return self
end
--- Iterate the SET_CARGO while identifying the nearest @{Cargo#CARGO} from a @{Point#POINT_VEC2}.
--- (R2.1) Iterate the SET_CARGO while identifying the nearest @{Cargo#CARGO} from a @{Point#POINT_VEC2}.
-- @param #SET_CARGO self
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest @{Cargo#CARGO}.
-- @return Wrapper.Cargo#CARGO The closest @{Cargo#CARGO}.
@@ -2878,7 +2878,7 @@ end
---
--- (R2.1)
-- @param #SET_CARGO self
-- @param AI.AI_Cargo#AI_CARGO MCargo
-- @return #SET_CARGO self
@@ -2932,7 +2932,7 @@ function SET_CARGO:IsIncludeObject( MCargo )
return MCargoInclude
end
--- Handles the OnEventNewCargo event for the Set.
--- (R2.1) Handles the OnEventNewCargo event for the Set.
-- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA EventData
function SET_CARGO:OnEventNewCargo( EventData )
@@ -2944,7 +2944,7 @@ function SET_CARGO:OnEventNewCargo( EventData )
end
end
--- Handles the OnDead or OnCrash event for alive units set.
--- (R2.1) Handles the OnDead or OnCrash event for alive units set.
-- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA EventData
function SET_CARGO:OnEventDeleteCargo( EventData )

View File

@@ -1,4 +1,4 @@
--- **Core** -- Spawn dynamically new STATICs in your missions.
--- (R2.1) **Core** -- Spawn dynamically new STATICs in your missions.
--
-- ![Banner Image](..\Presentations\SPAWNSTATIC\Dia1.JPG)
--
@@ -91,7 +91,7 @@ SPAWNSTATIC = {
-- @list <Core.Zone#ZONE_BASE> SpawnZone
--- Creates the main object to spawn a @{Static} defined in the ME.
--- (R2.1) Creates the main object to spawn a @{Static} defined in the ME.
-- @param #SPAWNSTATIC self
-- @param #string SpawnTemplatePrefix is the name of the Group in the ME that defines the Template. Each new group will have the name starting with SpawnTemplatePrefix.
-- @return #SPAWNSTATIC
@@ -113,7 +113,7 @@ function SPAWNSTATIC:NewFromStatic( SpawnTemplatePrefix, CountryID )
return self
end
--- Creates the main object to spawn a @{Static} based on a type name.
--- (R2.1) Creates the main object to spawn a @{Static} based on a type name.
-- @param #SPAWNSTATIC self
-- @param #string SpawnTypeName is the name of the type.
-- @return #SPAWNSTATIC
@@ -131,7 +131,7 @@ function SPAWNSTATIC:NewFromType( SpawnTypeName, SpawnShapeName, SpawnCategory,
end
--- Creates a new @{Static} from a POINT_VEC2.
--- (R2.1) Creates a new @{Static} from a POINT_VEC2.
-- @param #SPAWNSTATIC self
-- @param Core.Point#POINT_VEC2 PointVec2 The 2D coordinate where to spawn the static.
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
@@ -161,7 +161,7 @@ function SPAWNSTATIC:SpawnFromPointVec2( PointVec2, Heading, NewName )
return Static
end
--- Creates a new @{Static} from a @{Zone}.
--- (R2.1) Creates a new @{Static} from a @{Zone}.
-- @param #SPAWNSTATIC self
-- @param Core.Zone#ZONE_BASE Zone The Zone where to spawn the static.
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.

View File

@@ -50,7 +50,7 @@ do
function SPOT:New( Recce )
local self = BASE:Inherit( self, FSM:New() ) -- #SPOT
self:F( { Type, Name, Weight } )
self:F( {} )
self:SetStartState( "Off" )
self:AddTransition( "Off", "LaseOn", "On" )
@@ -82,7 +82,7 @@ do
self:AddTransition( "On", "Lasing", "On" )
self:AddTransition( "On" , "LaseOff", "Off" )
self:AddTransition( { "On", "Destroyed" } , "LaseOff", "Off" )
--- LaseOff Handler OnBefore for SPOT
-- @function [parent=#SPOT] OnBeforeLaseOff
@@ -108,6 +108,32 @@ do
-- @param #SPOT self
-- @param #number Delay
self:AddTransition( "*" , "Destroyed", "Destroyed" )
--- Destroyed Handler OnBefore for SPOT
-- @function [parent=#SPOT] OnBeforeDestroyed
-- @param #SPOT self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @return #boolean
--- Destroyed Handler OnAfter for SPOT
-- @function [parent=#SPOT] OnAfterDestroyed
-- @param #SPOT self
-- @param #string From
-- @param #string Event
-- @param #string To
--- Destroyed Trigger for SPOT
-- @function [parent=#SPOT] Destroyed
-- @param #SPOT self
--- Destroyed Asynchronous Trigger for SPOT
-- @function [parent=#SPOT] __Destroyed
-- @param #SPOT self
-- @param #number Delay
self.Recce = Recce
@@ -127,6 +153,7 @@ do
-- @param #number LaserCode
-- @param #number Duration
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
self:E( { "LaseOn", Target, LaserCode, Duration } )
local function StopLase( self )
self:LaseOff()
@@ -137,8 +164,8 @@ do
local RecceDcsUnit = self.Recce:GetDCSObject()
self.Spot = Spot.createInfraRed( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3() )
self.Spot = Spot.createLaser( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3(), LaserCode )
self.SpotIR = Spot.createInfraRed( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3() )
self.SpotLaser = Spot.createLaser( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3(), LaserCode )
if Duration then
self.ScheduleID = self.LaseScheduler:Schedule( self, StopLase, {self}, Duration )
@@ -148,14 +175,16 @@ do
self:__Lasing( -0.2 )
end
--- @param #SPOT self
-- @param Core.Event#EVENTDATA EventData
function SPOT:OnEventDead(EventData)
self:E( { Dead = EventData.IniDCSUnitName, Target = self.Target } )
if self.Target then
if EventData.IniDCSUnitName == self.Target:GetName() then
self:E( {"Target dead ", self.Target:GetName() } )
self:__LaseOff( 0.1 )
self:Destroyed()
self:LaseOff( 0.1 )
end
end
end
@@ -167,10 +196,11 @@ do
function SPOT:onafterLasing( From, Event, To )
if self.Target:IsAlive() then
self.Spot:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self:__Lasing( -0.2 )
else
self:__LaseOff( 0.2 )
self:E( { "Target is not alive", self.Target:IsAlive() } )
end
end
@@ -182,9 +212,14 @@ do
-- @return #SPOT
function SPOT:onafterLaseOff( From, Event, To )
self:E( {"Stopped lasing for ", self.Target:GetName() } )
self.Spot:destroy()
self.Spot = nil
self:E( {"Stopped lasing for ", self.Target:GetName() , SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
self.SpotIR:destroy()
self.SpotLaser:destroy()
self.SpotIR = nil
self.SpotLaser = nil
if self.ScheduleID then
self.LaseScheduler:Stop(self.ScheduleID)
end
@@ -203,7 +238,7 @@ do
local Lasing = false
if self.Spot then
if self.SpotIR then
Lasing = true
end