mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Updates
This commit is contained in:
parent
8d12cc2a4d
commit
9dcfe83ed8
2197
Moose Development/Moose/Controllable.lua
Normal file
2197
Moose Development/Moose/Controllable.lua
Normal file
File diff suppressed because it is too large
Load Diff
@ -239,7 +239,7 @@ function DATABASE:AddPlayer( UnitName, PlayerName )
|
||||
|
||||
if PlayerName then
|
||||
self:E( { "Add player for unit:", UnitName, PlayerName } )
|
||||
self.PLAYERS[PlayerName] = UNIT:FindByName( UnitName )
|
||||
self.PLAYERS[PlayerName] = self:FindUnit( UnitName )
|
||||
self.PLAYERSJOINED[PlayerName] = PlayerName
|
||||
end
|
||||
end
|
||||
|
||||
@ -3,10 +3,31 @@
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{Detection#DETECTION_BASE} class, extends @{Base#BASE}
|
||||
-- =====================================================
|
||||
-- ==========================================================
|
||||
-- The @{Detection#DETECTION_BASE} class defines the core functions to administer detected objects.
|
||||
-- Detected objects are grouped in SETS of UNITS.
|
||||
--
|
||||
-- 1.1) DETECTION constructor:
|
||||
-- ----------------------------
|
||||
-- * @{Detection#DETECTION.New}(): Create a new DETECTION object.
|
||||
--
|
||||
-- 1.2) DETECTION initialization:
|
||||
-- ------------------------------
|
||||
-- By default, detection will return detected units with all the methods available.
|
||||
-- However, you can specify which units it found with specific detection methods.
|
||||
-- If you use one of the below functions, the detection will work with the detection method specified.
|
||||
-- You can specify to apply multiple detection methods.
|
||||
-- Use the following functions to report the units it detected using the methods Visual, Optical, Radar, IRST, RWR, DLINK:
|
||||
--
|
||||
-- * @{Detection#DETECTION.InitDetectVisual}(): Detected using Visual.
|
||||
-- * @{Detection#DETECTION.InitDetectOptical}(): Detected using Optical.
|
||||
-- * @{Detection#DETECTION.InitDetectRadar}(): Detected using Radar.
|
||||
-- * @{Detection#DETECTION.InitDetectIRST}(): Detected using IRST.
|
||||
-- * @{Detection#DETECTION.InitDetectRWR}(): Detected using RWR.
|
||||
-- * @{Detection#DETECTION.InitDetectDLINK}(): Detected using DLINK.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- @module Detection
|
||||
-- @author Mechanic : Concept & Testing
|
||||
-- @author FlightControl : Design & Programming
|
||||
@ -19,11 +40,12 @@
|
||||
-- @field DCSTypes#Distance DetectionRange The range till which targets are accepted to be detected.
|
||||
-- @field DCSTypes#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
||||
-- @field #DETECTION_BASE.DetectedUnitSets DetectedUnitSets A list of @{Set#SET_UNIT}s containing the units in each set that were detected within a DetectedZoneRange.
|
||||
-- @field #DETECTION_BASE.DetectedZones DetectedZones A list of @{Zone#ZONE_UNIT}s containing the zones of the reference detected units.
|
||||
-- @field #DETECTION_BASE.DetectedUnitZones DetectedUnitZones A list of @{Zone#ZONE_UNIT}s containing the zones of the reference detected units.
|
||||
-- @extends Set#SET_BASE
|
||||
DETECTION_BASE = {
|
||||
ClassName = "DETECTION_BASE",
|
||||
DetectedUnitSets = {},
|
||||
DetectedUnitZones = {},
|
||||
DetectedUnits = {},
|
||||
FACGroup = nil,
|
||||
DetectionRange = nil,
|
||||
@ -34,7 +56,7 @@ DETECTION_BASE = {
|
||||
-- @list <Set#SET_UNIT>
|
||||
|
||||
|
||||
--- @type DETECTION_BASE.DetectedZones
|
||||
--- @type DETECTION_BASE.DetectedUnitZones
|
||||
-- @list <Zone#ZONE_UNIT>
|
||||
|
||||
|
||||
@ -50,7 +72,116 @@ function DETECTION_BASE:New( FACGroup, DetectionRange, DetectionZoneRange )
|
||||
self.DetectionRange = DetectionRange
|
||||
self.DetectionZoneRange = DetectionZoneRange
|
||||
|
||||
self:InitDetectVisual( false )
|
||||
self:InitDetectOptical( false )
|
||||
self:InitDetectRadar( false )
|
||||
self:InitDetectRWR( false )
|
||||
self:InitDetectIRST( false )
|
||||
self:InitDetectDLINK( false )
|
||||
|
||||
self.DetectionScheduler = SCHEDULER:New(self, self._DetectionScheduler, { self, "Detection" }, 10, 30, 0.2 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Detect Visual.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #boolean DetectVisual
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:InitDetectVisual( DetectVisual )
|
||||
|
||||
self.DetectVisual = DetectVisual
|
||||
end
|
||||
|
||||
--- Detect Optical.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #boolean DetectOptical
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:InitDetectOptical( DetectOptical )
|
||||
self:F2()
|
||||
|
||||
self.DetectOptical = DetectOptical
|
||||
end
|
||||
|
||||
--- Detect Radar.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #boolean DetectRadar
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:InitDetectRadar( DetectRadar )
|
||||
self:F2()
|
||||
|
||||
self.DetectRadar = DetectRadar
|
||||
end
|
||||
|
||||
--- Detect IRST.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #boolean DetectIRST
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:InitDetectIRST( DetectIRST )
|
||||
self:F2()
|
||||
|
||||
self.DetectIRST = DetectIRST
|
||||
end
|
||||
|
||||
--- Detect RWR.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #boolean DetectRWR
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:InitDetectRWR( DetectRWR )
|
||||
self:F2()
|
||||
|
||||
self.DetectRWR = DetectRWR
|
||||
end
|
||||
|
||||
--- Detect DLINK.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #boolean DetectDLINK
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:InitDetectDLINK( DetectDLINK )
|
||||
self:F2()
|
||||
|
||||
self.DetectDLINK = DetectDLINK
|
||||
end
|
||||
|
||||
--- Gets the FAC group.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @return Group#GROUP self
|
||||
function DETECTION_BASE:GetFACGroup()
|
||||
self:F2()
|
||||
|
||||
return self.FACGroup
|
||||
end
|
||||
|
||||
--- Get the detected @{Set#SET_UNIT}s.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @return #DETECTION_BASE.DetectedUnitSets DetectedUnitSets
|
||||
function DETECTION_BASE:GetDetectionUnitSets()
|
||||
|
||||
local DetectionUnitSets = self.DetectedUnitSets
|
||||
return DetectionUnitSets
|
||||
end
|
||||
|
||||
--- Get the amount of SETs with detected units.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @return #number Count
|
||||
function DETECTION_BASE:GetDetectionUnitSetCount()
|
||||
|
||||
local DetectionUnitSetCount = #self.DetectedUnitSets
|
||||
return DetectionUnitSetCount
|
||||
end
|
||||
|
||||
--- Get a SET of detected units using a given numeric index.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #number Index
|
||||
-- @return Set#SET_UNIT
|
||||
function DETECTION_BASE:GetDetectionUnitSet( Index )
|
||||
|
||||
local DetectionUnitSet = self.DetectedUnitSets[Index]
|
||||
if DetectionUnitSet then
|
||||
return DetectionUnitSet
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Form @{Set}s of detected @{Unit#UNIT}s in an array of @{Set#SET_UNIT}s.
|
||||
@ -59,10 +190,19 @@ function DETECTION_BASE:_DetectionScheduler( SchedulerName )
|
||||
self:F2( { SchedulerName } )
|
||||
|
||||
self.DetectedUnitSets = {}
|
||||
self.DetectedUnitZones = {}
|
||||
|
||||
if self.FACGroup:IsAlive() then
|
||||
local FACGroupName = self.FACGroup:GetName()
|
||||
local FACDetectedTargets = self.FACGroup:GetDetectedTargets()
|
||||
|
||||
local FACDetectedTargets = self.FACGroup:GetDetectedTargets(
|
||||
self.DetectVisual,
|
||||
self.DetectOptical,
|
||||
self.DetectRadar,
|
||||
self.DetectIRST,
|
||||
self.DetectRWR,
|
||||
self.DetectDLINK
|
||||
)
|
||||
|
||||
for FACDetectedTargetID, FACDetectedTarget in pairs( FACDetectedTargets ) do
|
||||
local FACObject = FACDetectedTarget.object
|
||||
@ -115,28 +255,28 @@ function DETECTION_BASE:_DetectionScheduler( SchedulerName )
|
||||
self:T( DetectedUnit:GetName() )
|
||||
if #self.DetectedUnitSets == 0 then
|
||||
self:T( { "Adding Unit Set #", 1 } )
|
||||
self.DetectedUnitSets[1] = {}
|
||||
self.DetectedUnitSets[1].Zone = ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange )
|
||||
self.DetectedUnitSets[1].Set = SET_UNIT:New()
|
||||
self.DetectedUnitSets[1].Set:AddUnit( DetectedUnit )
|
||||
self.DetectedUnitZones[1] = ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange )
|
||||
self.DetectedUnitSets[1] = SET_UNIT:New()
|
||||
self.DetectedUnitSets[1]:AddUnit( DetectedUnit )
|
||||
else
|
||||
local AddedToSet = false
|
||||
for DetectedUnitSetID, DetectedUnitSetData in pairs( self.DetectedUnitSets ) do
|
||||
self:T( "Detected Unit Set #" .. DetectedUnitSetID )
|
||||
local DetectedUnitSet = DetectedUnitSetData.Set -- Set#SET_UNIT
|
||||
local DetectedZone = DetectedUnitSetData.Zone -- Zone#ZONE_UNIT
|
||||
for DetectedZoneIndex = 1, #self.DetectedUnitZones do
|
||||
self:T( "Detected Unit Set #" .. DetectedZoneIndex )
|
||||
local DetectedUnitSet = self.DetectedUnitSets[DetectedZoneIndex] -- Set#SET_UNIT
|
||||
DetectedUnitSet:Flush()
|
||||
local DetectedZone = self.DetectedUnitZones[DetectedZoneIndex] -- Zone#ZONE_UNIT
|
||||
if DetectedUnit:IsInZone( DetectedZone ) then
|
||||
self:T( "Adding to Unit Set #" .. DetectedUnitSetID )
|
||||
self.DetectedUnitSets[DetectedUnitSetID].Set:AddUnit( DetectedUnit )
|
||||
self:T( "Adding to Unit Set #" .. DetectedZoneIndex )
|
||||
DetectedUnitSet:AddUnit( DetectedUnit )
|
||||
AddedToSet = true
|
||||
end
|
||||
end
|
||||
if AddedToSet == false then
|
||||
self:T( "Adding new Unit Set #" .. #self.DetectedUnitSets+1 )
|
||||
self.DetectedUnitSets[#self.DetectedUnitSets+1] = {}
|
||||
self.DetectedUnitSets[#self.DetectedUnitSets].Zone = ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange )
|
||||
self.DetectedUnitSets[#self.DetectedUnitSets].Set = SET_UNIT:New()
|
||||
self.DetectedUnitSets[#self.DetectedUnitSets].Set:AddUnit( DetectedUnit )
|
||||
local DetectedZoneIndex = #self.DetectedUnitZones + 1
|
||||
self:T( "Adding new zone #" .. DetectedZoneIndex )
|
||||
self.DetectedUnitZones[DetectedZoneIndex] = ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange )
|
||||
self.DetectedUnitSets[DetectedZoneIndex] = SET_UNIT:New()
|
||||
self.DetectedUnitSets[DetectedZoneIndex]:AddUnit( DetectedUnit )
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -145,10 +285,10 @@ function DETECTION_BASE:_DetectionScheduler( SchedulerName )
|
||||
|
||||
-- Now all the tests should have been build, now make some smoke and flares...
|
||||
|
||||
for DetectedUnitSetID, DetectedUnitSetData in pairs( self.DetectedUnitSets ) do
|
||||
local DetectedUnitSet = DetectedUnitSetData.Set -- Set#SET_UNIT
|
||||
local DetectedZone = DetectedUnitSetData.Zone -- Zone#ZONE_UNIT
|
||||
self:T( "Detected Set #" .. DetectedUnitSetID )
|
||||
for DetectedZoneIndex = 1, #self.DetectedUnitZones do
|
||||
local DetectedUnitSet = self.DetectedUnitSets[DetectedZoneIndex] -- Set#SET_UNIT
|
||||
local DetectedZone = self.DetectedUnitZones[DetectedZoneIndex] -- Zone#ZONE_UNIT
|
||||
self:T( "Detected Set #" .. DetectedZoneIndex )
|
||||
DetectedUnitSet:ForEachUnit(
|
||||
--- @param Unit#UNIT DetectedUnit
|
||||
function( DetectedUnit )
|
||||
@ -156,7 +296,7 @@ function DETECTION_BASE:_DetectionScheduler( SchedulerName )
|
||||
DetectedUnit:FlareRed()
|
||||
end
|
||||
)
|
||||
DetectedZone:SmokeZone( POINT_VEC3.SmokeColor.White, 30 )
|
||||
DetectedZone:FlareZone( POINT_VEC3.SmokeColor.White, 30, math.random( 0,90 ) )
|
||||
end
|
||||
end
|
||||
end
|
||||
97
Moose Development/Moose/FAC.lua
Normal file
97
Moose Development/Moose/FAC.lua
Normal file
@ -0,0 +1,97 @@
|
||||
--- This module contains the FAC classes.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{Fac#FAC_BASE} class, extends @{Base#BASE}
|
||||
-- ==============================================
|
||||
-- The @{Fac#FAC_BASE} class defines the core functions to report detected objects to:
|
||||
--
|
||||
-- * CLIENTS
|
||||
-- * COALITIONS
|
||||
--
|
||||
-- Detected objects are grouped in SETS of UNITS.
|
||||
--
|
||||
-- 1.1) FAC constructor:
|
||||
-- ----------------------------
|
||||
-- * @{Fac#FAC.New}(): Create a new FAC object.
|
||||
--
|
||||
-- 1.2) FAC initialization:
|
||||
-- ------------------------------
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- @module Fac
|
||||
-- @author Mechanic : Concept & Testing
|
||||
-- @author FlightControl : Design & Programming
|
||||
|
||||
|
||||
|
||||
--- FAC_BASE class
|
||||
-- @type FAC_BASE
|
||||
-- @field Set#SET_CLIENT ClientSet The clients to which the FAC will report to.
|
||||
-- @field Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects.
|
||||
-- @extends Set#SET_BASE
|
||||
FAC_BASE = {
|
||||
ClassName = "FAC_BASE",
|
||||
ClientSet = nil,
|
||||
Detection = nil,
|
||||
}
|
||||
|
||||
--- FAC constructor.
|
||||
-- @param #FAC_BASE self
|
||||
-- @param Set#SET_CLIENT ClientSet
|
||||
-- @param Detection#DETECTION_BASE Detection
|
||||
-- @return #FAC_BASE self
|
||||
function FAC_BASE:New( ClientSet, Detection )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
|
||||
self.ClientSet = ClientSet
|
||||
self.Detection = Detection
|
||||
|
||||
self.FacScheduler = SCHEDULER:New(self, self._FacScheduler, { self, "Fac" }, 5, 15 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Report the detected @{Unit#UNIT}s detected within the @{DetectION#DETECTION_BASE} object to the @{Set#SET_CLIENT}s.
|
||||
-- @param #FAC_BASE self
|
||||
function FAC_BASE:_FacScheduler( SchedulerName )
|
||||
self:F2( { SchedulerName } )
|
||||
|
||||
self.ClientSet:ForEachClient(
|
||||
--- @param Client#CLIENT Client
|
||||
function( Client )
|
||||
if Client:IsAlive() then
|
||||
local DetectedUnitSets = self.Detection:GetDetectionUnitSets()
|
||||
local DetectedMsg = { }
|
||||
for DetectedUnitSetID, DetectedUnitSet in pairs( DetectedUnitSets ) do
|
||||
local UnitSet = DetectedUnitSet -- Set#SET_UNIT
|
||||
local MT = {} -- Message Text
|
||||
local UnitTypes = {}
|
||||
for DetectedUnitID, DetectedUnitData in pairs( UnitSet:GetSet() ) do
|
||||
local DetectedUnit = DetectedUnitData -- Unit#UNIT
|
||||
local UnitType = DetectedUnit:GetTypeName()
|
||||
if not UnitTypes[UnitType] then
|
||||
UnitTypes[UnitType] = 1
|
||||
else
|
||||
UnitTypes[UnitType] = UnitTypes[UnitType] + 1
|
||||
end
|
||||
end
|
||||
for UnitTypeID, UnitType in pairs( UnitTypes ) do
|
||||
MT[#MT+1] = UnitType .. " of " .. UnitTypeID
|
||||
end
|
||||
local MessageText = table.concat( MT, ", " )
|
||||
DetectedMsg[#DetectedMsg+1] = " - Group #" .. DetectedUnitSetID .. ": " .. MessageText
|
||||
end
|
||||
local FACGroup = self.Detection:GetFACGroup()
|
||||
FACGroup:MessageToClient( "Reporting detected target groups:\n" .. table.concat( DetectedMsg, "\n" ), 12, Client )
|
||||
end
|
||||
return true
|
||||
end
|
||||
)
|
||||
|
||||
return true
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@ Include.File( "Base" )
|
||||
Include.File( "Scheduler" )
|
||||
Include.File( "Event" )
|
||||
Include.File( "Menu" )
|
||||
Include.File( "Controllable" )
|
||||
Include.File( "Group" )
|
||||
Include.File( "Unit" )
|
||||
Include.File( "Zone" )
|
||||
@ -40,6 +41,7 @@ Include.File( "PatrolZone" )
|
||||
Include.File( "AIBalancer" )
|
||||
Include.File( "AirbasePolice" )
|
||||
Include.File( "Detection" )
|
||||
Include.File( "FAC" )
|
||||
|
||||
-- The order of the declarations is important here. Don't touch it.
|
||||
|
||||
|
||||
@ -260,6 +260,15 @@ function SET_BASE:_Find( ObjectName )
|
||||
end
|
||||
|
||||
|
||||
--- Gets the Set.
|
||||
-- @param #SET_BASE self
|
||||
-- @return #SET_BASE self
|
||||
function SET_BASE:GetSet()
|
||||
self:F2()
|
||||
|
||||
return self.Set
|
||||
end
|
||||
|
||||
--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using the Object Name as the index.
|
||||
-- @param #SET_BASE self
|
||||
-- @param #string ObjectName
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
--- This module contains the UNIT class.
|
||||
--
|
||||
-- 1) @{Unit#UNIT} class, extends @{Base#BASE}
|
||||
-- ===========================================
|
||||
-- 1) @{Unit#UNIT} class, extends @{Controllable#CONTROLLABLE}
|
||||
-- ===========================================================
|
||||
-- The @{Unit#UNIT} class is a wrapper class to handle the DCS Unit objects:
|
||||
--
|
||||
-- * Support all DCS Unit APIs.
|
||||
@ -74,7 +74,7 @@
|
||||
|
||||
--- The UNIT class
|
||||
-- @type UNIT
|
||||
-- @extends Base#BASE
|
||||
-- @extends Controllable#CONTROLLABLE
|
||||
-- @field #UNIT.FlareColor FlareColor
|
||||
-- @field #UNIT.SmokeColor SmokeColor
|
||||
UNIT = {
|
||||
@ -125,7 +125,7 @@ UNIT = {
|
||||
-- @return Unit#UNIT
|
||||
function UNIT:Register( UnitName )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
local self = BASE:Inherit( self, CONTROLLABLE:New() )
|
||||
self:F2( UnitName )
|
||||
self.UnitName = UnitName
|
||||
return self
|
||||
@ -154,7 +154,10 @@ function UNIT:FindByName( UnitName )
|
||||
return UnitFound
|
||||
end
|
||||
|
||||
function UNIT:GetDCSUnit()
|
||||
|
||||
--- @param #UNIT self
|
||||
-- @return DCSUnit#Unit
|
||||
function UNIT:GetDCSObject()
|
||||
|
||||
local DCSUnit = Unit.getByName( self.UnitName )
|
||||
|
||||
@ -172,7 +175,7 @@ end
|
||||
function UNIT:GetCoalition()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitCoalition = DCSUnit:getCoalition()
|
||||
@ -190,7 +193,7 @@ end
|
||||
function UNIT:GetCountry()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitCountry = DCSUnit:getCountry()
|
||||
@ -210,7 +213,7 @@ end
|
||||
function UNIT:GetName()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitName = self.UnitName
|
||||
@ -228,7 +231,7 @@ end
|
||||
function UNIT:IsAlive()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitIsAlive = DCSUnit:isExist()
|
||||
@ -245,7 +248,7 @@ end
|
||||
function UNIT:IsActive()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
|
||||
@ -263,7 +266,7 @@ end
|
||||
function UNIT:IsAboveRunway()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
|
||||
@ -287,7 +290,7 @@ end
|
||||
function UNIT:GetPlayerName()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
|
||||
@ -308,7 +311,7 @@ end
|
||||
function UNIT:GetID()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitID = DCSUnit:getID()
|
||||
@ -328,7 +331,7 @@ end
|
||||
function UNIT:GetNumber()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitNumber = DCSUnit:getNumber()
|
||||
@ -345,7 +348,7 @@ end
|
||||
function UNIT:GetGroup()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitGroup = GROUP:Find( DCSUnit:getGroup() )
|
||||
@ -363,7 +366,7 @@ end
|
||||
function UNIT:GetCallSign()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitCallSign = DCSUnit:getCallsign()
|
||||
@ -380,7 +383,7 @@ end
|
||||
function UNIT:GetLife()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitLife = DCSUnit:getLife()
|
||||
@ -397,7 +400,7 @@ end
|
||||
function UNIT:GetLife0()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitLife0 = DCSUnit:getLife0()
|
||||
@ -414,7 +417,7 @@ end
|
||||
function UNIT:GetFuel()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitFuel = DCSUnit:getFuel()
|
||||
@ -431,7 +434,7 @@ end
|
||||
function UNIT:GetAmmo()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitAmmo = DCSUnit:getAmmo()
|
||||
@ -448,7 +451,7 @@ end
|
||||
function UNIT:GetSensors()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitSensors = DCSUnit:getSensors()
|
||||
@ -472,7 +475,7 @@ end
|
||||
function UNIT:GetRadar()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitRadarOn, UnitRadarObject = DCSUnit:getRadar()
|
||||
@ -491,7 +494,7 @@ end
|
||||
function UNIT:GetDesc()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitDesc = DCSUnit:getDesc()
|
||||
@ -511,7 +514,7 @@ end
|
||||
function UNIT:GetTypeName()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitTypeName = DCSUnit:getTypeName()
|
||||
@ -533,7 +536,7 @@ end
|
||||
function UNIT:GetPrefix()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitPrefix = string.match( self.UnitName, ".*#" ):sub( 1, -2 )
|
||||
@ -553,7 +556,7 @@ end
|
||||
function UNIT:GetPointVec2()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitPointVec3 = DCSUnit:getPosition().p
|
||||
@ -577,7 +580,7 @@ end
|
||||
function UNIT:GetPointVec3()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitPointVec3 = DCSUnit:getPosition().p
|
||||
@ -595,7 +598,7 @@ end
|
||||
function UNIT:GetPositionVec3()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitPosition = DCSUnit:getPosition()
|
||||
@ -613,7 +616,7 @@ end
|
||||
function UNIT:GetVelocity()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitVelocityVec3 = DCSUnit:getVelocity()
|
||||
@ -667,7 +670,7 @@ end
|
||||
function UNIT:InAir()
|
||||
self:F2( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitInAir = DCSUnit:inAir()
|
||||
@ -685,7 +688,7 @@ end
|
||||
function UNIT:GetAltitude()
|
||||
self:F2()
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitPointVec3 = DCSUnit:getPoint() --DCSTypes#Vec3
|
||||
@ -704,7 +707,7 @@ end
|
||||
function UNIT:OtherUnitInRadius( AwaitUnit, Radius )
|
||||
self:F2( { self.UnitName, AwaitUnit.UnitName, Radius } )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitPos = self:GetPointVec3()
|
||||
@ -726,7 +729,7 @@ end
|
||||
-- @param Unit#UNIT self
|
||||
-- @return #string The DCS Unit Category Name
|
||||
function UNIT:GetCategoryName()
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitCategoryName = self.CategoryName[ self:GetDesc().category ]
|
||||
@ -740,7 +743,7 @@ end
|
||||
-- @param Unit#UNIT self
|
||||
-- @return #number The DCS Unit heading
|
||||
function UNIT:GetHeading()
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -43,6 +43,7 @@ COPY /b Moose.lua + %1\Base.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Scheduler.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Event.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Menu.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Controllable.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Group.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Unit.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Zone.lua Moose.lua
|
||||
@ -78,6 +79,7 @@ COPY /b Moose.lua + %1\PatrolZone.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\AIBalancer.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\AirbasePolice.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Detection.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\FAC.lua Moose.lua
|
||||
|
||||
COPY /b Moose.lua + "Moose Create Static\Moose_Trace_Off.lua" Moose.lua
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,5 @@
|
||||
|
||||
local FACGroup = GROUP:FindByName( "FAC Group" )
|
||||
|
||||
local FACDetection = DETECTION_BASE:New( FACGroup, 1000, 250 )
|
||||
local FACDetection = DETECTION_BASE:New( FACGroup, 1000, 250 ):InitDetectIRST( true )
|
||||
|
||||
|
||||
Binary file not shown.
@ -0,0 +1,63 @@
|
||||
|
||||
local FACGroup = GROUP:FindByName( "FAC Group Lase" )
|
||||
|
||||
local FACDetection = DETECTION_BASE:New( FACGroup, 1000, 250 )
|
||||
|
||||
|
||||
local LaseScheduler = SCHEDULER:New(nil,
|
||||
--- @param Group#GROUP FACGroup
|
||||
-- @param Detection#DETECTION_BASE FACDetection
|
||||
function( FACGroup, FACDetection )
|
||||
if FACDetection:GetDetectionUnitSetCount() > 0 then
|
||||
local DetectedUnitSet = FACDetection:GetDetectionUnitSet(1)
|
||||
if DetectedUnitSet then
|
||||
FACDetection:E( { "I have a unit set ", DetectedUnitSet } )
|
||||
local FACUnit = FACGroup:GetUnit(1)
|
||||
if FACUnit then
|
||||
FACDetection:E( FACUnit )
|
||||
local FACDCSUnit = FACUnit:GetDCSUnit()
|
||||
local FACUnitController = FACDCSUnit:getController()
|
||||
DetectedUnitSet:ForEachUnit(
|
||||
--- @param Unit#UNIT DetectedUnit
|
||||
function( DetectedUnit, FACDCSUnit )
|
||||
FACDetection:E( DetectedUnit:GetDCSUnit() )
|
||||
FACDetection:E( FACDCSUnit )
|
||||
local JTAC = Spot.createInfraRed( FACDCSUnit, {x = 0, y = 2.0, z = 0}, DetectedUnit:GetPointVec3(), 1337)
|
||||
end, FACDCSUnit
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end, { FACGroup, FACDetection },
|
||||
30
|
||||
)
|
||||
|
||||
local LaseScheduler2 = SCHEDULER:New(nil,
|
||||
--- @param Group#GROUP FACGroup
|
||||
-- @param Detection#DETECTION_BASE FACDetection
|
||||
function( FACGroup, FACDetection )
|
||||
if FACDetection:GetDetectionUnitSetCount() > 0 then
|
||||
local DetectedUnitSet = FACDetection:GetDetectionUnitSet(1)
|
||||
if DetectedUnitSet then
|
||||
FACDetection:E( { "I have a unit set ", DetectedUnitSet } )
|
||||
local FACUnit = FACGroup:GetUnit(1)
|
||||
if FACUnit then
|
||||
FACDetection:E( FACUnit )
|
||||
local FACDCSUnit = FACUnit:GetDCSUnit()
|
||||
local FACUnitController = FACDCSUnit:getController()
|
||||
DetectedUnitSet:ForEachUnit(
|
||||
--- @param Unit#UNIT DetectedUnit
|
||||
function( DetectedUnit, FACDCSUnit )
|
||||
FACDetection:E( DetectedUnit:GetDCSUnit() )
|
||||
FACDetection:E( FACDCSUnit )
|
||||
local TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity
|
||||
= FACUnitController:isTargetDetected( DetectedUnit:GetDCSUnit(), Controller.Detection.IRST )
|
||||
FACDetection:E( { TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity } )
|
||||
end, FACDCSUnit
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end, { FACGroup, FACDetection },
|
||||
40
|
||||
)
|
||||
Binary file not shown.
@ -18,6 +18,7 @@ do
|
||||
:MenuSmoke()
|
||||
:MenuReportTargets( 60, 20 )
|
||||
:MenuResumeMission()
|
||||
:MenuROE()
|
||||
:MenuAssistedAttack()
|
||||
|
||||
local EscortGroupArtillery = SpawnEscortArtillery:ReSpawn(1)
|
||||
|
||||
Binary file not shown.
8
Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.lua
Normal file
8
Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.lua
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
local FACGroup = GROUP:FindByName( "FAC Group" )
|
||||
|
||||
local FACDetection = DETECTION_BASE:New( FACGroup, 1000, 250 )
|
||||
local FACClientSet = SET_CLIENT:New():FilterCoalitions( "blue" ):FilterStart()
|
||||
|
||||
local FACReporting = FAC_BASE:New( FACClientSet, FACDetection )
|
||||
BIN
Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz
Normal file
BIN
Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user