mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-13 17:31:41 +00:00
Merge remote-tracking branch 'origin/master' into branch
This commit is contained in:
@@ -638,7 +638,7 @@ CTLD_ENGINEERING = {
|
||||
local crate = ctable[1] -- Ops.CTLD#CTLD_CARGO
|
||||
local static = crate:GetPositionable() -- Wrapper.Static#STATIC
|
||||
local crate_pos = static:GetCoordinate() -- Core.Point#COORDINATE
|
||||
local gpos = group:GetCoordinate() -- Core.Point#COORDINATE
|
||||
local gpos = group:GetCoord() -- Core.Point#COORDINATE
|
||||
-- see how far we are from the crate
|
||||
local distance = self:_GetDistance(gpos,crate_pos)
|
||||
self:T(string.format("%s Distance to crate: %d", self.lid, distance))
|
||||
@@ -667,7 +667,7 @@ CTLD_ENGINEERING = {
|
||||
--local COps = self.C_Ops -- Ops.CTLD#CTLD
|
||||
local group = self.Group -- Wrapper.Group#GROUP
|
||||
local tgtpos = self.currwpt -- Core.Point#COORDINATE
|
||||
local gpos = group:GetCoordinate() -- Core.Point#COORDINATE
|
||||
local gpos = group:GetCoord() -- Core.Point#COORDINATE
|
||||
-- see how far we are from the crate
|
||||
local distance = self:_GetDistance(gpos,tgtpos)
|
||||
self:T(string.format("%s Distance remaining: %d", self.lid, distance))
|
||||
|
||||
@@ -398,7 +398,8 @@ function CHIEF:New(Coalition, AgentSet, Alias)
|
||||
self.TransportCategories = {Group.Category.HELICOPTER}
|
||||
|
||||
-- Create a new COMMANDER.
|
||||
self.commander=COMMANDER:New(Coalition)
|
||||
self.commander=COMMANDER:New(Coalition, Alias)
|
||||
|
||||
|
||||
-- Add FSM transitions.
|
||||
-- From State --> Event --> To State
|
||||
@@ -3359,6 +3360,15 @@ function CHIEF._CheckAssetProperties(Asset, Properties)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
--- Checks whether or not any of the legions con run a mission.
|
||||
-- @param #CHIEF self
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
-- @return #boolean If `true`, one of the cohorts can run the mission.
|
||||
function CHIEF:CanMission(Mission)
|
||||
return self.commander and self.commander:CanMission(Mission)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1748,6 +1748,70 @@ function COMMANDER:_GetCohorts(Legions, Cohorts, Operation)
|
||||
return cohorts
|
||||
end
|
||||
|
||||
--- Checks whether or not any of the legions con run a mission.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
-- @return #boolean If `true`, one of the cohorts can run the mission.
|
||||
function COMMANDER:CanMission(Mission)
|
||||
local commander = self
|
||||
|
||||
-- Target position.
|
||||
local TargetVec2 = Mission:GetTargetVec2()
|
||||
|
||||
local MaxWeight = nil
|
||||
|
||||
if Mission.NcarriersMin then
|
||||
|
||||
local legions = commander.legions
|
||||
local cohorts = nil
|
||||
if Mission.transportLegions or Mission.transportCohorts then
|
||||
legions = Mission.transportLegions
|
||||
cohorts = Mission.transportCohorts
|
||||
end
|
||||
|
||||
-- Get transport cohorts.
|
||||
local Cohorts = LEGION._GetCohorts(legions, cohorts)
|
||||
|
||||
-- Filter cohorts that can actually perform transport missions.
|
||||
local transportcohorts = {}
|
||||
for _, _cohort in pairs(Cohorts) do
|
||||
local cohort = _cohort --Ops.Cohort#COHORT
|
||||
|
||||
-- Check if cohort can perform transport to target.
|
||||
local can = LEGION._CohortCan(cohort, AUFTRAG.Type.OPSTRANSPORT, Mission.carrierCategories, Mission.carrierAttributes, Mission.carrierProperties, nil, TargetVec2)
|
||||
|
||||
-- MaxWeight of cargo assets is limited by the largets available cargo bay. We don't want to select, e.g., tanks that cannot be transported by APCs or helos.
|
||||
if can and (MaxWeight == nil or cohort.cargobayLimit > MaxWeight) then
|
||||
MaxWeight = cohort.cargobayLimit
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local legions = commander.legions
|
||||
local cohorts = nil
|
||||
if Mission.specialLegions or Mission.specialCohorts then
|
||||
legions = Mission.specialLegions
|
||||
cohorts = Mission.specialCohorts
|
||||
end
|
||||
|
||||
-- Get cohorts.
|
||||
local Cohorts = LEGION._GetCohorts(legions, cohorts, Mission.operation, commander.opsqueue)
|
||||
|
||||
for _, _cohort in pairs(Cohorts) do
|
||||
local cohort = _cohort --Ops.Cohort#COHORT
|
||||
|
||||
-- Check if cohort can do the mission.
|
||||
local can = LEGION._CohortCan(cohort, Mission.type, nil, Mission.attributes, Mission.properties, { Mission.engageWeaponType }, TargetVec2, Mission.engageRange, Mission.refuelSystem, nil, MaxWeight)
|
||||
if can then
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
--- Recruit assets for a given mission.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
@@ -1175,7 +1175,7 @@ function INTEL:_CreateContact(Positionable, RecceName)
|
||||
item.category=3 --static:GetCategory()
|
||||
item.categoryname=static:GetCategoryName() or "Unknown"
|
||||
item.threatlevel=static:GetThreatLevel() or 0
|
||||
item.position=static:GetCoordinate()
|
||||
item.position=static:GetCoord()
|
||||
item.velocity=static:GetVelocityVec3()
|
||||
item.speed=0
|
||||
item.recce=RecceName
|
||||
@@ -1282,15 +1282,15 @@ function INTEL:GetDetectedUnits(Unit, DetectedUnits, RecceDetecting, DetectVisua
|
||||
local DetectionAccepted = true
|
||||
|
||||
if self.RadarAcceptRange then
|
||||
local reccecoord = Unit:GetCoordinate()
|
||||
local coord = unit:GetCoordinate()
|
||||
local reccecoord = Unit:GetCoord()
|
||||
local coord = unit:GetCoord()
|
||||
local dist = math.floor(coord:Get2DDistance(reccecoord)/1000) -- km
|
||||
if dist > self.RadarAcceptRangeKilometers then DetectionAccepted = false end
|
||||
end
|
||||
|
||||
if self.RadarBlur then
|
||||
local reccecoord = Unit:GetCoordinate()
|
||||
local coord = unit:GetCoordinate()
|
||||
local reccecoord = Unit:GetCoord()
|
||||
local coord = unit:GetCoord()
|
||||
local dist = math.floor(coord:Get2DDistance(reccecoord)/1000) -- km
|
||||
local AGL = unit:GetAltitude(true)
|
||||
local minheight = self.RadarBlurMinHeight or 250 -- meters
|
||||
|
||||
Reference in New Issue
Block a user