From 8e5af4ada4ddb3c2caa0717d497baebd50098a94 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 1 Jul 2017 12:32:44 +0200 Subject: [PATCH 01/11] New implementations of inheritance of private - public methods .... This is a big improvement for many! --- Moose Development/Moose/Core/Base.lua | 93 ++-- .../Moose/Functional/CleanUp.lua | 182 ++++--- .../Moose/Wrapper/Positionable.lua | 6 +- Moose Development/Moose/Wrapper/Unit.lua | 4 +- docs/Documentation/AI_A2A.html | 1 + docs/Documentation/Base.html | 63 +-- docs/Documentation/Cargo.html | 1 - docs/Documentation/CleanUp.html | 451 ++++++++++-------- docs/Documentation/Detection.html | 2 +- docs/Documentation/Fsm.html | 3 +- docs/Documentation/Positionable.html | 24 +- docs/Documentation/Spawn.html | 23 - docs/Documentation/SpawnStatic.html | 1 + docs/Documentation/Spot.html | 4 - docs/Documentation/Task_Cargo.html | 3 +- 15 files changed, 441 insertions(+), 420 deletions(-) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index a40e4d729..68356d0eb 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -201,6 +201,10 @@ BASE = { _ = {}, } + +--- @field #BASE.__ +BASE.__ = {} + --- The Formation Class -- @type FORMATION -- @field Cone A cone formation. @@ -224,47 +228,19 @@ FORMATION = { -- @return #BASE function BASE:New() local self = routines.utils.deepCopy( self ) -- Create a new self instance - local MetaTable = {} - setmetatable( self, MetaTable ) - self.__index = self + _ClassID = _ClassID + 1 self.ClassID = _ClassID - + + -- This is for "private" methods... + -- When a __ is passed to a method as "self", the __index will search for the method on the public method list too! + if self.__ then + setmetatable( self, { __index = self.__ } ) + end return self end -function BASE:_Destructor() - --self:E("_Destructor") - - --self:EventRemoveAll() -end - - --- THIS IS WHY WE NEED LUA 5.2 ... -function BASE:_SetDestructor() - - -- TODO: Okay, this is really technical... - -- When you set a proxy to a table to catch __gc, weak tables don't behave like weak... - -- Therefore, I am parking this logic until I've properly discussed all this with the community. - - local proxy = newproxy(true) - local proxyMeta = getmetatable(proxy) - - proxyMeta.__gc = function () - env.info("In __gc for " .. self:GetClassNameAndID() ) - if self._Destructor then - self:_Destructor() - end - end - - -- keep the userdata from newproxy reachable until the object - -- table is about to be garbage-collected - then the __gc hook - -- will be invoked and the destructor called - rawset( self, '__proxy', proxy ) - -end - --- This is the worker method to inherit from a parent class. -- @param #BASE self -- @param Child is the Child class that inherits. @@ -272,11 +248,18 @@ end -- @return #BASE Child function BASE:Inherit( Child, Parent ) local Child = routines.utils.deepCopy( Child ) - --local Parent = routines.utils.deepCopy( Parent ) - --local Parent = Parent + if Child ~= nil then - setmetatable( Child, Parent ) - Child.__index = Child + + -- This is for "private" methods... + -- When a __ is passed to a method as "self", the __index will search for the method on the public method list of the same object too! + if Child.__ then + setmetatable( Child, { __index = Child.__ } ) + setmetatable( Child.__, { __index = Parent } ) + else + setmetatable( Child, { __index = Parent } ) + end + --Child:_SetDestructor() end @@ -895,3 +878,35 @@ end +--- old stuff + +--function BASE:_Destructor() +-- --self:E("_Destructor") +-- +-- --self:EventRemoveAll() +--end + + +-- THIS IS WHY WE NEED LUA 5.2 ... +--function BASE:_SetDestructor() +-- +-- -- TODO: Okay, this is really technical... +-- -- When you set a proxy to a table to catch __gc, weak tables don't behave like weak... +-- -- Therefore, I am parking this logic until I've properly discussed all this with the community. +-- +-- local proxy = newproxy(true) +-- local proxyMeta = getmetatable(proxy) +-- +-- proxyMeta.__gc = function () +-- env.info("In __gc for " .. self:GetClassNameAndID() ) +-- if self._Destructor then +-- self:_Destructor() +-- end +-- end +-- +-- -- keep the userdata from newproxy reachable until the object +-- -- table is about to be garbage-collected - then the __gc hook +-- -- will be invoked and the destructor called +-- rawset( self, '__proxy', proxy ) +-- +--end \ No newline at end of file diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua index 7b3a91c00..5db07d6d9 100644 --- a/Moose Development/Moose/Functional/CleanUp.lua +++ b/Moose Development/Moose/Functional/CleanUp.lua @@ -1,7 +1,5 @@ --- **Functional** -- The CLEANUP class keeps an area clean of crashing or colliding airplanes. It also prevents airplanes from firing within this area. -- --- ![Banner Image](..\Presentations\CLEANUP\Dia1.JPG) --- -- === -- -- ### Author: **Sven Van de Velde (FlightControl)** @@ -11,14 +9,57 @@ -- -- @module CleanUp +--- @type CLEANUP.__ +-- @extends Core.Base#BASE --- @type CLEANUP --- @extends Core.Base#BASE +-- @extends #CLEANUP.__ -- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases. --- # CLEANUP, extends @{Base#BASE} -- +-- ![Banner Image](..\Presentations\CLEANUP\Dia1.JPG) +-- -- The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat. +-- Specific airbases need to be provided that need to be guarded. Each airbase registered, will be guarded within a zone of 8 km around the airbase. +-- Any unit that fires a missile, or shoots within the zone of an airbase, will be monitored by CLEANUP. +-- Within the 8km zone, units cannot fire any missile, which prevents the airbase runway to receive missile or bomb hits. +-- Any airborne or ground unit that is on the runway below 30 meters (default value) will be automatically removed if it is damaged. +-- +-- This is not a full 100% secure implementation. It is still possible that CLEANUP cannot prevent (in-time) to keep the airbase clean. +-- The following situations may happen that will still stop the runway of an airbase: +-- +-- * A damaged unit is not removed on time when above the runway, and crashes on the runway. +-- * A bomb or missile is still able to dropped on the runway. +-- * Units collide on the airbase, and could not be removed on time. +-- +-- When a unit is within the airbase zone and needs to be monitored, +-- its status will be checked every 0.25 seconds! This is required to ensure that the airbase is kept clean. +-- But as a result, there is more CPU overload. +-- +-- So as an advise, I suggest you use the CLEANUP class with care: +-- +-- * Only monitor airbases that really need to be monitored! +-- * Try not to monitor airbases that are likely to be invaded by enemy troops. +-- For these airbases, there is little use to keep them clean, as they will be invaded anyway... +-- +-- By following the above guidelines, you can add airbase cleanup with acceptable CPU overhead. +-- +-- ## 1. CLEANUP Constructor +-- +-- Creates the main object which is preventing the airbase to get polluted with debris on the runway, which halts the airbase. +-- +-- -- Clean these Zones. +-- CleanUpAirports = CLEANUP:New( { AIRBASE.Caucasus.Tbilisi, AIRBASE.Caucasus.Kutaisi ) +-- +-- -- or +-- CleanUpTbilisi = CLEANUP:New( AIRBASE.Caucasus.Tbilisi ) +-- CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi ) +-- +-- ## 2. Add or Remove airbases +-- +-- The method @{#CLEANUP.AddAirbase} to add an airbase to the cleanup validation process. +-- The method @{#CLEANUP.RemoveAirbase} removes an airbase from the cleanup validation process. -- -- @field #CLEANUP CLEANUP = { @@ -28,6 +69,10 @@ CLEANUP = { Airbases = {}, } + +--- @field #CLEANUP.__ +CLEANUP.__ = {} + --- Creates the main object which is handling the cleaning of the debris within the given Zone Names. -- @param #CLEANUP self -- @param #list<#string> AirbaseNames Is a table of airbase names where the debris should be cleaned. Also a single string can be passed with one airbase name. @@ -52,9 +97,9 @@ function CLEANUP:New( AirbaseNames ) self:AddAirbase( AirbaseName ) end - self:HandleEvent( EVENTS.Birth ) + self:HandleEvent( EVENTS.Birth, self.__.OnEventBirth ) - self.CleanUpScheduler = SCHEDULER:New( self, self._CleanUpScheduler, {}, 1, self.TimeInterval ) + self.CleanUpScheduler = SCHEDULER:New( self, self.__.CleanUpScheduler, {}, 1, self.TimeInterval ) return self end @@ -81,7 +126,7 @@ end -function CLEANUP:IsInAirbase( Vec2 ) +function CLEANUP.__:IsInAirbase( Vec2 ) local InAirbase = false for AirbaseName, Airbase in pairs( self.Airbases ) do @@ -95,23 +140,12 @@ function CLEANUP:IsInAirbase( Vec2 ) return InAirbase end ---- Destroys a group from the simulator, but checks first if it is still existing! --- @param #CLEANUP self --- @param Dcs.DCSWrapper.Group#Group GroupObject The object to be destroyed. --- @param #string CleanUpGroupName The groupname... -function CLEANUP:_DestroyGroup( GroupObject, CleanUpGroupName ) - self:F( { GroupObject, CleanUpGroupName } ) - if GroupObject then -- and GroupObject:isExist() then - trigger.action.deactivateGroup(GroupObject) - self:T( { "GroupObject Destroyed", GroupObject } ) - end -end --- Destroys a @{Unit} from the simulator, but checks first if it is still existing! -- @param #CLEANUP self -- @param Wrapper.Unit#UNIT CleanUpUnit The object to be destroyed. -function CLEANUP:_DestroyUnit( CleanUpUnit ) +function CLEANUP.__:DestroyUnit( CleanUpUnit ) self:F( { CleanUpUnit } ) if CleanUpUnit then @@ -131,13 +165,14 @@ function CLEANUP:_DestroyUnit( CleanUpUnit ) end end --- TODO check Dcs.DCSTypes#Weapon + + --- Destroys a missile from the simulator, but checks first if it is still existing! -- @param #CLEANUP self -- @param Dcs.DCSTypes#Weapon MissileObject -function CLEANUP:_DestroyMissile( MissileObject ) +function CLEANUP.__:DestroyMissile( MissileObject ) self:F( { MissileObject } ) - + if MissileObject and MissileObject:isExist() then MissileObject:destroy() self:T( "MissileObject Destroyed") @@ -146,30 +181,31 @@ end --- @param #CLEANUP self -- @param Core.Event#EVENTDATA EventData -function CLEANUP:OnEventBirth( EventData ) +function CLEANUP.__:OnEventBirth( EventData ) self:F( { EventData } ) self.CleanUpList[EventData.IniDCSUnitName] = {} - self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniDCSUnit - self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniDCSGroup + self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit + self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroupName = EventData.IniDCSGroupName self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnitName = EventData.IniDCSUnitName - self:HandleEvent( EVENTS.EngineShutdown , self._EventAddForCleanUp ) - self:HandleEvent( EVENTS.EngineStartup, self._EventAddForCleanUp ) - self:HandleEvent( EVENTS.Hit, self._EventAddForCleanUp ) - self:HandleEvent( EVENTS.PilotDead, self.OnEventCrash ) - self:HandleEvent( EVENTS.Dead, self.OnEventCrash ) - self:HandleEvent( EVENTS.Crash, self.OnEventCrash ) - self:HandleEvent( EVENTS.Shot, self.OnEventShot ) + self:HandleEvent( EVENTS.EngineShutdown , self.__.EventAddForCleanUp ) + self:HandleEvent( EVENTS.EngineStartup, self.__.EventAddForCleanUp ) + self:HandleEvent( EVENTS.Hit, self.__.EventAddForCleanUp ) + self:HandleEvent( EVENTS.PilotDead, self.__.OnEventCrash ) + self:HandleEvent( EVENTS.Dead, self.__.OnEventCrash ) + self:HandleEvent( EVENTS.Crash, self.__.OnEventCrash ) + self:HandleEvent( EVENTS.Shot, self.__.OnEventShot ) end + --- Detects if a crash event occurs. -- Crashed units go into a CleanUpList for removal. -- @param #CLEANUP self --- @param Dcs.DCSTypes#Event event -function CLEANUP:OnEventCrash( Event ) +-- @param Core.Event#EVENTDATA Event +function CLEANUP.__:OnEventCrash( Event ) self:F( { Event } ) --TODO: This stuff is not working due to a DCS bug. Burning units cannot be destroyed. @@ -180,10 +216,10 @@ function CLEANUP:OnEventCrash( Event ) -- self:T("after deactivateGroup") -- event.initiator:destroy() - if Event.IniDCSUnitName then + if Event.IniDCSUnitName and Event.IniCategory == Object.Category.UNIT then self.CleanUpList[Event.IniDCSUnitName] = {} - self.CleanUpList[Event.IniDCSUnitName].CleanUpUnit = Event.IniDCSUnit - self.CleanUpList[Event.IniDCSUnitName].CleanUpGroup = Event.IniDCSGroup + self.CleanUpList[Event.IniDCSUnitName].CleanUpUnit = Event.IniUnit + self.CleanUpList[Event.IniDCSUnitName].CleanUpGroup = Event.IniGroup self.CleanUpList[Event.IniDCSUnitName].CleanUpGroupName = Event.IniDCSGroupName self.CleanUpList[Event.IniDCSUnitName].CleanUpUnitName = Event.IniDCSUnitName end @@ -194,79 +230,85 @@ end -- If this occurs within one of the airbases, then the weapon used must be destroyed. -- @param #CLEANUP self -- @param Core.Event#EVENTDATA Event -function CLEANUP:OnEventShot( Event ) +function CLEANUP.__:OnEventShot( Event ) self:F( { Event } ) -- Test if the missile was fired within one of the CLEANUP.AirbaseNames. if self:IsInAirbase( Event.IniUnit:GetVec2() ) then -- Okay, the missile was fired within the CLEANUP.AirbaseNames, destroy the fired weapon. - self:_DestroyMissile( Event.Weapon ) + self:DestroyMissile( Event.Weapon ) end end - --- Detects if the Unit has an S_EVENT_HIT within the given AirbaseNames. If this is the case, destroy the unit. -- @param #CLEANUP self -- @param Core.Event#EVENTDATA Event -function CLEANUP:OnEventHit( Event ) +function CLEANUP.__:OnEventHit( Event ) self:F( { Event } ) if Event.IniUnit then if self:IsInAirbase( Event.IniUnit:GetVec2() ) then - self:T( { "Life: ", Event.IniDCSUnitName, ' = ', Event.IniDCSUnit:getLife(), "/", Event.IniDCSUnit:getLife0() } ) - if Event.IniDCSUnit:getLife() < Event.IniDCSUnit:getLife0() then + self:T( { "Life: ", Event.IniDCSUnitName, ' = ', Event.IniUnit:GetLife(), "/", Event.IniUnit:GetLife0() } ) + if Event.IniUnit:GetLife() < Event.IniUnit:GetLife0() then self:T( "CleanUp: Destroy: " .. Event.IniDCSUnitName ) - CLEANUP:_DestroyUnit( Event.IniUnit ) + CLEANUP.__:DestroyUnit( Event.IniUnit ) end end end if Event.TgtUnit then if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then - self:T( { "Life: ", Event.TgtDCSUnitName, ' = ', Event.TgtDCSUnit:getLife(), "/", Event.TgtDCSUnit:getLife0() } ) - if Event.TgtDCSUnit:getLife() < Event.TgtDCSUnit:getLife0() then + self:T( { "Life: ", Event.TgtDCSUnitName, ' = ', Event.TgtUnit:GetLife(), "/", Event.TgtUnit:GetLife0() } ) + if Event.TgtUnit:GetLife() < Event.TgtUnit:GetLife0() then self:T( "CleanUp: Destroy: " .. Event.TgtDCSUnitName ) - CLEANUP:_DestroyUnit( Event.TgtUnit ) + CLEANUP.__:DestroyUnit( Event.TgtUnit ) end end end end --- Add the @{DCSWrapper.Unit#Unit} to the CleanUpList for CleanUp. -function CLEANUP:_AddForCleanUp( CleanUpUnit, CleanUpUnitName ) +-- @param #CLEANUP self +-- @param Wrapper.Unit#UNIT CleanUpUnit +-- @oaram #string CleanUpUnitName +function CLEANUP.__:AddForCleanUp( CleanUpUnit, CleanUpUnitName ) self:F( { CleanUpUnit, CleanUpUnitName } ) self.CleanUpList[CleanUpUnitName] = {} self.CleanUpList[CleanUpUnitName].CleanUpUnit = CleanUpUnit self.CleanUpList[CleanUpUnitName].CleanUpUnitName = CleanUpUnitName - self.CleanUpList[CleanUpUnitName].CleanUpGroup = Unit.getGroup(CleanUpUnit) - self.CleanUpList[CleanUpUnitName].CleanUpGroupName = Unit.getGroup(CleanUpUnit):getName() + + local CleanUpGroup = CleanUpUnit:GetGroup() + + self.CleanUpList[CleanUpUnitName].CleanUpGroup = CleanUpGroup + self.CleanUpList[CleanUpUnitName].CleanUpGroupName = CleanUpGroup:GetName() self.CleanUpList[CleanUpUnitName].CleanUpTime = timer.getTime() self.CleanUpList[CleanUpUnitName].CleanUpMoved = false - self:T( { "CleanUp: Add to CleanUpList: ", Unit.getGroup(CleanUpUnit):getName(), CleanUpUnitName } ) + self:T( { "CleanUp: Add to CleanUpList: ", CleanUpGroup:GetName(), CleanUpUnitName } ) end --- Detects if the Unit has an S_EVENT_ENGINE_SHUTDOWN or an S_EVENT_HIT within the given AirbaseNames. If this is the case, add the Group to the CLEANUP List. --- @param #CLEANUP self +-- @param #CLEANUP.__ self -- @param Core.Event#EVENTDATA Event -function CLEANUP:_EventAddForCleanUp( Event ) +function CLEANUP.__:EventAddForCleanUp( Event ) self:F({Event}) - if Event.IniDCSUnit then + + if Event.IniDCSUnit and Event.IniCategory == Object.Category.UNIT then if self.CleanUpList[Event.IniDCSUnitName] == nil then if self:IsInAirbase( Event.IniUnit:GetVec2() ) then - self:_AddForCleanUp( Event.IniDCSUnit, Event.IniDCSUnitName ) + self:AddForCleanUp( Event.IniUnit, Event.IniDCSUnitName ) end end end - if Event.TgtDCSUnit then + if Event.TgtDCSUnit and Event.TgtCategory == Object.Category.UNIT then if self.CleanUpList[Event.TgtDCSUnitName] == nil then if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then - self:_AddForCleanUp( Event.TgtDCSUnit, Event.TgtDCSUnitName ) + self:AddForCleanUp( Event.TgtUnit, Event.TgtDCSUnitName ) end end end @@ -276,23 +318,23 @@ end --- At the defined time interval, CleanUp the Groups within the CleanUpList. -- @param #CLEANUP self -function CLEANUP:_CleanUpScheduler() +function CLEANUP.__:CleanUpScheduler() local CleanUpCount = 0 - for CleanUpUnitName, UnitData in pairs( self.CleanUpList ) do + for CleanUpUnitName, CleanUpListData in pairs( self.CleanUpList ) do CleanUpCount = CleanUpCount + 1 - local CleanUpUnit = UNIT:FindByName( CleanUpUnitName ) - local CleanUpDCSUnit = Unit.getByName( CleanUpUnitName ) - local CleanUpGroupName = UnitData.CleanUpGroupName + local CleanUpUnit = CleanUpListData.CleanUpUnit -- Wrapper.Unit#UNIT + local CleanUpGroupName = CleanUpListData.CleanUpGroupName - if CleanUpUnit then + if CleanUpUnit:IsAlive() ~= nil then if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then local CleanUpCoordinate = CleanUpUnit:GetCoordinate() - if CleanUpDCSUnit and CleanUpDCSUnit:getLife() <= CleanUpDCSUnit:getLife0() * 0.95 then + self:T( { "CleanUp Scheduler", CleanUpUnitName } ) + if CleanUpUnit:GetLife() <= CleanUpUnit:GetLife0() * 0.95 then if CleanUpUnit:IsAboveRunway() then if CleanUpUnit:InAir() then @@ -301,11 +343,11 @@ function CLEANUP:_CleanUpScheduler() if CleanUpUnitHeight < 30 then self:T( { "CleanUp Scheduler", "Destroy " .. CleanUpUnitName .. " because below safe height and damaged." } ) - self:_DestroyUnit( CleanUpUnit ) + self:DestroyUnit( CleanUpUnit ) end else self:T( { "CleanUp Scheduler", "Destroy " .. CleanUpUnitName .. " because on runway and damaged." } ) - self:_DestroyUnit(CleanUpUnit ) + self:DestroyUnit( CleanUpUnit ) end end end @@ -313,15 +355,15 @@ function CLEANUP:_CleanUpScheduler() if CleanUpUnit then local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH() if CleanUpUnitVelocity < 1 then - if UnitData.CleanUpMoved then - if UnitData.CleanUpTime + 180 <= timer.getTime() then + if CleanUpListData.CleanUpMoved then + if CleanUpListData.CleanUpTime + 180 <= timer.getTime() then self:T( { "CleanUp Scheduler", "Destroy due to not moving anymore " .. CleanUpUnitName } ) - self:_DestroyUnit( CleanUpUnit ) + self:DestroyUnit( CleanUpUnit ) end end else - UnitData.CleanUpTime = timer.getTime() - UnitData.CleanUpMoved = true + CleanUpListData.CleanUpTime = timer.getTime() + CleanUpListData.CleanUpMoved = true end end diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index fbe5421b0..b2054eea2 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -365,7 +365,6 @@ end --- Returns the POSITIONABLE velocity in km/h. -- @param Wrapper.Positionable#POSITIONABLE self -- @return #number The velocity in km/h --- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:GetVelocityKMH() self:F2( self.PositionableName ) @@ -379,13 +378,12 @@ function POSITIONABLE:GetVelocityKMH() return Velocity end - return nil + return 0 end --- Returns the POSITIONABLE velocity in meters per second. -- @param Wrapper.Positionable#POSITIONABLE self -- @return #number The velocity in meters per second. --- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:GetVelocityMPS() self:F2( self.PositionableName ) @@ -398,7 +396,7 @@ function POSITIONABLE:GetVelocityMPS() return Velocity end - return nil + return 0 end diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 01f71e691..576aed957 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -536,7 +536,7 @@ function UNIT:GetLife() return UnitLife end - return nil + return -1 end --- Returns the Unit's initial health. @@ -553,7 +553,7 @@ function UNIT:GetLife0() return UnitLife0 end - return nil + return 0 end --- Returns the category name of the #UNIT. diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html index ee2dc9007..2a24504d1 100644 --- a/docs/Documentation/AI_A2A.html +++ b/docs/Documentation/AI_A2A.html @@ -575,6 +575,7 @@
+ #number AI_A2A.IdleCount diff --git a/docs/Documentation/Base.html b/docs/Documentation/Base.html index 5d0f76673..e79a06992 100644 --- a/docs/Documentation/Base.html +++ b/docs/Documentation/Base.html @@ -472,30 +472,24 @@ When Moose is loaded statically, (as one file), tracing is switched off by defau BASE:UnHandleEvent(Event)

UnSubscribe to a DCS event.

- - - - BASE:_Destructor() - - BASE:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

- - - - BASE:_SetDestructor() - - BASE:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

+ + + + BASE.__ + + @@ -2134,19 +2128,6 @@ BASE:TraceOnOff( false )

#BASE:

- -
-
-
- - -BASE:_Destructor() - -
-
- - -
@@ -2187,22 +2168,6 @@ A #table or any field.

- -BASE:_SetDestructor() - -
-
- - - - -

THIS IS WHY WE NEED LUA 5.2 ...

- -
-
-
-
- BASE:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) @@ -2230,6 +2195,20 @@ A #table or any field.

+ +
+
+
+ + #BASE.__ + +BASE.__ + +
+
+ + +
@@ -2260,6 +2239,8 @@ A #table or any field.

+

Type BASE.__

+

Type FORMATION

The Formation Class

diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html index 0f74ec2a0..262969991 100644 --- a/docs/Documentation/Cargo.html +++ b/docs/Documentation/Cargo.html @@ -2934,7 +2934,6 @@ The range till cargo will board.

- CARGO_UNIT.CargoCarrier diff --git a/docs/Documentation/CleanUp.html b/docs/Documentation/CleanUp.html index fe64315b1..a9c1593dd 100644 --- a/docs/Documentation/CleanUp.html +++ b/docs/Documentation/CleanUp.html @@ -110,8 +110,6 @@

It also prevents airplanes from firing within this area.

-

Banner Image

-

Author: Sven Van de Velde (FlightControl)

@@ -127,8 +125,9 @@

CLEANUP, extends Base#BASE

-

The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.

+

Banner Image

+

The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.

@@ -150,42 +149,12 @@ CLEANUP.CleanUpScheduler - - - - CLEANUP:IsInAirbase(Vec2) - - CLEANUP:New(<, AirbaseNames)

Creates the main object which is handling the cleaning of the debris within the given Zone Names.

- - - - CLEANUP:OnEventBirth(EventData) - - - - - - CLEANUP:OnEventCrash(event, Event) - -

Detects if a crash event occurs.

- - - - CLEANUP:OnEventHit(Event) - -

Detects if the Unit has an SEVENTHIT within the given AirbaseNames.

- - - - CLEANUP:OnEventShot(Event) - -

Detects if a unit shoots a missile.

@@ -195,39 +164,73 @@ - CLEANUP:_AddForCleanUp(CleanUpUnit, CleanUpUnitName) + CLEANUP.__ + + + + + + +

Type CLEANUP.__

+ + + - + - + - - - - - + - + + + + + + + + + + + + + + + + + + + + +
CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName)

Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.

CLEANUP:_CleanUpScheduler()CLEANUP.__:CleanUpScheduler()

At the defined time interval, CleanUp the Groups within the CleanUpList.

CLEANUP:_DestroyGroup(GroupObject, CleanUpGroupName)CLEANUP.__:DestroyMissile(MissileObject) -

Destroys a group from the simulator, but checks first if it is still existing!

+

Destroys a missile from the simulator, but checks first if it is still existing!

CLEANUP:_DestroyMissile(MissileObject) - -
CLEANUP:_DestroyUnit(CleanUpUnit)CLEANUP.__:DestroyUnit(CleanUpUnit)

Destroys a Unit from the simulator, but checks first if it is still existing!

CLEANUP:_EventAddForCleanUp(Event)CLEANUP.__:EventAddForCleanUp(Event)

Detects if the Unit has an SEVENTENGINESHUTDOWN or an SEVENT_HIT within the given AirbaseNames.

+
CLEANUP.__:IsInAirbase(Vec2) + +
CLEANUP.__:OnEventBirth(EventData) + +
CLEANUP.__:OnEventCrash(Event) +

Detects if a crash event occurs.

+
CLEANUP.__:OnEventHit(Event) +

Detects if the Unit has an SEVENTHIT within the given AirbaseNames.

+
CLEANUP.__:OnEventShot(Event) +

Detects if a unit shoots a missile.

@@ -245,8 +248,56 @@

CLEANUP, extends Base#BASE

+

Banner Image

+

The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.

+ +

Specific airbases need to be provided that need to be guarded. Each airbase registered, will be guarded within a zone of 8 km around the airbase. +Any unit that fires a missile, or shoots within the zone of an airbase, will be monitored by CLEANUP. +Within the 8km zone, units cannot fire any missile, which prevents the airbase runway to receive missile or bomb hits. +Any airborne or ground unit that is on the runway below 30 meters (default value) will be automatically removed if it is damaged.

+ +

This is not a full 100% secure implementation. It is still possible that CLEANUP cannot prevent (in-time) to keep the airbase clean. +The following situations may happen that will still stop the runway of an airbase:

+ +
    +
  • A damaged unit is not removed on time when above the runway, and crashes on the runway.
  • +
  • A bomb or missile is still able to dropped on the runway.
  • +
  • Units collide on the airbase, and could not be removed on time.
  • +
+ +

When a unit is within the airbase zone and needs to be monitored, +its status will be checked every 0.25 seconds! This is required to ensure that the airbase is kept clean. +But as a result, there is more CPU overload.

+ +

So as an advise, I suggest you use the CLEANUP class with care:

+ +
    +
  • Only monitor airbases that really need to be monitored!
  • +
  • Try not to monitor airbases that are likely to be invaded by enemy troops. + For these airbases, there is little use to keep them clean, as they will be invaded anyway...
  • +
+ +

By following the above guidelines, you can add airbase cleanup with acceptable CPU overhead.

+ +

1. CLEANUP Constructor

+ +

Creates the main object which is preventing the airbase to get polluted with debris on the runway, which halts the airbase.

+ +
 -- Clean these Zones.
+ CleanUpAirports = CLEANUP:New( { AIRBASE.Caucasus.Tbilisi, AIRBASE.Caucasus.Kutaisi )
+
+ -- or
+ CleanUpTbilisi = CLEANUP:New( AIRBASE.Caucasus.Tbilisi )
+ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )
+
+ +

2. Add or Remove airbases

+ +

The method CLEANUP.AddAirbase to add an airbase to the cleanup validation process. +The method CLEANUP.RemoveAirbase removes an airbase from the cleanup validation process.

+
@@ -306,27 +357,6 @@ - -
-
-
- - -CLEANUP:IsInAirbase(Vec2) - -
-
- - - -

Parameter

-
    -
  • - -

    Vec2 :

    - -
  • -
@@ -371,104 +401,6 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )
- -CLEANUP:OnEventBirth(EventData) - -
-
- - - -

Parameter

- -
-
-
-
- - -CLEANUP:OnEventCrash(event, Event) - -
-
- -

Detects if a crash event occurs.

- - -

Crashed units go into a CleanUpList for removal.

- -

Parameters

- -
-
-
-
- - -CLEANUP:OnEventHit(Event) - -
-
- -

Detects if the Unit has an SEVENTHIT within the given AirbaseNames.

- - -

If this is the case, destroy the unit.

- -

Parameter

- -
-
-
-
- - -CLEANUP:OnEventShot(Event) - -
-
- -

Detects if a unit shoots a missile.

- - -

If this occurs within one of the airbases, then the weapon used must be destroyed.

- -

Parameter

- -
-
-
-
- CLEANUP:RemoveAirbase(AirbaseName) @@ -495,8 +427,25 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )
- -CLEANUP:_AddForCleanUp(CleanUpUnit, CleanUpUnitName) + #CLEANUP.__ + +CLEANUP.__ + +
+
+ + + +
+
+ +

Type CLEANUP.__

+

Field(s)

+
+
+ + +CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName)
@@ -507,7 +456,7 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi ) -
-
-
-
- - - -SPAWN.uncontrolled - -
-
- - -
diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html index bc91b9624..d8aa5e633 100644 --- a/docs/Documentation/SpawnStatic.html +++ b/docs/Documentation/SpawnStatic.html @@ -436,6 +436,7 @@ ptional) The name of the new static.

+ #number SPAWNSTATIC.SpawnIndex diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html index 5fdc3b305..ead3792db 100644 --- a/docs/Documentation/Spot.html +++ b/docs/Documentation/Spot.html @@ -765,7 +765,6 @@ true if it is lasing

- SPOT.ScheduleID @@ -779,7 +778,6 @@ true if it is lasing

- SPOT.SpotIR @@ -793,7 +791,6 @@ true if it is lasing

- SPOT.SpotLaser @@ -807,7 +804,6 @@ true if it is lasing

- SPOT.Target diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html index dda7b2ea9..76e219e8b 100644 --- a/docs/Documentation/Task_Cargo.html +++ b/docs/Documentation/Task_Cargo.html @@ -510,7 +510,7 @@ based on the tasking capabilities defined in Task#TA
- Core.Cargo#CARGO + Core.Cargo#CARGO_GROUP FSM_PROCESS.Cargo @@ -524,6 +524,7 @@ based on the tasking capabilities defined in Task#TA
+ FSM_PROCESS.DeployZone From 083568d3fdbfa70aa79f62ff592b954468b94040 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 1 Jul 2017 12:55:51 +0200 Subject: [PATCH 02/11] Updates --- Moose Development/Moose/Functional/CleanUp.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua index 5db07d6d9..7bcda11dd 100644 --- a/Moose Development/Moose/Functional/CleanUp.lua +++ b/Moose Development/Moose/Functional/CleanUp.lua @@ -69,7 +69,6 @@ CLEANUP = { Airbases = {}, } - --- @field #CLEANUP.__ CLEANUP.__ = {} From 8b1583df30189f04f8abb4dd96744880b3460aeb Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 1 Jul 2017 13:00:12 +0200 Subject: [PATCH 03/11] Made Airbases private --- .../Moose/Functional/CleanUp.lua | 14 +++-- docs/Documentation/AI_A2A.html | 1 - docs/Documentation/CleanUp.html | 62 +++++++++++++------ docs/Documentation/Detection.html | 2 +- docs/Documentation/Movement.html | 4 -- docs/Documentation/Settings.html | 2 +- docs/Documentation/Spawn.html | 15 ++++- docs/Documentation/SpawnStatic.html | 1 - 8 files changed, 64 insertions(+), 37 deletions(-) diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua index 7bcda11dd..9e209ff27 100644 --- a/Moose Development/Moose/Functional/CleanUp.lua +++ b/Moose Development/Moose/Functional/CleanUp.lua @@ -10,11 +10,11 @@ -- @module CleanUp --- @type CLEANUP.__ +-- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases. -- @extends Core.Base#BASE --- @type CLEANUP -- @extends #CLEANUP.__ --- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases. --- # CLEANUP, extends @{Base#BASE} -- @@ -66,12 +66,14 @@ CLEANUP = { ClassName = "CLEANUP", TimeInterval = 0.2, CleanUpList = {}, - Airbases = {}, } --- @field #CLEANUP.__ CLEANUP.__ = {} +--- @field #CLEANUP.__.Airbases +CLEANUP.__.Airbases = {} + --- Creates the main object which is handling the cleaning of the debris within the given Zone Names. -- @param #CLEANUP self -- @param #list<#string> AirbaseNames Is a table of airbase names where the debris should be cleaned. Also a single string can be passed with one airbase name. @@ -108,8 +110,8 @@ end -- @param #string AirbaseName -- @return #CLEANUP function CLEANUP:AddAirbase( AirbaseName ) - self.Airbases[AirbaseName] = AIRBASE:FindByName( AirbaseName ) - self:F({"Airbase:", AirbaseName, self.Airbases[AirbaseName]:GetDesc()}) + self.__.Airbases[AirbaseName] = AIRBASE:FindByName( AirbaseName ) + self:F({"Airbase:", AirbaseName, self.__.Airbases[AirbaseName]:GetDesc()}) return self end @@ -119,7 +121,7 @@ end -- @param #string AirbaseName -- @return #CLEANUP function CLEANUP:RemoveAirbase( AirbaseName ) - self.Airbases[AirbaseName] = nil + self.__.Airbases[AirbaseName] = nil return self end @@ -128,7 +130,7 @@ end function CLEANUP.__:IsInAirbase( Vec2 ) local InAirbase = false - for AirbaseName, Airbase in pairs( self.Airbases ) do + for AirbaseName, Airbase in pairs( self.__.Airbases ) do local Airbase = Airbase -- Wrapper.Airbase#AIRBASE if Airbase:GetZone():IsVec2InZone( Vec2 ) then InAirbase = true diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html index 2a24504d1..ee2dc9007 100644 --- a/docs/Documentation/AI_A2A.html +++ b/docs/Documentation/AI_A2A.html @@ -575,7 +575,6 @@
- #number AI_A2A.IdleCount diff --git a/docs/Documentation/CleanUp.html b/docs/Documentation/CleanUp.html index a9c1593dd..24d7c0a67 100644 --- a/docs/Documentation/CleanUp.html +++ b/docs/Documentation/CleanUp.html @@ -134,12 +134,6 @@

Type CLEANUP

- - - - - + @@ -2005,27 +2005,20 @@ Takeoff From the airbase hot, from the airbase cold, in the air, from the runway
-AI_A2A_DISPATCHER:New(Detection, GroupingRadius) +AI_A2A_DISPATCHER:New(Detection)

AIA2ADISPATCHER constructor.

-

Parameters

+

Parameter

  • Functional.Detection#DETECTION_BASE Detection : The DETECTION object that will detects targets using the the Early Warning Radar network.

    -
  • -
  • - -

    #number GroupingRadius : -The radius in meters wherein detected planes are being grouped as one target area. -For airplanes, 6000 (6km) is recommended, and is also the default value of this parameter.

    -

Return value

diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html index 43392b308..93a9f8ce6 100644 --- a/docs/Documentation/AI_Patrol.html +++ b/docs/Documentation/AI_Patrol.html @@ -926,9 +926,6 @@ Use the method AIPATROLZONE.M - -

This table contains the targets detected during patrol.

-
diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html index e3fae231c..262969991 100644 --- a/docs/Documentation/Cargo.html +++ b/docs/Documentation/Cargo.html @@ -2934,7 +2934,6 @@ The range till cargo will board.

- CARGO_UNIT.CargoCarrier @@ -3060,7 +3059,6 @@ The range till cargo will board.

- #number CARGO_UNIT.RunCount diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html index 8c70074f0..1754d0aa0 100644 --- a/docs/Documentation/Detection.html +++ b/docs/Documentation/Detection.html @@ -2393,7 +2393,6 @@ The index of the DetectedItem.

- #number DETECTION_BASE.DetectedItemCount @@ -2407,7 +2406,6 @@ The index of the DetectedItem.

- #number DETECTION_BASE.DetectedItemMax @@ -2565,7 +2563,7 @@ The index of the DetectedItem.

- + #number DETECTION_BASE.DetectionInterval diff --git a/docs/Documentation/Point.html b/docs/Documentation/Point.html index c9a6550f1..ba2001e76 100644 --- a/docs/Documentation/Point.html +++ b/docs/Documentation/Point.html @@ -2823,7 +2823,6 @@ The y coordinate.

- POINT_VEC2.z diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index 6c440cb38..0f27003d1 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -2746,6 +2746,9 @@ when nothing was spawned.

+ +

By default, no InitLimit

+
@@ -2781,7 +2784,7 @@ when nothing was spawned.

- + #number SPAWN.SpawnMaxGroups @@ -2798,7 +2801,7 @@ when nothing was spawned.

- + #number SPAWN.SpawnMaxUnitsAlive diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html index 5fdc3b305..ead3792db 100644 --- a/docs/Documentation/Spot.html +++ b/docs/Documentation/Spot.html @@ -765,7 +765,6 @@ true if it is lasing

- SPOT.ScheduleID @@ -779,7 +778,6 @@ true if it is lasing

- SPOT.SpotIR @@ -793,7 +791,6 @@ true if it is lasing

- SPOT.SpotLaser @@ -807,7 +804,6 @@ true if it is lasing

- SPOT.Target diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html index 9bf9da484..8c17ced64 100644 --- a/docs/Documentation/Task_Cargo.html +++ b/docs/Documentation/Task_Cargo.html @@ -510,7 +510,7 @@ based on the tasking capabilities defined in Task#TA
- Core.Cargo#CARGO + FSM_PROCESS.Cargo @@ -524,7 +524,6 @@ based on the tasking capabilities defined in Task#TA
- FSM_PROCESS.DeployZone From 33c62908649951bb47af3918b69d3ebc9d6fd63b Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sun, 2 Jul 2017 00:29:17 +0200 Subject: [PATCH 07/11] Fixed error with __ Had to test for the presence in raw format, not using __Index --- Moose Development/Moose/Core/Base.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index c7dd7f446..511610786 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -234,7 +234,7 @@ function BASE:New() -- This is for "private" methods... -- When a __ is passed to a method as "self", the __index will search for the method on the public method list too! - if self.__ then + if rawget( self, "__" ) then setmetatable( self, { __index = self.__ } ) end @@ -254,7 +254,7 @@ function BASE:Inherit( Child, Parent ) -- This is for "private" methods... -- When a __ is passed to a method as "self", the __index will search for the method on the public method list of the same object too! - if Child.__ then + if rawget( Child, "__" ) then setmetatable( Child, { __index = Child.__ } ) setmetatable( Child.__, { __index = Parent } ) else From e7b3aa82f909dab656d46b85e5a86c1c92958d6a Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sun, 2 Jul 2017 01:08:00 +0200 Subject: [PATCH 08/11] SWEEP tasks should fall under the SWEEP menu, not INTERCEPT menu --- Moose Development/Moose/Tasking/Task_A2A.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Tasking/Task_A2A.lua b/Moose Development/Moose/Tasking/Task_A2A.lua index 9adf00b9b..6edeb57d1 100644 --- a/Moose Development/Moose/Tasking/Task_A2A.lua +++ b/Moose Development/Moose/Tasking/Task_A2A.lua @@ -439,7 +439,7 @@ do -- TASK_A2A_SWEEP -- @param #string TaskBriefing The briefing of the task. -- @return #TASK_A2A_SWEEP self function TASK_A2A_SWEEP:New( Mission, SetGroup, TaskName, TargetSetUnit, TaskBriefing ) - local self = BASE:Inherit( self, TASK_A2A:New( Mission, SetGroup, TaskName, TargetSetUnit, "INTERCEPT", TaskBriefing ) ) -- #TASK_A2A_SWEEP + local self = BASE:Inherit( self, TASK_A2A:New( Mission, SetGroup, TaskName, TargetSetUnit, "SWEEP", TaskBriefing ) ) -- #TASK_A2A_SWEEP self:F() Mission:AddTask( self ) From f221047ebaeae765929753e8aa9591476ccf2547 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sun, 2 Jul 2017 12:14:41 +0200 Subject: [PATCH 09/11] Updated various functions for tasking. --- Moose Development/Moose/Tasking/Task.lua | 48 +++++++++++++------ Moose Development/Moose/Tasking/Task_A2A.lua | 18 +++---- .../Moose/Tasking/Task_A2A_Dispatcher.lua | 4 +- Moose Development/Moose/Tasking/Task_A2G.lua | 18 +++---- Moose Mission Setup/Moose.lua | 2 +- 5 files changed, 55 insertions(+), 35 deletions(-) diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 2d736ef48..b65a85df1 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -1020,10 +1020,15 @@ end --- Sets the Information on the Task -- @param #TASK self --- @param #string TaskInfo -function TASK:SetInfo( TaskInfo, TaskInfoText ) +-- @param #string TaskInfo The key and title of the task information. +-- @param #string TaskInfoText The Task info text. +-- @param #number TaskInfoOrder The ordering, a number between 0 and 99. +function TASK:SetInfo( TaskInfo, TaskInfoText, TaskInfoOrder ) - self.TaskInfo[TaskInfo] = TaskInfoText + self.TaskInfo = self.TaskInfo or {} + self.TaskInfo[TaskInfo] = self.TaskInfo[TaskInfo] or {} + self.TaskInfo[TaskInfo].TaskInfoText = TaskInfoText + self.TaskInfo[TaskInfo].TaskInfoOrder = TaskInfoOrder end --- Gets the Type of the Task @@ -1365,26 +1370,41 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form -- Determine the status of the Task. local Status = "<" .. self:GetState() .. ">" + + local Line = 0 + local LineReport = REPORT:New() - for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do + for TaskInfoID, TaskInfo in UTILS.spairs( self.TaskInfo, function( t, a, b ) return t[a].TaskInfoOrder < t[b].TaskInfoOrder end ) do + + self:F( { TaskInfo = TaskInfo } ) + + if Line < math.floor( TaskInfo.TaskInfoOrder / 10 ) then + Report:AddIndent( LineReport:Text( ", " ) ) + LineReport = REPORT:New() + Line = math.floor( TaskInfo.TaskInfoOrder / 10 ) + end local TaskInfoIDText = string.format( "%s: ", TaskInfoID ) - - if type(TaskInfo) == "string" then - Report:Add( TaskInfoIDText .. TaskInfo ) + + if type( TaskInfo.TaskInfoText ) == "string" then + LineReport:Add( TaskInfoIDText .. TaskInfo.TaskInfoText ) elseif type(TaskInfo) == "table" then if TaskInfoID == "Coordinates" then local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate() - local ToCoordinate = TaskInfo -- Core.Point#COORDINATE + local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE --Report:Add( TaskInfoIDText ) - Report:Add( ToCoordinate:ToString( ReportGroup ) ) + LineReport:Add( ToCoordinate:ToString( ReportGroup ) ) --Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) ) else end end + + end + + Report:AddIndent( LineReport:Text( ", " ) ) - return Report:Text( ", ") + return Report:Text() end --- Create a count of the players in the Task. @@ -1457,16 +1477,16 @@ function TASK:ReportDetails( ReportGroup ) Report:Add( " - Players:" ) Report:AddIndent( Players ) - for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do + for TaskInfoID, TaskInfo in pairs( self.TaskInfo, function( t, a, b ) return t[a].TaskInfoOrder < t[b].TaskInfoOrder end ) do local TaskInfoIDText = string.format( " - %s: ", TaskInfoID ) - if type(TaskInfo) == "string" then - Report:Add( TaskInfoIDText .. TaskInfo ) + if type( TaskInfo.TaskInfoText ) == "string" then + Report:Add( TaskInfoIDText .. TaskInfo.TaskInfoText ) elseif type(TaskInfo) == "table" then if TaskInfoID == "Coordinates" then local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate() - local ToCoordinate = TaskInfo -- Core.Point#COORDINATE + local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE Report:Add( TaskInfoIDText ) Report:AddIndent( ToCoordinate:ToStringBRA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) ) Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) ) diff --git a/Moose Development/Moose/Tasking/Task_A2A.lua b/Moose Development/Moose/Tasking/Task_A2A.lua index 6edeb57d1..4d58b9432 100644 --- a/Moose Development/Moose/Tasking/Task_A2A.lua +++ b/Moose Development/Moose/Tasking/Task_A2A.lua @@ -329,12 +329,12 @@ do -- TASK_A2A_INTERCEPT ) local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() - self:SetInfo( "Coordinates", TargetCoordinate ) + self:SetInfo( "Coordinates", TargetCoordinate, 10 ) - self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 ) local DetectedItemsCount = TargetSetUnit:Count() local DetectedItemsTypes = TargetSetUnit:GetTypeNames() - self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 ) return self end @@ -452,12 +452,12 @@ do -- TASK_A2A_SWEEP ) local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() - self:SetInfo( "Coordinates", TargetCoordinate ) + self:SetInfo( "Coordinates", TargetCoordinate, 10 ) - self:SetInfo( "Assumed Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + self:SetInfo( "Assumed Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 ) local DetectedItemsCount = TargetSetUnit:Count() local DetectedItemsTypes = TargetSetUnit:GetTypeNames() - self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 ) return self end @@ -571,12 +571,12 @@ do -- TASK_A2A_ENGAGE ) local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() - self:SetInfo( "Coordinates", TargetCoordinate ) + self:SetInfo( "Coordinates", TargetCoordinate, 10 ) - self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 ) local DetectedItemsCount = TargetSetUnit:Count() local DetectedItemsTypes = TargetSetUnit:GetTypeNames() - self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 ) return self end diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua index 2f03cb5e3..018ba2910 100644 --- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua @@ -565,9 +565,9 @@ do -- TASK_A2A_DISPATCHER if Task then local FriendliesCount, FriendliesReport = self:GetFriendliesNearBy( DetectedItem ) - Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ) ) + Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ), 30 ) local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem ) - Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ) ) + Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ), 31 ) end -- OK, so the tasking has been done, now delete the changes reported for the area. diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua index aa56d3d42..ade6da690 100644 --- a/Moose Development/Moose/Tasking/Task_A2G.lua +++ b/Moose Development/Moose/Tasking/Task_A2G.lua @@ -320,12 +320,12 @@ do -- TASK_A2G_SEAD ) local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() - self:SetInfo( "Coordinates", TargetCoordinate ) + self:SetInfo( "Coordinates", TargetCoordinate, 10 ) - self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 ) local DetectedItemsCount = TargetSetUnit:Count() local DetectedItemsTypes = TargetSetUnit:GetTypeNames() - self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 ) return self end @@ -433,12 +433,12 @@ do -- TASK_A2G_BAI ) local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() - self:SetInfo( "Coordinates", TargetCoordinate ) + self:SetInfo( "Coordinates", TargetCoordinate, 10 ) - self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 ) local DetectedItemsCount = TargetSetUnit:Count() local DetectedItemsTypes = TargetSetUnit:GetTypeNames() - self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 ) return self end @@ -546,12 +546,12 @@ do -- TASK_A2G_CAS ) local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() - self:SetInfo( "Coordinates", TargetCoordinate ) + self:SetInfo( "Coordinates", TargetCoordinate, 10 ) - self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 ) local DetectedItemsCount = TargetSetUnit:Count() local DetectedItemsTypes = TargetSetUnit:GetTypeNames() - self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 ) return self end diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index dbcc4bd87..ccb8f24d0 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170701_1713' ) +env.info( 'Moose Generation Timestamp: 20170702_1214' ) local base = _G From af230d987484984fd982ad0f774491a27559c1d0 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sun, 2 Jul 2017 12:44:27 +0200 Subject: [PATCH 10/11] Fixed goal problem in TASK_CARGO_TRANSPORT more or less, needs further investigation --- Moose Development/Moose/Core/Cargo.lua | 6 ++++- .../Moose/Tasking/Task_CARGO.lua | 26 +++++++++++++++---- .../Moose/Wrapper/Controllable.lua | 11 ++++++++ Moose Development/Moose/Wrapper/Group.lua | 9 +++++-- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Core/Cargo.lua b/Moose Development/Moose/Core/Cargo.lua index 230cc4e05..4f9dbd560 100644 --- a/Moose Development/Moose/Core/Cargo.lua +++ b/Moose Development/Moose/Core/Cargo.lua @@ -357,7 +357,11 @@ function CARGO:IsInZone( Zone ) if self:IsLoaded() then return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() ) else - return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) + if self.CargoObject:GetSize() ~= 0 then + return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) + else + return false + end end return nil diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua index c6f902dc1..e919cc740 100644 --- a/Moose Development/Moose/Tasking/Task_CARGO.lua +++ b/Moose Development/Moose/Tasking/Task_CARGO.lua @@ -770,6 +770,17 @@ do -- TASK_CARGO return self end + function TASK_CARGO:SetGoalTotal() + + self.GoalTotal = self.SetCargo:Count() + end + + function TASK_CARGO:GetGoalTotal() + + return self.GoalTotal + end + + end @@ -924,11 +935,16 @@ do -- TASK_CARGO_TRANSPORT return CargoDeployed end - - --- - - - + --- @param #TASK_CARGO_TRANSPORT self + function TASK_CARGO_TRANSPORT:onafterGoal( TaskUnit, From, Event, To ) + local CargoSet = self.CargoSet + + if self:IsAllCargoTransported() then + self:Success() + end + + self:__Goal( -10 ) + end end diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 5ee4d7da8..f004b9e1c 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -2395,5 +2395,16 @@ function CONTROLLABLE:IsAirPlane() return nil end +function CONTROLLABLE:GetSize() + + local DCSObject = self:GetDCSObject() + + if DCSObject then + return 1 + else + return 0 + end +end + -- Message APIs \ No newline at end of file diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 403a52a2c..8e1deed6e 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -353,8 +353,13 @@ function GROUP:GetSize() if DCSGroup then local GroupSize = DCSGroup:getSize() - self:T3( GroupSize ) - return GroupSize + + if GroupSize then + self:T3( GroupSize ) + return GroupSize + else + return 0 + end end return nil From 1283caf80bf1a1a5cd6d3fa3a5631182b46efe10 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sun, 2 Jul 2017 12:55:29 +0200 Subject: [PATCH 11/11] OK. fixed --- Moose Development/Moose/Core/Cargo.lua | 1 + Moose Development/Moose/Tasking/Task_CARGO.lua | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Core/Cargo.lua b/Moose Development/Moose/Core/Cargo.lua index 4f9dbd560..35a04f6e8 100644 --- a/Moose Development/Moose/Core/Cargo.lua +++ b/Moose Development/Moose/Core/Cargo.lua @@ -357,6 +357,7 @@ function CARGO:IsInZone( Zone ) if self:IsLoaded() then return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() ) else + self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } ) if self.CargoObject:GetSize() ~= 0 then return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) else diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua index e919cc740..368bf9d26 100644 --- a/Moose Development/Moose/Tasking/Task_CARGO.lua +++ b/Moose Development/Moose/Tasking/Task_CARGO.lua @@ -914,11 +914,13 @@ do -- TASK_CARGO_TRANSPORT local DeployZones = self:GetDeployZones() - local CargoDeployed = true + local CargoDeployed = false -- Loop the CargoSet (so evaluate each Cargo in the SET_CARGO ). for CargoID, CargoData in pairs( Set ) do local Cargo = CargoData -- Core.Cargo#CARGO + + local CargoInDeployZone = false -- Loop the DeployZones set for the TASK_CARGO_TRANSPORT. for DeployZoneID, DeployZone in pairs( DeployZones ) do @@ -926,10 +928,12 @@ do -- TASK_CARGO_TRANSPORT -- If there is a Cargo not in one of DeployZones, then not all Cargo is deployed. self:T( { Cargo.CargoObject } ) if Cargo:IsInZone( DeployZone ) then - else - CargoDeployed = false + CargoInDeployZone = true end end + + CargoDeployed = CargoDeployed or CargoInDeployZone + end return CargoDeployed
CLEANUP.< -

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

-
CLEANUP:AddAirbase(AirbaseName)

Adds an airbase to the airbase validation list.

@@ -174,9 +168,21 @@

Type CLEANUP.__

+ + + + + + + + @@ -308,20 +314,6 @@ The method CLEANUP.RemoveAirbase removes
- #map - -CLEANUP.< - -
-
- -

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

- -
-
-
-
- CLEANUP:AddAirbase(AirbaseName) @@ -444,6 +436,20 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )
+ #map + +CLEANUP.__.< + +
+
+ +

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

+ +
+
+
+
+ CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName) @@ -465,6 +471,20 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi ) + +
+
+
+ + #CLEANUP.__.Airbases + +CLEANUP.__.Airbases + +
+
+ + +
@@ -662,6 +682,8 @@ The object to be destroyed.

+

Type CLEANUP.__.Airbases

+

Type list

Type map

diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html index 1754d0aa0..d18ec397a 100644 --- a/docs/Documentation/Detection.html +++ b/docs/Documentation/Detection.html @@ -2563,7 +2563,7 @@ The index of the DetectedItem.

- #number + DETECTION_BASE.DetectionInterval diff --git a/docs/Documentation/Movement.html b/docs/Documentation/Movement.html index be5ce073c..4307c3aaa 100644 --- a/docs/Documentation/Movement.html +++ b/docs/Documentation/Movement.html @@ -227,7 +227,6 @@ on defined intervals (currently every minute).

- #number MOVEMENT.AliveUnits @@ -236,9 +235,6 @@ on defined intervals (currently every minute).

- -

Contains the counter how many units are currently alive

-
diff --git a/docs/Documentation/Settings.html b/docs/Documentation/Settings.html index 4dce02244..7dca37cbf 100644 --- a/docs/Documentation/Settings.html +++ b/docs/Documentation/Settings.html @@ -1073,7 +1073,7 @@ true if metric.

- #boolean + SETTINGS.Metric diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index 1183a03bf..26a6bfada 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -2194,6 +2194,9 @@ The group that was spawned. You can use this group for further actions.

+ +

Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.

+
@@ -2726,6 +2729,9 @@ when nothing was spawned.

+ +

Overwrite unit names by default with group name.

+
@@ -2740,6 +2746,9 @@ when nothing was spawned.

+ +

By default, no InitLimit

+
@@ -2775,7 +2784,7 @@ when nothing was spawned.

- + #number SPAWN.SpawnMaxGroups @@ -2792,7 +2801,7 @@ when nothing was spawned.

- + #number SPAWN.SpawnMaxUnitsAlive @@ -3144,7 +3153,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 ) -

When the first Spawn executes, all the Groups need to be made visible before start.

+

Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.

diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html index d8aa5e633..bc91b9624 100644 --- a/docs/Documentation/SpawnStatic.html +++ b/docs/Documentation/SpawnStatic.html @@ -436,7 +436,6 @@ ptional) The name of the new static.

- #number SPAWNSTATIC.SpawnIndex From 507e4ef25ae18bc368f5ba1bb08fa133700104bb Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 1 Jul 2017 13:02:49 +0200 Subject: [PATCH 04/11] Made CleanUpScheduler private --- Moose Development/Moose/Functional/CleanUp.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua index 9e209ff27..aab745642 100644 --- a/Moose Development/Moose/Functional/CleanUp.lua +++ b/Moose Development/Moose/Functional/CleanUp.lua @@ -100,7 +100,7 @@ function CLEANUP:New( AirbaseNames ) self:HandleEvent( EVENTS.Birth, self.__.OnEventBirth ) - self.CleanUpScheduler = SCHEDULER:New( self, self.__.CleanUpScheduler, {}, 1, self.TimeInterval ) + self.__.CleanUpScheduler = SCHEDULER:New( self, self.__.CleanUpSchedule, {}, 1, self.TimeInterval ) return self end @@ -319,7 +319,7 @@ end --- At the defined time interval, CleanUp the Groups within the CleanUpList. -- @param #CLEANUP self -function CLEANUP.__:CleanUpScheduler() +function CLEANUP.__:CleanUpSchedule() local CleanUpCount = 0 for CleanUpUnitName, CleanUpListData in pairs( self.CleanUpList ) do From 22b02cd3eead0f40837ede70eeae77e2203c83c6 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 1 Jul 2017 13:12:52 +0200 Subject: [PATCH 05/11] Made __ methods invisible --- .../Moose/Functional/CleanUp.lua | 4 +- docs/Documentation/AI_Patrol.html | 3 + docs/Documentation/Cargo.html | 2 + docs/Documentation/CleanUp.html | 325 +----------------- docs/Documentation/Detection.html | 2 + docs/Documentation/Movement.html | 4 + docs/Documentation/Point.html | 1 + docs/Documentation/Settings.html | 2 +- docs/Documentation/Spawn.html | 9 +- docs/Documentation/SpawnStatic.html | 1 + docs/Documentation/Spot.html | 4 + docs/Documentation/Task_Cargo.html | 2 +- 12 files changed, 28 insertions(+), 331 deletions(-) diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua index aab745642..3f9425ac0 100644 --- a/Moose Development/Moose/Functional/CleanUp.lua +++ b/Moose Development/Moose/Functional/CleanUp.lua @@ -9,7 +9,7 @@ -- -- @module CleanUp ---- @type CLEANUP.__ +--- @type CLEANUP.__ Methods which are not intended for mission designers, but which are used interally by the moose designer :-) -- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases. -- @extends Core.Base#BASE @@ -68,7 +68,7 @@ CLEANUP = { CleanUpList = {}, } ---- @field #CLEANUP.__ +-- @field #CLEANUP.__ CLEANUP.__ = {} --- @field #CLEANUP.__.Airbases diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html index 93a9f8ce6..43392b308 100644 --- a/docs/Documentation/AI_Patrol.html +++ b/docs/Documentation/AI_Patrol.html @@ -926,6 +926,9 @@ Use the method AIPATROLZONE.M + +

This table contains the targets detected during patrol.

+
diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html index 262969991..e3fae231c 100644 --- a/docs/Documentation/Cargo.html +++ b/docs/Documentation/Cargo.html @@ -2934,6 +2934,7 @@ The range till cargo will board.

+ CARGO_UNIT.CargoCarrier @@ -3059,6 +3060,7 @@ The range till cargo will board.

+ #number CARGO_UNIT.RunCount diff --git a/docs/Documentation/CleanUp.html b/docs/Documentation/CleanUp.html index 24d7c0a67..c8e23a470 100644 --- a/docs/Documentation/CleanUp.html +++ b/docs/Documentation/CleanUp.html @@ -137,12 +137,6 @@
- - - - @@ -171,72 +165,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CLEANUP.__.< +

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

+
CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName)

Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.

+
CLEANUP.__.Airbases +
CLEANUP:AddAirbase(AirbaseName)

Adds an airbase to the airbase validation list.

-
CLEANUP.CleanUpScheduler -
CLEANUP.__.<

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

-
CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName) -

Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.

-
CLEANUP.__.Airbases - -
CLEANUP.__:CleanUpScheduler() -

At the defined time interval, CleanUp the Groups within the CleanUpList.

-
CLEANUP.__:DestroyMissile(MissileObject) -

Destroys a missile from the simulator, but checks first if it is still existing!

-
CLEANUP.__:DestroyUnit(CleanUpUnit) -

Destroys a Unit from the simulator, but checks first if it is still existing!

-
CLEANUP.__:EventAddForCleanUp(Event) -

Detects if the Unit has an SEVENTENGINESHUTDOWN or an SEVENT_HIT within the given AirbaseNames.

-
CLEANUP.__:IsInAirbase(Vec2) - -
CLEANUP.__:OnEventBirth(EventData) - -
CLEANUP.__:OnEventCrash(Event) -

Detects if a crash event occurs.

-
CLEANUP.__:OnEventHit(Event) -

Detects if the Unit has an SEVENTHIT within the given AirbaseNames.

-
CLEANUP.__:OnEventShot(Event) -

Detects if a unit shoots a missile.

@@ -335,20 +263,6 @@ The method CLEANUP.RemoveAirbase removes

#CLEANUP:

- - -
-
- - - -CLEANUP.CleanUpScheduler - -
-
- - -
@@ -419,7 +333,7 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )
- #CLEANUP.__ + CLEANUP.__ @@ -428,6 +342,9 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi ) + +

@field #CLEANUP.__

+
@@ -445,240 +362,6 @@ CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

- -
-
-
- - -CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName) - -
-
- -

Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.

- -

Parameters

- -
-
-
-
- - #CLEANUP.__.Airbases - -CLEANUP.__.Airbases - -
-
- - - -
-
-
-
- - -CLEANUP.__:CleanUpScheduler() - -
-
- -

At the defined time interval, CleanUp the Groups within the CleanUpList.

- -
-
-
-
- - -CLEANUP.__:DestroyMissile(MissileObject) - -
-
- -

Destroys a missile from the simulator, but checks first if it is still existing!

- -

Parameter

- -
-
-
-
- - -CLEANUP.__:DestroyUnit(CleanUpUnit) - -
-
- -

Destroys a Unit from the simulator, but checks first if it is still existing!

- -

Parameter

- -
-
-
-
- - -CLEANUP.__:EventAddForCleanUp(Event) - -
-
- -

Detects if the Unit has an SEVENTENGINESHUTDOWN or an SEVENT_HIT within the given AirbaseNames.

- - -

If this is the case, add the Group to the CLEANUP List.

- -

Parameter

- -
-
-
-
- - -CLEANUP.__:IsInAirbase(Vec2) - -
-
- - - -

Parameter

-
    -
  • - -

    Vec2 :

    - -
  • -
-
-
-
-
- - -CLEANUP.__:OnEventBirth(EventData) - -
-
- - - -

Parameter

- -
-
-
-
- - -CLEANUP.__:OnEventCrash(Event) - -
-
- -

Detects if a crash event occurs.

- - -

Crashed units go into a CleanUpList for removal.

- -

Parameter

- -
-
-
-
- - -CLEANUP.__:OnEventHit(Event) - -
-
- -

Detects if the Unit has an SEVENTHIT within the given AirbaseNames.

- - -

If this is the case, destroy the unit.

- -

Parameter

- -
-
-
-
- - -CLEANUP.__:OnEventShot(Event) - -
-
- -

Detects if a unit shoots a missile.

- - -

If this occurs within one of the airbases, then the weapon used must be destroyed.

- -

Parameter

-
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html index d18ec397a..8c70074f0 100644 --- a/docs/Documentation/Detection.html +++ b/docs/Documentation/Detection.html @@ -2393,6 +2393,7 @@ The index of the DetectedItem.

+ #number DETECTION_BASE.DetectedItemCount @@ -2406,6 +2407,7 @@ The index of the DetectedItem.

+ #number DETECTION_BASE.DetectedItemMax diff --git a/docs/Documentation/Movement.html b/docs/Documentation/Movement.html index 4307c3aaa..be5ce073c 100644 --- a/docs/Documentation/Movement.html +++ b/docs/Documentation/Movement.html @@ -227,6 +227,7 @@ on defined intervals (currently every minute).

+ #number MOVEMENT.AliveUnits @@ -235,6 +236,9 @@ on defined intervals (currently every minute).

+ +

Contains the counter how many units are currently alive

+
diff --git a/docs/Documentation/Point.html b/docs/Documentation/Point.html index ba2001e76..c9a6550f1 100644 --- a/docs/Documentation/Point.html +++ b/docs/Documentation/Point.html @@ -2823,6 +2823,7 @@ The y coordinate.

+ POINT_VEC2.z diff --git a/docs/Documentation/Settings.html b/docs/Documentation/Settings.html index 7dca37cbf..4dce02244 100644 --- a/docs/Documentation/Settings.html +++ b/docs/Documentation/Settings.html @@ -1073,7 +1073,7 @@ true if metric.

- + #boolean SETTINGS.Metric diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index 26a6bfada..6c440cb38 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -2746,9 +2746,6 @@ when nothing was spawned.

- -

By default, no InitLimit

-
@@ -2784,7 +2781,7 @@ when nothing was spawned.

- #number + SPAWN.SpawnMaxGroups @@ -2801,7 +2798,7 @@ when nothing was spawned.

- #number + SPAWN.SpawnMaxUnitsAlive @@ -3129,7 +3126,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
- + #boolean SPAWN.SpawnUnControlled diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html index bc91b9624..d8aa5e633 100644 --- a/docs/Documentation/SpawnStatic.html +++ b/docs/Documentation/SpawnStatic.html @@ -436,6 +436,7 @@ ptional) The name of the new static.

+ #number SPAWNSTATIC.SpawnIndex diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html index ead3792db..5fdc3b305 100644 --- a/docs/Documentation/Spot.html +++ b/docs/Documentation/Spot.html @@ -765,6 +765,7 @@ true if it is lasing

+ SPOT.ScheduleID @@ -778,6 +779,7 @@ true if it is lasing

+ SPOT.SpotIR @@ -791,6 +793,7 @@ true if it is lasing

+ SPOT.SpotLaser @@ -804,6 +807,7 @@ true if it is lasing

+ SPOT.Target diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html index 76e219e8b..9bf9da484 100644 --- a/docs/Documentation/Task_Cargo.html +++ b/docs/Documentation/Task_Cargo.html @@ -510,7 +510,7 @@ based on the tasking capabilities defined in Task#TA
- Core.Cargo#CARGO_GROUP + Core.Cargo#CARGO FSM_PROCESS.Cargo From 9006e17c2557db1b7b0f13f75e1dc7abf42ed7b5 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 1 Jul 2017 19:00:44 +0200 Subject: [PATCH 06/11] Fixed problem with BASE:GetParent method --- Moose Development/Moose/AI/AI_A2A_Dispatcher.lua | 2 -- Moose Development/Moose/Core/Base.lua | 3 ++- Moose Mission Setup/Moose.lua | 2 +- docs/Documentation/AI_A2A.html | 1 + docs/Documentation/AI_A2A_Dispatcher.html | 13 +++---------- docs/Documentation/AI_Patrol.html | 3 --- docs/Documentation/Cargo.html | 2 -- docs/Documentation/Detection.html | 4 +--- docs/Documentation/Point.html | 1 - docs/Documentation/Spawn.html | 7 +++++-- docs/Documentation/Spot.html | 4 ---- docs/Documentation/Task_Cargo.html | 3 +-- 12 files changed, 14 insertions(+), 31 deletions(-) diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua index 316a7ab12..fcb65227a 100644 --- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua @@ -551,8 +551,6 @@ do -- AI_A2A_DISPATCHER --- AI_A2A_DISPATCHER constructor. -- @param #AI_A2A_DISPATCHER self -- @param Functional.Detection#DETECTION_BASE Detection The DETECTION object that will detects targets using the the Early Warning Radar network. - -- @param #number GroupingRadius The radius in meters wherein detected planes are being grouped as one target area. - -- For airplanes, 6000 (6km) is recommended, and is also the default value of this parameter. -- @return #AI_A2A_DISPATCHER self -- @usage -- diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 68356d0eb..c7dd7f446 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -250,6 +250,7 @@ function BASE:Inherit( Child, Parent ) local Child = routines.utils.deepCopy( Child ) if Child ~= nil then + Child.ClassParent = Parent -- This is for "private" methods... -- When a __ is passed to a method as "self", the __index will search for the method on the public method list of the same object too! @@ -277,7 +278,7 @@ end -- @param #BASE Child is the Child class from which the Parent class needs to be retrieved. -- @return #BASE function BASE:GetParent( Child ) - local Parent = getmetatable( Child ) + local Parent = Child.ClassParent -- env.info('Inherited class of ' .. Child.ClassName .. ' is ' .. Parent.ClassName ) return Parent end diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index ba2e8320e..dbcc4bd87 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170630_1035' ) +env.info( 'Moose Generation Timestamp: 20170701_1713' ) local base = _G diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html index ee2dc9007..2a24504d1 100644 --- a/docs/Documentation/AI_A2A.html +++ b/docs/Documentation/AI_A2A.html @@ -575,6 +575,7 @@
+ #number AI_A2A.IdleCount diff --git a/docs/Documentation/AI_A2A_Dispatcher.html b/docs/Documentation/AI_A2A_Dispatcher.html index b2cf47842..2dba4f655 100644 --- a/docs/Documentation/AI_A2A_Dispatcher.html +++ b/docs/Documentation/AI_A2A_Dispatcher.html @@ -345,7 +345,7 @@
AI_A2A_DISPATCHER:New(Detection, GroupingRadius)AI_A2A_DISPATCHER:New(Detection)

AIA2ADISPATCHER constructor.