mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Updates
This commit is contained in:
parent
9c523cad52
commit
1e0e67c13d
@ -270,36 +270,8 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
|
||||||
-- @param Core.Set#SET_GROUP EscortGroupSet
|
|
||||||
function AI_ESCORT:onafterStart( EscortGroupSet )
|
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
function AI_ESCORT:_InitFlightMenus()
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
|
||||||
function( EscortGroup )
|
|
||||||
EscortGroup:WayPointInitialize()
|
|
||||||
|
|
||||||
EscortGroup:OptionROTVertical()
|
|
||||||
EscortGroup:OptionROEOpenFire()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
local LeaderEscort = EscortGroupSet:GetFirst() -- Wrapper.Group#GROUP
|
|
||||||
|
|
||||||
local Report = REPORT:New( "Escort reporting:" )
|
|
||||||
Report:Add( "Joining Up " .. EscortGroupSet:GetUnitTypeNames():Text( ", " ) .. " from " .. LeaderEscort:GetCoordinate():ToString( self.PlayerUnit ) )
|
|
||||||
|
|
||||||
LeaderEscort:MessageTypeToGroup( Report:Text(), MESSAGE.Type.Information, self.PlayerUnit )
|
|
||||||
|
|
||||||
self.Detection = DETECTION_AREAS:New( EscortGroupSet, 5000 )
|
|
||||||
|
|
||||||
self.Detection:__Start( 30 )
|
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Dead, OnEventDeadOrCrash )
|
|
||||||
self:HandleEvent( EVENTS.Crash, OnEventDeadOrCrash )
|
|
||||||
|
|
||||||
self.MainMenu = MENU_GROUP:New( self.PlayerGroup, self.EscortName )
|
|
||||||
self.FlightMenu = MENU_GROUP:New( self.PlayerGroup, "Flight", self.MainMenu )
|
|
||||||
|
|
||||||
self:SetFlightMenuJoinUp()
|
self:SetFlightMenuJoinUp()
|
||||||
self:SetFlightMenuFormation( "Trail" )
|
self:SetFlightMenuFormation( "Trail" )
|
||||||
@ -322,9 +294,9 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
self:SetFlightMenuTargets()
|
self:SetFlightMenuTargets()
|
||||||
|
|
||||||
self.EscortGroupSet:ForSomeGroupAlive(
|
end
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
|
||||||
function( EscortGroup )
|
function AI_ESCORT:_InitEscortMenus( EscortGroup )
|
||||||
|
|
||||||
EscortGroup.EscortMenu = MENU_GROUP:New( self.PlayerGroup, EscortGroup:GetCallsign(), self.MainMenu )
|
EscortGroup.EscortMenu = MENU_GROUP:New( self.PlayerGroup, EscortGroup:GetCallsign(), self.MainMenu )
|
||||||
|
|
||||||
@ -342,6 +314,58 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
self:SetEscortMenuTargets( EscortGroup )
|
self:SetEscortMenuTargets( EscortGroup )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function AI_ESCORT:_InitEscortRoute( EscortGroup )
|
||||||
|
|
||||||
|
EscortGroup.MissionRoute = EscortGroup:GetTaskRoute()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- @param #AI_ESCORT self
|
||||||
|
-- @param Core.Set#SET_GROUP EscortGroupSet
|
||||||
|
function AI_ESCORT:onafterStart( EscortGroupSet )
|
||||||
|
|
||||||
|
self:F()
|
||||||
|
|
||||||
|
EscortGroupSet:ForEachGroup(
|
||||||
|
--- @param Core.Group#GROUP EscortGroup
|
||||||
|
function( EscortGroup )
|
||||||
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
|
EscortGroup:OptionROTVertical()
|
||||||
|
EscortGroup:OptionROEOpenFire()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- TODO:Revise this...
|
||||||
|
local LeaderEscort = EscortGroupSet:GetFirst() -- Wrapper.Group#GROUP
|
||||||
|
if LeaderEscort then
|
||||||
|
local Report = REPORT:New( "Escort reporting:" )
|
||||||
|
Report:Add( "Joining Up " .. EscortGroupSet:GetUnitTypeNames():Text( ", " ) .. " from " .. LeaderEscort:GetCoordinate():ToString( self.PlayerUnit ) )
|
||||||
|
LeaderEscort:MessageTypeToGroup( Report:Text(), MESSAGE.Type.Information, self.PlayerUnit )
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Detection = DETECTION_AREAS:New( EscortGroupSet, 5000 )
|
||||||
|
|
||||||
|
self.Detection:__Start( 30 )
|
||||||
|
|
||||||
|
self:HandleEvent( EVENTS.Dead, OnEventDeadOrCrash )
|
||||||
|
self:HandleEvent( EVENTS.Crash, OnEventDeadOrCrash )
|
||||||
|
|
||||||
|
self.MainMenu = MENU_GROUP:New( self.PlayerGroup, self.EscortName )
|
||||||
|
self.FlightMenu = MENU_GROUP:New( self.PlayerGroup, "Flight", self.MainMenu )
|
||||||
|
|
||||||
|
self:_InitFlightMenus()
|
||||||
|
|
||||||
|
self.EscortGroupSet:ForSomeGroupAlive(
|
||||||
|
--- @param Core.Group#GROUP EscortGroup
|
||||||
|
function( EscortGroup )
|
||||||
|
|
||||||
|
self:_InitEscortMenus( EscortGroup )
|
||||||
|
self:_InitEscortRoute( EscortGroup )
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1086,6 +1110,7 @@ function AI_ESCORT:SetEscortMenuTargets( EscortGroup )
|
|||||||
local EscortMenuAttackTargets = MENU_GROUP:New( self.PlayerGroup, "Attack targets", EscortGroup.EscortMenu )
|
local EscortMenuAttackTargets = MENU_GROUP:New( self.PlayerGroup, "Attack targets", EscortGroup.EscortMenu )
|
||||||
|
|
||||||
--EscortGroup.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, { EscortGroup }, 1, MenuTargets.Interval )
|
--EscortGroup.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, { EscortGroup }, 1, MenuTargets.Interval )
|
||||||
|
EscortGroup.ResumeScheduler = SCHEDULER:New( self, self._ResumeScheduler, { EscortGroup }, 1, 60 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1562,7 +1587,9 @@ function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
|
|||||||
|
|
||||||
--self.FollowScheduler:Stop( self.FollowSchedule )
|
--self.FollowScheduler:Stop( self.FollowSchedule )
|
||||||
|
|
||||||
local WayPoints = EscortGroup:GetTaskRoute()
|
self:ModeMission( EscortGroup )
|
||||||
|
|
||||||
|
local WayPoints = EscortGroup.MissionRoute
|
||||||
self:T( WayPoint, WayPoints )
|
self:T( WayPoint, WayPoints )
|
||||||
|
|
||||||
for WayPointIgnore = 1, WayPoint do
|
for WayPointIgnore = 1, WayPoint do
|
||||||
@ -1788,6 +1815,32 @@ function AI_ESCORT:RegisterRoute()
|
|||||||
return TaskPoints
|
return TaskPoints
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Resume Scheduler.
|
||||||
|
-- @param #AI_ESCORT self
|
||||||
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
|
function AI_ESCORT:_ResumeScheduler( EscortGroup )
|
||||||
|
self:F( EscortGroup:GetName() )
|
||||||
|
|
||||||
|
if EscortGroup:IsAlive() and self.PlayerUnit:IsAlive() then
|
||||||
|
|
||||||
|
|
||||||
|
local EscortGroupName = EscortGroup:GetCallsign()
|
||||||
|
|
||||||
|
if EscortGroup.EscortMenuResumeMission then
|
||||||
|
EscortGroup.EscortMenuResumeMission:RemoveSubMenus()
|
||||||
|
|
||||||
|
local TaskPoints = EscortGroup.MissionRoute
|
||||||
|
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Report Targets Scheduler.
|
--- Report Targets Scheduler.
|
||||||
@ -1861,20 +1914,6 @@ function AI_ESCORT:_ReportTargetsScheduler( EscortGroup )
|
|||||||
EscortGroup:MessageTypeToGroup( "No targets detected.", MESSAGE.Type.Information, self.PlayerGroup )
|
EscortGroup:MessageTypeToGroup( "No targets detected.", MESSAGE.Type.Information, self.PlayerGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
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
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -226,43 +226,27 @@ end
|
|||||||
function AI_ESCORT_REQUEST:SpawnEscort()
|
function AI_ESCORT_REQUEST:SpawnEscort()
|
||||||
|
|
||||||
local EscortGroup = self.EscortSpawn:SpawnAtAirbase( self.EscortAirbase, SPAWN.Takeoff.Hot )
|
local EscortGroup = self.EscortSpawn:SpawnAtAirbase( self.EscortAirbase, SPAWN.Takeoff.Hot )
|
||||||
self.EscortGroupSet:AddGroup( EscortGroup )
|
|
||||||
|
|
||||||
EscortGroup:OptionROTVertical()
|
EscortGroup:OptionROTVertical()
|
||||||
EscortGroup:OptionROEHoldFire()
|
EscortGroup:OptionROEHoldFire()
|
||||||
|
|
||||||
self:ScheduleOnce( 0.1,
|
self:ScheduleOnce( 0.1,
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
|
|
||||||
|
self.EscortGroupSet:AddGroup( EscortGroup )
|
||||||
|
|
||||||
local LeaderEscort = self.EscortGroupSet:GetFirst() -- Wrapper.Group#GROUP
|
local LeaderEscort = self.EscortGroupSet:GetFirst() -- Wrapper.Group#GROUP
|
||||||
|
|
||||||
local Report = REPORT:New()
|
local Report = REPORT:New()
|
||||||
|
|
||||||
Report:Add( "Joining Up " .. self.EscortGroupSet:GetUnitTypeNames():Text( ", " ) .. " from " .. LeaderEscort:GetCoordinate():ToString( self.EscortUnit ) )
|
Report:Add( "Joining Up " .. self.EscortGroupSet:GetUnitTypeNames():Text( ", " ) .. " from " .. LeaderEscort:GetCoordinate():ToString( self.EscortUnit ) )
|
||||||
LeaderEscort:MessageTypeToGroup( Report:Text(), MESSAGE.Type.Information, self.PlayerUnit )
|
LeaderEscort:MessageTypeToGroup( Report:Text(), MESSAGE.Type.Information, self.PlayerUnit )
|
||||||
|
|
||||||
self:FormationTrail( 50, 50, 50 )
|
|
||||||
if self.SpawnMode == self.__Enum.Mode.Formation then
|
if self.SpawnMode == self.__Enum.Mode.Formation then
|
||||||
self:ModeFormation( EscortGroup )
|
self:ModeFormation( EscortGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
--self:Menus( self.XStart, self.XSpace, self.YStart, self.YSpace, self.ZStart, self.ZSpace, self.ZLevels )
|
self:_InitFlightMenus()
|
||||||
|
self:_InitEscortMenus( EscortGroup )
|
||||||
EscortGroup.EscortMenu = MENU_GROUP:New( self.PlayerGroup, EscortGroup:GetName(), self.MainMenu )
|
self:_InitEscortRoute( EscortGroup )
|
||||||
|
|
||||||
self:EscortMenuJoinUp( EscortGroup )
|
|
||||||
|
|
||||||
self:EscortMenuHoldAtEscortPosition( EscortGroup )
|
|
||||||
self:EscortMenuHoldAtLeaderPosition( EscortGroup )
|
|
||||||
|
|
||||||
self:MenuFlare()
|
|
||||||
self:MenuSmoke()
|
|
||||||
|
|
||||||
self:MenuReportTargets( 60 )
|
|
||||||
self:MenuAssistedAttack()
|
|
||||||
self:MenuROE()
|
|
||||||
self:MenuROT()
|
|
||||||
|
|
||||||
self:MenuResumeMission()
|
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
--- @param #AI_ESCORT self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
@ -283,6 +267,8 @@ end
|
|||||||
-- @param Core.Set#SET_GROUP EscortGroupSet
|
-- @param Core.Set#SET_GROUP EscortGroupSet
|
||||||
function AI_ESCORT_REQUEST:onafterStart( EscortGroupSet )
|
function AI_ESCORT_REQUEST:onafterStart( EscortGroupSet )
|
||||||
|
|
||||||
|
self:F()
|
||||||
|
|
||||||
if not self.MenuRequestEscort then
|
if not self.MenuRequestEscort then
|
||||||
self.MenuRequestEscort = MENU_GROUP_COMMAND:New( self.LeaderGroup, "Request new escort ", self.MainMenu,
|
self.MenuRequestEscort = MENU_GROUP_COMMAND:New( self.LeaderGroup, "Request new escort ", self.MainMenu,
|
||||||
function()
|
function()
|
||||||
@ -291,6 +277,8 @@ function AI_ESCORT_REQUEST:onafterStart( EscortGroupSet )
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self:GetParent( self ).onafterStart( self, EscortGroupSet )
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Dead, self.OnEventDeadOrCrash )
|
self:HandleEvent( EVENTS.Dead, self.OnEventDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.Crash, self.OnEventDeadOrCrash )
|
self:HandleEvent( EVENTS.Crash, self.OnEventDeadOrCrash )
|
||||||
|
|
||||||
|
|||||||
@ -2840,6 +2840,19 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) --R2.2
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Callsign
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
local Callsign = SpawnTemplate.units[UnitID].callsign
|
||||||
|
if Callsign[1] ~= nil then -- blue callsign
|
||||||
|
Callsign[2] = ( ( SpawnIndex - 1 ) % 10 ) + 1
|
||||||
|
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
||||||
|
local CallsignLen = CallsignName:len()
|
||||||
|
SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub(1,CallsignLen) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
||||||
|
else
|
||||||
|
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:T3( { "Template:", SpawnTemplate } )
|
self:T3( { "Template:", SpawnTemplate } )
|
||||||
return SpawnTemplate
|
return SpawnTemplate
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user