mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
AWACS - Tweaked escort logic to use one AUFTRAG per escort fighter and tweaked positioning logic. Allows more control over escort fighters which will support a future PR (#1746)
This commit is contained in:
committed by
GitHub
parent
0e4d731068
commit
ab1dd2b374
@@ -919,6 +919,8 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
|||||||
-- Escorts
|
-- Escorts
|
||||||
self.HasEscorts = false
|
self.HasEscorts = false
|
||||||
self.EscortTemplate = ""
|
self.EscortTemplate = ""
|
||||||
|
self.EscortMission = {}
|
||||||
|
self.EscortMissionReplacement = {}
|
||||||
|
|
||||||
-- SRS
|
-- SRS
|
||||||
self.PathToSRS = "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.PathToSRS = "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
@@ -1738,20 +1740,21 @@ function AWACS:_StartEscorts(Shiftchange)
|
|||||||
|
|
||||||
local AwacsFG = self.AwacsFG -- Ops.FlightGroup#FLIGHTGROUP
|
local AwacsFG = self.AwacsFG -- Ops.FlightGroup#FLIGHTGROUP
|
||||||
local group = AwacsFG:GetGroup()
|
local group = AwacsFG:GetGroup()
|
||||||
local mission = AUFTRAG:NewESCORT(group,{x=-100, y=0, z=200},45,{"Air"})
|
|
||||||
self.CatchAllMissions[#self.CatchAllMissions+1] = mission
|
|
||||||
|
|
||||||
mission:SetRequiredAssets(self.EscortNumber)
|
|
||||||
|
|
||||||
local timeonstation = (self.EscortsTimeOnStation + self.ShiftChangeTime) * 3600 -- hours to seconds
|
local timeonstation = (self.EscortsTimeOnStation + self.ShiftChangeTime) * 3600 -- hours to seconds
|
||||||
mission:SetTime(nil,timeonstation)
|
for i=1,self.EscortNumber do
|
||||||
|
-- every
|
||||||
self.AirWing:AddMission(mission)
|
local escort = AUFTRAG:NewESCORT(group, {x= -100*((i + (i%2))/2), y=0, z=(100 + 100*((i + (i%2))/2))*(-1)^i},45,{"Air"})
|
||||||
|
escort:SetRequiredAssets(1)
|
||||||
if Shiftchange then
|
escort:SetTime(nil,timeonstation)
|
||||||
self.EscortMissionReplacement = mission
|
self.AirWing:AddMission(escort)
|
||||||
else
|
self.CatchAllMissions[#self.CatchAllMissions+1] = escort
|
||||||
self.EscortMission = mission
|
|
||||||
|
if Shiftchange then
|
||||||
|
self.EscortMissionReplacement[i] = mission
|
||||||
|
else
|
||||||
|
self.EscortMission[i] = mission
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -5601,57 +5604,27 @@ function AWACS:_CheckAwacsStatus()
|
|||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
if self.HasEscorts then
|
if self.HasEscorts then
|
||||||
local ESmission = self.EscortMission -- Ops.Auftrag#AUFTRAG
|
for i=1, self.EscortNumber do
|
||||||
local esstatus = ESmission:GetState()
|
local ESmission = self.EscortMission[i] -- Ops.Auftrag#AUFTRAG
|
||||||
local ESmissiontime = (timer.getTime() - self.EscortsTimeStamp)
|
if not ESmission then break end
|
||||||
local ESTOSLeft = UTILS.Round((((self.EscortsTimeOnStation+self.ShiftChangeTime)*3600) - ESmissiontime),0) -- seconds
|
|
||||||
ESTOSLeft = UTILS.Round(ESTOSLeft/60,0) -- minutes
|
|
||||||
local ChangeTime = UTILS.Round(((self.ShiftChangeTime * 3600)/60),0)
|
|
||||||
local Changedue = "No"
|
|
||||||
|
|
||||||
if (ESTOSLeft <= ChangeTime and not self.ShiftChangeEscortsFlag) or (ESmission:IsOver() and not self.ShiftChangeEscortsFlag) then
|
|
||||||
Changedue = "Yes"
|
|
||||||
self.ShiftChangeEscortsFlag = true -- set this back when new Escorts arrived
|
|
||||||
self:__EscortShiftChange(2)
|
|
||||||
end
|
|
||||||
|
|
||||||
report:Add("====================")
|
|
||||||
report:Add("ESCORTS:")
|
|
||||||
report:Add(string.format("Auftrag Status: %s",esstatus))
|
|
||||||
report:Add(string.format("TOS Left: %d min",ESTOSLeft))
|
|
||||||
report:Add(string.format("Needs ShiftChange: %s",Changedue))
|
|
||||||
|
|
||||||
local OpsGroups = ESmission:GetOpsGroups()
|
|
||||||
local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP
|
|
||||||
if OpsGroup then
|
|
||||||
local OpsName = OpsGroup:GetName() or "Unknown"
|
|
||||||
local OpsCallSign = OpsGroup:GetCallsignName() or "Unknown"
|
|
||||||
report:Add(string.format("Mission FG %s",OpsName))
|
|
||||||
report:Add(string.format("Callsign %s",OpsCallSign))
|
|
||||||
report:Add(string.format("Mission FG State %s",OpsGroup:GetState()))
|
|
||||||
monitoringdata.EscortsStateMission = esstatus
|
|
||||||
monitoringdata.EscortsStateFG = OpsGroup:GetState()
|
|
||||||
else
|
|
||||||
report:Add("***** Cannot obtain (yet) this missions OpsGroup!")
|
|
||||||
end
|
|
||||||
|
|
||||||
report:Add("====================")
|
|
||||||
|
|
||||||
-- Check for replacement mission - if any
|
|
||||||
if self.ShiftChangeEscortsFlag and self.ShiftChangeEscortsRequested then -- Ops.Auftrag#AUFTRAG
|
|
||||||
ESmission = self.EscortMissionReplacement
|
|
||||||
local esstatus = ESmission:GetState()
|
local esstatus = ESmission:GetState()
|
||||||
local ESmissiontime = (timer.getTime() - self.EscortsTimeStamp)
|
local ESmissiontime = (timer.getTime() - self.EscortsTimeStamp)
|
||||||
local ESTOSLeft = UTILS.Round((((self.EscortsTimeOnStation+self.ShiftChangeTime)*3600) - ESmissiontime),0) -- seconds
|
local ESTOSLeft = UTILS.Round((((self.EscortsTimeOnStation+self.ShiftChangeTime)*3600) - ESmissiontime),0) -- seconds
|
||||||
ESTOSLeft = UTILS.Round(ESTOSLeft/60,0) -- minutes
|
ESTOSLeft = UTILS.Round(ESTOSLeft/60,0) -- minutes
|
||||||
local ChangeTime = UTILS.Round(((self.ShiftChangeTime * 3600)/60),0)
|
local ChangeTime = UTILS.Round(((self.ShiftChangeTime * 3600)/60),0)
|
||||||
--local Changedue = "No"
|
local Changedue = "No"
|
||||||
|
|
||||||
--report:Add("====================")
|
if (ESTOSLeft <= ChangeTime and not self.ShiftChangeEscortsFlag) or (ESmission:IsOver() and not self.ShiftChangeEscortsFlag) then
|
||||||
report:Add("ESCORTS REPLACEMENT:")
|
Changedue = "Yes"
|
||||||
|
self.ShiftChangeEscortsFlag = true -- set this back when new Escorts arrived
|
||||||
|
self:__EscortShiftChange(2)
|
||||||
|
end
|
||||||
|
|
||||||
|
report:Add("====================")
|
||||||
|
report:Add("ESCORTS:")
|
||||||
report:Add(string.format("Auftrag Status: %s",esstatus))
|
report:Add(string.format("Auftrag Status: %s",esstatus))
|
||||||
report:Add(string.format("TOS Left: %d min",ESTOSLeft))
|
report:Add(string.format("TOS Left: %d min",ESTOSLeft))
|
||||||
--report:Add(string.format("Needs ShiftChange: %s",Changedue))
|
report:Add(string.format("Needs ShiftChange: %s",Changedue))
|
||||||
|
|
||||||
local OpsGroups = ESmission:GetOpsGroups()
|
local OpsGroups = ESmission:GetOpsGroups()
|
||||||
local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP
|
local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP
|
||||||
@@ -5661,24 +5634,57 @@ function AWACS:_CheckAwacsStatus()
|
|||||||
report:Add(string.format("Mission FG %s",OpsName))
|
report:Add(string.format("Mission FG %s",OpsName))
|
||||||
report:Add(string.format("Callsign %s",OpsCallSign))
|
report:Add(string.format("Callsign %s",OpsCallSign))
|
||||||
report:Add(string.format("Mission FG State %s",OpsGroup:GetState()))
|
report:Add(string.format("Mission FG State %s",OpsGroup:GetState()))
|
||||||
|
monitoringdata.EscortsStateMission[i] = esstatus
|
||||||
|
monitoringdata.EscortsStateFG[i] = OpsGroup:GetState()
|
||||||
else
|
else
|
||||||
report:Add("***** Cannot obtain (yet) this missions OpsGroup!")
|
report:Add("***** Cannot obtain (yet) this missions OpsGroup!")
|
||||||
end
|
end
|
||||||
|
|
||||||
if ESmission:IsExecuting() then
|
|
||||||
-- make the actual change in the queue
|
|
||||||
self.ShiftChangeEscortsFlag = false
|
|
||||||
self.ShiftChangeEscortsRequested = false
|
|
||||||
-- cancel old mission
|
|
||||||
if self.EscortMission and self.EscortMission:IsNotOver() then
|
|
||||||
self.EscortMission:Cancel()
|
|
||||||
end
|
|
||||||
self.EscortMission = self.EscortMissionReplacement
|
|
||||||
self.EscortMissionReplacement = nil
|
|
||||||
self.EscortsTimeStamp = timer.getTime()
|
|
||||||
report:Add("*** Replacement DONE ***")
|
|
||||||
end
|
|
||||||
report:Add("====================")
|
report:Add("====================")
|
||||||
|
|
||||||
|
-- Check for replacement mission - if any
|
||||||
|
if self.ShiftChangeEscortsFlag and self.ShiftChangeEscortsRequested then -- Ops.Auftrag#AUFTRAG
|
||||||
|
ESmission = self.EscortMissionReplacement[i]
|
||||||
|
local esstatus = ESmission:GetState()
|
||||||
|
local ESmissiontime = (timer.getTime() - self.EscortsTimeStamp)
|
||||||
|
local ESTOSLeft = UTILS.Round((((self.EscortsTimeOnStation+self.ShiftChangeTime)*3600) - ESmissiontime),0) -- seconds
|
||||||
|
ESTOSLeft = UTILS.Round(ESTOSLeft/60,0) -- minutes
|
||||||
|
local ChangeTime = UTILS.Round(((self.ShiftChangeTime * 3600)/60),0)
|
||||||
|
--local Changedue = "No"
|
||||||
|
|
||||||
|
--report:Add("====================")
|
||||||
|
report:Add("ESCORTS REPLACEMENT:")
|
||||||
|
report:Add(string.format("Auftrag Status: %s",esstatus))
|
||||||
|
report:Add(string.format("TOS Left: %d min",ESTOSLeft))
|
||||||
|
--report:Add(string.format("Needs ShiftChange: %s",Changedue))
|
||||||
|
|
||||||
|
local OpsGroups = ESmission:GetOpsGroups()
|
||||||
|
local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP
|
||||||
|
if OpsGroup then
|
||||||
|
local OpsName = OpsGroup:GetName() or "Unknown"
|
||||||
|
local OpsCallSign = OpsGroup:GetCallsignName() or "Unknown"
|
||||||
|
report:Add(string.format("Mission FG %s",OpsName))
|
||||||
|
report:Add(string.format("Callsign %s",OpsCallSign))
|
||||||
|
report:Add(string.format("Mission FG State %s",OpsGroup:GetState()))
|
||||||
|
else
|
||||||
|
report:Add("***** Cannot obtain (yet) this missions OpsGroup!")
|
||||||
|
end
|
||||||
|
|
||||||
|
if ESmission:IsExecuting() then
|
||||||
|
-- make the actual change in the queue
|
||||||
|
self.ShiftChangeEscortsFlag = false
|
||||||
|
self.ShiftChangeEscortsRequested = false
|
||||||
|
-- cancel old mission
|
||||||
|
if ESmission and ESmission:IsNotOver() then
|
||||||
|
ESmission:Cancel()
|
||||||
|
end
|
||||||
|
self.EscortMission[i] = self.EscortMissionReplacement[i]
|
||||||
|
self.EscortMissionReplacement[i] = nil
|
||||||
|
self.EscortsTimeStamp = timer.getTime()
|
||||||
|
report:Add("*** Replacement DONE ***")
|
||||||
|
end
|
||||||
|
report:Add("====================")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user