mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPS Transport+Legion, Navy
This commit is contained in:
parent
d73ebaca76
commit
eba6e3f5f1
@ -533,7 +533,6 @@ function AUFTRAG:New(Type)
|
|||||||
self:SetStartState(self.status)
|
self:SetStartState(self.status)
|
||||||
|
|
||||||
-- PLANNED --> (QUEUED) --> (REQUESTED) --> SCHEDULED --> STARTED --> EXECUTING --> DONE
|
-- PLANNED --> (QUEUED) --> (REQUESTED) --> SCHEDULED --> STARTED --> EXECUTING --> DONE
|
||||||
|
|
||||||
self:AddTransition("*", "Planned", AUFTRAG.Status.PLANNED) -- Mission is in planning stage.
|
self:AddTransition("*", "Planned", AUFTRAG.Status.PLANNED) -- Mission is in planning stage.
|
||||||
self:AddTransition(AUFTRAG.Status.PLANNED, "Queued", AUFTRAG.Status.QUEUED) -- Mission is in queue of an AIRWING.
|
self:AddTransition(AUFTRAG.Status.PLANNED, "Queued", AUFTRAG.Status.QUEUED) -- Mission is in queue of an AIRWING.
|
||||||
self:AddTransition(AUFTRAG.Status.QUEUED, "Requested", AUFTRAG.Status.REQUESTED) -- Mission assets have been requested from the warehouse.
|
self:AddTransition(AUFTRAG.Status.QUEUED, "Requested", AUFTRAG.Status.REQUESTED) -- Mission assets have been requested from the warehouse.
|
||||||
@ -1728,6 +1727,13 @@ function AUFTRAG:SetOpsTransport(OpsTransport)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get the attach OPS transport of the mission.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @return Ops.OpsTransport#OPSTRANSPORT The OPS transport assignment attached to the mission.
|
||||||
|
function AUFTRAG:GetOpsTransport()
|
||||||
|
return self.opstransport
|
||||||
|
end
|
||||||
|
|
||||||
--- Attach OPS transport to the mission. Mission assets will be transported before the mission is started at the OPSGROUP level.
|
--- Attach OPS transport to the mission. Mission assets will be transported before the mission is started at the OPSGROUP level.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Zone#ZONE PickupZone Zone where assets are picked up.
|
-- @param Core.Zone#ZONE PickupZone Zone where assets are picked up.
|
||||||
@ -2182,6 +2188,15 @@ function AUFTRAG:IsReadyToGo()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Ops transport at
|
||||||
|
if self.opstransport then
|
||||||
|
if #self.legions>0 then
|
||||||
|
end
|
||||||
|
if self.opstransport:IsPlanned() or self.opstransport:IsQueued() or self.opstransport:IsRequested() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- All start conditions true?
|
-- All start conditions true?
|
||||||
local startme=self:EvalConditionsAll(self.conditionStart)
|
local startme=self:EvalConditionsAll(self.conditionStart)
|
||||||
|
|
||||||
|
|||||||
@ -158,6 +158,12 @@ function LEGION:AddMission(Mission)
|
|||||||
-- Add legion to mission.
|
-- Add legion to mission.
|
||||||
Mission:AddLegion(self)
|
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.
|
-- Add mission to queue.
|
||||||
table.insert(self.missionqueue, Mission)
|
table.insert(self.missionqueue, Mission)
|
||||||
|
|
||||||
@ -334,6 +340,9 @@ function LEGION:_GetNextMission()
|
|||||||
-- Check that mission is still scheduled, time has passed and enough assets are available.
|
-- Check that mission is still scheduled, time has passed and enough assets are available.
|
||||||
if can then
|
if can then
|
||||||
|
|
||||||
|
-- Number of required assets.
|
||||||
|
local Nassets=mission:GetRequiredAssets(self)
|
||||||
|
|
||||||
-- Optimize the asset selection. Most useful assets will come first. We do not include the payload as some assets have and some might not.
|
-- Optimize the asset selection. Most useful assets will come first. We do not include the payload as some assets have and some might not.
|
||||||
self:_OptimizeAssetSelection(assets, mission, false)
|
self:_OptimizeAssetSelection(assets, mission, false)
|
||||||
|
|
||||||
@ -384,7 +393,7 @@ function LEGION:_GetNextMission()
|
|||||||
--mission.assets={}
|
--mission.assets={}
|
||||||
|
|
||||||
-- Assign assets to mission.
|
-- Assign assets to mission.
|
||||||
for i=1,mission.Nassets[self.alias] do
|
for i=1,Nassets do
|
||||||
local asset=assets[i] --Functional.Warehouse#WAREHOUSE.Assetitem
|
local asset=assets[i] --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||||
|
|
||||||
-- Should not happen as we just checked!
|
-- Should not happen as we just checked!
|
||||||
@ -398,7 +407,7 @@ function LEGION:_GetNextMission()
|
|||||||
|
|
||||||
-- Now return the remaining payloads.
|
-- Now return the remaining payloads.
|
||||||
if self:IsAirwing() then
|
if self:IsAirwing() then
|
||||||
for i=mission.Nassets[self.alias]+1,#assets do
|
for i=Nassets+1,#assets do
|
||||||
local asset=assets[i] --Functional.Warehouse#WAREHOUSE.Assetitem
|
local asset=assets[i] --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||||
for _,uid in pairs(gotpayload) do
|
for _,uid in pairs(gotpayload) do
|
||||||
if uid==asset.uid then
|
if uid==asset.uid then
|
||||||
@ -998,6 +1007,11 @@ function LEGION:onafterAssetSpawned(From, Event, To, group, asset, request)
|
|||||||
--mission:SetTACAN(Tacan, Morse, UnitName, Band)
|
--mission:SetTACAN(Tacan, Morse, UnitName, Band)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Transport for mission assets.
|
||||||
|
if mission.opstransport then
|
||||||
|
mission.opstransport:AddCargoGroups(self)
|
||||||
|
end
|
||||||
|
|
||||||
-- Add mission to flightgroup queue.
|
-- Add mission to flightgroup queue.
|
||||||
flightgroup:AddMission(mission)
|
flightgroup:AddMission(mission)
|
||||||
|
|
||||||
|
|||||||
@ -133,16 +133,16 @@ function NAVYGROUP:New(group)
|
|||||||
self:AddTransition("*", "FullStop", "Holding") -- Hold position.
|
self:AddTransition("*", "FullStop", "Holding") -- Hold position.
|
||||||
self:AddTransition("*", "Cruise", "Cruising") -- Hold position.
|
self:AddTransition("*", "Cruise", "Cruising") -- Hold position.
|
||||||
|
|
||||||
self:AddTransition("*", "TurnIntoWind", "IntoWind") -- Command the group to turn into the wind.
|
self:AddTransition("*", "TurnIntoWind", "Cruising") -- Command the group to turn into the wind.
|
||||||
self:AddTransition("IntoWind", "TurnedIntoWind", "IntoWind") -- Group turned into wind.
|
self:AddTransition("*", "TurnedIntoWind", "*") -- Group turned into wind.
|
||||||
self:AddTransition("IntoWind", "TurnIntoWindStop", "IntoWind") -- Stop a turn into wind.
|
self:AddTransition("*", "TurnIntoWindStop", "*") -- Stop a turn into wind.
|
||||||
self:AddTransition("IntoWind", "TurnIntoWindOver", "Cruising") -- Turn into wind is over.
|
self:AddTransition("*", "TurnIntoWindOver", "*") -- Turn into wind is over.
|
||||||
|
|
||||||
self:AddTransition("*", "TurningStarted", "*") -- Group started turning.
|
self:AddTransition("*", "TurningStarted", "*") -- Group started turning.
|
||||||
self:AddTransition("*", "TurningStopped", "*") -- Group stopped turning.
|
self:AddTransition("*", "TurningStopped", "*") -- Group stopped turning.
|
||||||
|
|
||||||
self:AddTransition("*", "Detour", "OnDetour") -- Make a detour to a coordinate and resume route afterwards.
|
self:AddTransition("*", "Detour", "Cruising") -- Make a detour to a coordinate and resume route afterwards.
|
||||||
self:AddTransition("OnDetour", "DetourReached", "Cruising") -- Group reached the detour coordinate.
|
self:AddTransition("*", "DetourReached", "*") -- Group reached the detour coordinate.
|
||||||
|
|
||||||
self:AddTransition("*", "CollisionWarning", "*") -- Collision warning.
|
self:AddTransition("*", "CollisionWarning", "*") -- Collision warning.
|
||||||
self:AddTransition("*", "ClearAhead", "*") -- Clear ahead.
|
self:AddTransition("*", "ClearAhead", "*") -- Clear ahead.
|
||||||
@ -702,9 +702,6 @@ function NAVYGROUP:onafterSpawned(From, Event, To)
|
|||||||
self:FullStop()
|
self:FullStop()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update status.
|
|
||||||
self:__Status(-0.1)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -938,7 +935,11 @@ function NAVYGROUP:onafterTurnIntoWindOver(From, Event, To, IntoWindData)
|
|||||||
|
|
||||||
-- Detour to where we left the route.
|
-- Detour to where we left the route.
|
||||||
self:T(self.lid.."FF Turn Into Wind Over ==> Uturn!")
|
self:T(self.lid.."FF Turn Into Wind Over ==> Uturn!")
|
||||||
self:Detour(self.intowind.Coordinate, self:GetSpeedCruise(), 0, true)
|
|
||||||
|
-- ID of current waypoint.
|
||||||
|
local uid=self:GetWaypointCurrent().uid
|
||||||
|
|
||||||
|
self:AddWaypoint(self.intowind.Coordinate, self:GetSpeedCruise(), uid)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|||||||
@ -5732,6 +5732,9 @@ end
|
|||||||
-- @return #OPSGROUP self
|
-- @return #OPSGROUP self
|
||||||
function OPSGROUP:AddOpsTransport(OpsTransport)
|
function OPSGROUP:AddOpsTransport(OpsTransport)
|
||||||
|
|
||||||
|
-- Scheduled.
|
||||||
|
OpsTransport:Scheduled()
|
||||||
|
|
||||||
-- Add this group as carrier for the transport.
|
-- Add this group as carrier for the transport.
|
||||||
OpsTransport:_AddCarrier(self)
|
OpsTransport:_AddCarrier(self)
|
||||||
|
|
||||||
|
|||||||
@ -186,12 +186,13 @@ function OPSTRANSPORT:New(GroupSet, Pickupzone, Deployzone)
|
|||||||
-- Set some string id for output to DCS.log file.
|
-- Set some string id for output to DCS.log file.
|
||||||
self.lid=string.format("OPSTRANSPORT [UID=%d] | ", _OPSTRANSPORTID)
|
self.lid=string.format("OPSTRANSPORT [UID=%d] | ", _OPSTRANSPORTID)
|
||||||
|
|
||||||
-- Defaults.
|
-- UID of this transport.
|
||||||
self.uid=_OPSTRANSPORTID
|
self.uid=_OPSTRANSPORTID
|
||||||
|
|
||||||
self.pickupzone=Pickupzone
|
-- Defaults.
|
||||||
self.deployzone=Deployzone
|
self:SetPickupZone(Pickupzone)
|
||||||
self.embarkzone=Pickupzone
|
self:SetDeployZone(Deployzone)
|
||||||
|
self:SetEmbarkZone() -- Default is pickup zone.
|
||||||
self.cargos={}
|
self.cargos={}
|
||||||
self.carriers={}
|
self.carriers={}
|
||||||
self.Ncargo=0
|
self.Ncargo=0
|
||||||
@ -214,7 +215,7 @@ function OPSTRANSPORT:New(GroupSet, Pickupzone, Deployzone)
|
|||||||
self:AddTransition("*", "Planned", OPSTRANSPORT.Status.PLANNED) -- Cargo transport was planned.
|
self:AddTransition("*", "Planned", OPSTRANSPORT.Status.PLANNED) -- Cargo transport was planned.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.PLANNED, "Queued", OPSTRANSPORT.Status.QUEUED) -- Cargo is queued at at least one carrier.
|
self:AddTransition(OPSTRANSPORT.Status.PLANNED, "Queued", OPSTRANSPORT.Status.QUEUED) -- Cargo is queued at at least one carrier.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.QUEUED, "Requested", OPSTRANSPORT.Status.REQUESTED) -- Transport assets have been requested from a warehouse.
|
self:AddTransition(OPSTRANSPORT.Status.QUEUED, "Requested", OPSTRANSPORT.Status.REQUESTED) -- Transport assets have been requested from a warehouse.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.QUEUED, "Scheduled", OPSTRANSPORT.Status.SCHEDULED) -- Cargo is queued at at least one carrier.
|
self:AddTransition(OPSTRANSPORT.Status.REQUESTED, "Scheduled", OPSTRANSPORT.Status.SCHEDULED) -- Cargo is queued at at least one carrier.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.PLANNED, "Scheduled", OPSTRANSPORT.Status.SCHEDULED) -- Cargo is queued at at least one carrier.
|
self:AddTransition(OPSTRANSPORT.Status.PLANNED, "Scheduled", OPSTRANSPORT.Status.SCHEDULED) -- Cargo is queued at at least one carrier.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.SCHEDULED, "Executing", OPSTRANSPORT.Status.EXECUTING) -- Cargo is being transported.
|
self:AddTransition(OPSTRANSPORT.Status.SCHEDULED, "Executing", OPSTRANSPORT.Status.EXECUTING) -- Cargo is being transported.
|
||||||
self:AddTransition("*", "Delivered", OPSTRANSPORT.Status.DELIVERED) -- Cargo was delivered.
|
self:AddTransition("*", "Delivered", OPSTRANSPORT.Status.DELIVERED) -- Cargo was delivered.
|
||||||
@ -290,6 +291,24 @@ function OPSTRANSPORT:AddCargoGroups(GroupSet)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set pickup zone.
|
||||||
|
-- @param #OPSTRANSPORT self
|
||||||
|
-- @param Core.Zone#ZONE PickupZone Zone where the troops are picked up.
|
||||||
|
-- @return #OPSTRANSPORT self
|
||||||
|
function OPSTRANSPORT:SetPickupZone(PickupZone)
|
||||||
|
self.pickupzone=PickupZone
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set deploy zone.
|
||||||
|
-- @param #OPSTRANSPORT self
|
||||||
|
-- @param Core.Zone#ZONE DeployZone Zone where the troops are deployed.
|
||||||
|
-- @return #OPSTRANSPORT self
|
||||||
|
function OPSTRANSPORT:SetDeployZone(DeployZone)
|
||||||
|
self.deployzone=DeployZone
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set embark zone.
|
--- Set embark zone.
|
||||||
-- @param #OPSTRANSPORT self
|
-- @param #OPSTRANSPORT self
|
||||||
-- @param Core.Zone#ZONE EmbarkZone Zone where the troops are embarked.
|
-- @param Core.Zone#ZONE EmbarkZone Zone where the troops are embarked.
|
||||||
@ -793,6 +812,16 @@ function OPSTRANSPORT:IsReadyToGo()
|
|||||||
-- Current abs time.
|
-- Current abs time.
|
||||||
local Tnow=timer.getAbsTime()
|
local Tnow=timer.getAbsTime()
|
||||||
|
|
||||||
|
-- Pickup and deploy zones must be set.
|
||||||
|
if not self.pickupzone then
|
||||||
|
text=text.."No, pickup zone not defined!"
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not self.deployzone then
|
||||||
|
text=text.."No, deploy zone not defined!"
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- Start time did not pass yet.
|
-- Start time did not pass yet.
|
||||||
if self.Tstart and Tnow<self.Tstart or false then
|
if self.Tstart and Tnow<self.Tstart or false then
|
||||||
text=text.."No, start time not passed!"
|
text=text.."No, start time not passed!"
|
||||||
@ -881,7 +910,9 @@ function OPSTRANSPORT:onafterStatus(From, Event, To)
|
|||||||
if self.verbose>=1 then
|
if self.verbose>=1 then
|
||||||
|
|
||||||
-- Info text.
|
-- Info text.
|
||||||
local text=string.format("%s [%s --> %s]: Ncargo=%d/%d, Ncarrier=%d/%d", fsmstate:upper(), self.pickupzone:GetName(), self.deployzone:GetName(), self.Ncargo, self.Ndelivered, #self.carriers,self.Ncarrier)
|
local pickupname=self.pickupzone and self.pickupzone:GetName() or "Unknown"
|
||||||
|
local deployname=self.deployzone and self.deployzone:GetName() or "Unknown"
|
||||||
|
local text=string.format("%s [%s --> %s]: Ncargo=%d/%d, Ncarrier=%d/%d", fsmstate:upper(), pickupname, deployname, self.Ncargo, self.Ndelivered, #self.carriers, self.Ncarrier)
|
||||||
|
|
||||||
-- Info about cargo and carrier.
|
-- Info about cargo and carrier.
|
||||||
if self.verbose>=2 then
|
if self.verbose>=2 then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user