mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-21 21:17:30 +00:00
Auftrag
- Improvements
This commit is contained in:
@@ -676,7 +676,7 @@ AUFTRAG.Category={
|
|||||||
|
|
||||||
--- AUFTRAG class version.
|
--- AUFTRAG class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AUFTRAG.version="1.4.0"
|
AUFTRAG.version="1.4.1"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -2191,7 +2191,7 @@ function AUFTRAG:NewFREIGHTTRANSPORT(StaticCargo, Destination)
|
|||||||
|
|
||||||
-- Check if Destination is given
|
-- Check if Destination is given
|
||||||
if Destination==nil then
|
if Destination==nil then
|
||||||
self:E(self.lid..string.format("ERROR: Destination is nil for AUFTRAG:NewFREIGHTTRANSPORT! You must specify the destination airbase"))
|
BASE:E(self.lid..string.format("ERROR: Destination is nil for AUFTRAG:NewFREIGHTTRANSPORT! You must specify the destination airbase"))
|
||||||
return nil
|
return nil
|
||||||
elseif type(Destination)=="string" then
|
elseif type(Destination)=="string" then
|
||||||
Destination=AIRBASE:FindByName(Destination)
|
Destination=AIRBASE:FindByName(Destination)
|
||||||
@@ -2199,7 +2199,7 @@ function AUFTRAG:NewFREIGHTTRANSPORT(StaticCargo, Destination)
|
|||||||
|
|
||||||
-- Check if Cargo is given
|
-- Check if Cargo is given
|
||||||
if StaticCargo==nil then
|
if StaticCargo==nil then
|
||||||
self:E(self.lid..string.format("ERROR: StaticCargo is nil for AUFTRAG:NewFREIGHTTRANSPORT! You must specify the static object that represents the cargo"))
|
BASE:E(self.lid..string.format("ERROR: StaticCargo is nil for AUFTRAG:NewFREIGHTTRANSPORT! You must specify the static object that represents the cargo"))
|
||||||
return nil
|
return nil
|
||||||
elseif type(StaticCargo)=="string" then
|
elseif type(StaticCargo)=="string" then
|
||||||
StaticCargo=STATIC:FindByName(StaticCargo)
|
StaticCargo=STATIC:FindByName(StaticCargo)
|
||||||
@@ -2214,6 +2214,15 @@ function AUFTRAG:NewFREIGHTTRANSPORT(StaticCargo, Destination)
|
|||||||
|
|
||||||
local mission=AUFTRAG:New(AUFTRAG.Type.FREIGHTTRANSPORT)
|
local mission=AUFTRAG:New(AUFTRAG.Type.FREIGHTTRANSPORT)
|
||||||
|
|
||||||
|
-- Check that the set is not empty
|
||||||
|
local Ncargo=StaticCargo:Count()
|
||||||
|
if Ncargo==0 then
|
||||||
|
mission:E(mission.lid..string.format("ERROR: No cargo items in set!"))
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
mission:T(mission.lid..string.format("FREIGHTTRANSPORT with N=%d cargo items in set", Ncargo))
|
||||||
|
end
|
||||||
|
|
||||||
mission:_TargetFromObject(StaticCargo)
|
mission:_TargetFromObject(StaticCargo)
|
||||||
|
|
||||||
mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.FREIGHTTRANSPORT)
|
mission.missionTask=mission:GetMissionTaskforMissionType(AUFTRAG.Type.FREIGHTTRANSPORT)
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ OPSGROUP.CargoStatus={
|
|||||||
|
|
||||||
--- OpsGroup version.
|
--- OpsGroup version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
OPSGROUP.version="1.0.5"
|
OPSGROUP.version="1.0.6"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -6154,63 +6154,63 @@ function OPSGROUP:RouteToMission(mission, delay)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif mission.type==AUFTRAG.Type.FREIGHTTRANSPORT then
|
elseif mission.type==AUFTRAG.Type.FREIGHTTRANSPORT then
|
||||||
|
|
||||||
---
|
---
|
||||||
-- FREIGHTTRANSPORT
|
-- FREIGHTTRANSPORT
|
||||||
---
|
---
|
||||||
|
|
||||||
local destination=mission.DCStask.params.destination
|
local destination=mission.DCStask.params.destination
|
||||||
local cargo=mission.DCStask.params.cargo
|
local cargo=mission.DCStask.params.cargo
|
||||||
|
|
||||||
-- Set the waypoint coordinate directly above the airbase.
|
-- Set the waypoint coordinate directly above the airbase.
|
||||||
-- The only way to ensure the cargo is delivered there, because when the task is executed, the cargo is delivered to the closest airbase.
|
-- The only way to ensure the cargo is delivered there, because when the task is executed, the cargo is delivered to the closest airbase.
|
||||||
-- Hopefully, ED will change the behaviour of this task but at the moment, it is what it is.
|
-- Hopefully, ED will change the behaviour of this task but at the moment, it is what it is.
|
||||||
waypointcoord=destination:GetCoordinate()
|
waypointcoord=destination:GetCoordinate()
|
||||||
|
|
||||||
-- Get additional parameters
|
-- Get additional parameters
|
||||||
mission.DCStask.params.destination=destination --Wrapper.Airbase#AIRBASE
|
mission.DCStask.params.destination=destination --Wrapper.Airbase#AIRBASE
|
||||||
mission.DCStask.params.cargo=cargo --Core.Set#SET_STATIC
|
mission.DCStask.params.cargo=cargo --Core.Set#SET_STATIC
|
||||||
|
|
||||||
-- Get transport unit
|
-- Get transport unit
|
||||||
local unit=self.group:GetFirstUnit()
|
local unit=self.group:GetFirstUnit()
|
||||||
local unitIdTransport=unit:GetID()
|
local unitIdTransport=unit:GetID()
|
||||||
local vec2=unit:GetVec2()
|
local vec2=unit:GetVec2()
|
||||||
|
|
||||||
-- Create tasks to load/transport statics cargos
|
-- Create tasks to load/transport statics cargos
|
||||||
local tasks={}
|
local tasks={}
|
||||||
for StaticName, StaticObject in pairs(cargo:GetSet()) do
|
for StaticName, StaticObject in pairs(cargo:GetSet()) do
|
||||||
local static=StaticObject --Wrapper.Static#STATIC
|
local static=StaticObject --Wrapper.Static#STATIC
|
||||||
|
|
||||||
-- Task to transport cargo.
|
-- Task to transport cargo.
|
||||||
local TaskCargoTransportation={
|
local TaskCargoTransportation={
|
||||||
id = "CargoTransportationPlane",
|
id = "CargoTransportationPlane",
|
||||||
params = {
|
params = {
|
||||||
x=vec2.x,
|
x=vec2.x,
|
||||||
y=vec2.y,
|
y=vec2.y,
|
||||||
unitIdTransport=unitIdTransport,
|
unitIdTransport=unitIdTransport,
|
||||||
groupId=static:GetID(),
|
groupId=static:GetID(),
|
||||||
unitId=static:GetID(),
|
unitId=static:GetID(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
table.insert(tasks, TaskCargoTransportation)
|
table.insert(tasks, TaskCargoTransportation)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If we have multiple tasks, we create a combo task
|
-- If we have multiple tasks, we create a combo task
|
||||||
local TaskCargo=nil
|
local TaskCargo=nil
|
||||||
if #tasks==1 then
|
if #tasks==1 then
|
||||||
TaskCargo=tasks[1]
|
TaskCargo=tasks[1]
|
||||||
else
|
else
|
||||||
TaskCargo=CONTROLLABLE.TaskCombo(nil, tasks)
|
TaskCargo=CONTROLLABLE.TaskCombo(nil, tasks)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- We set the task to load the cargo into the aircraft.
|
-- We set the task to load the cargo into the aircraft.
|
||||||
-- We must be careful when calling updateroute because there the task is overwritten.
|
-- We must be careful when calling updateroute because there the task is overwritten.
|
||||||
-- We also clear present "UpdateRoute" FSM events
|
-- We also clear present "UpdateRoute" FSM events
|
||||||
self:_ClearFSMEvent( "UpdateRoute" )
|
self:_ClearFSMEvent( "UpdateRoute" )
|
||||||
delayGo=-30
|
delayGo=-50 --30 sec was not enough for CH-47 to load more than one cargo item
|
||||||
self.group:SetTask(TaskCargo)
|
self.group:SetTask(TaskCargo)
|
||||||
|
|
||||||
elseif mission.type==AUFTRAG.Type.ARTY then
|
elseif mission.type==AUFTRAG.Type.ARTY then
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user