mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-18 13:16:03 +00:00
Merge branch 'develop' into FF/Fox2
This commit is contained in:
@@ -119,7 +119,7 @@ function AI_A2A_CAP:New2( AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAlti
|
|||||||
local AI_Air = AI_AIR:New( AICap )
|
local AI_Air = AI_AIR:New( AICap )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage )
|
local self = BASE:Inherit( self, AI_Air_Engage ) --#AI_A2A_CAP
|
||||||
|
|
||||||
self:SetFuelThreshold( .2, 60 )
|
self:SetFuelThreshold( .2, 60 )
|
||||||
self:SetDamageThreshold( 0.4 )
|
self:SetDamageThreshold( 0.4 )
|
||||||
|
|||||||
@@ -707,13 +707,14 @@ end
|
|||||||
function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
|
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
|
|
||||||
|
-- Get tanker group.
|
||||||
local Tanker = GROUP:FindByName( self.TankerName )
|
local Tanker = GROUP:FindByName( self.TankerName )
|
||||||
|
|
||||||
if Tanker:IsAlive() and Tanker:IsAirPlane() then
|
if Tanker and Tanker:IsAlive() and Tanker:IsAirPlane() then
|
||||||
|
|
||||||
self:I( "Group " .. self.Controllable:GetName() .. " ... Refuelling! ( " .. self:GetState() .. "), at tanker " .. self.TankerName )
|
self:I( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
||||||
|
|
||||||
local RefuelRoute = {}
|
local RefuelRoute = {}
|
||||||
|
|
||||||
@@ -724,40 +725,43 @@ function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
|||||||
local ToRefuelSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToRefuelSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local FromRefuelRoutePoint = FromRefuelCoord:WaypointAir(
|
local FromRefuelRoutePoint = FromRefuelCoord:WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToRefuelSpeed, true)
|
||||||
self.PatrolAltType,
|
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
|
||||||
ToRefuelSpeed,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air. NOT used!
|
||||||
local ToRefuelRoutePoint = FromRefuelCoord:WaypointAir(
|
local ToRefuelRoutePoint = Tanker:GetCoordinate():WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToRefuelSpeed, true)
|
||||||
self.PatrolAltType,
|
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
|
||||||
ToRefuelSpeed,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
|
|
||||||
self:F( { ToRefuelSpeed = ToRefuelSpeed } )
|
self:F( { ToRefuelSpeed = ToRefuelSpeed } )
|
||||||
|
|
||||||
RefuelRoute[#RefuelRoute+1] = FromRefuelRoutePoint
|
RefuelRoute[#RefuelRoute+1] = FromRefuelRoutePoint
|
||||||
--RefuelRoute[#RefuelRoute+1] = ToRefuelRoutePoint
|
RefuelRoute[#RefuelRoute+1] = ToRefuelRoutePoint
|
||||||
|
|
||||||
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.
|
||||||
|
if classname=="AI_A2A_CAP" then
|
||||||
|
classname="AI_AIR_PATROL"
|
||||||
|
end
|
||||||
|
|
||||||
|
env.info("FF refueling classname="..classname)
|
||||||
|
|
||||||
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", self )
|
||||||
RefuelRoute[#RefuelRoute].task = AIGroup:TaskCombo( Tasks )
|
RefuelRoute[#RefuelRoute].task = AIGroup:TaskCombo( Tasks )
|
||||||
|
|
||||||
AIGroup:Route( RefuelRoute, self.TaskDelay )
|
AIGroup:Route( RefuelRoute, self.TaskDelay )
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
-- No tanker defined ==> RTB!
|
||||||
self:RTB()
|
self:RTB()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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 )
|
||||||
|
|
||||||
|
|||||||
@@ -693,7 +693,7 @@ ARTY.db={
|
|||||||
|
|
||||||
--- Arty script version.
|
--- Arty script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ARTY.version="1.1.6"
|
ARTY.version="1.1.7"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -3848,26 +3848,23 @@ end
|
|||||||
-- @param #boolean final True if it is the final waypoint.
|
-- @param #boolean final True if it is the final waypoint.
|
||||||
function ARTY._PassingWaypoint(group, arty, i, final)
|
function ARTY._PassingWaypoint(group, arty, i, final)
|
||||||
|
|
||||||
-- Debug message.
|
if group and group:IsAlive() then
|
||||||
local text=string.format("%s, passing waypoint %d.", group:GetName(), i)
|
|
||||||
if final then
|
local groupname=tostring(group:GetName())
|
||||||
text=string.format("%s, arrived at destination.", group:GetName())
|
|
||||||
end
|
|
||||||
arty:T(self.lid..text)
|
|
||||||
|
|
||||||
--[[
|
-- Debug message.
|
||||||
if final then
|
local text=string.format("%s, passing waypoint %d.", groupname, i)
|
||||||
MESSAGE:New(text, 10):ToCoalitionIf(group:GetCoalition(), arty.Debug or arty.report)
|
if final then
|
||||||
else
|
text=string.format("%s, arrived at destination.", groupname)
|
||||||
MESSAGE:New(text, 10):ToAllIf(arty.Debug)
|
end
|
||||||
|
arty:T(arty.lid..text)
|
||||||
|
|
||||||
|
-- Arrived event.
|
||||||
|
if final and arty.groupname==groupname then
|
||||||
|
arty:Arrived()
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
]]
|
|
||||||
|
|
||||||
-- Arrived event.
|
|
||||||
if final and arty.groupname==group:GetName() then
|
|
||||||
arty:Arrived()
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Relocate to another position, e.g. after an engagement to avoid couter strikes.
|
--- Relocate to another position, e.g. after an engagement to avoid couter strikes.
|
||||||
|
|||||||
Reference in New Issue
Block a user