This commit is contained in:
FlightControl 2019-06-18 20:03:24 +03:00
parent 1e0e67c13d
commit 1d4dad0180
2 changed files with 19 additions and 15 deletions

View File

@ -1099,17 +1099,17 @@ function AI_ESCORT:SetEscortMenuTargets( EscortGroup )
for _, MenuTargets in pairs( self.Menu.Targets) do for _, MenuTargets in pairs( self.Menu.Targets) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
local EscortMenuReportTargets = MENU_GROUP:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu ) --local EscortMenuReportTargets = MENU_GROUP:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu )
-- Report Targets -- Report Targets
EscortGroup.EscortMenuReportNearbyTargetsNow = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Report targets now!", EscortMenuReportTargets, AI_ESCORT._ReportNearbyTargetsNow, self, EscortGroup, true ) EscortGroup.EscortMenuReportNearbyTargetsNow = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu, AI_ESCORT._ReportNearbyTargetsNow, self, EscortGroup, true )
--EscortGroup.EscortMenuReportNearbyTargetsOn = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Report targets on", EscortGroup.EscortMenuReportNearbyTargets, AI_ESCORT._SwitchReportNearbyTargets, self, EscortGroup, true ) --EscortGroup.EscortMenuReportNearbyTargetsOn = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Report targets on", EscortGroup.EscortMenuReportNearbyTargets, AI_ESCORT._SwitchReportNearbyTargets, self, EscortGroup, true )
--EscortGroup.EscortMenuReportNearbyTargetsOff = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Report targets off", EscortGroup.EscortMenuReportNearbyTargets, AI_ESCORT._SwitchReportNearbyTargets, self, EscortGroup, false ) --EscortGroup.EscortMenuReportNearbyTargetsOff = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Report targets off", EscortGroup.EscortMenuReportNearbyTargets, AI_ESCORT._SwitchReportNearbyTargets, self, EscortGroup, false )
-- Attack Targets -- Attack Targets
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 ) EscortGroup.ResumeScheduler = SCHEDULER:New( self, self._ResumeScheduler, { EscortGroup }, 1, 60 )
end end
end end
@ -1365,6 +1365,8 @@ function AI_ESCORT:_JoinUp( EscortGroup )
local EscortUnit = self.PlayerUnit local EscortUnit = self.PlayerUnit
self:ModeFormation( EscortGroup ) self:ModeFormation( EscortGroup )
EscortGroup:MessageTypeToGroup( "Joining up!", MESSAGE.Type.Information, EscortUnit:GetGroup() )
end end
@ -1615,7 +1617,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
EscortGroup:OptionROEOpenFire() EscortGroup:OptionROEOpenFire()
EscortGroup:OptionROTPassiveDefense() EscortGroup:OptionROTVertical()
EscortGroup:SetState( EscortGroup, "Escort", self ) EscortGroup:SetState( EscortGroup, "Escort", self )
local DetectedSet = self.Detection:GetDetectedItemSet( DetectedItem ) local DetectedSet = self.Detection:GetDetectedItemSet( DetectedItem )
@ -1664,8 +1666,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
end end
EscortGroup:MessageTypeToGroup( "Engaging!", MESSAGE.Type.Information, EscortUnit ) EscortGroup:MessageTypeToGroup( "Engaging Target!", MESSAGE.Type.Information, self.PlayerGroup )
end end
@ -1846,7 +1847,7 @@ end
--- Report Targets Scheduler. --- Report Targets Scheduler.
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function AI_ESCORT:_ReportTargetsScheduler( EscortGroup ) function AI_ESCORT:_ReportTargetsScheduler( EscortGroup, Report )
self:F( EscortGroup:GetName() ) self:F( EscortGroup:GetName() )
if EscortGroup:IsAlive() and self.PlayerUnit:IsAlive() then if EscortGroup:IsAlive() and self.PlayerUnit:IsAlive() then
@ -1854,7 +1855,7 @@ function AI_ESCORT:_ReportTargetsScheduler( EscortGroup )
local EscortGroupName = EscortGroup:GetCallsign() local EscortGroupName = EscortGroup:GetCallsign()
local DetectedTargetsReport = REPORT:New( "Reporting target locations from my position:\n" ) -- A new report to display the detected targets as a message to the player. local DetectedTargetsReport = REPORT:New( "Reporting targets:\n" ) -- A new report to display the detected targets as a message to the player.
if EscortGroup.EscortMenuTargetAssistance then if EscortGroup.EscortMenuTargetAssistance then
@ -1908,10 +1909,12 @@ function AI_ESCORT:_ReportTargetsScheduler( EscortGroup )
EscortMenuAttackTargets:RemoveSubMenus( TimeUpdate, "Esort" ) EscortMenuAttackTargets:RemoveSubMenus( TimeUpdate, "Esort" )
if DetectedTargets then if Report then
EscortGroup:MessageTypeToGroup( DetectedTargetsReport:Text( "\n" ), MESSAGE.Type.Information, self.PlayerGroup ) if DetectedTargets then
else EscortGroup:MessageTypeToGroup( DetectedTargetsReport:Text( "\n" ), MESSAGE.Type.Information, self.PlayerGroup )
EscortGroup:MessageTypeToGroup( "No targets detected.", MESSAGE.Type.Information, self.PlayerGroup ) else
EscortGroup:MessageTypeToGroup( "No targets detected.", MESSAGE.Type.Information, self.PlayerGroup )
end
end end
return true return true
@ -1929,7 +1932,7 @@ function AI_ESCORT:_FlightReportTargetsScheduler()
local EscortGroup = self.EscortGroupSet:GetFirst() -- Wrapper.Group#GROUP local EscortGroup = self.EscortGroupSet:GetFirst() -- Wrapper.Group#GROUP
local DetectedTargetsReport = REPORT:New( "Reporting target locations from your position:\n" ) -- A new report to display the detected targets as a message to the player. local DetectedTargetsReport = REPORT:New( "Reporting your targets:\n" ) -- A new report to display the detected targets as a message to the player.
if EscortGroup and ( self.PlayerUnit:IsAlive() and EscortGroup:IsAlive() ) then if EscortGroup and ( self.PlayerUnit:IsAlive() and EscortGroup:IsAlive() ) then

View File

@ -1142,7 +1142,8 @@ function AI_FORMATION:onenterFollowing( FollowGroupSet ) --R2.1
-- Now we calculate the intersecting vector between the circle around CV2 with radius FollowDistance and GH2. -- Now we calculate the intersecting vector between the circle around CV2 with radius FollowDistance and GH2.
-- From the GeoGebra model: CVI = (x(CV2) + FollowDistance cos(alpha), y(GH2) + FollowDistance sin(alpha), z(CV2)) -- From the GeoGebra model: CVI = (x(CV2) + FollowDistance cos(alpha), y(GH2) + FollowDistance sin(alpha), z(CV2))
local CVI = { x = CV2.x + CS * 10 * math.sin(Ca), local CVI = { x = CV2.x + CS * 10 * math.sin(Ca),
y = GH2.y + ( Distance + FollowFormation.x ) / 10, -- + FollowFormation.y, --y = GH2.y + ( Distance + FollowFormation.x ) / 10, -- + FollowFormation.y,
y = GH2.y,
z = CV2.z + CS * 10 * math.cos(Ca), z = CV2.z + CS * 10 * math.cos(Ca),
} }