Optimizations

* Added ZONE_POLYGON:NewFromGroupName() to ease the syntax.
* Renamed Functional.Spawn#SPAWN to Core.Spawn#SPAWN
This commit is contained in:
FlightControl_Master 2017-10-10 21:32:59 +02:00
parent 5ee9633dc6
commit da476b29a6
8 changed files with 31 additions and 12 deletions

View File

@ -2610,7 +2610,7 @@ do -- AI_A2A_DISPATCHER
if Cap then
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Functional.Spawn#SPAWN
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Core.Spawn#SPAWN
local DefenderGrouping = DefenderSquadron.Grouping or self.DefenderDefault.Grouping
Spawn:InitGrouping( DefenderGrouping )
@ -2783,7 +2783,7 @@ do -- AI_A2A_DISPATCHER
while ( DefendersNeeded > 0 ) do
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Functional.Spawn#SPAWN
local Spawn = DefenderSquadron.Spawn[ math.random( 1, #DefenderSquadron.Spawn ) ] -- Core.Spawn#SPAWN
local DefenderGrouping = ( DefenderGrouping < DefendersNeeded ) and DefenderGrouping or DefendersNeeded
if DefenderGrouping then
Spawn:InitGrouping( DefenderGrouping )

View File

@ -33,7 +33,7 @@
--- @type AI_BALANCER
-- @field Core.Set#SET_CLIENT SetClient
-- @field Functional.Spawn#SPAWN SpawnAI
-- @field Core.Spawn#SPAWN SpawnAI
-- @field Wrapper.Group#GROUP Test
-- @extends Core.Fsm#FSM_SET
@ -106,7 +106,7 @@ AI_BALANCER = {
--- Creates a new AI_BALANCER object
-- @param #AI_BALANCER self
-- @param Core.Set#SET_CLIENT SetClient A SET\_CLIENT object that will contain the CLIENT objects to be monitored if they are alive or not (joined by a player).
-- @param Functional.Spawn#SPAWN SpawnAI The default Spawn object to spawn new AI Groups when needed.
-- @param Core.Spawn#SPAWN SpawnAI The default Spawn object to spawn new AI Groups when needed.
-- @return #AI_BALANCER
function AI_BALANCER:New( SetClient, SpawnAI )

View File

@ -47,7 +47,7 @@
-- @field Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @field Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
-- @field Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
-- @field Functional.Spawn#SPAWN CoordTest
-- @field Core.Spawn#SPAWN CoordTest
-- @extends Core.Fsm#FSM_CONTROLLABLE
--- # AI_PATROL_ZONE class, extends @{Fsm#FSM_CONTROLLABLE}

View File

@ -1354,7 +1354,7 @@ ZONE_POLYGON = {
ClassName="ZONE_POLYGON",
}
--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Group#GROUP} defined within the Mission Editor.
--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the @{Group#GROUP} defined within the Mission Editor.
-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
-- @param #ZONE_POLYGON self
-- @param #string ZoneName Name of the zone.
@ -1370,3 +1370,22 @@ function ZONE_POLYGON:New( ZoneName, ZoneGroup )
return self
end
--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the **name** of the @{Group#GROUP} defined within the Mission Editor.
-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
-- @param #ZONE_POLYGON self
-- @param #string ZoneName Name of the zone.
-- @param #string GroupName The group name of the GROUP defining the waypoints within the Mission Editor to define the polygon shape.
-- @return #ZONE_POLYGON self
function ZONE_POLYGON:NewFromGroupName( ZoneName, GroupName )
local ZoneGroup = GROUP:FindByName( GroupName )
local GroupPoints = ZoneGroup:GetTaskRoute()
local self = BASE:Inherit( self, ZONE_POLYGON_BASE:New( ZoneName, GroupPoints ) )
self:F( { ZoneName, ZoneGroup, self._.Polygon } )
return self
end

View File

@ -112,7 +112,7 @@
-- @field #string livery Livery of the aircraft set by user.
-- @field #string skill Skill of AI.
-- @field #boolean ATCswitch Enable/disable ATC if set to true/false.
-- @extends Functional.Spawn#SPAWN
-- @extends Core.Spawn#SPAWN
---# RAT class, extends @{Spawn#SPAWN}
-- The RAT class implements an easy to use way to randomly fill your map with AI aircraft.

View File

@ -17,6 +17,7 @@ Core/Point.lua
Core/Message.lua
Core/Fsm.lua
Core/Radio.lua
Core/Spawn.lua
Core/SpawnStatic.lua
Core/Goal.lua
Core/Cargo.lua
@ -35,7 +36,6 @@ Wrapper/Scenery.lua
Functional/Scoring.lua
Functional/CleanUp.lua
Functional/Spawn.lua
Functional/Movement.lua
Functional/Sead.lua
Functional/Escort.lua

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20171010_1107' )
env.info( 'Moose Generation Timestamp: 20171010_2132' )
local base = _G
@ -39,6 +39,7 @@ __Moose.Include( 'Core/Point.lua' )
__Moose.Include( 'Core/Message.lua' )
__Moose.Include( 'Core/Fsm.lua' )
__Moose.Include( 'Core/Radio.lua' )
__Moose.Include( 'Core/Spawn.lua' )
__Moose.Include( 'Core/SpawnStatic.lua' )
__Moose.Include( 'Core/Goal.lua' )
__Moose.Include( 'Core/Cargo.lua' )
@ -55,7 +56,6 @@ __Moose.Include( 'Wrapper/Airbase.lua' )
__Moose.Include( 'Wrapper/Scenery.lua' )
__Moose.Include( 'Functional/Scoring.lua' )
__Moose.Include( 'Functional/CleanUp.lua' )
__Moose.Include( 'Functional/Spawn.lua' )
__Moose.Include( 'Functional/Movement.lua' )
__Moose.Include( 'Functional/Sead.lua' )
__Moose.Include( 'Functional/Escort.lua' )

View File

@ -1,5 +1,5 @@
env.info('*** MOOSE DYNAMIC INCLUDE START *** ')
env.info('Moose Generation Timestamp: 20171010_1107')
env.info('Moose Generation Timestamp: 20171010_2132')
local base=_G
__Moose={}
__Moose.Include=function(IncludeFile)
@ -34,6 +34,7 @@ __Moose.Include('Core/Point.lua')
__Moose.Include('Core/Message.lua')
__Moose.Include('Core/Fsm.lua')
__Moose.Include('Core/Radio.lua')
__Moose.Include('Core/Spawn.lua')
__Moose.Include('Core/SpawnStatic.lua')
__Moose.Include('Core/Goal.lua')
__Moose.Include('Core/Cargo.lua')
@ -50,7 +51,6 @@ __Moose.Include('Wrapper/Airbase.lua')
__Moose.Include('Wrapper/Scenery.lua')
__Moose.Include('Functional/Scoring.lua')
__Moose.Include('Functional/CleanUp.lua')
__Moose.Include('Functional/Spawn.lua')
__Moose.Include('Functional/Movement.lua')
__Moose.Include('Functional/Sead.lua')
__Moose.Include('Functional/Escort.lua')