mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
This commit is contained in:
@@ -227,7 +227,7 @@ function FLIGHTGROUP:New(group)
|
||||
self.lid=string.format("FLIGHTGROUP %s | ", self.groupname)
|
||||
|
||||
-- Defaults
|
||||
self:SetVerbosity(0)
|
||||
--self:SetVerbosity(0)
|
||||
self:SetFuelLowThreshold()
|
||||
self:SetFuelLowRTB()
|
||||
self:SetFuelCriticalThreshold()
|
||||
@@ -410,6 +410,25 @@ function FLIGHTGROUP:GetFlightControl()
|
||||
end
|
||||
|
||||
|
||||
--- Set the homebase.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param Wrapper.Airbase#AIRBASE HomeAirbase The home airbase.
|
||||
-- @return #FLIGHTGROUP self
|
||||
function FLIGHTGROUP:SetHomebase(HomeAirbase)
|
||||
self.homebase=HomeAirbase
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set the destination airbase. This is where the flight will go, when the final waypoint is reached.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param Wrapper.Airbase#AIRBASE DestinationAirbase The destination airbase.
|
||||
-- @return #FLIGHTGROUP self
|
||||
function FLIGHTGROUP:SetDestinationbase(DestinationAirbase)
|
||||
self.destbase=DestinationAirbase
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set the AIRBOSS controlling this flight group.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param Ops.Airboss#AIRBOSS airboss The AIRBOSS object.
|
||||
@@ -1386,7 +1405,7 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
||||
if self.option.ROT then
|
||||
self:SwitchROT(self.option.ROT)
|
||||
else
|
||||
self:SwitchROE(ENUMS.ROT.PassiveDefense)
|
||||
self:SwitchROT(ENUMS.ROT.PassiveDefense)
|
||||
end
|
||||
|
||||
-- Turn TACAN beacon on.
|
||||
@@ -1529,6 +1548,7 @@ function FLIGHTGROUP:onafterLanding(From, Event, To)
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- On after "Landed" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
@@ -1538,16 +1558,24 @@ end
|
||||
function FLIGHTGROUP:onafterLanded(From, Event, To, airbase)
|
||||
self:T(self.lid..string.format("Flight landed at %s", airbase and airbase:GetName() or "unknown place"))
|
||||
|
||||
if self:IsLandingAt() then
|
||||
self:LandedAt()
|
||||
else
|
||||
if self.flightcontrol and airbase and self.flightcontrol.airbasename==airbase:GetName() then
|
||||
-- Add flight to taxiinb queue.
|
||||
self.flightcontrol:SetFlightStatus(self, FLIGHTCONTROL.FlightStatus.TAXIINB)
|
||||
end
|
||||
if self.flightcontrol and airbase and self.flightcontrol.airbasename==airbase:GetName() then
|
||||
-- Add flight to taxiinb queue.
|
||||
self.flightcontrol:SetFlightStatus(self, FLIGHTCONTROL.FlightStatus.TAXIINB)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- On after "LandedAt" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Wrapper.Airbase#AIRBASE airbase The airbase the flight landed.
|
||||
function FLIGHTGROUP:onafterLandedAt(From, Event, To)
|
||||
self:I(self.lid..string.format("Flight landed at"))
|
||||
end
|
||||
|
||||
|
||||
--- On after "Arrived" event.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param #string From From state.
|
||||
@@ -2519,6 +2547,8 @@ function FLIGHTGROUP:_InitGroup()
|
||||
self.radio.Freq=self.template.frequency
|
||||
self.radio.Modu=self.template.modulation
|
||||
|
||||
self.radioDefault=UTILS.DeepCopy(self.radio)
|
||||
|
||||
--TODO callsign from template or getCallsign
|
||||
self.callsign.NumberSquad=self.template.units[1].callsign[1]
|
||||
self.callsign.NumberGroup=self.template.units[1].callsign[2]
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
OPSGROUP = {
|
||||
ClassName = "OPSGROUP",
|
||||
Debug = false,
|
||||
verbose = 0,
|
||||
verbose = 3,
|
||||
lid = nil,
|
||||
groupname = nil,
|
||||
group = nil,
|
||||
@@ -2443,7 +2443,7 @@ function OPSGROUP:_CheckInZones()
|
||||
for inzonename, inzone in pairs(self.inzones:GetSet()) do
|
||||
|
||||
-- Check if group is still inside the zone.
|
||||
local isstillinzone=self.group:IsPartlyOrCompletelyInZone(inzone)
|
||||
local isstillinzone=self.group:IsInZone(inzone) --:IsPartlyOrCompletelyInZone(inzone)
|
||||
|
||||
-- If not, trigger, LeaveZone event.
|
||||
if not isstillinzone then
|
||||
@@ -2463,7 +2463,7 @@ function OPSGROUP:_CheckInZones()
|
||||
local checkzone=_checkzone --Core.Zone#ZONE
|
||||
|
||||
-- Is group currtently in this check zone?
|
||||
local isincheckzone=self.group:IsPartlyOrCompletelyInZone(checkzone)
|
||||
local isincheckzone=self.group:IsInZone(checkzone) --:IsPartlyOrCompletelyInZone(checkzone)
|
||||
|
||||
if isincheckzone and not self.inzones:_Find(checkzonename) then
|
||||
table.insert(enterzones, checkzone)
|
||||
@@ -3009,7 +3009,7 @@ function OPSGROUP:SwitchROE(roe)
|
||||
|
||||
self.group:OptionROE(roe)
|
||||
|
||||
self:T(self.lid..string.format("Setting current ROE=%d (0=WeaponFree, 1=OpenFireWeaponFree, 2=OpenFire, 3=ReturnFire, 4=WeaponHold)", self.option.ROE))
|
||||
self:I(self.lid..string.format("Setting current ROE=%d (0=WeaponFree, 1=OpenFireWeaponFree, 2=OpenFire, 3=ReturnFire, 4=WeaponHold)", self.option.ROE))
|
||||
end
|
||||
|
||||
|
||||
@@ -3475,7 +3475,7 @@ function OPSGROUP:SwitchFormation(Formation)
|
||||
self.option.Formation=Formation
|
||||
|
||||
-- Debug info.
|
||||
self:I(self.lid..string.format("Switching formation to %d", self.formation))
|
||||
self:I(self.lid..string.format("Switching formation to %d", self.option.Formation))
|
||||
|
||||
end
|
||||
|
||||
@@ -3771,7 +3771,11 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
||||
---
|
||||
|
||||
if self:_AllSimilarStatus(newstatus) then
|
||||
self:Landed(airbase)
|
||||
if self:IsLandingAt() then
|
||||
self:LandedAt()
|
||||
else
|
||||
self:Landed(airbase)
|
||||
end
|
||||
end
|
||||
|
||||
elseif newstatus==OPSGROUP.ElementStatus.ARRIVED then
|
||||
|
||||
Reference in New Issue
Block a user