Fixed AI_CAP

-- ROE fine tuned.
-- Detection events cross firing and exploding...
-- Crash, Ejected, PilotDead is detected, makes the FSM stop.
-- FSM bug fixed. There was an issue with the onbefore and onleave
events returning false, which did not stop the transition! Fixed now.
-- Event calling can return errors, and these must be logged correctly
-> xpcall implemented.
-- Added help from moose club members as a reference in the
documentation. -> delta99 en whisper.
-- ...
This commit is contained in:
FlightControl
2017-01-19 19:51:37 +01:00
parent b52dd7cf57
commit 15fdb0fd45
83 changed files with 613 additions and 326 deletions

View File

@@ -14,7 +14,7 @@
--
-- ![HoldAndEngage](..\Presentations\AI_Cas\Dia3.JPG)
--
-- The AI_CAS_ZONE is assigned a @(Group) and this must be done before the AI_CAS_ZONE process can be started through the **Start** event.
-- The AI_CAS_ZONE is assigned a @{Group} and this must be done before the AI_CAS_ZONE process can be started through the **Start** event.
--
-- ![Start Event](..\Presentations\AI_Cas\Dia4.JPG)
--
@@ -122,7 +122,7 @@
-- @type AI_CAS_ZONE
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling.
-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed.
-- @extends AI.AI_Patrol#AI_CAS_ZONE
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
AI_CAS_ZONE = {
ClassName = "AI_CAS_ZONE",
}
@@ -334,24 +334,10 @@ end
-- @param #string To The To State string.
function AI_CAS_ZONE:onafterStart( Controllable, From, Event, To )
self:Route()
self:__Status( 30 ) -- Check status status every 30 seconds.
self:__Detect( self.DetectInterval ) -- Detect for new targets every DetectInterval in the EngageZone.
-- Call the parent Start event handler
self:GetParent(self).onafterStart( self, Controllable, From, Event, To )
self:EventOnDead( self.OnDead )
Controllable:OptionROEHoldFire()
Controllable:OptionROTVertical()
self.Controllable:OnReSpawn(
function( PatrolGroup )
self:E( "ReSpawn" )
self:__Reset()
self:__Route( 5 )
end
)
end
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
@@ -384,8 +370,6 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
if Controllable:IsAlive() then
self:Detect( self.EngageZone )
local EngageRoute = {}
--- Calculate the current route point.
@@ -516,7 +500,7 @@ end
-- @param #string To The To State string.
function AI_CAS_ZONE:onafterAccomplish( Controllable, From, Event, To )
self.Accomplished = true
self.DetectUnits = false
self:SetDetectionOff()
end
--- @param #AI_CAS_ZONE self