Merge branch 'develop' into FF/Ops

This commit is contained in:
Frank
2021-12-17 13:27:13 +01:00
11 changed files with 625 additions and 301 deletions

View File

@@ -1977,7 +1977,7 @@ function AUFTRAG:_DetermineAuftragType(Target)
auftrag=AUFTRAG.Type.ANTISHIP
else
self:E(self.lid.."ERROR: Unknown Group category!")
self:T(self.lid.."ERROR: Unknown Group category!")
end
elseif airbase then
@@ -3237,7 +3237,7 @@ function AUFTRAG:onafterStatus(From, Event, To)
-- Check for error.
if fsmstate~=self.status then
self:E(self.lid..string.format("ERROR: FSM state %s != %s mission status!", fsmstate, self.status))
self:T(self.lid..string.format("ERROR: FSM state %s != %s mission status!", fsmstate, self.status))
end
-- General info.
@@ -3254,7 +3254,7 @@ function AUFTRAG:onafterStatus(From, Event, To)
local chief=self.chief and self.statusChief or "N/A"
-- Info message.
self:I(self.lid..string.format("Status %s: Target=%s, T=%s-%s, assets=%d, groups=%d, targets=%d, legions=%d, commander=%s, chief=%s",
self:T(self.lid..string.format("Status %s: Target=%s, T=%s-%s, assets=%d, groups=%d, targets=%d, legions=%d, commander=%s, chief=%s",
self.status, targetname, Cstart, Cstop, #self.assets, Ngroups, Ntargets, Nlegions, commander, chief))
end
@@ -3366,22 +3366,23 @@ function AUFTRAG:Evaluate()
end
-- Debug text.
local text=string.format("Evaluating mission:\n")
text=text..string.format("Own casualties = %d/%d\n", self.Ncasualties, self.Nelements)
text=text..string.format("Own losses = %.1f %%\n", owndamage)
text=text..string.format("Killed units = %d\n", self.Nkills)
text=text..string.format("--------------------------\n")
text=text..string.format("Targets left = %d/%d\n", Ntargets, Ntargets0)
text=text..string.format("Targets life = %.1f/%.1f\n", Life, Life0)
text=text..string.format("Enemy losses = %.1f %%\n", targetdamage)
text=text..string.format("--------------------------\n")
text=text..string.format("Success Cond = %s\n", tostring(successCondition))
text=text..string.format("Failure Cond = %s\n", tostring(failureCondition))
text=text..string.format("--------------------------\n")
text=text..string.format("Final Success = %s\n", tostring(not failed))
text=text..string.format("=========================")
self:I(self.lid..text)
if self.verbose > 0 then
local text=string.format("Evaluating mission:\n")
text=text..string.format("Own casualties = %d/%d\n", self.Ncasualties, self.Nelements)
text=text..string.format("Own losses = %.1f %%\n", owndamage)
text=text..string.format("Killed units = %d\n", self.Nkills)
text=text..string.format("--------------------------\n")
text=text..string.format("Targets left = %d/%d\n", Ntargets, Ntargets0)
text=text..string.format("Targets life = %.1f/%.1f\n", Life, Life0)
text=text..string.format("Enemy losses = %.1f %%\n", targetdamage)
text=text..string.format("--------------------------\n")
text=text..string.format("Success Cond = %s\n", tostring(successCondition))
text=text..string.format("Failure Cond = %s\n", tostring(failureCondition))
text=text..string.format("--------------------------\n")
text=text..string.format("Final Success = %s\n", tostring(not failed))
text=text..string.format("=========================")
self:I(self.lid..text)
end
if failed then
self:Failed()
else
@@ -3446,7 +3447,7 @@ function AUFTRAG:SetGroupStatus(opsgroup, status)
if groupdata then
groupdata.status=status
else
self:E(self.lid.."WARNING: Could not SET flight data for flight group. Setting status to DONE")
self:T(self.lid.."WARNING: Could not SET flight data for flight group. Setting status to DONE")
end
end
@@ -3483,7 +3484,7 @@ function AUFTRAG:GetGroupStatus(opsgroup)
return groupdata.status
else
self:E(self.lid..string.format("WARNING: Could not GET groupdata for opsgroup %s. Returning status DONE.", opsgroup and opsgroup.groupname or "nil"))
self:T(self.lid..string.format("WARNING: Could not GET groupdata for opsgroup %s. Returning status DONE.", opsgroup and opsgroup.groupname or "nil"))
return AUFTRAG.GroupStatus.DONE
end
@@ -3521,7 +3522,7 @@ function AUFTRAG:RemoveLegion(Legion)
end
end
self:E(self.lid..string.format("ERROR: Legion %s not found and could not be removed!", Legion.alias))
self:T(self.lid..string.format("ERROR: Legion %s not found and could not be removed!", Legion.alias))
return self
end
@@ -3735,7 +3736,7 @@ function AUFTRAG:OnEventUnitLost(EventData)
for _,_groupdata in pairs(self.groupdata) do
local groupdata=_groupdata --#AUFTRAG.GroupData
if groupdata and groupdata.opsgroup and groupdata.opsgroup.groupname==EventData.IniGroupName then
self:I(self.lid..string.format("UNIT LOST event for opsgroup %s unit %s", groupdata.opsgroup.groupname, EventData.IniUnitName))
self:T(self.lid..string.format("UNIT LOST event for opsgroup %s unit %s", groupdata.opsgroup.groupname, EventData.IniUnitName))
end
end
@@ -3858,7 +3859,7 @@ function AUFTRAG:onafterAssetDead(From, Event, To, Asset)
-- Number of groups alive.
local N=self:CountOpsGroups()
self:I(self.lid..string.format("Asset %s dead! Number of ops groups remaining %d", tostring(Asset.spawngroupname), N))
self:T(self.lid..string.format("Asset %s dead! Number of ops groups remaining %d", tostring(Asset.spawngroupname), N))
-- All assets dead?
if N==0 then
@@ -3892,7 +3893,7 @@ function AUFTRAG:onafterCancel(From, Event, To)
local Ngroups = self:CountOpsGroups()
-- Debug info.
self:I(self.lid..string.format("CANCELLING mission in status %s. Will wait for %d groups to report mission DONE before evaluation", self.status, Ngroups))
self:T(self.lid..string.format("CANCELLING mission in status %s. Will wait for %d groups to report mission DONE before evaluation", self.status, Ngroups))
-- Time stamp.
self.Tover=timer.getAbsTime()
@@ -4010,13 +4011,13 @@ function AUFTRAG:onafterSuccess(From, Event, To)
local N=math.max(self.NrepeatSuccess, self.Nrepeat)
-- Repeat mission.
self:I(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
self:T(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
self:Repeat()
else
-- Stop mission.
self:I(self.lid..string.format("Mission SUCCESS! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
self:T(self.lid..string.format("Mission SUCCESS! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
self:Stop()
end
@@ -4052,13 +4053,13 @@ function AUFTRAG:onafterFailed(From, Event, To)
local N=math.max(self.NrepeatFailure, self.Nrepeat)
-- Repeat mission.
self:I(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
self:T(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
self:Repeat()
else
-- Stop mission.
self:I(self.lid..string.format("Mission FAILED! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
self:T(self.lid..string.format("Mission FAILED! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
self:Stop()
end
@@ -4185,7 +4186,7 @@ end
function AUFTRAG:onafterStop(From, Event, To)
-- Debug info.
self:I(self.lid..string.format("STOPPED mission in status=%s. Removing missions from queues. Stopping CallScheduler!", self.status))
self:T(self.lid..string.format("STOPPED mission in status=%s. Removing missions from queues. Stopping CallScheduler!", self.status))
-- TODO: Mission should be OVER! we dont want to remove running missions from any queues.
@@ -4378,7 +4379,7 @@ function AUFTRAG:GetTargetCoordinate()
return nil
else
self:E(self.lid.."ERROR: Cannot get target coordinate!")
self:T(self.lid.."ERROR: Cannot get target coordinate!")
end
return nil
@@ -4409,7 +4410,7 @@ function AUFTRAG:GetTargetDistance(FromCoord)
if TargetCoord and FromCoord then
return TargetCoord:Get2DDistance(FromCoord)
else
self:E(self.lid.."ERROR: TargetCoord or FromCoord does not exist in AUFTRAG:GetTargetDistance() function! Returning 0")
self:T(self.lid.."ERROR: TargetCoord or FromCoord does not exist in AUFTRAG:GetTargetDistance() function! Returning 0")
end
return 0
@@ -5021,7 +5022,7 @@ function AUFTRAG:GetDCSMissionTask(TaskControllable)
table.insert(DCStasks, DCStask)
else
self:E(self.lid..string.format("ERROR: Unknown mission task!"))
self:T(self.lid..string.format("ERROR: Unknown mission task!"))
return nil
end