mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updates for mission mode.
This commit is contained in:
parent
6be56b1b86
commit
d3ecbac40a
@ -274,7 +274,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
||||
--- @param Core.Group#GROUP EscortGroup
|
||||
function( EscortGroup )
|
||||
EscortGroup.EscortMenu = MENU_GROUP:New( self.PlayerGroup, EscortGroup:GetName(), self.MainMenu )
|
||||
EscortGroup:WayPointInitialize( 1 )
|
||||
EscortGroup:WayPointInitialize()
|
||||
|
||||
EscortGroup:OptionROTVertical()
|
||||
EscortGroup:OptionROEOpenFire()
|
||||
@ -361,7 +361,7 @@ function AI_ESCORT:Menus( XStart, XSpace, YStart, YSpace, ZStart, ZSpace, ZLevel
|
||||
self:MenuROE()
|
||||
self:MenuROT()
|
||||
|
||||
-- self:MenuResumeMission()
|
||||
self:MenuResumeMission()
|
||||
|
||||
|
||||
return self
|
||||
@ -1047,10 +1047,16 @@ end
|
||||
function AI_ESCORT:MenuResumeMission()
|
||||
self:F()
|
||||
|
||||
if not self.EscortMenuResumeMission then
|
||||
-- Mission Resume Menu Root
|
||||
self.EscortMenuResumeMission = MENU_GROUP:New( self.PlayerGroup, "Resume mission from", self.EscortMenu )
|
||||
end
|
||||
self.EscortGroupSet:ForSomeGroupAlive(
|
||||
--- @param Core.Group#GROUP EscortGroup
|
||||
function( EscortGroup )
|
||||
if EscortGroup:IsAir() then
|
||||
local EscortGroupName = EscortGroup:GetName()
|
||||
local EscortMenu = MENU_GROUP:New( self.PlayerGroup, EscortGroupName, self.MainMenu )
|
||||
EscortGroup.EscortMenuResumeMission = MENU_GROUP:New( self.PlayerGroup, "Resume from", EscortMenu )
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
return self
|
||||
end
|
||||
@ -1324,10 +1330,12 @@ function AI_ESCORT:_ScanTargets( ScanDuration )
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_ESCORT self
|
||||
-- @param Wrapper.Group#GROUP EscortGroup
|
||||
--- @param Wrapper.Group#GROUP EscortGroup
|
||||
-- @param #AI_ESCORT self
|
||||
function AI_ESCORT.___Resume( EscortGroup, self )
|
||||
|
||||
self:F( { self=self } )
|
||||
|
||||
local PlayerGroup = self.PlayerGroup
|
||||
|
||||
self:JoinFormation( EscortGroup )
|
||||
@ -1336,6 +1344,26 @@ function AI_ESCORT.___Resume( EscortGroup, self )
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_ESCORT self
|
||||
-- @param Wrapper.Group#GROUP EscortGroup
|
||||
-- @param #number WayPoint
|
||||
function AI_ESCORT._ResumeMission( EscortGroup, WayPoint )
|
||||
|
||||
--self.FollowScheduler:Stop( self.FollowSchedule )
|
||||
|
||||
local WayPoints = EscortGroup:GetTaskRoute()
|
||||
self:T( WayPoint, WayPoints )
|
||||
|
||||
for WayPointIgnore = 1, WayPoint do
|
||||
table.remove( WayPoints, 1 )
|
||||
end
|
||||
|
||||
EscortGroup:SetTask( EscortGroup:TaskRoute( WayPoints ), 1 )
|
||||
|
||||
EscortGroup:MessageTypeToClient( "Resuming mission from waypoint ", MESSAGE.Type.Information, self.PlayerGroup )
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_ESCORT self
|
||||
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
|
||||
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||
@ -1481,26 +1509,6 @@ end
|
||||
|
||||
|
||||
|
||||
function AI_ESCORT:_ResumeMission( WayPoint )
|
||||
|
||||
local EscortGroup = self.EscortGroup
|
||||
local EscortUnit = self.PlayerUnit
|
||||
|
||||
self.FollowScheduler:Stop( self.FollowSchedule )
|
||||
|
||||
local WayPoints = EscortGroup:GetTaskRoute()
|
||||
self:T( WayPoint, WayPoints )
|
||||
|
||||
for WayPointIgnore = 1, WayPoint do
|
||||
table.remove( WayPoints, 1 )
|
||||
end
|
||||
|
||||
SCHEDULER:New( EscortGroup, EscortGroup.SetTask, { EscortGroup:TaskRoute( WayPoints ) }, 1 )
|
||||
|
||||
EscortGroup:MessageToClient( "Resuming mission from waypoint " .. WayPoint .. ".", 10, EscortUnit )
|
||||
end
|
||||
|
||||
|
||||
--- Registers the waypoints
|
||||
-- @param #AI_ESCORT self
|
||||
-- @return #table
|
||||
@ -1580,6 +1588,20 @@ function AI_ESCORT:_ReportTargetsScheduler( EscortGroup )
|
||||
|
||||
EscortMenuAttackTargets:RemoveSubMenus( TimeUpdate, "Esort" )
|
||||
|
||||
if EscortGroup.EscortMenuResumeMission then
|
||||
EscortGroup.EscortMenuResumeMission:RemoveSubMenus()
|
||||
|
||||
local TaskPoints = EscortGroup:GetTaskRoute()
|
||||
|
||||
for WayPointID, WayPoint in pairs( TaskPoints ) do
|
||||
local EscortVec3 = EscortGroup:GetVec3()
|
||||
local Distance = ( ( WayPoint.x - EscortVec3.x )^2 +
|
||||
( WayPoint.y - EscortVec3.z )^2
|
||||
) ^ 0.5 / 1000
|
||||
MENU_GROUP_COMMAND:New( self.PlayerGroup, "Waypoint " .. WayPointID .. " at " .. string.format( "%.2f", Distance ).. "km", EscortGroup.EscortMenuResumeMission, AI_ESCORT._ResumeMission, self, EscortGroup, WayPointID )
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
else
|
||||
end
|
||||
|
||||
@ -149,7 +149,7 @@
|
||||
|
||||
|
||||
--- @type AI_ESCORT_REQUEST
|
||||
-- @extends AI.AI_Formation#AI_FORMATION
|
||||
-- @extends AI.AI_Escort#AI_ESCORT
|
||||
|
||||
--- AI_ESCORT_REQUEST class
|
||||
--
|
||||
@ -217,6 +217,7 @@ function AI_ESCORT_REQUEST:New( EscortUnit, EscortSpawn, EscortAirbase, EscortNa
|
||||
self.Detection = DETECTION_AREAS:New( self.EscortGroupSet, 5000 )
|
||||
self.Detection:__Start( 30 )
|
||||
|
||||
self.SpawnMode = self.__Enum.Mode.Mission
|
||||
|
||||
return self
|
||||
end
|
||||
@ -240,8 +241,10 @@ function AI_ESCORT_REQUEST:SpawnEscort()
|
||||
Report:Add( "Joining Up " .. self.EscortGroupSet:GetUnitTypeNames():Text( ", " ) .. " from " .. LeaderEscort:GetCoordinate():ToString( self.EscortUnit ) )
|
||||
|
||||
LeaderEscort:MessageTypeToGroup( Report:Text(), MESSAGE.Type.Information, self.PlayerUnit )
|
||||
self:FormationTrail( 50, 50, 50 )
|
||||
self:JoinFormation( EscortGroup )
|
||||
if self.SpawnMode == self.__Enum.Mode.Formation then
|
||||
self:FormationTrail( 50, 50, 50 )
|
||||
self:JoinFormation( EscortGroup )
|
||||
end
|
||||
self:Menus( self.XStart, self.XSpace, self.YStart, self.YSpace, self.ZStart, self.ZSpace, self.ZLevels )
|
||||
end
|
||||
)
|
||||
@ -253,7 +256,7 @@ end
|
||||
function AI_ESCORT_REQUEST:onafterStart( EscortGroupSet )
|
||||
|
||||
if not self.MenuRequestEscort then
|
||||
self.MenuRequestEscort = MENU_GROUP_COMMAND:New( self.LeaderGroup, "Request A2G Escort", self.MainMenu,
|
||||
self.MenuRequestEscort = MENU_GROUP_COMMAND:New( self.LeaderGroup, "Request new escort ", self.MainMenu,
|
||||
function()
|
||||
self:SpawnEscort()
|
||||
end
|
||||
@ -262,3 +265,10 @@ function AI_ESCORT_REQUEST:onafterStart( EscortGroupSet )
|
||||
|
||||
end
|
||||
|
||||
--- Set the spawn mode to be mission execution.
|
||||
-- @param #AI_ESCORT_REQUEST self
|
||||
function AI_ESCORT_REQUEST:SetEscortSpawnMission()
|
||||
|
||||
self.SpawnMode = self.__Enum.Mode.Mission
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user