- Fixed call to .Resume function if AI_A2A_CAP is calling.
This commit is contained in:
Frank 2020-01-02 20:15:42 +01:00
parent 6208c79d1f
commit d5b8ed62ae
3 changed files with 13 additions and 3 deletions

View File

@ -748,10 +748,20 @@ function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
AIGroup:OptionROEHoldFire() AIGroup:OptionROEHoldFire()
AIGroup:OptionROTEvadeFire() AIGroup:OptionROTEvadeFire()
-- Get Class name for .Resume function
local classname=self:GetClassName()
-- AI_A2A_CAP can call this function but does not have a .Resume function. Try to fix.
local fsm=self
if classname=="AI_A2A_CAP" then
fsm=self:GetParent(self, AI_A2A_CAP)
classname=fsm:GetClassName()
end
local Tasks = {} local Tasks = {}
Tasks[#Tasks+1] = AIGroup:TaskRefueling() Tasks[#Tasks+1] = AIGroup:TaskRefueling()
Tasks[#Tasks+1] = AIGroup:TaskFunction( self:GetClassName() .. ".Resume", self ) Tasks[#Tasks+1] = AIGroup:TaskFunction( classname .. ".Resume", fsm )
RefuelRoute[#RefuelRoute].task = AIGroup:TaskCombo( Tasks ) RefuelRoute[#RefuelRoute].task = AIGroup:TaskCombo( Tasks )
AIGroup:Route( RefuelRoute, self.TaskDelay ) AIGroup:Route( RefuelRoute, self.TaskDelay )

View File

@ -356,7 +356,6 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
local taskOrbit=AIPatrol:TaskOrbit(c1, altitude, UTILS.KmphToMps(speedkmh), c2) local taskOrbit=AIPatrol:TaskOrbit(c1, altitude, UTILS.KmphToMps(speedkmh), c2)
-- Task function to redo the patrol at other random position. -- Task function to redo the patrol at other random position.
--local taskPatrol=AIPatrol:TaskFunction("AI_A2A_PATROL.PatrolRoute", self)
local taskPatrol=AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self) local taskPatrol=AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
-- Controlled task with task condition. -- Controlled task with task condition.

View File

@ -298,7 +298,8 @@ end
-- --
-- --
-- @param #BASE self -- @param #BASE self
-- @param #BASE Child is the Child class from which the Parent class needs to be retrieved. -- @param #BASE Child This is the Child class from which the Parent class needs to be retrieved.
-- @param #BASE FromClass (Optional) The class from which to get the parent.
-- @return #BASE -- @return #BASE
function BASE:GetParent( Child, FromClass ) function BASE:GetParent( Child, FromClass )