mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Progress
- Removed the old classes and moved into an "Old" folder in the Moose/Development folder. -- Cleaned Moose.lua + Documented class types -- Cleaned Create_Moose.bat + Documented class types - Extend the ZONE_BASE class with a probability randomization factor, that can be used for zone randomization purposes. - Documented the Zone module classes. - Changed and removed the POINT_VEC3 SmokeColor and FlareColor structure. Replaced with SMOKECOLOR and FLARECOLOR types. -- Replaced also code in test missions with SMOKECOLOR and FLARECOLOR references. - Renamed UnControlled() method to InitUnControlled method.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
--- The main include file for the MOOSE system.
|
||||
|
||||
--- Core Routines
|
||||
Include.File( "Routines" )
|
||||
Include.File( "Utils" )
|
||||
|
||||
--- Core Classes
|
||||
Include.File( "Base" )
|
||||
Include.File( "Object" )
|
||||
Include.File( "Identifiable" )
|
||||
@@ -19,21 +22,11 @@ Include.File( "Airbase" )
|
||||
Include.File( "Database" )
|
||||
Include.File( "Set" )
|
||||
Include.File( "Point" )
|
||||
Include.File( "Moose" )
|
||||
Include.File( "Scoring" )
|
||||
|
||||
--- Functional Classes
|
||||
Include.File( "Cargo" )
|
||||
Include.File( "Message" )
|
||||
Include.File( "Stage" )
|
||||
Include.File( "Task" )
|
||||
Include.File( "GoHomeTask" )
|
||||
Include.File( "DestroyBaseTask" )
|
||||
Include.File( "DestroyGroupsTask" )
|
||||
Include.File( "DestroyRadarsTask" )
|
||||
Include.File( "DestroyUnitTypesTask" )
|
||||
Include.File( "PickupTask" )
|
||||
Include.File( "DeployTask" )
|
||||
Include.File( "NoTask" )
|
||||
Include.File( "RouteTask" )
|
||||
Include.File( "Mission" )
|
||||
Include.File( "CleanUp" )
|
||||
Include.File( "Spawn" )
|
||||
@@ -44,8 +37,9 @@ Include.File( "MissileTrainer" )
|
||||
Include.File( "PatrolZone" )
|
||||
Include.File( "AIBalancer" )
|
||||
Include.File( "AirbasePolice" )
|
||||
|
||||
Include.File( "Detection" )
|
||||
|
||||
--- Task Handling Classes
|
||||
Include.File( "DetectionManager" )
|
||||
|
||||
Include.File( "StateMachine" )
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
local Mission = MISSION:New( "Pickup Cargo", "High", "Test for Cargo Pickup", coalition.side.RED )
|
||||
|
||||
local CargoEngineer = UNIT:FindByName( "Engineer" )
|
||||
local InfantryCargo = CARGO_UNIT:New( Mission, CargoEngineer, "Engineer", "Engineer Sven", "81", 2000, 300 )
|
||||
|
||||
local CargoCarrier = UNIT:FindByName( "CargoCarrier" )
|
||||
InfantryCargo:OnBoard( CargoCarrier )
|
||||
@@ -35,25 +35,12 @@
|
||||
-- @field #number y The y coordinate in 3D space.
|
||||
-- @field #number z The z coordiante in 3D space.
|
||||
-- @field #POINT_VEC3.SmokeColor SmokeColor
|
||||
-- @field #POINT_VEC3.FlareColor FlareColor
|
||||
-- @field Utils#FLARECOLOR FlareColor
|
||||
-- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
|
||||
-- @field #POINT_VEC3.RoutePointType RoutePointType
|
||||
-- @field #POINT_VEC3.RoutePointAction RoutePointAction
|
||||
POINT_VEC3 = {
|
||||
ClassName = "POINT_VEC3",
|
||||
SmokeColor = {
|
||||
Green = trigger.smokeColor.Green,
|
||||
Red = trigger.smokeColor.Red,
|
||||
White = trigger.smokeColor.White,
|
||||
Orange = trigger.smokeColor.Orange,
|
||||
Blue = trigger.smokeColor.Blue
|
||||
},
|
||||
FlareColor = {
|
||||
Green = trigger.flareColor.Green,
|
||||
Red = trigger.flareColor.Red,
|
||||
White = trigger.flareColor.White,
|
||||
Yellow = trigger.flareColor.Yellow
|
||||
},
|
||||
Metric = true,
|
||||
RoutePointAltType = {
|
||||
BARO = "BARO",
|
||||
@@ -78,43 +65,18 @@ POINT_VEC2 = {
|
||||
|
||||
do -- POINT_VEC3
|
||||
|
||||
--- SmokeColor
|
||||
-- @type POINT_VEC3.SmokeColor
|
||||
-- @field Green
|
||||
-- @field Red
|
||||
-- @field White
|
||||
-- @field Orange
|
||||
-- @field Blue
|
||||
|
||||
|
||||
|
||||
--- FlareColor
|
||||
-- @type POINT_VEC3.FlareColor
|
||||
-- @field Green
|
||||
-- @field Red
|
||||
-- @field White
|
||||
-- @field Yellow
|
||||
|
||||
|
||||
|
||||
--- RoutePoint AltTypes
|
||||
-- @type POINT_VEC3.RoutePointAltType
|
||||
-- @field BARO "BARO"
|
||||
|
||||
|
||||
|
||||
--- RoutePoint Types
|
||||
-- @type POINT_VEC3.RoutePointType
|
||||
-- @field TurningPoint "Turning Point"
|
||||
|
||||
|
||||
|
||||
--- RoutePoint Actions
|
||||
-- @type POINT_VEC3.RoutePointAction
|
||||
-- @field TurningPoint "Turning Point"
|
||||
|
||||
|
||||
|
||||
-- Constructor.
|
||||
|
||||
--- Create a new POINT_VEC3 object.
|
||||
@@ -490,7 +452,7 @@ end
|
||||
|
||||
--- Smokes the point in a color.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param Point#POINT_VEC3.SmokeColor SmokeColor
|
||||
-- @param Utils#SMOKECOLOR SmokeColor
|
||||
function POINT_VEC3:Smoke( SmokeColor )
|
||||
self:F2( { SmokeColor } )
|
||||
trigger.action.smoke( self:GetVec3(), SmokeColor )
|
||||
@@ -500,40 +462,40 @@ end
|
||||
-- @param #POINT_VEC3 self
|
||||
function POINT_VEC3:SmokeGreen()
|
||||
self:F2()
|
||||
self:Smoke( POINT_VEC3.SmokeColor.Green )
|
||||
self:Smoke( SMOKECOLOR.Green )
|
||||
end
|
||||
|
||||
--- Smoke the POINT_VEC3 Red.
|
||||
-- @param #POINT_VEC3 self
|
||||
function POINT_VEC3:SmokeRed()
|
||||
self:F2()
|
||||
self:Smoke( POINT_VEC3.SmokeColor.Red )
|
||||
self:Smoke( SMOKECOLOR.Red )
|
||||
end
|
||||
|
||||
--- Smoke the POINT_VEC3 White.
|
||||
-- @param #POINT_VEC3 self
|
||||
function POINT_VEC3:SmokeWhite()
|
||||
self:F2()
|
||||
self:Smoke( POINT_VEC3.SmokeColor.White )
|
||||
self:Smoke( SMOKECOLOR.White )
|
||||
end
|
||||
|
||||
--- Smoke the POINT_VEC3 Orange.
|
||||
-- @param #POINT_VEC3 self
|
||||
function POINT_VEC3:SmokeOrange()
|
||||
self:F2()
|
||||
self:Smoke( POINT_VEC3.SmokeColor.Orange )
|
||||
self:Smoke( SMOKECOLOR.Orange )
|
||||
end
|
||||
|
||||
--- Smoke the POINT_VEC3 Blue.
|
||||
-- @param #POINT_VEC3 self
|
||||
function POINT_VEC3:SmokeBlue()
|
||||
self:F2()
|
||||
self:Smoke( POINT_VEC3.SmokeColor.Blue )
|
||||
self:Smoke( SMOKECOLOR.Blue )
|
||||
end
|
||||
|
||||
--- Flares the point in a color.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param Point#POINT_VEC3.FlareColor
|
||||
-- @param Utils#FLARECOLOR FlareColor
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:Flare( FlareColor, Azimuth )
|
||||
self:F2( { FlareColor } )
|
||||
@@ -545,7 +507,7 @@ end
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:FlareWhite( Azimuth )
|
||||
self:F2( Azimuth )
|
||||
self:Flare( POINT_VEC3.FlareColor.White, Azimuth )
|
||||
self:Flare( FLARECOLOR.White, Azimuth )
|
||||
end
|
||||
|
||||
--- Flare the POINT_VEC3 Yellow.
|
||||
@@ -553,7 +515,7 @@ end
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:FlareYellow( Azimuth )
|
||||
self:F2( Azimuth )
|
||||
self:Flare( POINT_VEC3.FlareColor.Yellow, Azimuth )
|
||||
self:Flare( FLARECOLOR.Yellow, Azimuth )
|
||||
end
|
||||
|
||||
--- Flare the POINT_VEC3 Green.
|
||||
@@ -561,14 +523,14 @@ end
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:FlareGreen( Azimuth )
|
||||
self:F2( Azimuth )
|
||||
self:Flare( POINT_VEC3.FlareColor.Green, Azimuth )
|
||||
self:Flare( FLARECOLOR.Green, Azimuth )
|
||||
end
|
||||
|
||||
--- Flare the POINT_VEC3 Red.
|
||||
-- @param #POINT_VEC3 self
|
||||
function POINT_VEC3:FlareRed( Azimuth )
|
||||
self:F2( Azimuth )
|
||||
self:Flare( POINT_VEC3.FlareColor.Red, Azimuth )
|
||||
self:Flare( FLARECOLOR.Red, Azimuth )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -218,13 +218,12 @@
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- ### Contributions:
|
||||
--
|
||||
-- * Mechanist : Concept & Testing
|
||||
--
|
||||
-- ### Authors:
|
||||
--
|
||||
-- * FlightControl : Design & Programming
|
||||
--
|
||||
-- ### Contributions:
|
||||
--
|
||||
--
|
||||
-- @module Set
|
||||
|
||||
|
||||
@@ -87,13 +87,25 @@
|
||||
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
|
||||
-- Check the @{#SPAWN.CleanUp} for further info.
|
||||
--
|
||||
-- 1.6) Call a function new GROUP is spawned.
|
||||
-- ------------------------------------------
|
||||
-- When using the SpawnScheduled class, new GROUPs are created following the schedule timing parameters.
|
||||
-- However, when a new GROUP is spawned, you maybe want to execute actions with that group spawned.
|
||||
-- To achieve this functionality, utilize the @{#SPAWN.OnSpawn}( **function( SpawnedGroup ) end ** ) method, which takes a function as a parameter that you can define locally at the
|
||||
-- OnSpawn() method utilization. Whenever a new GROUP is spawned, the function that is given as a parameter to OnSpawn() will be called.
|
||||
-- This function requires one parameter to be declared, containing the just spawned GROUP object. For an example, consult to function.
|
||||
-- 1.6) Catch the @{Group} Spawn event.
|
||||
-- ------------------------------------
|
||||
-- When using the SpawnScheduled method, new @{Group}s are created following the schedule timing parameters.
|
||||
-- When a new @{Group} is spawned, you maybe want to execute actions with that group spawned at the spawn event.
|
||||
-- To SPAWN class supports this functionality through the @{#SPAWN.OnSpawnGroup}( **function( SpawnedGroup ) end ** ) method, which takes a function as a parameter that you can define locally.
|
||||
-- Whenever a new @{Group} is spawned, the given function is called, and the @{Group} that was just spawned, is given as a parameter.
|
||||
-- As a result, your spawn event handling function requires one parameter to be declared, which will contain the spawned @{Group} object.
|
||||
-- A coding example is provided at the description of the @{#SPAWN.OnSpawnGroup}( **function( SpawnedGroup ) end ** ) method.
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- ### Contributions:
|
||||
--
|
||||
-- * Aaron:
|
||||
--
|
||||
-- ### Authors:
|
||||
--
|
||||
-- * FlightControl : Design & Programming
|
||||
--
|
||||
--
|
||||
-- @module Spawn
|
||||
-- @author FlightControl
|
||||
@@ -116,7 +128,7 @@ SPAWN = {
|
||||
|
||||
|
||||
|
||||
--- Creates the main object to spawn a GROUP defined in the DCS ME.
|
||||
--- Creates the main object to spawn a @{Group} defined in the DCS ME.
|
||||
-- @param #SPAWN 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 #SPAWN
|
||||
@@ -735,7 +747,7 @@ end
|
||||
-- The **first waypoint** (where the group is spawned) is replaced with the zone location coordinates.
|
||||
-- @param #SPAWN self
|
||||
-- @param Zone#ZONE Zone The zone where the group is to be spawned.
|
||||
-- @param #boolean RandomizeGroup (optional) Randomization of the @{GROUP} position in the zone.
|
||||
-- @param #boolean RandomizeGroup (optional) Randomization of the @{Group} position in the zone.
|
||||
-- @param #number SpawnIndex (optional) The index which group to spawn within the given zone.
|
||||
-- @return Group#GROUP that was spawned.
|
||||
-- @return #nil when nothing was spawned.
|
||||
@@ -753,13 +765,11 @@ function SPAWN:SpawnInZone( Zone, RandomizeGroup, SpawnIndex )
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--- Will spawn a plane group in uncontrolled mode...
|
||||
--- (AIR) Will spawn a plane group in uncontrolled mode...
|
||||
-- This will be similar to the uncontrolled flag setting in the ME.
|
||||
-- @param #SPAWN self
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:UnControlled()
|
||||
function SPAWN:InitUnControlled()
|
||||
self:F( { self.SpawnTemplatePrefix } )
|
||||
|
||||
self.SpawnUnControlled = true
|
||||
@@ -796,12 +806,12 @@ function SPAWN:SpawnGroupName( SpawnIndex )
|
||||
|
||||
end
|
||||
|
||||
--- Will find the first alive GROUP it has spawned, and return the alive GROUP object and the first Index where the first alive GROUP object has been found.
|
||||
--- Will find the first alive @{Group} it has spawned, and return the alive @{Group} object and the first Index where the first alive @{Group} object has been found.
|
||||
-- @param #SPAWN self
|
||||
-- @return Group#GROUP, #number The GROUP object found, the new Index where the group was found.
|
||||
-- @return Group#GROUP, #number The @{Group} object found, the new Index where the group was found.
|
||||
-- @return #nil, #nil When no group is found, #nil is returned.
|
||||
-- @usage
|
||||
-- -- Find the first alive GROUP object of the SpawnPlanes SPAWN object GROUP collection that it has spawned during the mission.
|
||||
-- -- Find the first alive @{Group} object of the SpawnPlanes SPAWN object @{Group} collection that it has spawned during the mission.
|
||||
-- local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
|
||||
-- while GroupPlane ~= nil do
|
||||
-- -- Do actions with the GroupPlane object.
|
||||
@@ -821,13 +831,13 @@ function SPAWN:GetFirstAliveGroup()
|
||||
end
|
||||
|
||||
|
||||
--- Will find the next alive GROUP object from a given Index, and return a reference to the alive GROUP object and the next Index where the alive GROUP has been found.
|
||||
--- Will find the next alive @{Group} object from a given Index, and return a reference to the alive @{Group} object and the next Index where the alive @{Group} has been found.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number SpawnIndexStart A Index holding the start position to search from. This function can also be used to find the first alive GROUP object from the given Index.
|
||||
-- @return Group#GROUP, #number The next alive GROUP object found, the next Index where the next alive GROUP object was found.
|
||||
-- @return #nil, #nil When no alive GROUP object is found from the start Index position, #nil is returned.
|
||||
-- @param #number SpawnIndexStart A Index holding the start position to search from. This function can also be used to find the first alive @{Group} object from the given Index.
|
||||
-- @return Group#GROUP, #number The next alive @{Group} object found, the next Index where the next alive @{Group} object was found.
|
||||
-- @return #nil, #nil When no alive @{Group} object is found from the start Index position, #nil is returned.
|
||||
-- @usage
|
||||
-- -- Find the first alive GROUP object of the SpawnPlanes SPAWN object GROUP collection that it has spawned during the mission.
|
||||
-- -- Find the first alive @{Group} object of the SpawnPlanes SPAWN object @{Group} collection that it has spawned during the mission.
|
||||
-- local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
|
||||
-- while GroupPlane ~= nil do
|
||||
-- -- Do actions with the GroupPlane object.
|
||||
@@ -847,12 +857,12 @@ function SPAWN:GetNextAliveGroup( SpawnIndexStart )
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
--- Will find the last alive GROUP object, and will return a reference to the last live GROUP object and the last Index where the last alive GROUP object has been found.
|
||||
--- Will find the last alive @{Group} object, and will return a reference to the last live @{Group} object and the last Index where the last alive @{Group} object has been found.
|
||||
-- @param #SPAWN self
|
||||
-- @return Group#GROUP, #number The last alive GROUP object found, the last Index where the last alive GROUP object was found.
|
||||
-- @return #nil, #nil When no alive GROUP object is found, #nil is returned.
|
||||
-- @return Group#GROUP, #number The last alive @{Group} object found, the last Index where the last alive @{Group} object was found.
|
||||
-- @return #nil, #nil When no alive @{Group} object is found, #nil is returned.
|
||||
-- @usage
|
||||
-- -- Find the last alive GROUP object of the SpawnPlanes SPAWN object GROUP collection that it has spawned during the mission.
|
||||
-- -- Find the last alive @{Group} object of the SpawnPlanes SPAWN object @{Group} collection that it has spawned during the mission.
|
||||
-- local GroupPlane, Index = SpawnPlanes:GetLastAliveGroup()
|
||||
-- if GroupPlane then -- GroupPlane can be nil!!!
|
||||
-- -- Do actions with the GroupPlane object.
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
--- This module contains derived utilities taken from the MIST framework,
|
||||
-- which are excellent tools to be reused in an OO environment!.
|
||||
--
|
||||
-- ### Authors:
|
||||
--
|
||||
-- * Grimes : Design & Programming of the MIST framework.
|
||||
--
|
||||
-- ### Contributions:
|
||||
--
|
||||
-- * FlightControl : Rework to OO framework
|
||||
--
|
||||
-- @module Utils
|
||||
|
||||
|
||||
--- @type SMOKECOLOR
|
||||
-- @field Green
|
||||
|
||||
@@ -22,46 +22,94 @@
|
||||
-- * @{Zone#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius.
|
||||
-- * @{Zone#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
|
||||
--
|
||||
-- Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
|
||||
--
|
||||
-- * @{#ZONE_BASE.IsPointVec2InZone}: Returns if a location is within the zone.
|
||||
-- * @{#ZONE_BASE.IsPointVec3InZone}: Returns if a point is within the zone.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
|
||||
-- ================================================
|
||||
-- The ZONE_BASE class defining the base for all other zone classes.
|
||||
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
|
||||
--
|
||||
-- ### 1.1) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
|
||||
--
|
||||
-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
|
||||
-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
|
||||
--
|
||||
-- ### 1.2) A zone has a probability factor that can be set to randomize a selection between zones:
|
||||
--
|
||||
-- * @{#ZONE_BASE.SetRandomizeProbability}(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% )
|
||||
-- * @{#ZONE_BASE.GetRandomizeProbability}(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% )
|
||||
-- * @{#ZONE_BASE.GetZoneRandomize}(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate.
|
||||
--
|
||||
-- ### 1.3) A zone manages Vectors:
|
||||
--
|
||||
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone.
|
||||
-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
|
||||
--
|
||||
-- ### 1.4) A zone has a bounding square:
|
||||
--
|
||||
-- * @{#ZONE_BASE.GetBoundingSquare}(): Get the outer most bounding square of the zone.
|
||||
--
|
||||
-- ### 1.5) A zone can be marked:
|
||||
--
|
||||
-- * @{#ZONE_BASE.SmokeZone}(): Smokes the zone boundaries in a color.
|
||||
-- * @{#ZONE_BASE.FlareZone}(): Flares the zone boundaries in a color.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
|
||||
-- =======================================================
|
||||
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
|
||||
-- This class implements the inherited functions from Zone#ZONE_BASE taking into account the own zone format and properties.
|
||||
--
|
||||
-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
|
||||
--
|
||||
-- * @{#ZONE_BASE.New}(): Constructor.
|
||||
--
|
||||
-- ### 2.2) Manage the radius of the zone:
|
||||
--
|
||||
-- * @{#ZONE_BASE.SetRadius}(): Sets the radius of the zone.
|
||||
-- * @{#ZONE_BASE.GetRadius}(): Returns the radius of the zone.
|
||||
--
|
||||
-- ### 2.3) Manage the location of the zone:
|
||||
--
|
||||
-- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
|
||||
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
|
||||
-- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
|
||||
-- ==========================================
|
||||
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
|
||||
-- This class implements the inherited functions from {Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
|
||||
-- =======================================================
|
||||
-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
|
||||
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
|
||||
-- =======================================================
|
||||
-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
|
||||
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 6) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_BASE}
|
||||
-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
|
||||
-- ========================================================
|
||||
-- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
|
||||
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
|
||||
-- ================================================================
|
||||
-- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
|
||||
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -72,9 +120,12 @@
|
||||
--- The ZONE_BASE class
|
||||
-- @type ZONE_BASE
|
||||
-- @field #string ZoneName Name of the zone.
|
||||
-- @field #number RandomizationProbability A value between 0 and 1. 0 = 0% and 1 = 100% probability.
|
||||
-- @extends Base#BASE
|
||||
ZONE_BASE = {
|
||||
ClassName = "ZONE_BASE",
|
||||
ZoneName = "",
|
||||
RandomizationProbability = 1,
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +172,7 @@ function ZONE_BASE:IsPointVec3InZone( Vec3 )
|
||||
return InZone
|
||||
end
|
||||
|
||||
--- Returns the Vec2 coordinate of the zone.
|
||||
--- Returns the @{DCSTypes#Vec2} coordinate of the zone.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @return #nil.
|
||||
function ZONE_BASE:GetVec2()
|
||||
@@ -153,6 +204,39 @@ function ZONE_BASE:SmokeZone( SmokeColor )
|
||||
|
||||
end
|
||||
|
||||
--- Set the randomization probability of a zone to be selected.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @param RandomizationProbability A value between 0 and 1. 0 = 0% and 1 = 100% probability.
|
||||
function ZONE_BASE:SetRandomizationProbability( RandomizationProbability )
|
||||
self:F2( RandomizationProbability )
|
||||
|
||||
self.RandomizationProbability = RandomizationProbability or 1
|
||||
end
|
||||
|
||||
--- Get the randomization probability of a zone to be selected.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @return #number A value between 0 and 1. 0 = 0% and 1 = 100% probability.
|
||||
function ZONE_BASE:GetRandomizationProbability()
|
||||
self:F2()
|
||||
|
||||
return self.RandomizationProbability
|
||||
end
|
||||
|
||||
--- Get the zone taking into account the randomization probability of a zone to be selected.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @return #ZONE_BASE The zone is selected taking into account the randomization probability factor.
|
||||
-- @return #nil The zone is not selected taking into account the randomization probability factor.
|
||||
function ZONE_BASE:GetZoneRandomized()
|
||||
self:F2()
|
||||
|
||||
local Randomization = math.random()
|
||||
if Randomization <= self.RandomizationProbability then
|
||||
return self
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- The ZONE_RADIUS class, defined by a zone name, a location and a radius.
|
||||
-- @type ZONE_RADIUS
|
||||
@@ -163,7 +247,7 @@ ZONE_RADIUS = {
|
||||
ClassName="ZONE_RADIUS",
|
||||
}
|
||||
|
||||
--- Constructor of ZONE_RADIUS, taking the zone name, the zone location and a radius.
|
||||
--- Constructor of @{#ZONE_RADIUS}, taking the zone name, the zone location and a radius.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param #string ZoneName Name of the zone.
|
||||
-- @param DCSTypes#Vec2 Vec2 The location of the zone.
|
||||
@@ -208,7 +292,7 @@ end
|
||||
|
||||
--- Flares the zone boundaries in a color.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param #POINT_VEC3.FlareColor FlareColor The flare color.
|
||||
-- @param Utils#FLARECOLOR FlareColor The flare color.
|
||||
-- @param #number Points (optional) The amount of points in the circle.
|
||||
-- @param DCSTypes#Azimuth Azimuth (optional) Azimuth The azimuth of the flare.
|
||||
-- @return #ZONE_RADIUS self
|
||||
@@ -257,7 +341,7 @@ function ZONE_RADIUS:SetRadius( Radius )
|
||||
return self.Radius
|
||||
end
|
||||
|
||||
--- Returns the location of the zone.
|
||||
--- Returns the @{DCSTypes#Vec2} of the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @return DCSTypes#Vec2 The location of the zone.
|
||||
function ZONE_RADIUS:GetVec2()
|
||||
@@ -268,11 +352,11 @@ function ZONE_RADIUS:GetVec2()
|
||||
return self.Vec2
|
||||
end
|
||||
|
||||
--- Sets the location of the zone.
|
||||
--- Sets the @{DCSTypes#Vec2} of the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param DCSTypes#Vec2 Vec2 The new location of the zone.
|
||||
-- @return DCSTypes#Vec2 The new location of the zone.
|
||||
function ZONE_RADIUS:SetPointVec2( Vec2 )
|
||||
function ZONE_RADIUS:SetVec2( Vec2 )
|
||||
self:F2( self.ZoneName )
|
||||
|
||||
self.Vec2 = Vec2
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
2016-08-15
|
||||
|
||||
- Removed the old classes and moved into an "Old" folder in the Moose/Development folder.
|
||||
-- Cleaned Moose.lua + Documented class types
|
||||
-- Cleaned Create_Moose.bat + Documented class types
|
||||
|
||||
- Extend the ZONE_BASE class with a probability randomization factor, that can be used for zone randomization purposes.
|
||||
|
||||
- Documented the Zone module classes.
|
||||
|
||||
- Changed and removed the POINT_VEC3 SmokeColor and FlareColor structure. Replaced with SMOKECOLOR and FLARECOLOR types.
|
||||
-- Replaced also code in test missions with SMOKECOLOR and FLARECOLOR references.
|
||||
|
||||
|
||||
2016-08-14
|
||||
|
||||
- Changed Spawn APIs to express Group position and Unit position randomization.
|
||||
@@ -26,6 +40,8 @@
|
||||
|
||||
- Renamed RandomizeTemplate() method to InitRandomizeTemplate() method.
|
||||
|
||||
- Renamed UnControlled() method to InitUnControlled method.
|
||||
|
||||
- Reviewed all test missions for the changes executed and made adaptions where necessary + re-tests.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user