mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPS
- Airwing added :SetPayloadAmount() and SetAirboss() functions - AUFTRAG fixed Failure to Failed event name - CHIEF added statics as targets - LEGION added check that runway is operational and carrier is not recovering for mission selection
This commit is contained in:
parent
854a1e5723
commit
40c0f69eff
@ -33,6 +33,7 @@
|
||||
-- @field #table pointsTANKER Table of Tanker points.
|
||||
-- @field #table pointsAWACS Table of AWACS points.
|
||||
-- @field #boolean markpoints Display markers on the F10 map.
|
||||
-- @field Ops.Airboss#AIRBOSS airboss Airboss attached to this wing.
|
||||
--
|
||||
-- @field Ops.RescueHelo#RESCUEHELO rescuehelo The rescue helo.
|
||||
-- @field Ops.RecoveryTanker#RECOVERYTANKER recoverytanker The recoverytanker.
|
||||
@ -173,7 +174,7 @@ AIRWING.version="0.9.0"
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Spawn in air ==> Needs WAREHOUSE update.
|
||||
-- DONE: Spawn in air.
|
||||
-- DONE: Spawn hot.
|
||||
-- TODO: Make special request to transfer squadrons to anther airwing (or warehouse).
|
||||
-- TODO: Check that airbase has enough parking spots if a request is BIG.
|
||||
-- DONE: Add squadrons to warehouse.
|
||||
@ -340,13 +341,11 @@ function AIRWING:NewPayload(Unit, Npayloads, MissionTypes, Performance)
|
||||
payload.unitname=Unit:GetName()
|
||||
payload.aircrafttype=Unit:GetTypeName()
|
||||
payload.pylons=Unit:GetTemplatePayload()
|
||||
payload.unlimited=Npayloads<0
|
||||
if payload.unlimited then
|
||||
payload.navail=1
|
||||
else
|
||||
payload.navail=Npayloads or 99
|
||||
end
|
||||
|
||||
-- Set the number of available payloads.
|
||||
self:SetPayloadAmount(payload, Npayloads)
|
||||
|
||||
-- Payload capabilities.
|
||||
payload.capabilities={}
|
||||
for _,missiontype in pairs(MissionTypes) do
|
||||
local capability={} --Ops.Auftrag#AUFTRAG.Capability
|
||||
@ -381,6 +380,29 @@ function AIRWING:NewPayload(Unit, Npayloads, MissionTypes, Performance)
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Set the number of payload available.
|
||||
-- @param #AIRWING self
|
||||
-- @param #AIRWING.Payload Payload The payload table created by the `:NewPayload` function.
|
||||
-- @param #number Navailable Number of payloads available to the airwing resources. Default 99 (which should be enough for most scenarios). Set to -1 for unlimited.
|
||||
-- @return #AIRWING self
|
||||
function AIRWING:SetPayloadAmount(Payload, Navailable)
|
||||
|
||||
Navailable=Navailable or 99
|
||||
|
||||
if Payload then
|
||||
|
||||
Payload.unlimited=Navailable<0
|
||||
if Payload.unlimited then
|
||||
Payload.navail=1
|
||||
else
|
||||
Payload.navail=Navailable
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a mission capability to an existing payload.
|
||||
-- @param #AIRWING self
|
||||
-- @param #AIRWING.Payload Payload The payload table to which the capability should be added.
|
||||
@ -775,6 +797,15 @@ function AIRWING:AddPatrolPointAWACS(Coordinate, Altitude, Speed, Heading, LegLe
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set airboss of this wing. He/she will take care that no missions are launched if the carrier is recovering.
|
||||
-- @param #AIRWING self
|
||||
-- @param Ops.Airboss#AIRBOSS airboss The AIRBOSS object.
|
||||
-- @return #AIRWING self
|
||||
function AIRWING:SetAirboss(airboss)
|
||||
self.airboss=airboss
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Start & Status
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -382,7 +382,7 @@ _AUFTRAGSNR=0
|
||||
-- @field #string ONGUARD On guard.
|
||||
-- @field #string ARMOREDGUARD On guard - with armored groups.
|
||||
-- @field #string BARRAGE Barrage.
|
||||
-- @field #STRING ARMORATTACK Armor attack.
|
||||
-- @field #string ARMORATTACK Armor attack.
|
||||
AUFTRAG.Type={
|
||||
ANTISHIP="Anti Ship",
|
||||
AWACS="AWACS",
|
||||
@ -838,17 +838,17 @@ function AUFTRAG:New(Type)
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
|
||||
--- Triggers the FSM event "Failure".
|
||||
-- @function [parent=#AUFTRAG] Failure
|
||||
--- Triggers the FSM event "Failed".
|
||||
-- @function [parent=#AUFTRAG] Failed
|
||||
-- @param #AUFTRAG self
|
||||
|
||||
--- Triggers the FSM event "Failure" after a delay.
|
||||
-- @function [parent=#AUFTRAG] __Failure
|
||||
--- Triggers the FSM event "Failed" after a delay.
|
||||
-- @function [parent=#AUFTRAG] __Failed
|
||||
-- @param #AUFTRAG self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
--- On after "Failure" event.
|
||||
-- @function [parent=#AUFTRAG] OnAfterFailure
|
||||
--- On after "Failed" event.
|
||||
-- @function [parent=#AUFTRAG] OnAfterFailed
|
||||
-- @param #AUFTRAG self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
@ -4342,8 +4342,17 @@ end
|
||||
-- @param #AUFTRAG self
|
||||
-- @return #string The target type.
|
||||
function AUFTRAG:GetTargetType()
|
||||
local ttype=self:GetTargetData().Type
|
||||
return ttype
|
||||
local target=self.engageTarget
|
||||
if target then
|
||||
local to=target:GetObjective()
|
||||
if to then
|
||||
return to.Type
|
||||
else
|
||||
return "Unknown"
|
||||
end
|
||||
else
|
||||
return "Unknown"
|
||||
end
|
||||
end
|
||||
|
||||
--- Get 2D vector of target.
|
||||
|
||||
@ -180,7 +180,7 @@ CHIEF.Strategy = {
|
||||
|
||||
--- CHIEF class version.
|
||||
-- @field #string version
|
||||
CHIEF.version="0.0.3"
|
||||
CHIEF.version="0.1.0"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@ -1935,6 +1935,7 @@ function CHIEF:_GetMissionPerformanceFromTarget(Target)
|
||||
local group=nil --Wrapper.Group#GROUP
|
||||
local airbase=nil --Wrapper.Airbase#AIRBASE
|
||||
local scenery=nil --Wrapper.Scenery#SCENERY
|
||||
local static=nil --Wrapper.Static#STATIC
|
||||
local coordinate=nil --Core.Point#COORDINATE
|
||||
|
||||
-- Get target objective.
|
||||
@ -1946,6 +1947,8 @@ function CHIEF:_GetMissionPerformanceFromTarget(Target)
|
||||
group=target:GetGroup()
|
||||
elseif target:IsInstanceOf("AIRBASE") then
|
||||
airbase=target
|
||||
elseif target:IsInstanceOf("STATIC") then
|
||||
static=target
|
||||
elseif target:IsInstanceOf("SCENERY") then
|
||||
scenery=target
|
||||
end
|
||||
@ -2044,6 +2047,17 @@ function CHIEF:_GetMissionPerformanceFromTarget(Target)
|
||||
|
||||
-- Bomb runway.
|
||||
table.insert(missionperf, self:_CreateMissionPerformance(AUFTRAG.Type.BOMBRUNWAY, 100))
|
||||
|
||||
elseif static then
|
||||
|
||||
---
|
||||
-- STATIC
|
||||
---
|
||||
|
||||
table.insert(missionperf, self:_CreateMissionPerformance(AUFTRAG.Type.BAI, 100))
|
||||
table.insert(missionperf, self:_CreateMissionPerformance(AUFTRAG.Type.BOMBING, 70))
|
||||
table.insert(missionperf, self:_CreateMissionPerformance(AUFTRAG.Type.BOMBCARPET, 50))
|
||||
table.insert(missionperf, self:_CreateMissionPerformance(AUFTRAG.Type.ARTY, 30))
|
||||
|
||||
elseif scenery then
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ LEGION = {
|
||||
|
||||
--- LEGION class version.
|
||||
-- @field #string version
|
||||
LEGION.version="0.1.0"
|
||||
LEGION.version="0.2.0"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@ -467,6 +467,19 @@ function LEGION:CheckMissionQueue()
|
||||
mission:Cancel()
|
||||
end
|
||||
end
|
||||
|
||||
-- Check that runway is operational and that carrier is not recovering.
|
||||
if self:IsAirwing() then
|
||||
if self:IsRunwayOperational() then
|
||||
return nil
|
||||
end
|
||||
local airboss=self.airboss --Ops.Airboss#AIRBOSS
|
||||
if airboss then
|
||||
if not airboss:IsIdle() then
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Sort results table wrt prio and start time.
|
||||
local function _sort(a, b)
|
||||
@ -2384,11 +2397,11 @@ function LEGION.CalculateAssetMissionScore(asset, MissionType, TargetVec2, Inclu
|
||||
score=score-distance
|
||||
|
||||
-- Intercepts need to be carried out quickly. We prefer spawned assets.
|
||||
if MissionType==AUFTRAG.Type.INTERCEPT then
|
||||
--if MissionType==AUFTRAG.Type.INTERCEPT then
|
||||
if asset.spawned then
|
||||
score=score+25
|
||||
end
|
||||
end
|
||||
--end
|
||||
|
||||
-- TRANSPORT specific.
|
||||
if MissionType==AUFTRAG.Type.OPSTRANSPORT then
|
||||
|
||||
@ -334,7 +334,7 @@ OPSGROUP.TaskType={
|
||||
-- @field #number Formation Formation.
|
||||
-- @field #boolean EPLRS data link.
|
||||
-- @field #boolean Disperse Disperse under fire.
|
||||
-- @field #boolen Emission Emission on/off.
|
||||
-- @field #boolean Emission Emission on/off.
|
||||
|
||||
--- Weapon range data.
|
||||
-- @type OPSGROUP.WeaponData
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user