mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
OPS
Strange version buggy
This commit is contained in:
parent
eba6e3f5f1
commit
c6ebbc6122
@ -2596,6 +2596,12 @@ function WAREHOUSE:SetSpawnZone(zone, maxdist)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get the spawn zone.
|
||||
-- @param #WAREHOUSE self
|
||||
-- @return Core.Zone#ZONE The spawn zone.
|
||||
function WAREHOUSE:GetSpawnZone()
|
||||
return self.spawnzone
|
||||
end
|
||||
|
||||
--- Set a warehouse zone. If this zone is captured, the warehouse and all its assets fall into the hands of the enemy.
|
||||
-- @param #WAREHOUSE self
|
||||
@ -6331,9 +6337,17 @@ function WAREHOUSE:_OnEventBirth(EventData)
|
||||
|
||||
-- Set born to true.
|
||||
request.born=true
|
||||
|
||||
|
||||
if not asset.spawned then
|
||||
asset.spawned=1
|
||||
else
|
||||
asset.spawned=asset.spawned+1
|
||||
end
|
||||
|
||||
|
||||
-- Birth is triggered for each unit. We need to make sure not to call this too often!
|
||||
if not asset.spawned then
|
||||
if asset.spawned==asset.nunits then
|
||||
|
||||
-- Remove asset from stock.
|
||||
self:_DeleteStockItem(asset)
|
||||
@ -6355,9 +6369,9 @@ function WAREHOUSE:_OnEventBirth(EventData)
|
||||
group:SetState(group, "WAREHOUSE", self)
|
||||
|
||||
-- Asset spawned FSM function.
|
||||
--self:__AssetSpawned(1, group, asset, request)
|
||||
--env.info(string.format("FF asset spawned %s, %s", asset.spawngroupname, EventData.IniUnitName))
|
||||
self:AssetSpawned(group, asset, request)
|
||||
-- This needs to be delayed a bit for all units to be present. Especially, since MOOSE needs a birth event for UNITs to be added to the _DATABASE.
|
||||
self:__AssetSpawned(0.1, group, asset, request)
|
||||
--self:AssetSpawned(group, asset, request)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -840,6 +840,21 @@ function AIRWING:onafterStatus(From, Event, To)
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
----------------
|
||||
-- Transport ---
|
||||
----------------
|
||||
|
||||
-- Check if any transports should be cancelled.
|
||||
--self:_CheckTransports()
|
||||
|
||||
-- Get next mission.
|
||||
local transport=self:_GetNextTransport()
|
||||
|
||||
-- Request mission execution.
|
||||
if transport then
|
||||
self:TransportRequest(transport)
|
||||
end
|
||||
|
||||
--------------
|
||||
-- Mission ---
|
||||
--------------
|
||||
|
||||
@ -350,10 +350,9 @@ function ARMYGROUP:Status()
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
-- Is group alive?
|
||||
local alive=self:IsAlive()
|
||||
|
||||
env.info(self.lid.."FF status="..fsmstate)
|
||||
|
||||
|
||||
if alive then
|
||||
|
||||
---
|
||||
@ -1228,19 +1227,35 @@ function ARMYGROUP:_InitGroup(Template)
|
||||
-- Units of the group.
|
||||
local units=self.group:GetUnits()
|
||||
|
||||
-- DCS group.
|
||||
local dcsgroup=Group.getByName(self.groupname)
|
||||
local size0=dcsgroup:getInitialSize()
|
||||
|
||||
-- Quick check.
|
||||
if #units~=size0 then
|
||||
self:E(self.lid..string.format("ERROR: Got #units=%d but group consists of %d units!", #units, size0))
|
||||
end
|
||||
|
||||
-- Add elemets.
|
||||
for _,unit in pairs(units) do
|
||||
self:_AddElementByName(unit:GetName())
|
||||
end
|
||||
|
||||
-- Get Descriptors.
|
||||
self.descriptors=units[1]:GetDesc()
|
||||
|
||||
-- Get first unit. This is used to extract other parameters.
|
||||
local unit=units[1] --Wrapper.Unit#UNIT
|
||||
|
||||
-- Set type name.
|
||||
self.actype=units[1]:GetTypeName()
|
||||
if unit then
|
||||
|
||||
-- Get Descriptors.
|
||||
self.descriptors=unit:GetDesc()
|
||||
|
||||
-- Init done.
|
||||
self.groupinitialized=true
|
||||
-- Set type name.
|
||||
self.actype=unit:GetTypeName()
|
||||
|
||||
-- Init done.
|
||||
self.groupinitialized=true
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -960,7 +960,7 @@ end
|
||||
--- Check if a mission type is contained in a list of possible capabilities.
|
||||
-- @param #COHORT self
|
||||
-- @param #table MissionTypes The requested mission type. Can also be passed as a single mission type `#string`.
|
||||
-- @param #table Capabilities A table with possible capabilities.
|
||||
-- @param #table Capabilities (Optional) A table with possible capabilities `Ops.Auftrag#AUFTRAG.Capability`. Default is capabilities of the cohort.
|
||||
-- @return #boolean If true, the requested mission type is part of the possible mission types.
|
||||
function COHORT:CheckMissionCapability(MissionTypes, Capabilities)
|
||||
|
||||
@ -968,6 +968,8 @@ function COHORT:CheckMissionCapability(MissionTypes, Capabilities)
|
||||
MissionTypes={MissionTypes}
|
||||
end
|
||||
|
||||
Capabilities=Capabilities or self.missiontypes
|
||||
|
||||
for _,cap in pairs(Capabilities) do
|
||||
local capability=cap --Ops.Auftrag#AUFTRAG.Capability
|
||||
for _,MissionType in pairs(MissionTypes) do
|
||||
|
||||
@ -1983,6 +1983,13 @@ function FLIGHTGROUP:onbeforeUpdateRoute(From, Event, To, n)
|
||||
trepeat=-5
|
||||
allowed=false
|
||||
end
|
||||
|
||||
if self:IsUncontrolled() then
|
||||
-- Not airborne yet. Try again in 5 sec.
|
||||
self:T(self.lid.."Update route denied. Group is UNCONTROLLED ==> checking back in 5 sec")
|
||||
trepeat=-5
|
||||
allowed=false
|
||||
end
|
||||
|
||||
if n and n<1 then
|
||||
self:E(self.lid.."Update route denied because waypoint n<1!")
|
||||
@ -2065,13 +2072,16 @@ function FLIGHTGROUP:onafterUpdateRoute(From, Event, To, n)
|
||||
|
||||
-- Waypoint type.
|
||||
local waypointType=COORDINATE.WaypointType.TurningPoint
|
||||
local waypointAction=COORDINATE.WaypointAction.TurningPoint
|
||||
if self:IsLanded() or self:IsLandedAt() or self:IsAirborne()==false then
|
||||
-- Had some issues with passing waypoint function of the next WP called too ealy when the type is TurningPoint. Setting it to TakeOff solved it!
|
||||
waypointType=COORDINATE.WaypointType.TakeOff
|
||||
env.info("FF takeoff type waypoint")
|
||||
--waypointAction=COORDINATE.WaypointAction.FromParkingArea
|
||||
end
|
||||
|
||||
-- Set current waypoint or we get problem that the _PassingWaypoint function is triggered too early, i.e. right now and not when passing the next WP.
|
||||
local current=self.group:GetCoordinate():WaypointAir(COORDINATE.WaypointAltType.BARO, waypointType, COORDINATE.WaypointAction.TurningPoint, speed, true, nil, {}, "Current")
|
||||
local current=self.group:GetCoordinate():WaypointAir(COORDINATE.WaypointAltType.BARO, waypointType, waypointAction, speed, true, nil, {}, "Current")
|
||||
table.insert(wp, current)
|
||||
|
||||
local Nwp=self.waypoints and #self.waypoints or 0
|
||||
@ -2084,7 +2094,13 @@ function FLIGHTGROUP:onafterUpdateRoute(From, Event, To, n)
|
||||
-- Debug info.
|
||||
local hb=self.homebase and self.homebase:GetName() or "unknown"
|
||||
local db=self.destbase and self.destbase:GetName() or "unknown"
|
||||
self:T(self.lid..string.format("Updating route for WP #%d-%d homebase=%s destination=%s", n, #wp, hb, db))
|
||||
self:T(self.lid..string.format("Updating route for WP #%d-%d [%s], homebase=%s destination=%s", n, #wp, self:GetState(), hb, db))
|
||||
|
||||
-- Print waypoints.
|
||||
for i,w in pairs(wp) do
|
||||
env.info("FF waypoint index="..i)
|
||||
self:I(w)
|
||||
end
|
||||
|
||||
|
||||
if #wp>1 then
|
||||
@ -2243,7 +2259,7 @@ function FLIGHTGROUP:_CheckGroupDone(delay, waittime)
|
||||
self:T(self.lid..string.format("Flight (status=%s) did NOT pass the final waypoint yet ==> update route", self:GetState()))
|
||||
|
||||
-- Update route.
|
||||
self:__UpdateRoute(-1)
|
||||
self:__UpdateRoute(-0.01)
|
||||
|
||||
end
|
||||
end
|
||||
@ -3086,13 +3102,25 @@ function FLIGHTGROUP:_InitGroup(Template)
|
||||
self.menu.atc.root=self.menu.atc.root or MENU_GROUP:New(self.group, "ATC")
|
||||
end
|
||||
|
||||
-- Units of the group.
|
||||
local units=self.group:GetUnits()
|
||||
|
||||
-- DCS group.
|
||||
local dcsgroup=Group.getByName(self.groupname)
|
||||
local size0=dcsgroup:getInitialSize()
|
||||
|
||||
-- Quick check.
|
||||
if #units~=size0 then
|
||||
self:E(self.lid..string.format("ERROR: Got #units=%d but group consists of %d units!", #units, size0))
|
||||
end
|
||||
|
||||
-- Add elemets.
|
||||
for _,unit in pairs(self.group:GetUnits()) do
|
||||
for _,unit in pairs(units) do
|
||||
self:_AddElementByName(unit:GetName())
|
||||
end
|
||||
|
||||
-- Get first unit. This is used to extract other parameters.
|
||||
local unit=self.group:GetUnit(1)
|
||||
local unit=units[1] --Wrapper.Unit#UNIT
|
||||
|
||||
if unit then
|
||||
|
||||
@ -3469,7 +3497,7 @@ function FLIGHTGROUP:AddWaypoint(Coordinate, Speed, AfterWaypointWithID, Altitud
|
||||
|
||||
-- Update route.
|
||||
if Updateroute==nil or Updateroute==true then
|
||||
self:__UpdateRoute(-1)
|
||||
self:__UpdateRoute(-0.01)
|
||||
end
|
||||
|
||||
return waypoint
|
||||
|
||||
@ -158,11 +158,13 @@ function LEGION:AddMission(Mission)
|
||||
-- Add legion to mission.
|
||||
Mission:AddLegion(self)
|
||||
|
||||
--[[
|
||||
if Mission.opstransport then
|
||||
Mission.opstransport:SetPickupZone(self.spawnzone)
|
||||
Mission.opstransport:SetEmbarkZone(self.spawnzone)
|
||||
self:AddOpsTransport(Mission.opstransport)
|
||||
end
|
||||
]]
|
||||
|
||||
-- Add mission to queue.
|
||||
table.insert(self.missionqueue, Mission)
|
||||
@ -1007,12 +1009,7 @@ function LEGION:onafterAssetSpawned(From, Event, To, group, asset, request)
|
||||
--mission:SetTACAN(Tacan, Morse, UnitName, Band)
|
||||
end
|
||||
|
||||
-- Transport for mission assets.
|
||||
if mission.opstransport then
|
||||
mission.opstransport:AddCargoGroups(self)
|
||||
end
|
||||
|
||||
-- Add mission to flightgroup queue.
|
||||
-- Add mission to flightgroup queue. If mission has an OPSTRANSPORT attached, all added OPSGROUPS are added as CARGO for a transport.
|
||||
flightgroup:AddMission(mission)
|
||||
|
||||
-- Trigger event.
|
||||
|
||||
@ -461,8 +461,11 @@ function NAVYGROUP:Status(From, Event, To)
|
||||
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
-- Is group alive?
|
||||
local alive=self:IsAlive()
|
||||
|
||||
if self:IsAlive() then
|
||||
if alive then
|
||||
|
||||
---
|
||||
-- Detection
|
||||
@ -518,7 +521,11 @@ function NAVYGROUP:Status(From, Event, To)
|
||||
self:Cruise()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if alive~=nil then
|
||||
|
||||
if self.verbose>=1 then
|
||||
|
||||
@ -548,19 +555,7 @@ function NAVYGROUP:Status(From, Event, To)
|
||||
local text=string.format("%s [ROE=%d,AS=%d, T/M=%d/%d]: Wp=%d[%d]-->%d[%d] (of %d) Dist=%.1f NM ETA=%s - Speed=%.1f (%.1f) kts, Depth=%.1f m, Hdg=%03d, Turn=%s Collision=%d IntoWind=%s",
|
||||
fsmstate, roe, als, nTaskTot, nMissions, wpidxCurr, wpuidCurr, wpidxNext, wpuidNext, #self.waypoints or 0, wpDist, wpETA, speed, speedExpected, alt, self.heading, turning, freepath, intowind)
|
||||
self:I(self.lid..text)
|
||||
|
||||
if false then
|
||||
local text="Waypoints:"
|
||||
for i,wp in pairs(self.waypoints) do
|
||||
local waypoint=wp --Ops.OpsGroup#OPSGROUP.Waypoint
|
||||
text=text..string.format("\n%d. UID=%d", i, waypoint.uid)
|
||||
if i==self.currentwp then
|
||||
text=text.." current!"
|
||||
end
|
||||
end
|
||||
env.info(text)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
@ -575,7 +570,7 @@ function NAVYGROUP:Status(From, Event, To)
|
||||
-- Recovery Windows
|
||||
---
|
||||
|
||||
if self.verbose>=2 and #self.Qintowind>0 then
|
||||
if alive and self.verbose>=2 and #self.Qintowind>0 then
|
||||
|
||||
-- Debug output:
|
||||
local text=string.format(self.lid.."Turn into wind time windows:")
|
||||
@ -1190,20 +1185,36 @@ function NAVYGROUP:_InitGroup(Template)
|
||||
|
||||
-- Get all units of the group.
|
||||
local units=self.group:GetUnits()
|
||||
|
||||
-- DCS group.
|
||||
local dcsgroup=Group.getByName(self.groupname)
|
||||
local size0=dcsgroup:getInitialSize()
|
||||
|
||||
-- Quick check.
|
||||
if #units~=size0 then
|
||||
self:E(self.lid..string.format("ERROR: Got #units=%d but group consists of %d units!", #units, size0))
|
||||
end
|
||||
|
||||
-- Add elemets.
|
||||
for _,unit in pairs(units) do
|
||||
self:_AddElementByName(unit:GetName())
|
||||
end
|
||||
|
||||
-- Get Descriptors.
|
||||
self.descriptors=units[1]:GetDesc()
|
||||
-- Get first unit. This is used to extract other parameters.
|
||||
local unit=units[1] --Wrapper.Unit#UNIT
|
||||
|
||||
-- Set type name.
|
||||
self.actype=units[1]:GetTypeName()
|
||||
if unit then
|
||||
|
||||
-- Init done.
|
||||
self.groupinitialized=true
|
||||
-- Get Descriptors.
|
||||
self.descriptors=unit:GetDesc()
|
||||
|
||||
-- Set type name.
|
||||
self.actype=unit:GetTypeName()
|
||||
|
||||
-- Init done.
|
||||
self.groupinitialized=true
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -1414,7 +1414,7 @@ function OPSGROUP:DestroyUnit(UnitName, Delay)
|
||||
-- Create a "Unit Lost" event.
|
||||
local EventTime=timer.getTime()
|
||||
|
||||
if self.isAircraft then
|
||||
if self:IsFlightgroup() then
|
||||
self:CreateEventUnitLost(EventTime, unit)
|
||||
else
|
||||
self:CreateEventDead(EventTime, unit)
|
||||
@ -2469,8 +2469,8 @@ function OPSGROUP:OnEventBirth(EventData)
|
||||
|
||||
if element and element.status~=OPSGROUP.ElementStatus.SPAWNED then
|
||||
|
||||
-- Set element to spawned state.
|
||||
self:ElementSpawned(element)
|
||||
-- Set element to spawned state. We need to delay this.
|
||||
self:__ElementSpawned(0.05, element)
|
||||
|
||||
end
|
||||
|
||||
@ -2646,12 +2646,11 @@ end
|
||||
|
||||
--- Clear DCS tasks.
|
||||
-- @param #OPSGROUP self
|
||||
-- @param #table DCSTask DCS task structure.
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:ClearTasks()
|
||||
if self:IsAlive() then
|
||||
self.group:ClearTasks()
|
||||
self:I(self.lid..string.format("CLEARING Tasks"))
|
||||
self.group:ClearTasks()
|
||||
end
|
||||
return self
|
||||
end
|
||||
@ -3166,8 +3165,8 @@ function OPSGROUP:onafterTaskExecute(From, Event, To, Task)
|
||||
-- NOTE: I am pushing the task instead of setting it as it seems to keep the mission task alive.
|
||||
-- There were issues that flights did not proceed to a later waypoint because the task did not finish until the fired missiles
|
||||
-- impacted (took rather long). Then the flight flew to the nearest airbase and one lost completely the control over the group.
|
||||
self:PushTask(TaskFinal)
|
||||
--self:SetTask(TaskFinal)
|
||||
--self:PushTask(TaskFinal)
|
||||
self:SetTask(TaskFinal)
|
||||
|
||||
|
||||
elseif Task.type==OPSGROUP.TaskType.WAYPOINT then
|
||||
@ -3307,14 +3306,16 @@ function OPSGROUP:onafterTaskDone(From, Event, To, Task)
|
||||
else
|
||||
--Mission paused. Do nothing!
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
if Task.description=="Engage_Target" then
|
||||
self:Disengage()
|
||||
end
|
||||
|
||||
self:T(self.lid.."Task Done but NO mission found ==> _CheckGroupDone in 1 sec")
|
||||
self:_CheckGroupDone(1)
|
||||
--
|
||||
self:T(self.lid.."Task Done but NO mission found ==> _CheckGroupDone in 0 sec")
|
||||
self:_CheckGroupDone()
|
||||
end
|
||||
|
||||
end
|
||||
@ -3575,7 +3576,7 @@ function OPSGROUP:onbeforeMissionStart(From, Event, To, Mission)
|
||||
end
|
||||
|
||||
-- Startup group if it is uncontrolled.
|
||||
if self.isAircraft and self:IsUncontrolled() then
|
||||
if self:IsFlightgroup() and self:IsUncontrolled() then
|
||||
self:StartUncontrolled(delay)
|
||||
end
|
||||
|
||||
@ -3966,7 +3967,7 @@ function OPSGROUP:RouteToMission(mission, delay)
|
||||
self:SwitchAlarmstate(mission.optionAlarm)
|
||||
end
|
||||
-- Formation
|
||||
if mission.optionFormation and self.isAircraft then
|
||||
if mission.optionFormation and self:IsFlightgroup() then
|
||||
self:SwitchFormation(mission.optionFormation)
|
||||
end
|
||||
-- Radio frequency and modulation.
|
||||
@ -4036,7 +4037,7 @@ function OPSGROUP:_QueueUpdate()
|
||||
local ready=true
|
||||
|
||||
-- For aircraft check airborne.
|
||||
if self.isAircraft then
|
||||
if self:IsFlightgroup() then
|
||||
ready=self:IsAirborne()
|
||||
end
|
||||
|
||||
@ -4219,8 +4220,8 @@ function OPSGROUP:onafterPassingWaypoint(From, Event, To, Waypoint)
|
||||
|
||||
-- Check if all tasks/mission are done?
|
||||
-- Note, we delay it for a second to let the OnAfterPassingwaypoint function to be executed in case someone wants to add another waypoint there.
|
||||
if ntasks==0 then
|
||||
self:_CheckGroupDone(0.1)
|
||||
if ntasks==0 and self:HasPassedFinalWaypoint() then
|
||||
self:_CheckGroupDone(0.01)
|
||||
end
|
||||
|
||||
-- Debug info.
|
||||
@ -5356,7 +5357,10 @@ function OPSGROUP:_CheckCargoTransport()
|
||||
local text=""
|
||||
for i,_transport in pairs(self.cargoqueue) do
|
||||
local transport=_transport --#Ops.OpsTransport#OPSTRANSPORT
|
||||
text=text..string.format("\n[%d] UID=%d Status=%s: %s --> %s", i, transport.uid, transport:GetState(), transport.pickupzone:GetName(), transport.deployzone:GetName())
|
||||
|
||||
local pickupname=transport.pickupzone and transport.pickupzone:GetName() or "unknown"
|
||||
local deployname=transport.deployzone and transport.deployzone:GetName() or "unknown"
|
||||
text=text..string.format("\n[%d] UID=%d Status=%s: %s --> %s", i, transport.uid, transport:GetState(), pickupname, deployname)
|
||||
for j,_cargo in pairs(transport.cargos) do
|
||||
local cargo=_cargo --#OPSGROUP.CargoGroup
|
||||
local state=cargo.opsgroup:GetState()
|
||||
@ -5386,7 +5390,9 @@ function OPSGROUP:_CheckCargoTransport()
|
||||
|
||||
-- Debug info.
|
||||
if self.verbose>=2 then
|
||||
local text=string.format("Carrier [%s]: %s --> %s", self.carrierStatus, self.cargoTransport.pickupzone:GetName(), self.cargoTransport.deployzone:GetName())
|
||||
local pickupname=self.cargoTransport.pickupzone and self.cargoTransport.pickupzone:GetName() or "unknown"
|
||||
local deployname=self.cargoTransport.deployzone and self.cargoTransport.deployzone:GetName() or "unknown"
|
||||
local text=string.format("Carrier [%s]: %s --> %s", self.carrierStatus, pickupname, deployname)
|
||||
for _,_cargo in pairs(self.cargoTransport.cargos) do
|
||||
local cargo=_cargo --Ops.OpsGroup#OPSGROUP.CargoGroup
|
||||
local name=cargo.opsgroup:GetName()
|
||||
@ -6483,7 +6489,7 @@ function OPSGROUP:onafterLoaded(From, Event, To)
|
||||
-- Cancel landedAt task.
|
||||
if self:IsFlightgroup() and self:IsLandedAt() then
|
||||
local Task=self:GetTaskCurrent()
|
||||
self:TaskCancel(Task)
|
||||
self:__TaskCancel(1, Task)
|
||||
end
|
||||
|
||||
-- Order group to transport.
|
||||
@ -6552,7 +6558,7 @@ function OPSGROUP:onafterTransport(From, Event, To)
|
||||
self:FullStop()
|
||||
end
|
||||
|
||||
-- Start loading.
|
||||
-- Start unloading.
|
||||
self:__UnLoading(-5)
|
||||
|
||||
else
|
||||
@ -6598,8 +6604,9 @@ function OPSGROUP:onafterTransport(From, Event, To)
|
||||
---
|
||||
|
||||
-- If this is a helo and no ZONE_AIRBASE was given, we make the helo land in the pickup zone.
|
||||
Coordinate:SetAltitude(200)
|
||||
local waypoint=FLIGHTGROUP.AddWaypoint(self, Coordinate) ; waypoint.detour=1
|
||||
Coordinate:MarkToAll("landing",ReadOnly,Text)
|
||||
env.info("FF helo add waypoint detour")
|
||||
local waypoint=FLIGHTGROUP.AddWaypoint(self, Coordinate, nil, self:GetWaypointCurrent().uid, 200) ; waypoint.detour=1
|
||||
|
||||
else
|
||||
self:E(self.lid.."ERROR: Carrier aircraft cannot land in Deploy zone! Specify a ZONE_AIRBASE as deploy zone")
|
||||
@ -7817,6 +7824,8 @@ function OPSGROUP:Route(waypoints, delay)
|
||||
|
||||
-- DCS task combo.
|
||||
local Tasks={}
|
||||
|
||||
self:ClearTasks(DCSTask)
|
||||
|
||||
-- Route (Mission) task.
|
||||
local TaskRoute=self.group:TaskRoute(waypoints)
|
||||
@ -7914,7 +7923,8 @@ function OPSGROUP._PassingWaypoint(group, opsgroup, uid)
|
||||
|
||||
if wpnext and (opsgroup.currentwp<#opsgroup.waypoints or opsgroup.adinfinitum or wpistemp) then
|
||||
|
||||
opsgroup:I(opsgroup.lid..string.format("Next waypoint UID=%d index=%d", wpnext.uid, opsgroup:GetWaypointIndex(wpnext.uid)))
|
||||
-- Debug info.
|
||||
opsgroup:T(opsgroup.lid..string.format("Next waypoint UID=%d index=%d", wpnext.uid, opsgroup:GetWaypointIndex(wpnext.uid)))
|
||||
|
||||
-- Set formation.
|
||||
if opsgroup.isGround then
|
||||
@ -7930,8 +7940,6 @@ function OPSGROUP._PassingWaypoint(group, opsgroup, uid)
|
||||
|
||||
else
|
||||
|
||||
env.info(opsgroup.lid.."FF 300")
|
||||
|
||||
-- Set passed final waypoint.
|
||||
opsgroup:_PassedFinalWaypoint(true, "_PassingWaypoint No next Waypoint found")
|
||||
|
||||
@ -7972,6 +7980,7 @@ function OPSGROUP._PassingWaypoint(group, opsgroup, uid)
|
||||
if opsgroup.isFlightgroup then
|
||||
|
||||
-- Land at current pos and wait for 60 min max.
|
||||
env.info("FF LandAt for Pickup")
|
||||
opsgroup:LandAt(opsgroup:GetCoordinate(), 60*60)
|
||||
|
||||
else
|
||||
@ -7985,6 +7994,7 @@ function OPSGROUP._PassingWaypoint(group, opsgroup, uid)
|
||||
if opsgroup.isFlightgroup then
|
||||
|
||||
-- Land at current pos and wait for 60 min max.
|
||||
env.info("FF LandAt for Transporting")
|
||||
opsgroup:LandAt(opsgroup:GetCoordinate(), 60*60)
|
||||
|
||||
else
|
||||
@ -8271,7 +8281,7 @@ function OPSGROUP:SetDefaultTACAN(Channel, Morse, UnitName, Band, OffSwitch)
|
||||
self.tacanDefault.Morse=Morse or "XXX"
|
||||
self.tacanDefault.BeaconName=UnitName
|
||||
|
||||
if self.isAircraft then
|
||||
if self:IsFlightgroup() then
|
||||
Band=Band or "Y"
|
||||
else
|
||||
Band=Band or "X"
|
||||
@ -8356,7 +8366,7 @@ function OPSGROUP:SwitchTACAN(Channel, Morse, UnitName, Band)
|
||||
|
||||
-- System
|
||||
local System=BEACON.System.TACAN
|
||||
if self.isAircraft then
|
||||
if self:IsFlightgroup() then
|
||||
System=BEACON.System.TACAN_TANKER_Y
|
||||
end
|
||||
|
||||
@ -8592,7 +8602,7 @@ function OPSGROUP:SwitchRadio(Frequency, Modulation)
|
||||
Frequency=Frequency or self.radioDefault.Freq
|
||||
Modulation=Modulation or self.radioDefault.Modu
|
||||
|
||||
if self.isAircraft and not self.radio.On then
|
||||
if self:IsFlightgroup() and not self.radio.On then
|
||||
self.group:SetOption(AI.Option.Air.id.SILENCE, false)
|
||||
end
|
||||
|
||||
@ -8621,7 +8631,7 @@ function OPSGROUP:TurnOffRadio()
|
||||
|
||||
if self:IsAlive() then
|
||||
|
||||
if self.isAircraft then
|
||||
if self:IsFlightgroup() then
|
||||
|
||||
-- Set group to be silient.
|
||||
self.group:SetOption(AI.Option.Air.id.SILENCE, true)
|
||||
@ -8662,7 +8672,7 @@ function OPSGROUP:SwitchFormation(Formation)
|
||||
|
||||
Formation=Formation or self.optionDefault.Formation
|
||||
|
||||
if self.isAircraft then
|
||||
if self:IsFlightgroup() then
|
||||
|
||||
self.group:SetOption(AI.Option.Air.id.FORMATION, Formation)
|
||||
|
||||
@ -9556,7 +9566,7 @@ end
|
||||
function OPSGROUP:_PassedFinalWaypoint(final, comment)
|
||||
|
||||
-- Debug info.
|
||||
self:I(self.lid..string.format("Passed final waypoint=%s [from %s]: comment \"%s\"", tostring(final), tostring(self.passedfinalwp), tostring(comment)))
|
||||
self:T(self.lid..string.format("Passed final waypoint=%s [from %s]: comment \"%s\"", tostring(final), tostring(self.passedfinalwp), tostring(comment)))
|
||||
|
||||
-- Set value.
|
||||
self.passedfinalwp=final
|
||||
|
||||
@ -248,11 +248,11 @@ function OPSTRANSPORT:AddCargoGroups(GroupSet)
|
||||
|
||||
-- Check type of GroupSet provided.
|
||||
if GroupSet:IsInstanceOf("GROUP") or GroupSet:IsInstanceOf("OPSGROUP") then
|
||||
|
||||
|
||||
-- We got a single GROUP or OPSGROUP object.
|
||||
local cargo=self:_CreateCargoGroupData(GroupSet)
|
||||
|
||||
if cargo then
|
||||
if cargo then
|
||||
table.insert(self.cargos, cargo)
|
||||
self.Ncargo=self.Ncargo+1
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user