mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Updates Misc
This commit is contained in:
parent
df512f7a58
commit
7360c51a8f
@ -655,6 +655,28 @@ do -- COORDINATE
|
|||||||
return Angle
|
return Angle
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Return an intermediate COORDINATE between this an another coordinate.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #COORDINATE ToCoordinate The other coordinate.
|
||||||
|
-- @param #number Fraction The fraction (0,1) where the new coordinate is created. Default 0.5, i.e. in the middle.
|
||||||
|
-- @return #COORDINATE Coordinate between this and the other coordinate.
|
||||||
|
function COORDINATE:GetIntermediateCoordinate( ToCoordinate, Fraction )
|
||||||
|
|
||||||
|
local f=Fraction or 0.5
|
||||||
|
|
||||||
|
-- Get the vector from A to B
|
||||||
|
local vec=UTILS.VecSubstract(ToCoordinate, self)
|
||||||
|
|
||||||
|
-- Scale the vector.
|
||||||
|
vec.x=f*vec.x
|
||||||
|
vec.y=f*vec.y
|
||||||
|
vec.z=f*vec.z
|
||||||
|
|
||||||
|
-- Move the vector to start at the end of A.
|
||||||
|
vec=UTILS.VecAdd(self, vec)
|
||||||
|
|
||||||
|
return self:New(vec.x,vec.y,vec.z)
|
||||||
|
end
|
||||||
|
|
||||||
--- Return the 2D distance in meters between the target COORDINATE and the COORDINATE.
|
--- Return the 2D distance in meters between the target COORDINATE and the COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
|
|||||||
@ -113,18 +113,20 @@ end
|
|||||||
-- @param #number dt (Optional) Time step in seconds for checking the queue. Default 0.01 sec.
|
-- @param #number dt (Optional) Time step in seconds for checking the queue. Default 0.01 sec.
|
||||||
-- @return #RADIOQUEUE self The RADIOQUEUE object.
|
-- @return #RADIOQUEUE self The RADIOQUEUE object.
|
||||||
function RADIOQUEUE:Start(delay, dt)
|
function RADIOQUEUE:Start(delay, dt)
|
||||||
|
|
||||||
|
-- Delay before start.
|
||||||
self.delay=delay or 1
|
self.delay=delay or 1
|
||||||
|
|
||||||
|
-- Time interval for queue check.
|
||||||
self.dt=dt or 0.01
|
self.dt=dt or 0.01
|
||||||
|
|
||||||
|
-- Debug message.
|
||||||
self:I(self.lid..string.format("Starting RADIOQUEUE %s on Frequency %.2f MHz [modulation=%d] in %.1f seconds (dt=%.3f sec)", self.alias, self.frequency/1000000, self.modulation, delay, dt))
|
self:I(self.lid..string.format("Starting RADIOQUEUE %s on Frequency %.2f MHz [modulation=%d] in %.1f seconds (dt=%.3f sec)", self.alias, self.frequency/1000000, self.modulation, delay, dt))
|
||||||
|
|
||||||
|
-- Start Scheduler.
|
||||||
if self.schedonce then
|
if self.schedonce then
|
||||||
self:_CheckRadioQueueDelayed(self.delta)
|
self:_CheckRadioQueueDelayed(delay)
|
||||||
else
|
else
|
||||||
--self.RQid=self.scheduler:Schedule(self, self._CheckRadioQueue, {}, delay, dt)
|
|
||||||
self.RQid=self.scheduler:Schedule(nil, RADIOQUEUE._CheckRadioQueue, {self}, delay, dt)
|
self.RQid=self.scheduler:Schedule(nil, RADIOQUEUE._CheckRadioQueue, {self}, delay, dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -279,10 +281,6 @@ end
|
|||||||
-- @return #number Duration of the call in seconds.
|
-- @return #number Duration of the call in seconds.
|
||||||
function RADIOQUEUE:Number2Transmission(number, delay, interval)
|
function RADIOQUEUE:Number2Transmission(number, delay, interval)
|
||||||
|
|
||||||
if not number then
|
|
||||||
self:E("ERROR: Number is nil!")
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Split string into characters.
|
--- Split string into characters.
|
||||||
local function _split(str)
|
local function _split(str)
|
||||||
local chars={}
|
local chars={}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -326,9 +326,27 @@ end -- coalition
|
|||||||
do -- Types
|
do -- Types
|
||||||
|
|
||||||
--- @type Desc
|
--- @type Desc
|
||||||
-- @field #TypeName typeName type name
|
-- @field #number speedMax0 Max speed in meters/second at zero altitude.
|
||||||
-- @field #string displayName localized display name
|
-- @field #number massEmpty Empty mass in kg.
|
||||||
-- @field #table attributes object type attributes
|
-- @field #number tankerType Type of refueling system: 0=boom, 1=probe.
|
||||||
|
-- @field #number range Range in km(?).
|
||||||
|
-- @field #table box Bounding box.
|
||||||
|
-- @field #number Hmax Max height in meters.
|
||||||
|
-- @field #number Kmax ?
|
||||||
|
-- @field #number speedMax10K Max speed in meters/second at 10k altitude.
|
||||||
|
-- @field #number NyMin ?
|
||||||
|
-- @field #number NyMax ?
|
||||||
|
-- @field #number fuelMassMax Max fuel mass in kg.
|
||||||
|
-- @field #number speedMax10K Max speed in meters/second.
|
||||||
|
-- @field #number massMax Max mass of unit.
|
||||||
|
-- @field #number RCS ?
|
||||||
|
-- @field #number life Life points.
|
||||||
|
-- @field #number VyMax Max vertical velocity in m/s.
|
||||||
|
-- @field #number Kab ?
|
||||||
|
-- @field #table attributes Table of attributes.
|
||||||
|
-- @field #TypeName typeName Type Name.
|
||||||
|
-- @field #string displayName Localized display name.
|
||||||
|
-- @field #number category Unit category.
|
||||||
|
|
||||||
--- A distance type
|
--- A distance type
|
||||||
-- @type Distance
|
-- @type Distance
|
||||||
|
|||||||
@ -1,49 +1,163 @@
|
|||||||
--- **Utilities** Enumerators.
|
--- **Utilities** Enumerators.
|
||||||
--
|
--
|
||||||
-- See the [Simulator Scripting Engine Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation) on Hoggit for further explanation and examples.
|
-- An enumerator is a variable that holds a constant value. Enumerators are very useful because they make the code easier to read and to change in general.
|
||||||
--
|
--
|
||||||
-- @module DCS
|
-- For example, instead of using the same value at multiple different places in your code, you should use a variable set to that value.
|
||||||
|
-- If, for whatever reason, the value needs to be changed, you only have to change the variable once and do not have to search through you code and reset
|
||||||
|
-- every value by hand.
|
||||||
|
--
|
||||||
|
-- Another big advantage is that the LDT intellisense "knows" the enumerators. So you can use the autocompletion feature and do not have to keep all the
|
||||||
|
-- values in your head or look them up in the docs.
|
||||||
|
--
|
||||||
|
-- DCS itself provides a lot of enumerators for various things. See [Enumerators](https://wiki.hoggitworld.com/view/Category:Enumerators) on Hoggit.
|
||||||
|
--
|
||||||
|
-- Other Moose classe also have enumerators. For example, the AIRBASE class has enumerators for airbase names.
|
||||||
|
--
|
||||||
|
-- @module ENUMS
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
--- [DCS Enum world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
||||||
|
-- @type ENUMS
|
||||||
|
|
||||||
|
--- Because ENUMS are just better practice.
|
||||||
|
--
|
||||||
|
-- The ENUMS class adds some handy variables, which help you to make your code better and more general.
|
||||||
|
--
|
||||||
|
-- @field #ENUMS
|
||||||
ENUMS = {}
|
ENUMS = {}
|
||||||
|
|
||||||
|
--- Rules of Engagement.
|
||||||
|
-- @type ENUMS.ROE
|
||||||
|
-- @field #number WeaponFree AI will engage any enemy group it detects. Target prioritization is based based on the threat of the target.
|
||||||
|
-- @field #number OpenFireWeaponFree AI will engage any enemy group it detects, but will prioritize targets specified in the groups tasking.
|
||||||
|
-- @field #number OpenFire AI will engage only targets specified in its taskings.
|
||||||
|
-- @field #number ReturnFire AI will only engage threats that shoot first.
|
||||||
|
-- @field #number WeaponHold AI will hold fire under all circumstances.
|
||||||
ENUMS.ROE = {
|
ENUMS.ROE = {
|
||||||
HoldFire = 1,
|
WeaponFree=0,
|
||||||
ReturnFire = 2,
|
OpenFireWeaponFree=1,
|
||||||
OpenFire = 3,
|
OpenFire=2,
|
||||||
WeaponFree = 4
|
ReturnFire=3,
|
||||||
|
WeaponHold=4,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- Reaction On Threat.
|
||||||
|
-- @type ENUMS.ROT
|
||||||
|
-- @field #number NoReaction No defensive actions will take place to counter threats.
|
||||||
|
-- @field #number PassiveDefense AI will use jammers and other countermeasures in an attempt to defeat the threat. AI will not attempt a maneuver to defeat a threat.
|
||||||
|
-- @field #number EvadeFire AI will react by performing defensive maneuvers against incoming threats. AI will also use passive defense.
|
||||||
|
-- @field #number BypassAndEscape AI will attempt to avoid enemy threat zones all together. This includes attempting to fly above or around threats.
|
||||||
|
-- @field #number AllowAbortMission If a threat is deemed severe enough the AI will abort its mission and return to base.
|
||||||
ENUMS.ROT = {
|
ENUMS.ROT = {
|
||||||
NoReaction = 1,
|
NoReaction=0,
|
||||||
PassiveDefense = 2,
|
PassiveDefense=1,
|
||||||
EvadeFire = 3,
|
EvadeFire=2,
|
||||||
Vertical = 4
|
BypassAndEscape=3,
|
||||||
|
AllowAbortMission=4,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- Weapon types. See the [Weapon Flag](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag) enumerotor on hoggit wiki.
|
||||||
|
-- @type ENUMS.WeaponFlag
|
||||||
ENUMS.WeaponFlag={
|
ENUMS.WeaponFlag={
|
||||||
-- Auto
|
|
||||||
Auto=1073741822,
|
|
||||||
-- Bombs
|
-- Bombs
|
||||||
LGB=2,
|
LGB = 2,
|
||||||
TvGB=4,
|
TvGB = 4,
|
||||||
SNSGB=8,
|
SNSGB = 8,
|
||||||
HEBomb=16,
|
HEBomb = 16,
|
||||||
Penetrator=32,
|
Penetrator = 32,
|
||||||
NapalmBomb=64,
|
NapalmBomb = 64,
|
||||||
FAEBomb=128,
|
FAEBomb = 128,
|
||||||
ClusterBomb=256,
|
ClusterBomb = 256,
|
||||||
Dispencer=512,
|
Dispencer = 512,
|
||||||
CandleBomb=1024,
|
CandleBomb = 1024,
|
||||||
ParachuteBomb=2147483648,
|
ParachuteBomb = 2147483648,
|
||||||
GuidedBomb=14, -- (LGB + TvGB + SNSGB)
|
|
||||||
AnyUnguidedBomb=2147485680, -- (HeBomb + Penetrator + NapalmBomb + FAEBomb + ClusterBomb + Dispencer + CandleBomb + ParachuteBomb)
|
|
||||||
AnyBomb=2147485694, -- (GuidedBomb + AnyUnguidedBomb)
|
|
||||||
-- Rockets
|
-- Rockets
|
||||||
LightRocket=2048,
|
LightRocket = 2048,
|
||||||
MarkerRocket=4096,
|
MarkerRocket = 4096,
|
||||||
CandleRocket=8192,
|
CandleRocket = 8192,
|
||||||
HeavyRocket=16384,
|
HeavyRocket = 16384,
|
||||||
AnyRocket=30720 -- (LightRocket + MarkerRocket + CandleRocket + HeavyRocket)
|
-- Air-To-Surface Missiles
|
||||||
|
AntiRadarMissile = 32768,
|
||||||
|
AntiShipMissile = 65536,
|
||||||
|
AntiTankMissile = 131072,
|
||||||
|
FireAndForgetASM = 262144,
|
||||||
|
LaserASM = 524288,
|
||||||
|
TeleASM = 1048576,
|
||||||
|
CruiseMissile = 2097152,
|
||||||
|
AntiRadarMissile2 = 1073741824,
|
||||||
|
-- Air-To-Air Missiles
|
||||||
|
SRAM = 4194304,
|
||||||
|
MRAAM = 8388608,
|
||||||
|
LRAAM = 16777216,
|
||||||
|
IR_AAM = 33554432,
|
||||||
|
SAR_AAM = 67108864,
|
||||||
|
AR_AAM = 134217728,
|
||||||
|
--- Guns
|
||||||
|
GunPod = 268435456,
|
||||||
|
BuiltInCannon = 536870912,
|
||||||
|
---
|
||||||
|
-- Combinations
|
||||||
|
--
|
||||||
|
-- Bombs
|
||||||
|
GuidedBomb = 14, -- (LGB + TvGB + SNSGB)
|
||||||
|
AnyUnguidedBomb = 2147485680, -- (HeBomb + Penetrator + NapalmBomb + FAEBomb + ClusterBomb + Dispencer + CandleBomb + ParachuteBomb)
|
||||||
|
AnyBomb = 2147485694, -- (GuidedBomb + AnyUnguidedBomb)
|
||||||
|
--- Rockets
|
||||||
|
AnyRocket = 30720, -- LightRocket + MarkerRocket + CandleRocket + HeavyRocket
|
||||||
|
--- Air-To-Surface Missiles
|
||||||
|
GuidedASM = 1572864, -- (LaserASM + TeleASM)
|
||||||
|
TacticalASM = 1835008, -- (GuidedASM + FireAndForgetASM)
|
||||||
|
AnyASM = 4161536, -- (AntiRadarMissile + AntiShipMissile + AntiTankMissile + FireAndForgetASM + GuidedASM + CruiseMissile)
|
||||||
|
AnyASM2 = 1077903360, -- 4161536+1073741824,
|
||||||
|
--- Air-To-Air Missiles
|
||||||
|
AnyAAM = 264241152, -- IR_AAM + SAR_AAM + AR_AAM + SRAAM + MRAAM + LRAAM
|
||||||
|
AnyAutonomousMissile = 36012032, -- IR_AAM + AntiRadarMissile + AntiShipMissile + FireAndForgetASM + CruiseMissile
|
||||||
|
AnyMissile = 268402688, -- AnyASM + AnyAAM
|
||||||
|
--- Guns
|
||||||
|
Cannons = 805306368, -- GUN_POD + BuiltInCannon
|
||||||
|
---
|
||||||
|
-- Even More Genral
|
||||||
|
Auto = 3221225470, -- Any Weapon (AnyBomb + AnyRocket + AnyMissile + Cannons)
|
||||||
|
AutoDCS = 1073741822, -- Something if often see
|
||||||
|
AnyAG = 2956984318, -- Any Air-To-Ground Weapon
|
||||||
|
AnyAA = 264241152, -- Any Air-To-Air Weapon
|
||||||
|
AnyUnguided = 2952822768, -- Any Unguided Weapon
|
||||||
|
AnyGuided = 268402702, -- Any Guided Weapon
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Mission tasks.
|
||||||
|
-- @type ENUMS.MissionTask
|
||||||
|
-- @field #string NOTHING No special task. Group can perform the minimal tasks: Orbit, Refuelling, Follow and Aerobatics.
|
||||||
|
-- @field #string AFAC Forward Air Controller Air. Can perform the tasks: Attack Group, Attack Unit, FAC assign group, Bombing, Attack Map Object.
|
||||||
|
-- @field #string ANTISHIPSTRIKE Naval ops. Can perform the tasks: Attack Group, Attack Unit.
|
||||||
|
-- @field #string AWACS AWACS.
|
||||||
|
-- @field #string CAP Combat Air Patrol.
|
||||||
|
-- @field #string CAS Close Air Support.
|
||||||
|
-- @field #string ESCORT Escort another group.
|
||||||
|
-- @field #string FIGHTERSWEEP Fighter sweep.
|
||||||
|
-- @field #string GROUNDATTACK Ground attack.
|
||||||
|
-- @field #string INTERCEPT Intercept.
|
||||||
|
-- @field #string PINPOINTSTRIKE Pinpoint strike.
|
||||||
|
-- @field #string RECONNAISSANCE Reconnaissance mission.
|
||||||
|
-- @field #string REFUELING Refueling mission.
|
||||||
|
-- @field #string RUNWAYATTACK Attack the runway of an airdrome.
|
||||||
|
-- @field #string SEAD Suppression of Enemy Air Defenses.
|
||||||
|
-- @field #string TRANSPORT Troop transport.
|
||||||
|
ENUMS.MissionTask={
|
||||||
|
NOTHING="Nothing",
|
||||||
|
AFAC="AFAC",
|
||||||
|
ANTISHIPSTRIKE="Antiship Strike",
|
||||||
|
AWACS="AWACS",
|
||||||
|
CAP="CAP",
|
||||||
|
CAS="CAS",
|
||||||
|
ESCORT="Escort",
|
||||||
|
FIGHTERSWEEP="Fighter Sweep",
|
||||||
|
GROUNDATTACK="Ground Attack",
|
||||||
|
INTERCEPT="Intercept",
|
||||||
|
PINPOINTSTRIKE="Pinpoint Strike",
|
||||||
|
RECONNAISSANCE="Reconnaissance",
|
||||||
|
REFUELING="Refueling",
|
||||||
|
RUNWAYATTACK="Runway Attack",
|
||||||
|
SEAD="SEAD",
|
||||||
|
TRANSPORT="Transport",
|
||||||
}
|
}
|
||||||
@ -312,7 +312,6 @@ function CONTROLLABLE:ClearTasks()
|
|||||||
|
|
||||||
if DCSControllable then
|
if DCSControllable then
|
||||||
local Controller = self:_GetController()
|
local Controller = self:_GetController()
|
||||||
env.info("FF clearing tasks!")
|
|
||||||
Controller:resetTask()
|
Controller:resetTask()
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -450,7 +449,6 @@ end
|
|||||||
-- @param #number lastWayPoint Last waypoint.
|
-- @param #number lastWayPoint Last waypoint.
|
||||||
-- return DCS#Task
|
-- return DCS#Task
|
||||||
function CONTROLLABLE:TaskCondition( time, userFlag, userFlagValue, condition, duration, lastWayPoint )
|
function CONTROLLABLE:TaskCondition( time, userFlag, userFlagValue, condition, duration, lastWayPoint )
|
||||||
self:F2( { time, userFlag, userFlagValue, condition, duration, lastWayPoint } )
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
StopCondition = {
|
StopCondition = {
|
||||||
@ -471,7 +469,6 @@ function CONTROLLABLE:TaskCondition( time, userFlag, userFlagValue, condition, d
|
|||||||
DCSStopCondition.duration = duration
|
DCSStopCondition.duration = duration
|
||||||
DCSStopCondition.lastWayPoint = lastWayPoint
|
DCSStopCondition.lastWayPoint = lastWayPoint
|
||||||
|
|
||||||
self:T3( { DCSStopCondition } )
|
|
||||||
return DCSStopCondition
|
return DCSStopCondition
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -481,11 +478,8 @@ end
|
|||||||
-- @param DCS#DCSStopCondition DCSStopCondition
|
-- @param DCS#DCSStopCondition DCSStopCondition
|
||||||
-- @return DCS#Task
|
-- @return DCS#Task
|
||||||
function CONTROLLABLE:TaskControlled( DCSTask, DCSStopCondition )
|
function CONTROLLABLE:TaskControlled( DCSTask, DCSStopCondition )
|
||||||
self:F2( { DCSTask, DCSStopCondition } )
|
|
||||||
|
|
||||||
local DCSTaskControlled
|
local DCSTaskControlled = {
|
||||||
|
|
||||||
DCSTaskControlled = {
|
|
||||||
id = 'ControlledTask',
|
id = 'ControlledTask',
|
||||||
params = {
|
params = {
|
||||||
task = DCSTask,
|
task = DCSTask,
|
||||||
@ -493,7 +487,6 @@ function CONTROLLABLE:TaskControlled( DCSTask, DCSStopCondition )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTaskControlled } )
|
|
||||||
return DCSTaskControlled
|
return DCSTaskControlled
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -502,22 +495,14 @@ end
|
|||||||
-- @param DCS#TaskArray DCSTasks Array of @{DCSTasking.Task#Task}
|
-- @param DCS#TaskArray DCSTasks Array of @{DCSTasking.Task#Task}
|
||||||
-- @return DCS#Task
|
-- @return DCS#Task
|
||||||
function CONTROLLABLE:TaskCombo( DCSTasks )
|
function CONTROLLABLE:TaskCombo( DCSTasks )
|
||||||
self:F2( { DCSTasks } )
|
|
||||||
|
|
||||||
local DCSTaskCombo
|
local DCSTaskCombo = {
|
||||||
|
|
||||||
DCSTaskCombo = {
|
|
||||||
id = 'ComboTask',
|
id = 'ComboTask',
|
||||||
params = {
|
params = {
|
||||||
tasks = DCSTasks
|
tasks = DCSTasks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for TaskID, Task in ipairs( DCSTasks ) do
|
|
||||||
self:T( Task )
|
|
||||||
end
|
|
||||||
|
|
||||||
self:T3( { DCSTaskCombo } )
|
|
||||||
return DCSTaskCombo
|
return DCSTaskCombo
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -526,11 +511,8 @@ end
|
|||||||
-- @param DCS#Command DCSCommand
|
-- @param DCS#Command DCSCommand
|
||||||
-- @return DCS#Task
|
-- @return DCS#Task
|
||||||
function CONTROLLABLE:TaskWrappedAction( DCSCommand, Index )
|
function CONTROLLABLE:TaskWrappedAction( DCSCommand, Index )
|
||||||
self:F2( { DCSCommand } )
|
|
||||||
|
|
||||||
local DCSTaskWrappedAction
|
local DCSTaskWrappedAction = {
|
||||||
|
|
||||||
DCSTaskWrappedAction = {
|
|
||||||
id = "WrappedAction",
|
id = "WrappedAction",
|
||||||
enabled = true,
|
enabled = true,
|
||||||
number = Index or 1,
|
number = Index or 1,
|
||||||
@ -540,7 +522,6 @@ function CONTROLLABLE:TaskWrappedAction( DCSCommand, Index )
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTaskWrappedAction } )
|
|
||||||
return DCSTaskWrappedAction
|
return DCSTaskWrappedAction
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -703,7 +684,6 @@ end
|
|||||||
-- @param #number Delay (Optional) Delay in seconds before the ICLS is deactivated.
|
-- @param #number Delay (Optional) Delay in seconds before the ICLS is deactivated.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:CommandActivateICLS(Channel, UnitID, Callsign, Delay)
|
function CONTROLLABLE:CommandActivateICLS(Channel, UnitID, Callsign, Delay)
|
||||||
self:F()
|
|
||||||
|
|
||||||
-- Command to activate ICLS system.
|
-- Command to activate ICLS system.
|
||||||
local CommandActivateICLS= {
|
local CommandActivateICLS= {
|
||||||
@ -731,7 +711,6 @@ end
|
|||||||
-- @param #number Delay (Optional) Delay in seconds before the beacon is deactivated.
|
-- @param #number Delay (Optional) Delay in seconds before the beacon is deactivated.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:CommandDeactivateBeacon(Delay)
|
function CONTROLLABLE:CommandDeactivateBeacon(Delay)
|
||||||
self:F()
|
|
||||||
|
|
||||||
-- Command to deactivate
|
-- Command to deactivate
|
||||||
local CommandDeactivateBeacon={id='DeactivateBeacon', params={}}
|
local CommandDeactivateBeacon={id='DeactivateBeacon', params={}}
|
||||||
@ -750,7 +729,6 @@ end
|
|||||||
-- @param #number Delay (Optional) Delay in seconds before the ICLS is deactivated.
|
-- @param #number Delay (Optional) Delay in seconds before the ICLS is deactivated.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:CommandDeactivateICLS(Delay)
|
function CONTROLLABLE:CommandDeactivateICLS(Delay)
|
||||||
self:F()
|
|
||||||
|
|
||||||
-- Command to deactivate
|
-- Command to deactivate
|
||||||
local CommandDeactivateICLS={id='DeactivateICLS', params={}}
|
local CommandDeactivateICLS={id='DeactivateICLS', params={}}
|
||||||
@ -771,7 +749,6 @@ end
|
|||||||
-- @param #number Delay (Optional) Delay in seconds before the callsign is set. Default is immediately.
|
-- @param #number Delay (Optional) Delay in seconds before the callsign is set. Default is immediately.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:CommandSetCallsign(CallName, CallNumber, Delay)
|
function CONTROLLABLE:CommandSetCallsign(CallName, CallNumber, Delay)
|
||||||
self:F()
|
|
||||||
|
|
||||||
-- Command to set the callsign.
|
-- Command to set the callsign.
|
||||||
local CommandSetCallsign={id='SetCallsign', params={callname=CallName, callnumber=CallNumber or 1}}
|
local CommandSetCallsign={id='SetCallsign', params={callname=CallName, callnumber=CallNumber or 1}}
|
||||||
@ -791,28 +768,56 @@ end
|
|||||||
-- @param #number Delay (Optional) Delay in seconds before the callsign is set. Default is immediately.
|
-- @param #number Delay (Optional) Delay in seconds before the callsign is set. Default is immediately.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:CommandEPLRS(SwitchOnOff, Delay)
|
function CONTROLLABLE:CommandEPLRS(SwitchOnOff, Delay)
|
||||||
self:F()
|
|
||||||
|
|
||||||
if SwitchOnOff==nil then
|
if SwitchOnOff==nil then
|
||||||
SwitchOnOff=true
|
SwitchOnOff=true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ID
|
|
||||||
local _id=self:GetID()
|
|
||||||
|
|
||||||
-- Command to set the callsign.
|
-- Command to set the callsign.
|
||||||
local CommandEPLRS={id='EPLRS', params={value=SwitchOnOff, groupId=_id}}
|
local CommandEPLRS={
|
||||||
|
id='EPLRS',
|
||||||
|
params={
|
||||||
|
value=SwitchOnOff,
|
||||||
|
groupId=self:GetID()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
SCHEDULER:New(nil, self.CommandEPLRS, {self, SwitchOnOff}, Delay)
|
SCHEDULER:New(nil, self.CommandEPLRS, {self, SwitchOnOff}, Delay)
|
||||||
else
|
else
|
||||||
self:T(string.format("EPLRS=%s for controllable %s (id=%s)", tostring(SwitchOnOff), tostring(self:GetName()), tostring(_id)))
|
self:T(string.format("EPLRS=%s for controllable %s (id=%s)", tostring(SwitchOnOff), tostring(self:GetName()), tostring(self:GetID())))
|
||||||
self:SetCommand(CommandEPLRS)
|
self:SetCommand(CommandEPLRS)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set radio frequency. See [DCS command EPLRS](https://wiki.hoggitworld.com/view/DCS_command_setFrequency)
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number Frequency Radio frequency in MHz.
|
||||||
|
-- @param #number Modulation Radio modulation. Default `radio.modulation.AM`.
|
||||||
|
-- @param #number Delay (Optional) Delay in seconds before the frequncy is set. Default is immediately.
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:CommandSetFrequency(Frequency, Modulation, Delay)
|
||||||
|
|
||||||
|
local CommandSetFrequency = {
|
||||||
|
id = 'SetFrequency',
|
||||||
|
params = {
|
||||||
|
frequency = Frequency,
|
||||||
|
modulation = Modulation or radio.modulation.AM,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if Delay and Delay>0 then
|
||||||
|
SCHEDULER:New(nil, self.CommandSetFrequency, {self, Frequency, Modulation}, Delay)
|
||||||
|
else
|
||||||
|
self:SetCommand(CommandSetFrequency)
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set EPLRS data link on/off.
|
--- Set EPLRS data link on/off.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param #boolean SwitchOnOff If true (or nil) switch EPLRS on. If false switch off.
|
-- @param #boolean SwitchOnOff If true (or nil) switch EPLRS on. If false switch off.
|
||||||
@ -820,14 +825,20 @@ end
|
|||||||
-- @return #table Task wrapped action.
|
-- @return #table Task wrapped action.
|
||||||
function CONTROLLABLE:TaskEPLRS(SwitchOnOff, idx)
|
function CONTROLLABLE:TaskEPLRS(SwitchOnOff, idx)
|
||||||
|
|
||||||
-- ID
|
if SwitchOnOff==nil then
|
||||||
local _id=self:GetID()
|
SwitchOnOff=true
|
||||||
|
end
|
||||||
|
|
||||||
-- Command to set the callsign.
|
-- Command to set the callsign.
|
||||||
local CommandEPLRS={id='EPLRS', params={value=SwitchOnOff, groupId=_id}}
|
local CommandEPLRS={
|
||||||
|
id='EPLRS',
|
||||||
|
params={
|
||||||
|
value=SwitchOnOff,
|
||||||
|
groupId=self:GetID()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return self:TaskWrappedAction(CommandEPLRS, idx or 1)
|
return self:TaskWrappedAction(CommandEPLRS, idx or 1)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -835,16 +846,17 @@ end
|
|||||||
|
|
||||||
--- (AIR) Attack a Controllable.
|
--- (AIR) Attack a Controllable.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE AttackGroup The Controllable to be attacked.
|
-- @param Wrapper.Group#GROUP AttackGroup The Group to be attacked.
|
||||||
-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
|
-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
|
||||||
-- @param DCS#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
-- @param DCS#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
||||||
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
|
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
|
||||||
-- @param DCS#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
|
-- @param DCS#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
|
||||||
-- @param DCS#Distance Altitude (optional) Desired attack start altitude. Controllable/aircraft will make its attacks from the altitude. If the altitude is too low or too high to use weapon aircraft/controllable will choose closest altitude to the desired attack start altitude. If the desired altitude is defined controllable/aircraft will not attack from safe altitude.
|
-- @param DCS#Distance Altitude (optional) Desired attack start altitude. Controllable/aircraft will make its attacks from the altitude. If the altitude is too low or too high to use weapon aircraft/controllable will choose closest altitude to the desired attack start altitude. If the desired altitude is defined controllable/aircraft will not attack from safe altitude.
|
||||||
-- @param #boolean AttackQtyLimit (optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
|
-- @param #boolean AttackQtyLimit (optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
|
||||||
|
-- @param #boolean GroupAttack (Optional) If true, attack as group.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit )
|
function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit, GroupAttack )
|
||||||
self:F2( { self.ControllableName, AttackGroup, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit } )
|
--self:F2( { self.ControllableName, AttackGroup, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit } )
|
||||||
|
|
||||||
-- AttackGroup = {
|
-- AttackGroup = {
|
||||||
-- id = 'AttackGroup',
|
-- id = 'AttackGroup',
|
||||||
@ -868,15 +880,15 @@ function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, At
|
|||||||
weaponType = WeaponType or 1073741822,
|
weaponType = WeaponType or 1073741822,
|
||||||
expend = WeaponExpend or "Auto",
|
expend = WeaponExpend or "Auto",
|
||||||
attackQtyLimit = AttackQty and true or false,
|
attackQtyLimit = AttackQty and true or false,
|
||||||
attackQty = AttackQty,
|
attackQty = AttackQty or 1,
|
||||||
directionEnabled = Direction and true or false,
|
directionEnabled = Direction and true or false,
|
||||||
direction = Direction and math.rad(Direction) or nil,
|
direction = Direction and math.rad(Direction) or 0,
|
||||||
altitudeEnabled = Altitude and true or false,
|
altitudeEnabled = Altitude and true or false,
|
||||||
altitude = Altitude,
|
altitude = Altitude,
|
||||||
|
groupAttack = GroupAttack and true or false,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -891,17 +903,15 @@ end
|
|||||||
-- @param #number WeaponType (optional) The WeaponType. See [DCS Enumerator Weapon Type](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag) on Hoggit.
|
-- @param #number WeaponType (optional) The WeaponType. See [DCS Enumerator Weapon Type](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag) on Hoggit.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskAttackUnit(AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType)
|
function CONTROLLABLE:TaskAttackUnit(AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType)
|
||||||
self:F2({self.ControllableName, AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType})
|
|
||||||
|
|
||||||
local DCSTask
|
local DCSTask = {
|
||||||
DCSTask = {
|
|
||||||
id = 'AttackUnit',
|
id = 'AttackUnit',
|
||||||
params = {
|
params = {
|
||||||
unitId = AttackUnit:GetID(),
|
unitId = AttackUnit:GetID(),
|
||||||
groupAttack = GroupAttack and GroupAttack or false,
|
groupAttack = GroupAttack and GroupAttack or false,
|
||||||
expend = WeaponExpend or "Auto",
|
expend = WeaponExpend or "Auto",
|
||||||
directionEnabled = Direction and true or false,
|
directionEnabled = Direction and true or false,
|
||||||
direction = Direction and math.rad(Direction) or nil,
|
direction = Direction and math.rad(Direction) or 0,
|
||||||
altitudeEnabled = Altitude and true or false,
|
altitudeEnabled = Altitude and true or false,
|
||||||
altitude = Altitude,
|
altitude = Altitude,
|
||||||
attackQtyLimit = AttackQty and true or false,
|
attackQtyLimit = AttackQty and true or false,
|
||||||
@ -909,9 +919,7 @@ function CONTROLLABLE:TaskAttackUnit(AttackUnit, GroupAttack, WeaponExpend, Atta
|
|||||||
weaponType = WeaponType or 1073741822,
|
weaponType = WeaponType or 1073741822,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( DCSTask )
|
|
||||||
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -928,16 +936,8 @@ end
|
|||||||
-- @param #boolean Divebomb (optional) Perform dive bombing. Default false.
|
-- @param #boolean Divebomb (optional) Perform dive bombing. Default false.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskBombing( Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType, Divebomb )
|
function CONTROLLABLE:TaskBombing( Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType, Divebomb )
|
||||||
self:F( { self.ControllableName, Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType, Divebomb } )
|
|
||||||
|
|
||||||
local _attacktype=nil
|
local DCSTask = {
|
||||||
if Divebomb then
|
|
||||||
_attacktype="Dive"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local DCSTask
|
|
||||||
DCSTask = {
|
|
||||||
id = 'Bombing',
|
id = 'Bombing',
|
||||||
params = {
|
params = {
|
||||||
point = Vec2,
|
point = Vec2,
|
||||||
@ -946,17 +946,16 @@ function CONTROLLABLE:TaskBombing( Vec2, GroupAttack, WeaponExpend, AttackQty, D
|
|||||||
groupAttack = GroupAttack and GroupAttack or false,
|
groupAttack = GroupAttack and GroupAttack or false,
|
||||||
expend = WeaponExpend or "Auto",
|
expend = WeaponExpend or "Auto",
|
||||||
attackQtyLimit = AttackQty and true or false,
|
attackQtyLimit = AttackQty and true or false,
|
||||||
attackQty = AttackQty,
|
attackQty = AttackQty or 1,
|
||||||
directionEnabled = Direction and true or false,
|
directionEnabled = Direction and true or false,
|
||||||
direction = Direction and math.rad(Direction) or nil,
|
direction = Direction and math.rad(Direction) or 0,
|
||||||
altitudeEnabled = Altitude and true or false,
|
altitudeEnabled = Altitude and true or false,
|
||||||
altitude = Altitude,
|
altitude = Altitude or 2000,
|
||||||
weaponType = WeaponType or 1073741822,
|
weaponType = WeaponType or 1073741822,
|
||||||
attackType = _attacktype,
|
attackType = Divebomb and "Dive" or nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
self:F( { TaskBombing=DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -971,10 +970,8 @@ end
|
|||||||
-- @param #number WeaponType (Optional) The WeaponType. Default Auto=1073741822.
|
-- @param #number WeaponType (Optional) The WeaponType. Default Auto=1073741822.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskAttackMapObject( Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType )
|
function CONTROLLABLE:TaskAttackMapObject( Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType )
|
||||||
self:F2( { self.ControllableName, Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType } )
|
|
||||||
|
|
||||||
local DCSTask
|
local DCSTask = {
|
||||||
DCSTask = {
|
|
||||||
id = 'AttackMapObject',
|
id = 'AttackMapObject',
|
||||||
params = {
|
params = {
|
||||||
point = Vec2,
|
point = Vec2,
|
||||||
@ -985,14 +982,13 @@ function CONTROLLABLE:TaskAttackMapObject( Vec2, GroupAttack, WeaponExpend, Atta
|
|||||||
attackQtyLimit = AttackQty and true or false,
|
attackQtyLimit = AttackQty and true or false,
|
||||||
attackQty = AttackQty,
|
attackQty = AttackQty,
|
||||||
directionEnabled = Direction and true or false,
|
directionEnabled = Direction and true or false,
|
||||||
direction = Direction,
|
direction = Direction and math.rad(Direction) or 0,
|
||||||
altitudeEnabled = Altitude and true or false,
|
altitudeEnabled = Altitude and true or false,
|
||||||
altitude = Altitude,
|
altitude = Altitude,
|
||||||
weaponType = WeaponType or 1073741822,
|
weaponType = WeaponType or 1073741822,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1009,7 +1005,6 @@ end
|
|||||||
-- @param #number CarpetLength (optional) default to 500 m.
|
-- @param #number CarpetLength (optional) default to 500 m.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskCarpetBombing(Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType, CarpetLength)
|
function CONTROLLABLE:TaskCarpetBombing(Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType, CarpetLength)
|
||||||
self:F2( { self.ControllableName, Vec2, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType, CarpetLength } )
|
|
||||||
|
|
||||||
-- Build Task Structure
|
-- Build Task Structure
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
@ -1026,7 +1021,7 @@ function CONTROLLABLE:TaskCarpetBombing(Vec2, GroupAttack, WeaponExpend, AttackQ
|
|||||||
attackQtyLimit = AttackQty and true or false,
|
attackQtyLimit = AttackQty and true or false,
|
||||||
attackQty = AttackQty,
|
attackQty = AttackQty,
|
||||||
directionEnabled = Direction and true or false,
|
directionEnabled = Direction and true or false,
|
||||||
direction = Direction and math.rad(Direction) or nil,
|
direction = Direction and math.rad(Direction) or 0,
|
||||||
altitudeEnabled = Altitude and true or false,
|
altitudeEnabled = Altitude and true or false,
|
||||||
altitude = Altitude,
|
altitude = Altitude,
|
||||||
}
|
}
|
||||||
@ -1064,9 +1059,9 @@ end
|
|||||||
--- (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable.
|
--- (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param DCS#Vec2 Vec2 The point where to wait. Needs to have x and y components.
|
-- @param DCS#Vec2 Vec2 The point where to wait. Needs to have x and y components.
|
||||||
-- @param Core.Set#SET_GROUP GroupSetForEmparking Set of groups to embark.
|
-- @param Core.Set#SET_GROUP GroupSetForEmbarking Set of groups to embark.
|
||||||
-- @param #number Duration (Optional) The maximum duration in seconds to wait until all groups have embarked.
|
-- @param #number Duration (Optional) The maximum duration in seconds to wait until all groups have embarked.
|
||||||
-- @param Core.Set#SET_GROUP (Optional) DistributionGroupSet Set of groups identifying the groups needing to board specific helicopters.
|
-- @param Core.Set#SET_GROUP DistributionGroupSet (Optional) Set of groups identifying the groups needing to board specific helicopters.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, DistributionGroupSet)
|
function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, DistributionGroupSet)
|
||||||
|
|
||||||
@ -1107,7 +1102,6 @@ function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1218,7 +1212,6 @@ end
|
|||||||
-- @param #boolean GroupAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a group and not to a single aircraft.
|
-- @param #boolean GroupAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a group and not to a single aircraft.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskBombingRunway(Airbase, WeaponType, WeaponExpend, AttackQty, Direction, GroupAttack)
|
function CONTROLLABLE:TaskBombingRunway(Airbase, WeaponType, WeaponExpend, AttackQty, Direction, GroupAttack)
|
||||||
self:F2( { self.ControllableName, Airbase, WeaponType, WeaponExpend, AttackQty, Direction, GroupAttack } )
|
|
||||||
|
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
id = 'BombingRunway',
|
id = 'BombingRunway',
|
||||||
@ -1227,8 +1220,8 @@ function CONTROLLABLE:TaskBombingRunway(Airbase, WeaponType, WeaponExpend, Attac
|
|||||||
weaponType = WeaponType or ENUMS.WeaponFlag.AnyBomb,
|
weaponType = WeaponType or ENUMS.WeaponFlag.AnyBomb,
|
||||||
expend = WeaponExpend or AI.Task.WeaponExpend.ALL,
|
expend = WeaponExpend or AI.Task.WeaponExpend.ALL,
|
||||||
attackQty = AttackQty or 1,
|
attackQty = AttackQty or 1,
|
||||||
direction = Direction and math.rad(Direction) or nil,
|
direction = Direction and math.rad(Direction) or 0,
|
||||||
groupAttack = GroupAttack and GroupAttack or false,
|
groupAttack = GroupAttack and true or false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1241,7 +1234,10 @@ end
|
|||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskRefueling()
|
function CONTROLLABLE:TaskRefueling()
|
||||||
|
|
||||||
local DCSTask={id='Refueling', params={}}
|
local DCSTask={
|
||||||
|
id='Refueling',
|
||||||
|
params={}
|
||||||
|
}
|
||||||
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
@ -1249,7 +1245,7 @@ end
|
|||||||
|
|
||||||
--- (AIR HELICOPTER) Landing at the ground. For helicopters only.
|
--- (AIR HELICOPTER) Landing at the ground. For helicopters only.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param DCS#Vec2 Point The point where to land.
|
-- @param DCS#Vec2 Vec2 The point where to land.
|
||||||
-- @param #number Duration The duration in seconds to stay on the ground.
|
-- @param #number Duration The duration in seconds to stay on the ground.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:TaskLandAtVec2(Vec2, Duration)
|
function CONTROLLABLE:TaskLandAtVec2(Vec2, Duration)
|
||||||
@ -1262,6 +1258,7 @@ function CONTROLLABLE:TaskLandAtVec2(Vec2, Duration)
|
|||||||
duration = Duration,
|
duration = Duration,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1271,18 +1268,12 @@ end
|
|||||||
-- @param #number Duration The duration in seconds to stay on the ground.
|
-- @param #number Duration The duration in seconds to stay on the ground.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:TaskLandAtZone( Zone, Duration, RandomPoint )
|
function CONTROLLABLE:TaskLandAtZone( Zone, Duration, RandomPoint )
|
||||||
self:F2( { self.ControllableName, Zone, Duration, RandomPoint } )
|
|
||||||
|
|
||||||
local Point
|
-- Get landing point
|
||||||
if RandomPoint then
|
local Point=RandomPoint and Zone:GetRandomVec2() or Zone:GetVec2()
|
||||||
Point = Zone:GetRandomVec2()
|
|
||||||
else
|
|
||||||
Point = Zone:GetVec2()
|
|
||||||
end
|
|
||||||
|
|
||||||
local DCSTask = self:TaskLandAtVec2( Point, Duration )
|
local DCSTask = CONTROLLABLE.TaskLandAtVec2( self, Point, Duration )
|
||||||
|
|
||||||
self:T3( DCSTask )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1343,7 +1334,6 @@ end
|
|||||||
-- @param DCS#AttributeNameArray TargetTypes Array of AttributeName that is contains threat categories allowed to engage. Default {"Air"}.
|
-- @param DCS#AttributeNameArray TargetTypes Array of AttributeName that is contains threat categories allowed to engage. Default {"Air"}.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes )
|
function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes )
|
||||||
self:F2( { self.ControllableName, FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes } )
|
|
||||||
|
|
||||||
-- Escort = {
|
-- Escort = {
|
||||||
-- id = 'Escort',
|
-- id = 'Escort',
|
||||||
@ -1368,9 +1358,8 @@ function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, E
|
|||||||
engagementDistMax = EngagementDistance,
|
engagementDistMax = EngagementDistance,
|
||||||
targetTypes = TargetTypes or {"Air"},
|
targetTypes = TargetTypes or {"Air"},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1385,7 +1374,6 @@ end
|
|||||||
-- @param #number WeaponType (optional) Enum for weapon type ID. This value is only required if you want the group firing to use a specific weapon, for instance using the task on a ship to force it to fire guided missiles at targets within cannon range. See http://wiki.hoggit.us/view/DCS_enum_weapon_flag
|
-- @param #number WeaponType (optional) Enum for weapon type ID. This value is only required if you want the group firing to use a specific weapon, for instance using the task on a ship to force it to fire guided missiles at targets within cannon range. See http://wiki.hoggit.us/view/DCS_enum_weapon_flag
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType )
|
function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType )
|
||||||
self:F2( { self.ControllableName, Vec2, Radius, AmmoCount, WeaponType } )
|
|
||||||
|
|
||||||
-- FireAtPoint = {
|
-- FireAtPoint = {
|
||||||
-- id = 'FireAtPoint',
|
-- id = 'FireAtPoint',
|
||||||
@ -1397,13 +1385,12 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType )
|
|||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
|
|
||||||
local DCSTask
|
local DCSTask = {
|
||||||
DCSTask = {
|
|
||||||
id = 'FireAtPoint',
|
id = 'FireAtPoint',
|
||||||
params = {
|
params = {
|
||||||
point = Vec2,
|
point = Vec2,
|
||||||
zoneRadius = Radius,
|
zoneRadius = Radius,
|
||||||
expendQty = 100, -- dummy value
|
expendQty = 100, -- dummy value
|
||||||
expendQtyEnabled = false,
|
expendQtyEnabled = false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1436,13 +1423,16 @@ end
|
|||||||
-- The killer is player-controlled allied CAS-aircraft that is in contact with the FAC.
|
-- The killer is player-controlled allied CAS-aircraft that is in contact with the FAC.
|
||||||
-- If the task is assigned to the controllable lead unit will be a FAC.
|
-- If the task is assigned to the controllable lead unit will be a FAC.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE AttackGroup Target CONTROLLABLE.
|
-- @param Wrapper.Group#GROUP AttackGroup Target GROUP object.
|
||||||
-- @param #number WeaponType Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
|
-- @param #number WeaponType Bitmask of weapon types, which are allowed to use.
|
||||||
-- @param DCS#AI.Task.Designation Designation (optional) Designation type.
|
-- @param DCS#AI.Task.Designation Designation (Optional) Designation type.
|
||||||
-- @param #boolean Datalink (optional) Allows to use datalink to send the target information to attack aircraft. Enabled by default.
|
-- @param #boolean Datalink (Optional) Allows to use datalink to send the target information to attack aircraft. Enabled by default.
|
||||||
|
-- @param #number Frequency Frequency used to communicate with the FAC.
|
||||||
|
-- @param #number Modulation Modulation of radio for communication.
|
||||||
|
-- @param #number CallsignName Callsign enumerator name of the FAC.
|
||||||
|
-- @param #number CallsignNumber Callsign number, e.g. Axeman-**1**.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation, Datalink )
|
function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation, Datalink, Frequency, Modulation, CallsignName, CallsignNumber )
|
||||||
self:F2( { self.ControllableName, AttackGroup, WeaponType, Designation, Datalink } )
|
|
||||||
|
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
id = 'FAC_AttackGroup',
|
id = 'FAC_AttackGroup',
|
||||||
@ -1451,10 +1441,13 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation,
|
|||||||
weaponType = WeaponType,
|
weaponType = WeaponType,
|
||||||
designation = Designation,
|
designation = Designation,
|
||||||
datalink = Datalink,
|
datalink = Datalink,
|
||||||
|
frequency = Frequency,
|
||||||
|
modulation = Modulation,
|
||||||
|
callname = CallsignName,
|
||||||
|
number = CallsignNumber,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1467,7 +1460,6 @@ end
|
|||||||
-- @param #number Priority All enroute 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 All enroute 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:EnRouteTaskEngageTargets( Distance, TargetTypes, Priority )
|
function CONTROLLABLE:EnRouteTaskEngageTargets( Distance, TargetTypes, Priority )
|
||||||
self:F2( { self.ControllableName, Distance, TargetTypes, Priority } )
|
|
||||||
|
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
id = 'EngageTargets',
|
id = 'EngageTargets',
|
||||||
@ -1479,7 +1471,6 @@ function CONTROLLABLE:EnRouteTaskEngageTargets( Distance, TargetTypes, Priority
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1489,11 +1480,10 @@ 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 )
|
||||||
self:F2( { self.ControllableName, Vec2, Radius, TargetTypes, Priority } )
|
|
||||||
|
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
id = 'EngageTargetsInZone',
|
id = 'EngageTargetsInZone',
|
||||||
@ -1505,7 +1495,6 @@ function CONTROLLABLE:EnRouteTaskEngageTargetsInZone( Vec2, Radius, TargetTypes,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1522,7 +1511,6 @@ end
|
|||||||
-- @param #boolean AttackQtyLimit (optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
|
-- @param #boolean AttackQtyLimit (optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskEngageGroup( AttackGroup, Priority, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit )
|
function CONTROLLABLE:EnRouteTaskEngageGroup( AttackGroup, Priority, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit )
|
||||||
self:F2( { self.ControllableName, AttackGroup, Priority, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit } )
|
|
||||||
|
|
||||||
-- EngageControllable = {
|
-- EngageControllable = {
|
||||||
-- id = 'EngageControllable ',
|
-- id = 'EngageControllable ',
|
||||||
@ -1554,9 +1542,8 @@ function CONTROLLABLE:EnRouteTaskEngageGroup( AttackGroup, Priority, WeaponType,
|
|||||||
attackQty = AttackQty,
|
attackQty = AttackQty,
|
||||||
priority = Priority or 1,
|
priority = Priority or 1,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1574,7 +1561,6 @@ end
|
|||||||
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
|
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskEngageUnit( EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack )
|
function CONTROLLABLE:EnRouteTaskEngageUnit( EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack )
|
||||||
self:F2( { self.ControllableName, EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack } )
|
|
||||||
|
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
id = 'EngageUnit',
|
id = 'EngageUnit',
|
||||||
@ -1592,9 +1578,8 @@ function CONTROLLABLE:EnRouteTaskEngageUnit( EngageUnit, Priority, GroupAttack,
|
|||||||
attackQty = AttackQty,
|
attackQty = AttackQty,
|
||||||
controllableAttack = ControllableAttack,
|
controllableAttack = ControllableAttack,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1604,11 +1589,12 @@ end
|
|||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskAWACS( )
|
function CONTROLLABLE:EnRouteTaskAWACS( )
|
||||||
self:F2( { self.ControllableName } )
|
|
||||||
|
|
||||||
local DCSTask = {id = 'AWACS', params = {}}
|
local DCSTask = {
|
||||||
|
id = 'AWACS',
|
||||||
|
params = {},
|
||||||
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1617,11 +1603,12 @@ end
|
|||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskTanker( )
|
function CONTROLLABLE:EnRouteTaskTanker( )
|
||||||
self:F2( { self.ControllableName } )
|
|
||||||
|
|
||||||
local DCSTask = {id = 'Tanker', params = {}}
|
local DCSTask = {
|
||||||
|
id = 'Tanker',
|
||||||
|
params = {},
|
||||||
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1632,11 +1619,12 @@ end
|
|||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskEWR( )
|
function CONTROLLABLE:EnRouteTaskEWR( )
|
||||||
self:F2( { self.ControllableName } )
|
|
||||||
|
|
||||||
local DCSTask = {id = 'EWR', params = {}}
|
local DCSTask = {
|
||||||
|
id = 'EWR',
|
||||||
|
params = {},
|
||||||
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1654,7 +1642,6 @@ end
|
|||||||
-- @param #boolean Datalink (optional) Allows to use datalink to send the target information to attack aircraft. Enabled by default.
|
-- @param #boolean Datalink (optional) Allows to use datalink to send the target information to attack aircraft. Enabled by default.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskFAC_EngageGroup( AttackGroup, Priority, WeaponType, Designation, Datalink )
|
function CONTROLLABLE:EnRouteTaskFAC_EngageGroup( AttackGroup, Priority, WeaponType, Designation, Datalink )
|
||||||
self:F2( { self.ControllableName, AttackGroup, WeaponType, Priority, Designation, Datalink } )
|
|
||||||
|
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
id = 'FAC_EngageControllable',
|
id = 'FAC_EngageControllable',
|
||||||
@ -1667,7 +1654,6 @@ function CONTROLLABLE:EnRouteTaskFAC_EngageGroup( AttackGroup, Priority, WeaponT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1680,7 +1666,6 @@ end
|
|||||||
-- @param #number Priority 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.
|
-- @param #number Priority 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.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskFAC( Radius, Priority )
|
function CONTROLLABLE:EnRouteTaskFAC( Radius, Priority )
|
||||||
self:F2( { self.ControllableName, Radius, Priority } )
|
|
||||||
|
|
||||||
-- FAC = {
|
-- FAC = {
|
||||||
-- id = 'FAC',
|
-- id = 'FAC',
|
||||||
@ -1690,15 +1675,14 @@ function CONTROLLABLE:EnRouteTaskFAC( Radius, Priority )
|
|||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
|
|
||||||
local DCSTask
|
local DCSTask = {
|
||||||
DCSTask = { id = 'FAC',
|
id = 'FAC',
|
||||||
params = {
|
params = {
|
||||||
radius = Radius,
|
radius = Radius,
|
||||||
priority = Priority
|
priority = Priority
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1799,30 +1783,6 @@ function CONTROLLABLE:TaskDisembarkFromTransport(Coordinate, Radius)
|
|||||||
end
|
end
|
||||||
]]
|
]]
|
||||||
|
|
||||||
--- (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable.
|
|
||||||
-- @param #CONTROLLABLE self
|
|
||||||
-- @param DCS#Vec2 Point The point where to wait.
|
|
||||||
-- @param #number Duration The duration in seconds to wait.
|
|
||||||
-- @param #CONTROLLABLE EmbarkingControllable The controllable to be embarked.
|
|
||||||
-- @return DCS#Task The DCS task structure
|
|
||||||
function CONTROLLABLE:TaskEmbarking( Point, Duration, EmbarkingControllable )
|
|
||||||
self:F2( { self.ControllableName, Point, Duration, EmbarkingControllable.DCSControllable } )
|
|
||||||
|
|
||||||
local DCSTask
|
|
||||||
DCSTask = { id = 'Embarking',
|
|
||||||
params = { x = Point.x,
|
|
||||||
y = Point.y,
|
|
||||||
duration = Duration,
|
|
||||||
controllablesForEmbarking = { EmbarkingControllable.ControllableID },
|
|
||||||
durationFlag = true,
|
|
||||||
distributionFlag = false,
|
|
||||||
distribution = {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
|
||||||
end
|
|
||||||
|
|
||||||
--- (GROUND) Embark to a Transport landed at a location.
|
--- (GROUND) Embark to a Transport landed at a location.
|
||||||
-- Move to a defined Vec2 Point, and embark to a controllable when arrived within a defined Radius.
|
-- Move to a defined Vec2 Point, and embark to a controllable when arrived within a defined Radius.
|
||||||
@ -1831,10 +1791,8 @@ end
|
|||||||
-- @param #number Radius The radius of the embarking zone around the Point.
|
-- @param #number Radius The radius of the embarking zone around the Point.
|
||||||
-- @return DCS#Task The DCS task structure.
|
-- @return DCS#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskEmbarkToTransport( Point, Radius )
|
function CONTROLLABLE:TaskEmbarkToTransport( Point, Radius )
|
||||||
self:F2( { self.ControllableName, Point, Radius } )
|
|
||||||
|
|
||||||
local DCSTask --DCS#Task
|
local DCSTask = {
|
||||||
DCSTask = {
|
|
||||||
id = 'EmbarkToTransport',
|
id = 'EmbarkToTransport',
|
||||||
params = {
|
params = {
|
||||||
point = Point,
|
point = Point,
|
||||||
@ -1844,7 +1802,6 @@ function CONTROLLABLE:TaskEmbarkToTransport( Point, Radius )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1899,12 +1856,9 @@ end
|
|||||||
--
|
--
|
||||||
function CONTROLLABLE:TaskFunction( FunctionString, ... )
|
function CONTROLLABLE:TaskFunction( FunctionString, ... )
|
||||||
|
|
||||||
local DCSTask
|
-- Script
|
||||||
|
|
||||||
local DCSScript = {}
|
local DCSScript = {}
|
||||||
DCSScript[#DCSScript+1] = "local MissionControllable = GROUP:Find( ... ) "
|
DCSScript[#DCSScript+1] = "local MissionControllable = GROUP:Find( ... ) "
|
||||||
--DCSScript[#DCSScript+1] = "env.info( 'TaskFunction: ' .. ( MissionControllable and MissionControllable:GetName() ) or 'No Group' )"
|
|
||||||
|
|
||||||
if arg and arg.n > 0 then
|
if arg and arg.n > 0 then
|
||||||
local ArgumentKey = '_' .. tostring( arg ):match("table: (.*)")
|
local ArgumentKey = '_' .. tostring( arg ):match("table: (.*)")
|
||||||
self:SetState( self, ArgumentKey, arg )
|
self:SetState( self, ArgumentKey, arg )
|
||||||
@ -1914,12 +1868,10 @@ function CONTROLLABLE:TaskFunction( FunctionString, ... )
|
|||||||
DCSScript[#DCSScript+1] = FunctionString .. "( MissionControllable )"
|
DCSScript[#DCSScript+1] = FunctionString .. "( MissionControllable )"
|
||||||
end
|
end
|
||||||
|
|
||||||
DCSTask = self:TaskWrappedAction(self:CommandDoScript(table.concat( DCSScript )))
|
-- DCS task.
|
||||||
|
local DCSTask = self:TaskWrappedAction(self:CommandDoScript(table.concat( DCSScript )))
|
||||||
self:T( DCSTask )
|
|
||||||
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1929,12 +1881,12 @@ end
|
|||||||
-- @param #table TaskMission A table containing the mission task.
|
-- @param #table TaskMission A table containing the mission task.
|
||||||
-- @return DCS#Task
|
-- @return DCS#Task
|
||||||
function CONTROLLABLE:TaskMission( TaskMission )
|
function CONTROLLABLE:TaskMission( TaskMission )
|
||||||
self:F2( Points )
|
|
||||||
|
|
||||||
local DCSTask
|
local DCSTask = {
|
||||||
DCSTask = { id = 'Mission', params = { TaskMission, }, }
|
id = 'Mission',
|
||||||
|
params = { TaskMission, },
|
||||||
|
}
|
||||||
|
|
||||||
self:T3( { DCSTask } )
|
|
||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2995,6 +2947,51 @@ end
|
|||||||
|
|
||||||
-- Options
|
-- Options
|
||||||
|
|
||||||
|
--- Set option.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number OptionID ID/Type of the option.
|
||||||
|
-- @param #number OptionValue Value of the option
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:SetOption(OptionID, OptionValue)
|
||||||
|
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
if DCSControllable then
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
|
||||||
|
Controller:setOption( OptionID, OptionValue )
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set option for Rules of Engagement (ROE).
|
||||||
|
-- @param Wrapper.Controllable#CONTROLLABLE self
|
||||||
|
-- @param #number ROEvalue ROE value. See ENUMS.ROE.
|
||||||
|
-- @return Wrapper.Controllable#CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionROE(ROEvalue)
|
||||||
|
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
|
||||||
|
if DCSControllable then
|
||||||
|
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
Controller:setOption(AI.Option.Air.id.ROE, ROEvalue )
|
||||||
|
elseif self:IsGround() then
|
||||||
|
Controller:setOption(AI.Option.Ground.id.ROE, ROEvalue )
|
||||||
|
elseif self:IsShip() then
|
||||||
|
Controller:setOption(AI.Option.Naval.id.ROE, ROEvalue )
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Can the CONTROLLABLE hold their weapons?
|
--- Can the CONTROLLABLE hold their weapons?
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
@ -3237,6 +3234,27 @@ function CONTROLLABLE:OptionROTNoReaction()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set Reation On Threat behaviour.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number ROTvalue ROT value. See ENUMS.ROT.
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionROT(ROTvalue)
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
if DCSControllable then
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
Controller:setOption( AI.Option.Air.id.REACTION_ON_THREAT, ROTvalue )
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Can the CONTROLLABLE evade using passive defenses?
|
--- Can the CONTROLLABLE evade using passive defenses?
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
@ -3515,8 +3533,76 @@ function CONTROLLABLE:OptionKeepWeaponsOnThreat()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Prohibit Afterburner.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #boolean Prohibit If true or nil, prohibit. If false, do not prohibit.
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionProhibitAfterburner(Prohibit)
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
if Prohibit==nil then
|
||||||
|
Prohibit=true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption(AI.Option.Air.id.PROHIBIT_AB, Prohibit)
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Defines the usage of Electronic Counter Measures by airborne forces. Disables the ability for AI to use their ECM.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionECM_Never()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption(AI.Option.Air.id.ECM_USING, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Defines the usage of Electronic Counter Measures by airborne forces. If the AI is actively being locked by an enemy radar they will enable their ECM jammer.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionECM_OnlyLockByRadar()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption(AI.Option.Air.id.ECM_USING, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Defines the usage of Electronic Counter Measures by airborne forces. If the AI is being detected by a radar they will enable their ECM.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionECM_DetectedLockByRadar()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption(AI.Option.Air.id.ECM_USING, 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Defines the usage of Electronic Counter Measures by airborne forces. AI will leave their ECM on all the time.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionECM_AlwaysOn()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption(AI.Option.Air.id.ECM_USING, 3)
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Retrieve the controllable mission and allow to place function hooks within the mission waypoint plan.
|
--- Retrieve the controllable mission and allow to place function hooks within the mission waypoint plan.
|
||||||
-- Use the method @{Wrapper.Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
|
-- Use the method @{Wrapper.Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
|
||||||
|
|||||||
@ -440,9 +440,16 @@ function GROUP:Destroy( GenerateEvent, delay )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns category of the DCS Group.
|
--- Returns category of the DCS Group. Returns one of
|
||||||
|
--
|
||||||
|
-- * Group.Category.AIRPLANE
|
||||||
|
-- * Group.Category.HELICOPTER
|
||||||
|
-- * Group.Category.GROUND
|
||||||
|
-- * Group.Category.SHIP
|
||||||
|
-- * Group.Category.TRAIN
|
||||||
|
--
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @return DCS#Group.Category The category ID
|
-- @return DCS#Group.Category The category ID.
|
||||||
function GROUP:GetCategory()
|
function GROUP:GetCategory()
|
||||||
self:F2( self.GroupName )
|
self:F2( self.GroupName )
|
||||||
|
|
||||||
@ -458,7 +465,7 @@ end
|
|||||||
|
|
||||||
--- Returns the category name of the #GROUP.
|
--- Returns the category name of the #GROUP.
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @return #string Category name = Helicopter, Airplane, Ground Unit, Ship
|
-- @return #string Category name = Helicopter, Airplane, Ground Unit, Ship, Train.
|
||||||
function GROUP:GetCategoryName()
|
function GROUP:GetCategoryName()
|
||||||
self:F2( self.GroupName )
|
self:F2( self.GroupName )
|
||||||
|
|
||||||
@ -469,6 +476,7 @@ function GROUP:GetCategoryName()
|
|||||||
[Group.Category.HELICOPTER] = "Helicopter",
|
[Group.Category.HELICOPTER] = "Helicopter",
|
||||||
[Group.Category.GROUND] = "Ground Unit",
|
[Group.Category.GROUND] = "Ground Unit",
|
||||||
[Group.Category.SHIP] = "Ship",
|
[Group.Category.SHIP] = "Ship",
|
||||||
|
[Group.Category.TRAIN] = "Train",
|
||||||
}
|
}
|
||||||
local GroupCategory = DCSGroup:getCategory()
|
local GroupCategory = DCSGroup:getCategory()
|
||||||
self:T3( GroupCategory )
|
self:T3( GroupCategory )
|
||||||
@ -867,10 +875,15 @@ end
|
|||||||
|
|
||||||
--- Activates a late activated GROUP.
|
--- Activates a late activated GROUP.
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
|
-- @param #number delay Delay in seconds, before the group is activated.
|
||||||
-- @return #GROUP self
|
-- @return #GROUP self
|
||||||
function GROUP:Activate()
|
function GROUP:Activate(delay)
|
||||||
self:F2( { self.GroupName } )
|
self:F2( { self.GroupName } )
|
||||||
trigger.action.activateGroup( self:GetDCSObject() )
|
if delay and delay>0 then
|
||||||
|
self:ScheduleOnce(delay, GROUP.Activate, self)
|
||||||
|
else
|
||||||
|
trigger.action.activateGroup( self:GetDCSObject() )
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,6 @@ end
|
|||||||
--- Returns the type name of the DCS Identifiable.
|
--- Returns the type name of the DCS Identifiable.
|
||||||
-- @param #IDENTIFIABLE self
|
-- @param #IDENTIFIABLE self
|
||||||
-- @return #string The type name of the DCS Identifiable.
|
-- @return #string The type name of the DCS Identifiable.
|
||||||
-- @return #nil The DCS Identifiable is not existing or alive.
|
|
||||||
function IDENTIFIABLE:GetTypeName()
|
function IDENTIFIABLE:GetTypeName()
|
||||||
self:F2( self.IdentifiableName )
|
self:F2( self.IdentifiableName )
|
||||||
|
|
||||||
@ -107,9 +106,17 @@ function IDENTIFIABLE:GetTypeName()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns category of the DCS Identifiable.
|
--- Returns object category of the DCS Identifiable. One of
|
||||||
|
--
|
||||||
|
-- * Object.Category.UNIT = 1
|
||||||
|
-- * Object.Category.WEAPON = 2
|
||||||
|
-- * Object.Category.STATIC = 3
|
||||||
|
-- * Object.Category.BASE = 4
|
||||||
|
-- * Object.Category.SCENERY = 5
|
||||||
|
-- * Object.Category.Cargo = 6
|
||||||
|
--
|
||||||
-- @param #IDENTIFIABLE self
|
-- @param #IDENTIFIABLE self
|
||||||
-- @return DCS#Object.Category The category ID
|
-- @return DCS#Object.Category The category ID, i.e. a number.
|
||||||
function IDENTIFIABLE:GetCategory()
|
function IDENTIFIABLE:GetCategory()
|
||||||
self:F2( self.ObjectName )
|
self:F2( self.ObjectName )
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
--
|
--
|
||||||
-- ### Contributions:
|
-- ### Contributions: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@ -48,6 +48,10 @@ STATIC = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
--- Register a static object.
|
||||||
|
-- @param #STATIC self
|
||||||
|
-- @param #string StaticName Name of the static object.
|
||||||
|
-- @return #STATIC self
|
||||||
function STATIC:Register( StaticName )
|
function STATIC:Register( StaticName )
|
||||||
local self = BASE:Inherit( self, POSITIONABLE:New( StaticName ) )
|
local self = BASE:Inherit( self, POSITIONABLE:New( StaticName ) )
|
||||||
self.StaticName = StaticName
|
self.StaticName = StaticName
|
||||||
@ -71,21 +75,19 @@ end
|
|||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
-- @param #string StaticName Name of the DCS **Static** as defined within the Mission Editor.
|
-- @param #string StaticName Name of the DCS **Static** as defined within the Mission Editor.
|
||||||
-- @param #boolean RaiseError Raise an error if not found.
|
-- @param #boolean RaiseError Raise an error if not found.
|
||||||
-- @return #STATIC
|
-- @return #STATIC self or *nil*
|
||||||
function STATIC:FindByName( StaticName, RaiseError )
|
function STATIC:FindByName( StaticName )
|
||||||
|
|
||||||
|
-- Find static in DB.
|
||||||
local StaticFound = _DATABASE:FindStatic( StaticName )
|
local StaticFound = _DATABASE:FindStatic( StaticName )
|
||||||
|
|
||||||
|
-- Set static name.
|
||||||
self.StaticName = StaticName
|
self.StaticName = StaticName
|
||||||
|
|
||||||
if StaticFound then
|
if StaticFound then
|
||||||
StaticFound:F3( { StaticName } )
|
|
||||||
return StaticFound
|
return StaticFound
|
||||||
end
|
end
|
||||||
|
|
||||||
if RaiseError == nil or RaiseError == true then
|
|
||||||
error( "STATIC not found for: " .. StaticName )
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -424,9 +424,9 @@ function UNIT:GetRange()
|
|||||||
local Desc = self:GetDesc()
|
local Desc = self:GetDesc()
|
||||||
|
|
||||||
if Desc then
|
if Desc then
|
||||||
local Range = Desc.range --This is in nautical miles for some reason. But should check again!
|
local Range = Desc.range --This is in kilometers (not meters) for some reason. But should check again!
|
||||||
if Range then
|
if Range then
|
||||||
Range=UTILS.NMToMeters(Range)
|
Range=Range*1000 -- convert to meters.
|
||||||
else
|
else
|
||||||
Range=10000000 --10.000 km if no range
|
Range=10000000 --10.000 km if no range
|
||||||
end
|
end
|
||||||
@ -436,6 +436,64 @@ function UNIT:GetRange()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if the unit is refuelable. Also retrieves the refuelling system (boom or probe) if applicable.
|
||||||
|
-- @param #UNIT self
|
||||||
|
-- @return #boolean If true, unit is refuelable (checks for the attribute "Refuelable").
|
||||||
|
-- @return #number Refueling system (if any): 0=boom, 1=probe.
|
||||||
|
function UNIT:IsRefuelable()
|
||||||
|
self:F2( self.UnitName )
|
||||||
|
|
||||||
|
local refuelable=self:HasAttribute("Refuelable")
|
||||||
|
|
||||||
|
local system=nil
|
||||||
|
|
||||||
|
local Desc=self:GetDesc()
|
||||||
|
if Desc and Desc.tankerType then
|
||||||
|
system=Desc.tankerType
|
||||||
|
end
|
||||||
|
|
||||||
|
return refuelable, system
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Check if the unit is a tanker. Also retrieves the refuelling system (boom or probe) if applicable.
|
||||||
|
-- @param #UNIT self
|
||||||
|
-- @return #boolean If true, unit is refuelable (checks for the attribute "Refuelable").
|
||||||
|
-- @return #number Refueling system (if any): 0=boom, 1=probe.
|
||||||
|
function UNIT:IsTanker()
|
||||||
|
self:F2( self.UnitName )
|
||||||
|
|
||||||
|
local tanker=self:HasAttribute("Tankers")
|
||||||
|
|
||||||
|
local system=nil
|
||||||
|
|
||||||
|
if tanker then
|
||||||
|
|
||||||
|
local Desc=self:GetDesc()
|
||||||
|
if Desc and Desc.tankerType then
|
||||||
|
system=Desc.tankerType
|
||||||
|
end
|
||||||
|
|
||||||
|
local typename=self:GetTypeName()
|
||||||
|
|
||||||
|
-- Some hard coded data as this is not in the descriptors...
|
||||||
|
if typename=="IL-78M" then
|
||||||
|
system=1 --probe
|
||||||
|
elseif typename=="KC130" then
|
||||||
|
system=1 --probe
|
||||||
|
elseif typename=="KC135BDA" then
|
||||||
|
system=1 --probe
|
||||||
|
elseif typename=="KC135MPRS" then
|
||||||
|
system=1 --probe
|
||||||
|
elseif typename=="S-3B Tanker" then
|
||||||
|
system=1 --probe
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return tanker, system
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns the unit's group if it exist and nil otherwise.
|
--- Returns the unit's group if it exist and nil otherwise.
|
||||||
-- @param Wrapper.Unit#UNIT self
|
-- @param Wrapper.Unit#UNIT self
|
||||||
-- @return Wrapper.Group#GROUP The Group of the Unit.
|
-- @return Wrapper.Group#GROUP The Group of the Unit.
|
||||||
@ -756,6 +814,27 @@ function UNIT:GetDamageRelative()
|
|||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns the category of the #UNIT from descriptor. Returns one of
|
||||||
|
--
|
||||||
|
-- * Unit.Category.AIRPLANE
|
||||||
|
-- * Unit.Category.HELICOPTER
|
||||||
|
-- * Unit.Category.GROUND_UNIT
|
||||||
|
-- * Unit.Category.SHIP
|
||||||
|
-- * Unit.Category.STRUCTURE
|
||||||
|
--
|
||||||
|
-- @param #UNIT self
|
||||||
|
-- @return #number Unit category from `getDesc().category`.
|
||||||
|
function UNIT:GetUnitCategory()
|
||||||
|
self:F3( self.UnitName )
|
||||||
|
|
||||||
|
local DCSUnit = self:GetDCSObject()
|
||||||
|
if DCSUnit then
|
||||||
|
return DCSUnit:getDesc().category
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns the category name of the #UNIT.
|
--- Returns the category name of the #UNIT.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
-- @return #string Category name = Helicopter, Airplane, Ground Unit, Ship
|
-- @return #string Category name = Helicopter, Airplane, Ground Unit, Ship
|
||||||
@ -833,7 +912,9 @@ end
|
|||||||
-- * Threat level 10: Unit is AAA.
|
-- * Threat level 10: Unit is AAA.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
|
-- @return #number Number between 0 (low threat level) and 10 (high threat level).
|
||||||
|
-- @return #string Some text.
|
||||||
function UNIT:GetThreatLevel()
|
function UNIT:GetThreatLevel()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user