mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
DCS, Detection, Controllable, Group
This commit is contained in:
parent
a09cd6e667
commit
52f429a991
@ -1,15 +1,19 @@
|
|||||||
--- DCS API prototypes
|
--- DCS API prototypes
|
||||||
|
-- See [https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation)
|
||||||
|
-- for further explanation and examples.
|
||||||
-- @module DCS
|
-- @module DCS
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
do -- world
|
do -- world
|
||||||
|
|
||||||
--- @type world
|
--- [DCS Enum world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
||||||
|
-- @type world
|
||||||
-- @field #world.event event
|
-- @field #world.event event
|
||||||
|
|
||||||
--- @type world.event
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
||||||
|
-- @type world.event
|
||||||
-- @field S_EVENT_INVALID
|
-- @field S_EVENT_INVALID
|
||||||
-- @field S_EVENT_SHOT
|
-- @field S_EVENT_SHOT [https://wiki.hoggitworld.com/view/DCS_event_shot](https://wiki.hoggitworld.com/view/DCS_event_shot)
|
||||||
-- @field S_EVENT_HIT
|
-- @field S_EVENT_HIT
|
||||||
-- @field S_EVENT_TAKEOFF
|
-- @field S_EVENT_TAKEOFF
|
||||||
-- @field S_EVENT_LAND
|
-- @field S_EVENT_LAND
|
||||||
@ -41,26 +45,28 @@ end -- world
|
|||||||
|
|
||||||
do -- env
|
do -- env
|
||||||
|
|
||||||
--- @type env
|
--- [DCS Singleton env](https://wiki.hoggitworld.com/view/DCS_singleton_env)
|
||||||
|
-- @type env
|
||||||
|
|
||||||
|
|
||||||
--- Add message to simulator log with caption "INFO". Message box is optional.
|
--- Add message to simulator log with caption "INFO". Message box is optional.
|
||||||
-- @function [parent=#env] info
|
-- @function [parent=#env] info
|
||||||
-- @field #string message message string to add to log.
|
-- @param #string message message string to add to log.
|
||||||
-- @field #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
|
-- @param #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
|
||||||
|
|
||||||
--- Add message to simulator log with caption "WARNING". Message box is optional.
|
--- Add message to simulator log with caption "WARNING". Message box is optional.
|
||||||
-- @function [parent=#env] warning
|
-- @function [parent=#env] warning
|
||||||
-- @field #string message message string to add to log.
|
-- @param #string message message string to add to log.
|
||||||
-- @field #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
|
-- @param #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
|
||||||
|
|
||||||
--- Add message to simulator log with caption "ERROR". Message box is optional.
|
--- Add message to simulator log with caption "ERROR". Message box is optional.
|
||||||
-- @function [parent=#env] error
|
-- @function [parent=#env] error
|
||||||
-- @field #string message message string to add to log.
|
-- @param #string message message string to add to log.
|
||||||
-- @field #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
|
-- @param #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
|
||||||
|
|
||||||
--- Enables/disables appearance of message box each time lua error occurs.
|
--- Enables/disables appearance of message box each time lua error occurs.
|
||||||
-- @function [parent=#env] setErrorMessageBoxEnabled
|
-- @function [parent=#env] setErrorMessageBoxEnabled
|
||||||
-- @field #boolean on if true message box appearance is enabled.
|
-- @param #boolean on if true message box appearance is enabled.
|
||||||
|
|
||||||
env = {} --#env
|
env = {} --#env
|
||||||
|
|
||||||
@ -69,8 +75,8 @@ end -- env
|
|||||||
|
|
||||||
do -- timer
|
do -- timer
|
||||||
|
|
||||||
--- @type timer
|
--- [DCS Singleton timer](https://wiki.hoggitworld.com/view/DCS_singleton_timer)
|
||||||
|
-- @type timer
|
||||||
|
|
||||||
--- Returns model time in seconds.
|
--- Returns model time in seconds.
|
||||||
-- @function [parent=#timer] getTime
|
-- @function [parent=#timer] getTime
|
||||||
@ -117,11 +123,12 @@ end
|
|||||||
|
|
||||||
do -- land
|
do -- land
|
||||||
|
|
||||||
--- @type land
|
--- [DCS Singleton land](https://wiki.hoggitworld.com/view/DCS_singleton_land)
|
||||||
|
-- @type land
|
||||||
-- @field #land.SurfaceType SurfaceType
|
-- @field #land.SurfaceType SurfaceType
|
||||||
|
|
||||||
|
--- [Type of surface enumerator](https://wiki.hoggitworld.com/view/DCS_singleton_land)
|
||||||
--- @type land.SurfaceType
|
-- @type land.SurfaceType
|
||||||
-- @field LAND
|
-- @field LAND
|
||||||
-- @field SHALLOW_WATER
|
-- @field SHALLOW_WATER
|
||||||
-- @field WATER
|
-- @field WATER
|
||||||
@ -144,10 +151,16 @@ end -- land
|
|||||||
|
|
||||||
do -- country
|
do -- country
|
||||||
|
|
||||||
--- @type country
|
--- [DCS Enum country](https://wiki.hoggitworld.com/view/DCS_enum_country)
|
||||||
|
-- @type country
|
||||||
-- @field #country.id id
|
-- @field #country.id id
|
||||||
|
|
||||||
--- @type country.id
|
--- [DCS Enum country](https://wiki.hoggitworld.com/view/DCS_enum_country)
|
||||||
|
-- @field #country
|
||||||
|
country = {}
|
||||||
|
|
||||||
|
--- [DCS enumerator country](https://wiki.hoggitworld.com/view/DCS_enum_country)
|
||||||
|
-- @type country.id
|
||||||
-- @field RUSSIA
|
-- @field RUSSIA
|
||||||
-- @field UKRAINE
|
-- @field UKRAINE
|
||||||
-- @field USA
|
-- @field USA
|
||||||
@ -223,10 +236,9 @@ do -- country
|
|||||||
-- @field OMAN
|
-- @field OMAN
|
||||||
-- @field UNITED_ARAB_EMIRATES
|
-- @field UNITED_ARAB_EMIRATES
|
||||||
|
|
||||||
country = {} -- #country
|
|
||||||
|
|
||||||
end -- country
|
end -- country
|
||||||
|
|
||||||
|
|
||||||
do -- Command
|
do -- Command
|
||||||
|
|
||||||
--- @type Command
|
--- @type Command
|
||||||
@ -239,10 +251,12 @@ end -- Command
|
|||||||
|
|
||||||
do -- coalition
|
do -- coalition
|
||||||
|
|
||||||
--- @type coalition
|
--- [DCS Enum coalition](https://wiki.hoggitworld.com/view/DCS_enum_coalition)
|
||||||
|
-- @type coalition
|
||||||
-- @field #coalition.side side
|
-- @field #coalition.side side
|
||||||
|
|
||||||
--- @type coalition.side
|
--- [DCS Enum coalition.side](https://wiki.hoggitworld.com/view/DCS_enum_coalition)
|
||||||
|
-- @type coalition.side
|
||||||
-- @field NEUTRAL
|
-- @field NEUTRAL
|
||||||
-- @field RED
|
-- @field RED
|
||||||
-- @field BLUE
|
-- @field BLUE
|
||||||
@ -349,7 +363,8 @@ do -- Types
|
|||||||
--- @type Time
|
--- @type Time
|
||||||
-- @extends #number
|
-- @extends #number
|
||||||
|
|
||||||
--- A task descriptor (internal structure for DCS World)
|
--- A task descriptor (internal structure for DCS World). See [https://wiki.hoggitworld.com/view/Category:Tasks](https://wiki.hoggitworld.com/view/Category:Tasks).
|
||||||
|
-- In MOOSE, these tasks can be accessed via @{Wrapper.Controllable#CONTROLLABLE}.
|
||||||
-- @type Task
|
-- @type Task
|
||||||
-- @field #string id
|
-- @field #string id
|
||||||
-- @field #Task.param param
|
-- @field #Task.param param
|
||||||
@ -365,11 +380,13 @@ end --
|
|||||||
|
|
||||||
do -- Object
|
do -- Object
|
||||||
|
|
||||||
--- @type Object
|
--- [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object)
|
||||||
|
-- @type Object
|
||||||
-- @field #Object.Category Category
|
-- @field #Object.Category Category
|
||||||
-- @field #Object.Desc Desc
|
-- @field #Object.Desc Desc
|
||||||
|
|
||||||
--- @type Object.Category
|
--- [DCS Enum Object.Category](https://wiki.hoggitworld.com/view/DCS_Class_Object)
|
||||||
|
-- @type Object.Category
|
||||||
-- @field UNIT
|
-- @field UNIT
|
||||||
-- @field WEAPON
|
-- @field WEAPON
|
||||||
-- @field STATIC
|
-- @field STATIC
|
||||||
@ -439,10 +456,10 @@ end -- Object
|
|||||||
|
|
||||||
do -- CoalitionObject
|
do -- CoalitionObject
|
||||||
|
|
||||||
--- @type CoalitionObject
|
--- [DCS Class CoalitionObject](https://wiki.hoggitworld.com/view/DCS_Class_Coalition_Object)
|
||||||
|
-- @type CoalitionObject
|
||||||
-- @extends #Object
|
-- @extends #Object
|
||||||
|
|
||||||
|
|
||||||
--- Returns coalition of the object.
|
--- Returns coalition of the object.
|
||||||
-- @function [parent=#CoalitionObject] getCoalition
|
-- @function [parent=#CoalitionObject] getCoalition
|
||||||
-- @param #CoalitionObject self
|
-- @param #CoalitionObject self
|
||||||
@ -453,14 +470,15 @@ do -- CoalitionObject
|
|||||||
-- @param #CoalitionObject self
|
-- @param #CoalitionObject self
|
||||||
-- @return #country.id
|
-- @return #country.id
|
||||||
|
|
||||||
CoalitionObject = {} --#CoalitionObject
|
CoalitionObject = {} --#CoalitionObject
|
||||||
|
|
||||||
end -- CoalitionObject
|
end -- CoalitionObject
|
||||||
|
|
||||||
|
|
||||||
do -- Airbase
|
do -- Airbase
|
||||||
|
|
||||||
--- Represents airbases: airdromes, helipads and ships with flying decks or landing pads.
|
--- [DCS Class Airbase](https://wiki.hoggitworld.com/view/DCS_Class_Airbase)
|
||||||
|
-- Represents airbases: airdromes, helipads and ships with flying decks or landing pads.
|
||||||
-- @type Airbase
|
-- @type Airbase
|
||||||
-- @extends #CoalitionObject
|
-- @extends #CoalitionObject
|
||||||
-- @field #Airbase.ID ID Identifier of an airbase. It assigned to an airbase by the Mission Editor automatically. This identifier is used in AI tasks to refer an airbase that exists (spawned and not dead) or not.
|
-- @field #Airbase.ID ID Identifier of an airbase. It assigned to an airbase by the Mission Editor automatically. This identifier is used in AI tasks to refer an airbase that exists (spawned and not dead) or not.
|
||||||
@ -962,12 +980,14 @@ end -- Group
|
|||||||
|
|
||||||
do -- AI
|
do -- AI
|
||||||
|
|
||||||
--- @type AI
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_AI](https://wiki.hoggitworld.com/view/DCS_enum_AI)
|
||||||
|
-- @type AI
|
||||||
-- @field #AI.Skill Skill
|
-- @field #AI.Skill Skill
|
||||||
-- @field #AI.Task Task
|
-- @field #AI.Task Task
|
||||||
-- @field #AI.Option Option
|
-- @field #AI.Option Option
|
||||||
|
|
||||||
--- @type AI.Skill
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_AI](https://wiki.hoggitworld.com/view/DCS_enum_AI)
|
||||||
|
-- @type AI.Skill
|
||||||
-- @field AVERAGE
|
-- @field AVERAGE
|
||||||
-- @field GOOD
|
-- @field GOOD
|
||||||
-- @field HIGH
|
-- @field HIGH
|
||||||
@ -975,7 +995,8 @@ do -- AI
|
|||||||
-- @field PLAYER
|
-- @field PLAYER
|
||||||
-- @field CLIENT
|
-- @field CLIENT
|
||||||
|
|
||||||
--- @type AI.Task
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_AI](https://wiki.hoggitworld.com/view/DCS_enum_AI)
|
||||||
|
-- @type AI.Task
|
||||||
-- @field #AI.Task.WeaponExpend WeaponExpend
|
-- @field #AI.Task.WeaponExpend WeaponExpend
|
||||||
-- @field #AI.Task.OrbitPattern OrbitPattern
|
-- @field #AI.Task.OrbitPattern OrbitPattern
|
||||||
-- @field #AI.Task.Designation Designation
|
-- @field #AI.Task.Designation Designation
|
||||||
@ -984,7 +1005,8 @@ do -- AI
|
|||||||
-- @field #AI.Task.AltitudeType AltitudeType
|
-- @field #AI.Task.AltitudeType AltitudeType
|
||||||
-- @field #AI.Task.VehicleFormation VehicleFormation
|
-- @field #AI.Task.VehicleFormation VehicleFormation
|
||||||
|
|
||||||
--- @type AI.Task.WeaponExpend
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_AI](https://wiki.hoggitworld.com/view/DCS_enum_AI)
|
||||||
|
-- @type AI.Task.WeaponExpend
|
||||||
-- @field ONE
|
-- @field ONE
|
||||||
-- @field TWO
|
-- @field TWO
|
||||||
-- @field FOUR
|
-- @field FOUR
|
||||||
@ -992,11 +1014,13 @@ do -- AI
|
|||||||
-- @field HALF
|
-- @field HALF
|
||||||
-- @field ALL
|
-- @field ALL
|
||||||
|
|
||||||
--- @type AI.Task.OrbitPattern
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_AI](https://wiki.hoggitworld.com/view/DCS_enum_AI)
|
||||||
|
-- @type AI.Task.OrbitPattern
|
||||||
-- @field CIRCLE
|
-- @field CIRCLE
|
||||||
-- @field RACE_TRACK
|
-- @field RACE_TRACK
|
||||||
|
|
||||||
--- @type AI.Task.Designation
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_AI](https://wiki.hoggitworld.com/view/DCS_enum_AI)
|
||||||
|
-- @type AI.Task.Designation
|
||||||
-- @field NO
|
-- @field NO
|
||||||
-- @field AUTO
|
-- @field AUTO
|
||||||
-- @field WP
|
-- @field WP
|
||||||
|
|||||||
@ -526,6 +526,7 @@ do -- DETECTION_BASE
|
|||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
-- @param Wrapper.Group#GROUP DetectionGroup The Group detecting.
|
-- @param Wrapper.Group#GROUP DetectionGroup The Group detecting.
|
||||||
|
-- @param #number DetectionTimeStamp Time stamp of detection event.
|
||||||
function DETECTION_BASE:onafterDetectionGroup( From, Event, To, DetectionGroup, DetectionTimeStamp )
|
function DETECTION_BASE:onafterDetectionGroup( From, Event, To, DetectionGroup, DetectionTimeStamp )
|
||||||
|
|
||||||
self.DetectionRun = self.DetectionRun + 1
|
self.DetectionRun = self.DetectionRun + 1
|
||||||
|
|||||||
@ -356,6 +356,8 @@ end
|
|||||||
|
|
||||||
--- Clearing the Task Queue and Setting the Task on the queue from the controllable.
|
--- Clearing the Task Queue and Setting the Task on the queue from the controllable.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #DCS.Task DCSTask DCS Task array.
|
||||||
|
-- @param #number WaitTime Time in seconds, before the task is set.
|
||||||
-- @return Wrapper.Controllable#CONTROLLABLE self
|
-- @return Wrapper.Controllable#CONTROLLABLE self
|
||||||
function CONTROLLABLE:SetTask( DCSTask, WaitTime )
|
function CONTROLLABLE:SetTask( DCSTask, WaitTime )
|
||||||
self:F2( { DCSTask = DCSTask } )
|
self:F2( { DCSTask = DCSTask } )
|
||||||
@ -424,6 +426,17 @@ end
|
|||||||
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 } )
|
self:F2( { time, userFlag, userFlagValue, condition, duration, lastWayPoint } )
|
||||||
|
|
||||||
|
--[[
|
||||||
|
StopCondition = {
|
||||||
|
time = Time,
|
||||||
|
userFlag = string,
|
||||||
|
userFlagValue = boolean,
|
||||||
|
condition = string,
|
||||||
|
duration = Time,
|
||||||
|
lastWaypoint = number,
|
||||||
|
}
|
||||||
|
--]]
|
||||||
|
|
||||||
local DCSStopCondition = {}
|
local DCSStopCondition = {}
|
||||||
DCSStopCondition.time = time
|
DCSStopCondition.time = time
|
||||||
DCSStopCondition.userFlag = userFlag
|
DCSStopCondition.userFlag = userFlag
|
||||||
|
|||||||
@ -856,7 +856,7 @@ function GROUP:IsCompletelyInZone( Zone )
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns true if some units of the group are within a @{Zone}.
|
--- Returns true if some but NOT ALL units of the group are within a @{Zone}.
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||||
-- @return #boolean Returns true if the Group is partially within the @{Core.Zone#ZONE_BASE}
|
-- @return #boolean Returns true if the Group is partially within the @{Core.Zone#ZONE_BASE}
|
||||||
@ -884,6 +884,14 @@ function GROUP:IsPartlyInZone( Zone )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns true if part or all units of the group are within a @{Zone}.
|
||||||
|
-- @param #GROUP self
|
||||||
|
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||||
|
-- @return #boolean Returns true if the Group is partially or completely within the @{Core.Zone#ZONE_BASE}.
|
||||||
|
function GROUP:IsPartlyOrCompletelyInZone( Zone )
|
||||||
|
return self:IsPartlyInZone(Zone) or self:IsCompletelyInZone(Zone)
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns true if none of the group units of the group are within a @{Zone}.
|
--- Returns true if none of the group units of the group are within a @{Zone}.
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user