mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-12 04:31:09 +00:00
Ops
This commit is contained in:
@@ -2175,7 +2175,23 @@ do -- SET_UNIT
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Iterate the SET_UNIT and count how many UNITs are alive.
|
||||||
|
-- @param #SET_UNIT self
|
||||||
|
-- @return #number The number of UNITs alive.
|
||||||
|
function SET_UNIT:CountAlive()
|
||||||
|
|
||||||
|
local Set = self:GetSet()
|
||||||
|
|
||||||
|
local CountU = 0
|
||||||
|
for UnitID, UnitData in pairs(Set) do -- For each GROUP in SET_GROUP
|
||||||
|
if UnitData and UnitData:IsAlive() then
|
||||||
|
CountU = CountU + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return CountU
|
||||||
|
end
|
||||||
|
|
||||||
--- Starts the filtering.
|
--- Starts the filtering.
|
||||||
-- @param #SET_UNIT self
|
-- @param #SET_UNIT self
|
||||||
@@ -3194,6 +3210,24 @@ do -- SET_STATIC
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Iterate the SET_STATIC and count how many STATICSs are alive.
|
||||||
|
-- @param #SET_STATIC self
|
||||||
|
-- @return #number The number of UNITs alive.
|
||||||
|
function SET_STATIC:CountAlive()
|
||||||
|
|
||||||
|
local Set = self:GetSet()
|
||||||
|
|
||||||
|
local CountU = 0
|
||||||
|
for UnitID, UnitData in pairs(Set) do
|
||||||
|
if UnitData and UnitData:IsAlive() then
|
||||||
|
CountU = CountU + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return CountU
|
||||||
|
end
|
||||||
|
|
||||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||||
-- @param #SET_STATIC self
|
-- @param #SET_STATIC self
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ end
|
|||||||
|
|
||||||
--- Create an ANTI-SHIP mission.
|
--- Create an ANTI-SHIP mission.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Set#SET_UNIT TargetGroupSet The set of target units.
|
-- @param Core.Set#SET_UNIT TargetUnitSet The set of target units.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:NewANTISHIP(TargetUnitSet)
|
function AUFTRAG:NewANTISHIP(TargetUnitSet)
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ end
|
|||||||
|
|
||||||
--- Create a BAI mission.
|
--- Create a BAI mission.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Set#SET_GROUP TargetGroupSet The set of target groups to attack. Instead of a SET an ordinary GROUP object can also be given if only a single group needs to be attacked.
|
-- @param Core.Set#SET_Unit TargetGroupSet The set of target groups to attack. Instead of a SET an ordinary GROUP object can also be given if only a single group needs to be attacked.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:NewBAI(TargetGroupSet)
|
function AUFTRAG:NewBAI(TargetGroupSet)
|
||||||
|
|
||||||
@@ -476,8 +476,8 @@ function AUFTRAG:NewBAI(TargetGroupSet)
|
|||||||
|
|
||||||
local mission=AUFTRAG:New(AUFTRAG.Type.BAI)
|
local mission=AUFTRAG:New(AUFTRAG.Type.BAI)
|
||||||
|
|
||||||
mission.engageTargetGroupset=TargetGroupSet
|
mission.engageTargetUnitset=TargetGroupSet
|
||||||
mission.engageTargetGroupset:FilterDeads():FilterCrashes()
|
mission.engageTargetUnitset:FilterDeads()
|
||||||
|
|
||||||
mission.missionTask=ENUMS.MissionTask.GROUNDATTACK
|
mission.missionTask=ENUMS.MissionTask.GROUNDATTACK
|
||||||
|
|
||||||
@@ -1397,7 +1397,7 @@ function AUFTRAG:CountMissionTargets()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.engageTargetUnitset then
|
if self.engageTargetUnitset then
|
||||||
local n=self.engageTargetUnitset:Count()
|
local n=self.engageTargetUnitset:CountAlive()
|
||||||
N=N+n
|
N=N+n
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1475,6 +1475,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
local TargetUnit=_unit
|
local TargetUnit=_unit
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.TaskAttackUnit(nil, TargetUnit, self.engageAltitude, self.WeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType)
|
local DCStask=CONTROLLABLE.TaskAttackUnit(nil, TargetUnit, self.engageAltitude, self.WeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType)
|
||||||
|
local DCStask=CONTROLLABLE.TaskAttackUnit(self,AttackUnit,GroupAttack,WeaponExpend,AttackQty,Direction,Altitude,WeaponType)
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
@@ -1496,13 +1497,25 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
-- BAI Mission --
|
-- BAI Mission --
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
--[[
|
||||||
for _,_group in pairs(self.engageTargetGroupset:GetSet()) do
|
for _,_group in pairs(self.engageTargetGroupset:GetSet()) do
|
||||||
local TargetGroup=_group
|
local TargetGroup=_group
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.TaskAttackGroup(nil, TargetGroup, self.engageWeaponType, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude)
|
local DCStask=CONTROLLABLE.TaskAttackGroup(nil, TargetGroup, self.engageWeaponType, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude)
|
||||||
|
local DCSTask=
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
|
for _,_unit in pairs(self.engageTargetUnitset:GetSet()) do
|
||||||
|
local TargetUnit=_unit
|
||||||
|
|
||||||
|
local DCStask=CONTROLLABLE.TaskAttackUnit(self, TargetUnit, self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType)
|
||||||
|
|
||||||
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.BOMBING then
|
elseif self.type==AUFTRAG.Type.BOMBING then
|
||||||
|
|
||||||
@@ -1512,7 +1525,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
|
|
||||||
local Vec2=self.engageCoord:GetVec2()
|
local Vec2=self.engageCoord:GetVec2()
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.TaskBombing(self, Vec2, self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, Divebomb)
|
local DCStask=CONTROLLABLE.TaskBombing(nil, Vec2, self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, Divebomb)
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
@@ -1522,7 +1535,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
-- CAP Mission --
|
-- CAP Mission --
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority)
|
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority)
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
@@ -1532,7 +1545,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
-- CAS Mission --
|
-- CAS Mission --
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority)
|
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority)
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ function INTEL:New(DetectionSet)
|
|||||||
-- Detection set.
|
-- Detection set.
|
||||||
self.detectionset=DetectionSet
|
self.detectionset=DetectionSet
|
||||||
|
|
||||||
|
local alias="SPECTRE"
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
-- Determine coalition from first group in set.
|
-- Determine coalition from first group in set.
|
||||||
self.coalition=DetectionSet:GetFirst():GetCoalition()
|
self.coalition=DetectionSet:GetFirst():GetCoalition()
|
||||||
|
|
||||||
@@ -104,6 +108,8 @@ function INTEL:New(DetectionSet)
|
|||||||
alias="CIA"
|
alias="CIA"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
-- Set some string id for output to DCS.log file.
|
-- Set some string id for output to DCS.log file.
|
||||||
self.lid=string.format("INTEL %s | ", alias)
|
self.lid=string.format("INTEL %s | ", alias)
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,11 @@ ENUMS.ROT = {
|
|||||||
--- Weapon types
|
--- Weapon types
|
||||||
-- @type ENUMS.WeaponFlag
|
-- @type ENUMS.WeaponFlag
|
||||||
ENUMS.WeaponFlag={
|
ENUMS.WeaponFlag={
|
||||||
Auto=1073741822, --Auto
|
Auto=3221225470, --AnyWeapon (AnyBomb + AnyRocket + AnyMissile + Cannons)
|
||||||
|
AnyAG=2956984318,
|
||||||
|
AnyAA=264241152,
|
||||||
|
AnyUnguided=2952822768,
|
||||||
|
AnyGuided=268402702,
|
||||||
LGB=2,
|
LGB=2,
|
||||||
TvGB=4,
|
TvGB=4,
|
||||||
SNSGB=8,
|
SNSGB=8,
|
||||||
|
|||||||
@@ -1447,7 +1447,7 @@ end
|
|||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param DCS#Vec2 Vec2 2D-coordinates of the zone.
|
-- @param DCS#Vec2 Vec2 2D-coordinates of the zone.
|
||||||
-- @param DCS#Distance Radius Radius of the zone.
|
-- @param DCS#Distance Radius Radius of the zone.
|
||||||
-- @param DCS#AttributeNameArray (Optional) TargetTypes Array of target categories allowed to engage. Default {"Air"}.
|
-- @param DCS#AttributeNameArray TargetTypes (Optional) Array of target categories allowed to engage. Default {"Air"}.
|
||||||
-- @param #number Priority (Optional) All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first. Default 0.
|
-- @param #number Priority (Optional) All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first. Default 0.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskEngageTargetsInZone( Vec2, Radius, TargetTypes, Priority )
|
function CONTROLLABLE:EnRouteTaskEngageTargetsInZone( Vec2, Radius, TargetTypes, Priority )
|
||||||
|
|||||||
Reference in New Issue
Block a user