Merge pull request #11 from FlightControl-Master/Create-ESCORT-class

Create escort class
This commit is contained in:
Sven Van de Velde 2016-04-01 17:28:23 +02:00
commit 9f03fea76a
66 changed files with 15690 additions and 1074 deletions

54
DCS/DCSAirbase.doclua Normal file
View File

@ -0,0 +1,54 @@
-------------------------------------------------------------------------------
-- @module DCSAirbase
--- Represents airbases: airdromes, helipads and ships with flying decks or landing pads.
-- @type Airbase
-- @extends DCSCoalitionObject#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.Category Category enum contains identifiers of airbase categories.
-- @field #Airbase.Desc Desc Airbase descriptor. Airdromes are unique and their types are unique, but helipads and ships are not always unique and may have the same type.
--- Enum contains identifiers of airbase categories.
-- @type Airbase.Category
-- @field AIRDROME
-- @field HELIPAD
-- @field SHIP
--- Airbase descriptor. Airdromes are unique and their types are unique, but helipads and ships are not always unique and may have the same type.
-- @type Airbase.Desc
-- @extends #Desc
-- @field #Airbase.Category category Category of the airbase type.
--- Returns airbase by its name. If no airbase found the function will return nil.
-- @function [parent=#Airbase] getByName
-- @param #string name
-- @return #Airbase
--- Returns airbase descriptor by type name. If no descriptor is found the function will return nil.
-- @function [parent=#Airbase] getDescByName
-- @param #TypeName typeName Airbase type name.
-- @return #Airbase.Desc
--- Returns Unit that is corresponded to the airbase. Works only for ships.
-- @function [parent=#Airbase] getUnit
-- @param self
-- @return Unit#Unit
--- Returns identifier of the airbase.
-- @function [parent=#Airbase] getID
-- @param self
-- @return #Airbase.ID
--- Returns the airbase's callsign - the localized string.
-- @function [parent=#Airbase] getCallsign
-- @param self
-- @return #string
--- Returns descriptor of the airbase.
-- @function [parent=#Airbase] getDesc
-- @param self
-- @return #Airbase.Desc
Airbase = {} --#Airbase

View File

@ -0,0 +1,17 @@
-------------------------------------------------------------------------------
-- @module DCSCoalitionObject
--- @type CoalitionObject
-- @extends DCSObject#Object
--- Returns coalition of the object.
-- @function [parent=#CoalitionObject] getCoalition
-- @param self
-- @return #coalition.side
--- Returns object country.
-- @function [parent=#CoalitionObject] getCountry
-- @param self
-- @return #country.id
CoalitionObject = {} --#CoalitionObject

115
DCS/DCSController.doclua Normal file
View File

@ -0,0 +1,115 @@
-------------------------------------------------------------------------------
-- @module DCSController
--- Controller is an object that performs A.I.-routines. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
--
-- This class has 2 types of functions:
--
-- * Tasks
-- * Commands: Commands are instant actions those required zero time to perform. Commands may be used both for control unit/group behavior and control game mechanics.
-- @type Controller
-- @field #Controller.Detection Detection Enum contains identifiers of surface types.
--- Enables and disables the controller.
-- Note: Now it works only for ground / naval groups!
-- @function [parent=#Controller] setOnOff
-- @param self
-- @param #boolean value Enable / Disable.
-- Tasks
--- Resets current task and then sets the task to the controller. Task is a table that contains task identifier and task parameters.
-- @function [parent=#Controller] setTask
-- @param self
-- @param #Task task
--- Resets current task of the controller.
-- @function [parent=#Controller] resetTask
-- @param self
--- Pushes the task to the front of the queue and makes the task active. Further call of function Controller.setTask() function will stop current task, clear the queue and set the new task active. If the task queue is empty the function will work like function Controller.setTask() function.
-- @function [parent=#Controller] pushTask
-- @param self
-- @param #Task task
--- Pops current (front) task from the queue and makes active next task in the queue (if exists). If no more tasks in the queue the function works like function Controller.resetTask() function. Does nothing if the queue is empty.
-- @function [parent=#Controller] popTask
-- @param self
--- Returns true if the controller has a task.
-- @function [parent=#Controller] hasTask
-- @param self
-- @return #boolean
-- Commands
--TODO: describe #Command structure
--- Sets the command to perform by controller.
-- @function [parent=#Controller] setCommand
-- @param self
-- @param #Command command Table that contains command identifier and command parameters.
-- Behaviours
--- Sets the option to the controller.
-- Option is a pair of identifier and value. Behavior options are global parameters those affect controller behavior in all tasks it performs.
-- Option identifiers and values are stored in table AI.Option in subtables Air, Ground and Naval.
--
-- OptionId = @{#AI.Option.Air.id} or @{#AI.Option.Ground.id} or @{#AI.Option.Naval.id}
-- OptionValue = AI.Option.Air.val[optionName] or AI.Option.Ground.val[optionName] or AI.Option.Naval.val[optionName]
--
-- @function [parent=#Controller] setOption
-- @param self
-- @param #OptionId optionId Option identifier.
-- @param #OptionValue optionValue Value of the option.
-- Detection
--- Enum contains identifiers of surface types.
-- @type Controller.Detection
-- @field VISUAL
-- @field OPTIC
-- @field RADAR
-- @field IRST
-- @field RWR
-- @field DLINK
--- Detected target.
-- @type DetectedTarget
-- @field Object#Object object The target
-- @field #boolean visible The target is visible
-- @field #boolean type The target type is known
-- @field #boolean distance Distance to the target is known
--- Checks if the target is detected or not. If one or more detection method is specified the function will return true if the target is detected by at least one of these methods. If no detection methods are specified the function will return true if the target is detected by any method.
-- @function [parent=#Controller] isTargetDetected
-- @param self
-- @param Object#Object target Target to check
-- @param #Controller.Detection detection Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN
-- @return #boolean detected True if the target is detected.
-- @return #boolean visible Has effect only if detected is true. True if the target is visible now.
-- @return #ModelTime lastTime Has effect only if visible is false. Last time when target was seen.
-- @return #boolean type Has effect only if detected is true. True if the target type is known.
-- @return #boolean distance Has effect only if detected is true. True if the distance to the target is known.
-- @return #Vec3 lastPos Has effect only if visible is false. Last position of the target when it was seen.
-- @return #Vec3 lastVel Has effect only if visible is false. Last velocity of the target when it was seen.
--- Returns list of detected targets. If one or more detection method is specified the function will return targets which were detected by at least one of these methods. If no detection methods are specified the function will return targets which were detected by any method.
-- @function [parent=#Controller] getDetectedTargets
-- @param self
-- @param #Controller.Detection detection Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN
-- @return #list<#DetectedTarget> array of DetectedTarget
--- Know a target.
-- @function [parent=#Controller] knowTarget
-- @param self
-- @param Object#Object object The target.
-- @param #boolean type Target type is known.
-- @param #boolean distance Distance to target is known.
Controller = {} --#Controller

82
DCS/DCSGroup.doclua Normal file
View File

@ -0,0 +1,82 @@
-------------------------------------------------------------------------------
-- @module DCSGroup
--- Represents group of Units.
-- @type Group
-- @field #ID ID Identifier of a group. It is assigned to a group by Mission Editor automatically.
-- @field #Group.Category Category Enum contains identifiers of group types.
--- Enum contains identifiers of group types.
-- @type Group.Category
-- @field AIRPLANE
-- @field HELICOPTER
-- @field GROUND
-- @field SHIP
-- Static Functions
--- Returns group by the name assigned to the group in Mission Editor.
-- @function [parent=#Group] getByName
-- @param #string name
-- @return #Group
-- Member Functions
--- returns true if the group exist or false otherwise.
-- @function [parent=#Group] isExist
-- @param #Group self
-- @return #boolean
--- Destroys the group and all of its units.
-- @function [parent=#Group] destroy
-- @param #Group self
--- Returns category of the group.
-- @function [parent=#Group] getCategory
-- @param #Group self
-- @return #Group.Category
--TODO check coalition.side
--- Returns coalition of the group.
-- @function [parent=#Group] getCoalition
-- @param #Group self
-- @return #coalition.side
--- Returns the group's name. This is the same name assigned to the group in Mission Editor.
-- @function [parent=#Group] getName
-- @param #Group self
-- @return #string
--- Returns the group identifier.
-- @function [parent=#Group] getID
-- @param #Group self
-- @return #ID
--- Returns the unit with number unitNumber. If the unit is not exists the function will return nil.
-- @function [parent=#Group] getUnit
-- @param #Group self
-- @param #number unitNumber
-- @return DCSUnit#Unit
--- Returns current size of the group. If some of the units will be destroyed, As units are destroyed the size of the group will be changed.
-- @function [parent=#Group] getSize
-- @param #Group self
-- @return #number
--- Returns initial size of the group. If some of the units will be destroyed, initial size of the group will not be changed. Initial size limits the unitNumber parameter for Group.getUnit() function.
-- @function [parent=#Group] getInitialSize
-- @param #Group self
-- @return #number
--- Returns array of the units present in the group now. Destroyed units will not be enlisted at all.
-- @function [parent=#Group] getUnits
-- @param #Group self
-- @return #list<DCSUnit#Unit> array of Units
--- Returns controller of the group.
-- @function [parent=#Group] getController
-- @param #Group self
-- @return Controller#Controller
Group = {} --#Group

73
DCS/DCSObject.doclua Normal file
View File

@ -0,0 +1,73 @@
-------------------------------------------------------------------------------
-- @module DCSObject
--- @type Object
-- @field #Object.Category Category
-- @field #Object.Desc Desc
--- @type Object.Category
-- @field UNIT
-- @field WEAPON
-- @field STATIC
-- @field SCENERY
-- @field BASE
--- @type Object.Desc
-- @extends #Desc
-- @field #number life initial life level
-- @field #Box3 box bounding box of collision geometry
--- @function [parent=#Object] isExist
-- @param #Object self
-- @return #boolean
--- @function [parent=#Object] destroy
-- @param #Object self
--- @function [parent=#Object] getCategory
-- @param #Object self
-- @return #Object.Category
--- Returns type name of the Object.
-- @function [parent=#Object] getTypeName
-- @param #Object self
-- @return #string
--- Returns object descriptor.
-- @function [parent=#Object] getDesc
-- @param #Object self
-- @return #Object.Desc
--- Returns true if the object belongs to the category.
-- @function [parent=#Object] hasAttribute
-- @param #Object self
-- @param #AttributeName attributeName Attribute name to check.
-- @return #boolean
--- Returns name of the object. This is the name that is assigned to the object in the Mission Editor.
-- @function [parent=#Object] getName
-- @param #Object self
-- @return #string
--- Returns object coordinates for current time.
-- @function [parent=#Object] getPoint
-- @param #Object self
-- @return #Vec3
--- Returns object position for current time.
-- @function [parent=#Object] getPosition
-- @param #Object self
-- @return #Position3
--- Returns the unit's velocity vector.
-- @function [parent=#Object] getVelocity
-- @param #Object self
-- @return #Vec3
--- Returns true if the unit is in air.
-- @function [parent=#Object] inAir
-- @param #Object self
-- @return #boolean
Object = {} --#Object

View File

@ -0,0 +1,34 @@
-------------------------------------------------------------------------------
-- @module DCSStaticObject
-------------------------------------------------------------------------------
-- @module StaticObject
-- @extends CoalitionObject#CoalitionObject
--- Represents static object added in the Mission Editor.
-- @type StaticObject
-- @field #StaticObject.ID ID Identifier of a StaticObject. It assigned to an StaticObject by the Mission Editor automatically.
-- @field #StaticObject.Desc Desc Descriptor of StaticObject and Unit are equal. StaticObject is just a passive variant of Unit.
--- StaticObject descriptor. Airdromes are unique and their types are unique, but helipads and ships are not always unique and may have the same type.
-- @type StaticObject.Desc
-- @extends Unit#Unit.Desc
--- Returns static object by its name. If no static object found nil will be returned.
-- @function [parent=#StaticObject] getByName
-- @param #string name Name of static object to find.
-- @return #StaticObject
--- returns identifier of the static object.
-- @function [parent=#StaticObject] getID
-- @param #StaticObject self
-- @return #StaticObject.ID
--- Returns descriptor of the StaticObject.
-- @function [parent=#StaticObject] getDesc
-- @param #StaticObject self
-- @return #StaticObject.Desc
StaticObject = {} --#StaticObject

8
DCS/DCSTask.doclua Normal file
View File

@ -0,0 +1,8 @@
--- @type DCSTask
-- @field #string id
-- @field #DCSTask.param param
--- @type DCSTask.param
env.info( "DCSTask defined" )

2
DCS/DCSTime.doclua Normal file
View File

@ -0,0 +1,2 @@
-- @type ModelTime
-- @extends #number

235
DCS/DCSTypes.doclua Normal file
View File

@ -0,0 +1,235 @@
-------------------------------------------------------------------------------
--- @module DCSTypes
--- Time is given in seconds.
-- @type Time
-- @extends #number
--- Model time is the time that drives the simulation. Model time may be stopped, accelerated and decelerated relative real time.
-- @type ModelTime
-- @extends #number
--- Mission time is a model time plus time of the mission start.
-- @type MissionTime
-- @extends #number
--- Distance is given in meters.
-- @type Distance
-- @extends #number
--- Angle is given in radians.
-- @type Angle
-- @extends #number
--- Azimuth is an angle of rotation around world axis y counter-clockwise.
-- @type Azimuth
-- @extends #number
--- Mass is given in kilograms.
-- @type Mass
-- @extends #number
--- Vec3 type is a 3D-vector.
-- DCS world has 3-dimensional coordinate system. DCS ground is an infinite plain.
-- @type Vec3
-- @field #Distance x is directed to the north
-- @field #Distance z is directed to the east
-- @field #Distance y is directed up
--- Vec2 is a 2D-vector for the ground plane as a reference plane.
-- @type Vec2
-- @field #Distance x Vec2.x = Vec3.x
-- @field #Distance y Vec2.y = Vec3.z
--- Position is a composite structure. It consists of both coordinate vector and orientation matrix. Position3 (also known as "Pos3" for short) is a table that has following format:
-- @type Position3
-- @field #Vec3 p
-- @field #Vec3 x
-- @field #Vec3 y
-- @field #Vec3 z
--- 3-dimensional box.
-- @type Box3
-- @field #Vec3 min
-- @field #Vec3 max
--- Each object belongs to a type. Object type is a named couple of properties those independent of mission and common for all units of the same type. Name of unit type is a string. Samples of unit type: "Su-27", "KAMAZ" and "M2 Bradley".
-- @type TypeName
-- @extends #string
--- @type AI
-- @field #AI.Skill Skill
-- @field #AI.Task Task
-- @field #AI.Option Option
--- @type AI.Skill
-- @field AVERAGE
-- @field GOOD
-- @field HIGH
-- @field EXCELLENT
-- @field PLAYER
-- @field CLIENT
--- @type AI.Task
-- @field #AI.Task.WeaponExpend WeaponExpend
-- @field #AI.Task.OrbitPattern OrbitPattern
-- @field #AI.Task.Designation Designation
-- @field #AI.Task.WaypointType WaypointType
-- @field #AI.Task.TurnMethod TurnMethod
-- @field #AI.Task.AltitudeType AltitudeType
-- @field #AI.Task.VehicleFormation VehicleFormation
--- @type AI.Task.WeaponExpend
-- @field ONE
-- @field TWO
-- @field FOUR
-- @field QUARTER
-- @field HALF
-- @field ALL
--- @type AI.Task.OrbitPattern
-- @field CIRCLE
-- @field RACE_TRACK
--- @type AI.Task.Designation
-- @field NO
-- @field AUTO
-- @field WP
-- @field IR_POINTER
-- @field LASER
--- @type AI.Task.WaypointType
-- @field TAKEOFF
-- @field TAKEOFF_PARKING
-- @field TURNING_POINT
-- @field LAND
--- @type AI.Task.TurnMethod
-- @field FLY_OVER_POINT
-- @field FIN_POINT
--- @type AI.Task.AltitudeType
-- @field BARO
-- @field RADIO
--- @type AI.Task.VehicleFormation
-- @field OFF_ROAD
-- @field ON_ROAD
-- @field RANK
-- @field CONE
-- @field DIAMOND
-- @field VEE
-- @field ECHELON_LEFT
-- @field ECHELON_RIGHT
--- @type AI.Option
-- @field #AI.Option.Air Air
-- @field #AI.Option.Ground Ground
-- @field #AI.Option.Naval Naval
--- @type AI.Option.Air
-- @field #AI.Option.Air.id id
-- @field #AI.Option.Air.val val
--- @type AI.Option.Ground
-- @field #AI.Option.Ground.id id
-- @field #AI.Option.Ground.val val
--- @type AI.Option.Naval
-- @field #AI.Option.Naval.id id
-- @field #AI.Option.Naval.val val
--TODO: work on formation
--- @type AI.Option.Air.id
-- @field NO_OPTION
-- @field ROE
-- @field REACTION_ON_THREAT
-- @field RADAR_USING
-- @field FLARE_USING
-- @field FORMATION
-- @field RTB_ON_BINGO
-- @field SILENCE
--- @type AI.Option.Air.val
-- @field #AI.Option.Air.val.ROE ROE
-- @field #AI.Option.Air.val.REACTION_ON_THREAT REACTION_ON_THREAT
-- @field #AI.Option.Air.val.RADAR_USING RADAR_USING
-- @field #AI.Option.Air.val.FLARE_USING FLARE_USING
--- @type AI.Option.Air.val.ROE
-- @field WEAPON_FREE
-- @field OPEN_FIRE_WEAPON_FREE
-- @field OPEN_FIRE
-- @field RETURN_FIRE
-- @field WEAPON_HOLD
--- @type AI.Option.Air.val.REACTION_ON_THREAT
-- @field NO_REACTION
-- @field PASSIVE_DEFENCE
-- @field EVADE_FIRE
-- @field BYPASS_AND_ESCAPE
-- @field ALLOW_ABORT_MISSION
--- @type AI.Option.Air.val.RADAR_USING
-- @field NEVER
-- @field FOR_ATTACK_ONLY
-- @field FOR_SEARCH_IF_REQUIRED
-- @field FOR_CONTINUOUS_SEARCH
--- @type AI.Option.Air.val.FLARE_USING
-- @field NEVER
-- @field AGAINST_FIRED_MISSILE
-- @field WHEN_FLYING_IN_SAM_WEZ
-- @field WHEN_FLYING_NEAR_ENEMIES
--- @type AI.Option.Ground.id
-- @field NO_OPTION
-- @field ROE @{#AI.Option.Ground.val.ROE}
-- @field DISPERSE_ON_ATTACK true or false
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
--- @type AI.Option.Ground.val
-- @field #AI.Option.Ground.val.ROE ROE
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
--- @type AI.Option.Ground.val.ROE
-- @field OPEN_FIRE
-- @field RETURN_FIRE
-- @field WEAPON_HOLD
--- @type AI.Option.Ground.val.ALARM_STATE
-- @field AUTO
-- @field GREEN
-- @field RED
--- @type AI.Option.Naval.id
-- @field NO_OPTION
-- @field ROE
--- @type AI.Option.Naval.val
-- @field #AI.Option.Naval.val.ROE ROE
--- @type AI.Option.Naval.val.ROE
-- @field OPEN_FIRE
-- @field RETURN_FIRE
-- @field WEAPON_HOLD
AI = {} --#AI
--- @type Desc
-- @field #TypeName typeName type name
-- @field #string displayName localized display name
-- @field #table attributes object type attributes
--- A distance type
-- @type Distance
--- An angle type
-- @type Angle
env.info( 'AI types created' )

241
DCS/DCSUnit.doclua Normal file
View File

@ -0,0 +1,241 @@
-------------------------------------------------------------------------------
-- @module DCSUnit
--- @type Unit
-- @extends DCSCoalitionObject#CoalitionObject
-- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically.
-- @field #Unit.Category Category
-- @field #Unit.RefuelingSystem RefuelingSystem
-- @field #Unit.SensorType SensorType
-- @field #Unit.OpticType OpticType
-- @field #Unit.RadarType RadarType
-- @field #Unit.Desc Desc
-- @field #Unit.DescAircraft DescAircraft
-- @field #Unit.DescAirplane DescAirplane
-- @field #Unit.DescHelicopter DescHelicopter
-- @field #Unit.DescVehicle DescVehicle
-- @field #Unit.DescShip DescShip
-- @field #Unit.AmmoItem AmmoItem
-- @field #list<#Unit.AmmoItem> Ammo
-- @field #Unit.Sensor Sensor
-- @field #Unit.Optic Optic
-- @field #Unit.Radar Radar
-- @field #Unit.IRST IRST
--- Enum that stores unit categories.
-- @type Unit.Category
-- @field AIRPLANE
-- @field HELICOPTER
-- @field GROUND_UNIT
-- @field SHIP
-- @field STRUCTURE
--- Enum that stores aircraft refueling system types.
-- @type Unit.RefuelingSystem
-- @field BOOM_AND_RECEPTACLE
-- @field PROBE_AND_DROGUE
--- Enum that stores sensor types.
-- @type Unit.SensorType
-- @field OPTIC
-- @field RADAR
-- @field IRST
-- @field RWR
--- Enum that stores types of optic sensors.
-- @type Unit.OpticType
-- @field TV TV-sensor
-- @field LLTV Low-level TV-sensor
-- @field IR Infra-Red optic sensor
--- Enum that stores radar types.
-- @type Unit.RadarType
-- @field AS air search radar
-- @field SS surface/land search radar
--- A unit descriptor.
-- @type Unit.Desc
-- @extends Object#Object.Desc
-- @field #Unit.Category category Unit Category
-- @field #Mass massEmpty mass of empty unit
-- @field #number speedMax istance / Time, --maximal velocity
--- An aircraft descriptor.
-- @type Unit.DescAircraft
-- @extends Unit#Unit.Desc
-- @field #Mass fuelMassMax maximal inner fuel mass
-- @field #Distance range Operational range
-- @field #Distance Hmax Ceiling
-- @field #number VyMax #Distance / #Time, --maximal climb rate
-- @field #number NyMin minimal safe acceleration
-- @field #number NyMax maximal safe acceleration
-- @field #Unit.RefuelingSystem tankerType refueling system type
--- An airplane descriptor.
-- @type Unit.DescAirplane
-- @extends Unit#Unit.DescAircraft
-- @field #number speedMax0 Distance / Time maximal TAS at ground level
-- @field #number speedMax10K Distance / Time maximal TAS at altitude of 10 km
--- A helicopter descriptor.
-- @type Unit.DescHelicopter
-- @extends Unit#Unit.DescAircraft
-- @field #Distance HmaxStat static ceiling
--- A vehicle descriptor.
-- @type Unit.DescVehicle
-- @extends Unit#Unit.Desc
-- @field #Angle maxSlopeAngle maximal slope angle
-- @field #boolean riverCrossing can the vehicle cross a rivers
--- A ship descriptor.
-- @type Unit.DescShip
-- @extends #Unit.Desc
--- ammunition item: "type-count" pair.
-- @type Unit.AmmoItem
-- @field #Weapon.Desc desc ammunition descriptor
-- @field #number count ammunition count
--- A unit sensor.
-- @type Unit.Sensor
-- @field #TypeName typeName
-- @field #Unit.SensorType type
--- An optic sensor.
-- @type Unit.Optic
-- @extends Unit#Unit.Sensor
-- @field #Unit.OpticType opticType
--- A radar.
-- @type Unit.Radar
-- @extends Unit#Unit.Sensor
-- @field #Distance detectionDistanceRBM detection distance for RCS=1m^2 in real-beam mapping mode, nil if radar doesn't support surface/land search
-- @field #Distance detectionDistanceHRM detection distance for RCS=1m^2 in high-resolution mapping mode, nil if radar has no HRM
-- @field #Unit.Radar.detectionDistanceAir detectionDistanceAir detection distance for RCS=1m^2 airborne target, nil if radar doesn't support air search
--- @type Unit.Radar.detectionDistanceAir
-- @field #Unit.Radar.detectionDistanceAir.upperHemisphere upperHemisphere
-- @field #Unit.Radar.detectionDistanceAir.lowerHemisphere lowerHemisphere
--- @type Unit.Radar.detectionDistanceAir.upperHemisphere
-- @field #Distance headOn
-- @field #Distance tailOn
--- @type Unit.Radar.detectionDistanceAir.lowerHemisphere
-- @field #Distance headOn
-- @field #Distance tailOn
--- An IRST.
-- @type Unit#Unit.IRST
-- @extends Unit.Sensor
-- @field #Distance detectionDistanceIdle detection of tail-on target with heat signature = 1 in upper hemisphere, engines are in idle
-- @field #Distance detectionDistanceMaximal ..., engines are in maximal mode
-- @field #Distance detectionDistanceAfterburner ..., engines are in afterburner mode
--- An RWR.
-- @type Unit.RWR
-- @extends Unit#Unit.Sensor
--- table that stores all unit sensors.
-- TODO @type Sensors
--
--- Returns unit object by the name assigned to the unit in Mission Editor. If there is unit with such name or the unit is destroyed the function will return nil. The function provides access to non-activated units too.
-- @function [parent=#Unit] getByName
-- @param #string name
-- @return #Unit
--- Returns if the unit is activated.
-- @function [parent=#Unit] isActive
-- @param #Unit self
-- @return #boolean
--- Returns name of the player that control the unit or nil if the unit is controlled by A.I.
-- @function [parent=#Unit] getPlayerName
-- @param #Unit self
-- @return #string
--- returns the unit's unique identifier.
-- @function [parent=#Unit] getID
-- @param #Unit self
-- @return #Unit.ID
--- Returns the unit's number in the group. The number is the same number the unit has in ME. It may not be changed during the mission. If any unit in the group is destroyed, the numbers of another units will not be changed.
-- @function [parent=#Unit] getNumber
-- @param #Unit self
-- @return #number
--- Returns controller of the unit if it exist and nil otherwise
-- @function [parent=#Unit] getController
-- @param #Unit self
-- @return #Controller
--- Returns the unit's group if it exist and nil otherwise
-- @function [parent=#Unit] getGroup
-- @param #Unit self
-- @return DCSGroup#Group
--- Returns the unit's callsign - the localized string.
-- @function [parent=#Unit] getCallsign
-- @param #Unit self
-- @return #string
--- Returns the unit's health. Dead units has health <= 1.0
-- @function [parent=#Unit] getLife
-- @param #Unit self
-- @return #number
--- returns the unit's initial health.
-- @function [parent=#Unit] getLife0
-- @param #Unit self
-- @return #number
--- Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks. If there are additional fuel tanks the value may be greater than 1.0.
-- @function [parent=#Unit] getFuel
-- @param #Unit self
-- @return #number
--- Returns the unit ammunition.
-- @function [parent=#Unit] getAmmo
-- @param #Unit self
-- @return #Unit.Ammo
--- Returns the unit sensors.
-- @function [parent=#Unit] getSensors
-- @param #Unit self
-- @return #Unit.Sensors
--- Returns true if the unit has specified types of sensors. This function is more preferable than Unit.getSensors() if you don't want to get information about all the unit's sensors, and just want to check if the unit has specified types of sensors.
-- @function [parent=#Unit] hasSensors
-- @param #Unit self
-- @param #Unit.SensorType sensorType (= nil) Sensor type.
-- @param ... Additional parameters.
-- @return #boolean
-- @usage
-- If sensorType is Unit.SensorType.OPTIC, additional parameters are optic sensor types. Following example checks if the unit has LLTV or IR optics:
-- unit:hasSensors(Unit.SensorType.OPTIC, Unit.OpticType.LLTV, Unit.OpticType.IR)
-- If sensorType is Unit.SensorType.RADAR, additional parameters are radar types. Following example checks if the unit has air search radars:
-- unit:hasSensors(Unit.SensorType.RADAR, Unit.RadarType.AS)
-- If no additional parameters are specified the function returns true if the unit has at least one sensor of specified type.
-- If sensor type is not specified the function returns true if the unit has at least one sensor of any type.
--
--- returns two values:
-- First value indicates if at least one of the unit's radar(s) is on.
-- Second value is the object of the radar's interest. Not nil only if at least one radar of the unit is tracking a target.
-- @function [parent=#Unit] getRadar
-- @param #Unit self
-- @return #boolean, Object#Object
--- Returns unit descriptor. Descriptor type depends on unit category.
-- @function [parent=#Unit] getDesc
-- @param #Unit self
-- @return #Unit.Desc
Unit = {} --#Unit

27
DCS/DCSenv.doclua Normal file
View File

@ -0,0 +1,27 @@
-------------------------------------------------------------------------------
-- @module env
--- @type env
--- Add message to simulator log with caption "INFO". Message box is optional.
-- @function [parent=#env] info
-- @field #string message message string to add to log.
-- @field #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
--- Add message to simulator log with caption "WARNING". Message box is optional.
-- @function [parent=#env] warning
-- @field #string message message string to add to log.
-- @field #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
--- Add message to simulator log with caption "ERROR". Message box is optional.
-- @function [parent=#env] error
-- @field #string message message string to add to log.
-- @field #boolean showMessageBox If the parameter is true Message Box will appear. Optional.
--- Enables/disables appearance of message box each time lua error occurs.
-- @function [parent=#env] setErrorMessageBoxEnabled
-- @field #boolean on if true message box appearance is enabled.
env = {} --#env

20
DCS/DCSland.doclua Normal file
View File

@ -0,0 +1,20 @@
-------------------------------------------------------------------------------
-- @module land
--- @type land
-- @field #land.SurfaceType SurfaceType
--- @type land.SurfaceType
-- @field LAND
-- @field SHALLOW_WATER
-- @field WATER
-- @field ROAD
-- @field RUNWAY
--- Returns altitude MSL of the point.
-- @function [parent=#land] getHeight
-- @param #Vec2 point point on the ground.
-- @return DCSTypes#Distance
land = {} --#land

45
DCS/DCStimer.doclua Normal file
View File

@ -0,0 +1,45 @@
-------------------------------------------------------------------------------
-- @module DCStimer
--- @type timer
--- Returns model time in seconds.
-- @function [parent=#timer] getTime
-- @return #Time
--- Returns mission time in seconds.
-- @function [parent=#timer] getAbsTime
-- @return #Time
--- Returns mission start time in seconds.
-- @function [parent=#timer] getTime0
-- @return #Time
--- Schedules function to call at desired model time.
-- Time function FunctionToCall(any argument, Time time)
--
-- ...
--
-- return ...
--
-- end
--
-- Must return model time of next call or nil. Note that the DCS scheduler calls the function in protected mode and any Lua errors in the called function will be trapped and not reported. If the function triggers a Lua error then it will be terminated and not scheduled to run again.
-- @function [parent=#timer] scheduleFunction
-- @param #FunctionToCall functionToCall Lua-function to call. Must have prototype of FunctionToCall.
-- @param functionArgument Function argument of any type to pass to functionToCall.
-- @param #Time time Model time of the function call.
-- @return functionId
--- Re-schedules function to call at another model time.
-- @function [parent=#timer] setFunctionTime
-- @param functionId Lua-function to call. Must have prototype of FunctionToCall.
-- @param #Time time Model time of the function call.
--- Removes the function from schedule.
-- @function [parent=#timer] removeFunction
-- @param functionId Function identifier to remove from schedule
timer = {} --#timer

View File

@ -27,5 +27,6 @@ copy /b ..\Moose\Trace.lua ^
+ ..\Moose\Spawn.lua ^ + ..\Moose\Spawn.lua ^
+ ..\Moose\Movement.lua ^ + ..\Moose\Movement.lua ^
+ ..\Moose\Sead.lua ^ + ..\Moose\Sead.lua ^
+ ..\Moose\Escort.lua ^
Moose_Embedded.lua /y Moose_Embedded.lua /y

File diff suppressed because it is too large Load Diff

BIN
Loaders/MOOSE-Template.miz Normal file

Binary file not shown.

View File

@ -1,11 +1,12 @@
--- BASE The base class for all the classes defined within MOOSE. --- BASE The base class for all the classes defined within MOOSE.
-- @module BASE -- @module Base
-- @author Flightcontrol -- @author Flightcontrol
Include.File( "Routines" ) Include.File( "Routines" )
_TraceOn = true local _TraceOn = true
_TraceClass = { local _TraceLevel = 1
local _TraceClass = {
--DATABASE = true, --DATABASE = true,
--SEAD = true, --SEAD = true,
--DESTROYBASETASK = true, --DESTROYBASETASK = true,
@ -15,13 +16,16 @@ _TraceClass = {
--ZONE = true, --ZONE = true,
--GROUP = true, --GROUP = true,
--UNIT = true, --UNIT = true,
--CLIENT = true, --CLIENT = true,
--CARGO = true, --CARGO = true,
--CARGO_GROUP = true, --CARGO_GROUP = true,
--CARGO_PACKAGE = true, --CARGO_PACKAGE = true,
--CARGO_SLINGLOAD = true, --CARGO_SLINGLOAD = true,
--CARGO_ZONE = true, --CARGO_ZONE = true,
--CLEANUP = true, --CLEANUP = true,
--MENU_CLIENT = true,
--MENU_CLIENT_COMMAND = true,
--ESCORT = true,
} }
--- The BASE Class --- The BASE Class
@ -48,7 +52,6 @@ FORMATION = {
-- @return #BASE -- @return #BASE
-- @usage -- @usage
-- function TASK:New() -- function TASK:New()
-- trace.f(self.ClassName)
-- --
-- local self = BASE:Inherit( self, BASE:New() ) -- local self = BASE:Inherit( self, BASE:New() )
-- --
@ -97,8 +100,31 @@ function BASE:Inherited( Child )
return Parent return Parent
end end
--- Get the ClassName + ClassID of the class instance.
-- The ClassName + ClassID is formatted as '%s#%09d'.
-- @param #BASE self
-- @return #string The ClassName + ClassID of the class instance.
function BASE:GetClassNameAndID()
return string.format( '%s#%09d', self:GetClassName(), self:GetClassID() )
end
--- Get the ClassName of the class instance.
-- @param #BASE self
-- @return #string The ClassName of the class instance.
function BASE:GetClassName()
return self.ClassName
end
--- Get the ClassID of the class instance.
-- @param #BASE self
-- @return #string The ClassID of the class instance.
function BASE:GetClassID()
return self.ClassID
end
function BASE:AddEvent( Event, EventFunction ) function BASE:AddEvent( Event, EventFunction )
trace.f( self.ClassName, Event ) self:F( Event )
self.Events[#self.Events+1] = {} self.Events[#self.Events+1] = {}
self.Events[#self.Events].Event = Event self.Events[#self.Events].Event = Event
@ -110,22 +136,20 @@ end
function BASE:EnableEvents() function BASE:EnableEvents()
trace.f( self.ClassName ) self:F( #self.Events )
trace.i( self.ClassName, #self.Events )
for EventID, Event in pairs( self.Events ) do for EventID, Event in pairs( self.Events ) do
Event.Self = self Event.Self = self
Event.EventEnabled = true Event.EventEnabled = true
end end
--env.info( 'EnableEvent Table Task = ' .. tostring(self) )
self.Events.Handler = world.addEventHandler( self ) self.Events.Handler = world.addEventHandler( self )
return self return self
end end
function BASE:DisableEvents() function BASE:DisableEvents()
trace.f( self.ClassName ) self:F()
world.removeEventHandler( self ) world.removeEventHandler( self )
for EventID, Event in pairs( self.Events ) do for EventID, Event in pairs( self.Events ) do
Event.Self = nil Event.Self = nil
@ -136,7 +160,7 @@ trace.f( self.ClassName )
end end
BaseEventCodes = { local BaseEventCodes = {
"S_EVENT_SHOT", "S_EVENT_SHOT",
"S_EVENT_HIT", "S_EVENT_HIT",
"S_EVENT_TAKEOFF", "S_EVENT_TAKEOFF",
@ -176,7 +200,7 @@ BaseEventCodes = {
function BASE:CreateEventBirth( EventTime, Initiator, IniUnitName, place, subplace ) function BASE:CreateEventBirth( EventTime, Initiator, IniUnitName, place, subplace )
trace.f( self.ClassName, { EventTime, Initiator, IniUnitName, place, subplace } ) self:F( { EventTime, Initiator, IniUnitName, place, subplace } )
local Event = { local Event = {
id = world.event.S_EVENT_BIRTH, id = world.event.S_EVENT_BIRTH,
@ -191,7 +215,7 @@ trace.f( self.ClassName, { EventTime, Initiator, IniUnitName, place, subplace }
end end
function BASE:CreateEventCrash( EventTime, Initiator ) function BASE:CreateEventCrash( EventTime, Initiator )
trace.f( self.ClassName, { EventTime, Initiator } ) self:F( { EventTime, Initiator } )
local Event = { local Event = {
id = world.event.S_EVENT_CRASH, id = world.event.S_EVENT_CRASH,
@ -203,7 +227,6 @@ trace.f( self.ClassName, { EventTime, Initiator } )
end end
function BASE:onEvent(event) function BASE:onEvent(event)
--trace.f(self.ClassName, event )
--env.info( 'onEvent Table self = ' .. tostring(self) ) --env.info( 'onEvent Table self = ' .. tostring(self) )
if self then if self then
@ -220,7 +243,7 @@ function BASE:onEvent(event)
if event.target and event.target:isExist() then if event.target and event.target:isExist() then
event.TgtUnitName = event.target:getName() event.TgtUnitName = event.target:getName()
end end
trace.i( self.ClassName, { BaseEventCodes[event.id], event } ) self:T( { BaseEventCodes[event.id], event } )
EventObject.EventFunction( self, event ) EventObject.EventFunction( self, event )
end end
end end
@ -233,6 +256,45 @@ end
-- Trace section -- Trace section
-- Log a trace (only shown when trace is on) -- Log a trace (only shown when trace is on)
-- TODO: Make trace function using variable parameters.
function BASE:F( Arguments )
if _TraceOn and _TraceClass[self.ClassName] then
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
local DebugInfoFrom = debug.getinfo( 3, "l" )
local Function = "function"
if DebugInfoCurrent.name then
Function = DebugInfoCurrent.name
end
local LineCurrent = DebugInfoCurrent.currentline
local LineFrom = 0
if DebugInfoFrom then
LineFrom = DebugInfoFrom.currentline
end
env.info( string.format( "%6d\(%6d\)/%1s:%20s%05d.%s\(%s\)" , LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) )
end
end
function BASE:F2( Arguments )
if _TraceLevel >= 2 then
self:F( Arguments )
end
end
function BASE:F3( Arguments )
if _TraceLevel >= 3 then
self:F( Arguments )
end
end
function BASE:T( Arguments ) function BASE:T( Arguments )
if _TraceOn and _TraceClass[self.ClassName] then if _TraceOn and _TraceClass[self.ClassName] then
@ -246,12 +308,31 @@ function BASE:T( Arguments )
end end
local LineCurrent = DebugInfoCurrent.currentline local LineCurrent = DebugInfoCurrent.currentline
local LineFrom = DebugInfoFrom.currentline local LineFrom = 0
if DebugInfoFrom then
env.info( string.format( "%6d\(%6d\)/%1s:%20s%05d.%s\(%s\)" , LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) LineFrom = DebugInfoFrom.currentline
end
env.info( string.format( "%6d\(%6d\)/%1s:%20s%05d.%s" , LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) )
end end
end end
function BASE:T2( Arguments )
if _TraceLevel >= 2 then
self:T( Arguments )
end
end
function BASE:T3( Arguments )
if _TraceLevel >= 3 then
self:T( Arguments )
end
end
-- Log an exception -- Log an exception
function BASE:E( Arguments ) function BASE:E( Arguments )
@ -269,3 +350,6 @@ function BASE:E( Arguments )
env.info( string.format( "%6d\(%6d\)/%1s:%20s%05d.%s\(%s\)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) env.info( string.format( "%6d\(%6d\)/%1s:%20s%05d.%s\(%s\)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) )
end end

View File

@ -32,7 +32,7 @@ CARGO_ZONE = {
} }
function CARGO_ZONE:New( CargoZoneName, CargoHostName ) local self = BASE:Inherit( self, BASE:New() ) function CARGO_ZONE:New( CargoZoneName, CargoHostName ) local self = BASE:Inherit( self, BASE:New() )
self:T( { CargoZoneName, CargoHostName } ) self:F( { CargoZoneName, CargoHostName } )
self.CargoZoneName = CargoZoneName self.CargoZoneName = CargoZoneName
self.CargoZone = trigger.misc.getZone( CargoZoneName ) self.CargoZone = trigger.misc.getZone( CargoZoneName )
@ -48,7 +48,7 @@ self:T( { CargoZoneName, CargoHostName } )
end end
function CARGO_ZONE:Spawn() function CARGO_ZONE:Spawn()
self:T( self.CargoHostName ) self:F( self.CargoHostName )
if self.CargoHostSpawn then if self.CargoHostSpawn then
local CargoHostGroup = self.CargoHostSpawn:GetGroupFromIndex() local CargoHostGroup = self.CargoHostSpawn:GetGroupFromIndex()
@ -66,7 +66,7 @@ function CARGO_ZONE:Spawn()
end end
function CARGO_ZONE:GetHostUnit() function CARGO_ZONE:GetHostUnit()
self:T( self ) self:F( self )
if self.CargoHostName then if self.CargoHostName then
@ -86,7 +86,7 @@ function CARGO_ZONE:GetHostUnit()
end end
function CARGO_ZONE:ReportCargosToClient( Client, CargoType ) function CARGO_ZONE:ReportCargosToClient( Client, CargoType )
self:T() self:F()
local SignalUnit = self:GetHostUnit() local SignalUnit = self:GetHostUnit()
@ -115,7 +115,7 @@ self:T()
end end
function CARGO_ZONE:Signal() function CARGO_ZONE:Signal()
self:T() self:F()
local Signalled = false local Signalled = false
@ -169,7 +169,7 @@ self:T()
end end
function CARGO_ZONE:WhiteSmoke() function CARGO_ZONE:WhiteSmoke()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.WHITE self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.WHITE
@ -178,7 +178,7 @@ self:T()
end end
function CARGO_ZONE:BlueSmoke() function CARGO_ZONE:BlueSmoke()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.BLUE self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.BLUE
@ -187,7 +187,7 @@ self:T()
end end
function CARGO_ZONE:RedSmoke() function CARGO_ZONE:RedSmoke()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.RED self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.RED
@ -196,7 +196,7 @@ self:T()
end end
function CARGO_ZONE:OrangeSmoke() function CARGO_ZONE:OrangeSmoke()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.ORANGE self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.ORANGE
@ -205,7 +205,7 @@ self:T()
end end
function CARGO_ZONE:GreenSmoke() function CARGO_ZONE:GreenSmoke()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.SMOKE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.GREEN self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.GREEN
@ -215,7 +215,7 @@ end
function CARGO_ZONE:WhiteFlare() function CARGO_ZONE:WhiteFlare()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.WHITE self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.WHITE
@ -224,7 +224,7 @@ self:T()
end end
function CARGO_ZONE:RedFlare() function CARGO_ZONE:RedFlare()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.RED self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.RED
@ -233,7 +233,7 @@ self:T()
end end
function CARGO_ZONE:GreenFlare() function CARGO_ZONE:GreenFlare()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.GREEN self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.GREEN
@ -242,7 +242,7 @@ self:T()
end end
function CARGO_ZONE:YellowFlare() function CARGO_ZONE:YellowFlare()
self:T() self:F()
self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE self.SignalType = CARGO_ZONE.SIGNAL.TYPE.FLARE
self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.YELLOW self.SignalColor = CARGO_ZONE.SIGNAL.COLOR.YELLOW
@ -252,7 +252,7 @@ end
function CARGO_ZONE:GetCargoHostUnit() function CARGO_ZONE:GetCargoHostUnit()
self:T( self ) self:F( self )
if self.CargoHostSpawn then if self.CargoHostSpawn then
local CargoHostGroup = self.CargoHostSpawn:GetGroupFromIndex(1) local CargoHostGroup = self.CargoHostSpawn:GetGroupFromIndex(1)
@ -268,7 +268,7 @@ function CARGO_ZONE:GetCargoHostUnit()
end end
function CARGO_ZONE:GetCargoZoneName() function CARGO_ZONE:GetCargoZoneName()
self:T() self:F()
return self.CargoZoneName return self.CargoZoneName
end end
@ -286,7 +286,7 @@ CARGO = {
--- Add Cargo to the mission... Cargo functionality needs to be reworked a bit, so this is still under construction. I need to make a CARGO Class... --- Add Cargo to the mission... Cargo functionality needs to be reworked a bit, so this is still under construction. I need to make a CARGO Class...
function CARGO:New( CargoType, CargoName, CargoWeight ) local self = BASE:Inherit( self, BASE:New() ) function CARGO:New( CargoType, CargoName, CargoWeight ) local self = BASE:Inherit( self, BASE:New() )
self:T( { CargoType, CargoName, CargoWeight } ) self:F( { CargoType, CargoName, CargoWeight } )
self.CargoType = CargoType self.CargoType = CargoType
@ -299,14 +299,14 @@ self:T( { CargoType, CargoName, CargoWeight } )
end end
function CARGO:Spawn( Client ) function CARGO:Spawn( Client )
self:T() self:F()
return self return self
end end
function CARGO:IsNear( Client, LandingZone ) function CARGO:IsNear( Client, LandingZone )
self:T() self:F()
local Near = true local Near = true
@ -316,7 +316,7 @@ end
function CARGO:IsLoadingToClient() function CARGO:IsLoadingToClient()
self:T() self:F()
if self:IsStatusLoading() then if self:IsStatusLoading() then
return self.CargoClient return self.CargoClient
@ -328,7 +328,7 @@ end
function CARGO:IsLoadedInClient() function CARGO:IsLoadedInClient()
self:T() self:F()
if self:IsStatusLoaded() then if self:IsStatusLoaded() then
return self.CargoClient return self.CargoClient
@ -340,7 +340,7 @@ end
function CARGO:UnLoad( Client, TargetZoneName ) function CARGO:UnLoad( Client, TargetZoneName )
self:T() self:F()
self:StatusUnLoaded() self:StatusUnLoaded()
@ -348,7 +348,7 @@ self:T()
end end
function CARGO:OnBoard( Client, LandingZone ) function CARGO:OnBoard( Client, LandingZone )
self:T() self:F()
local Valid = true local Valid = true
@ -359,7 +359,7 @@ self:T()
end end
function CARGO:OnBoarded( Client, LandingZone ) function CARGO:OnBoarded( Client, LandingZone )
self:T() self:F()
local OnBoarded = true local OnBoarded = true
@ -367,7 +367,7 @@ self:T()
end end
function CARGO:Load( Client ) function CARGO:Load( Client )
self:T() self:F()
self:StatusLoaded( Client ) self:StatusLoaded( Client )
@ -375,18 +375,18 @@ self:T()
end end
function CARGO:IsLandingRequired() function CARGO:IsLandingRequired()
self:T() self:F()
return true return true
end end
function CARGO:IsSlingLoad() function CARGO:IsSlingLoad()
self:T() self:F()
return false return false
end end
function CARGO:StatusNone() function CARGO:StatusNone()
self:T() self:F()
self.CargoClient = nil self.CargoClient = nil
self.CargoStatus = CARGO.STATUS.NONE self.CargoStatus = CARGO.STATUS.NONE
@ -395,7 +395,7 @@ self:T()
end end
function CARGO:StatusLoading( Client ) function CARGO:StatusLoading( Client )
self:T() self:F()
self.CargoClient = Client self.CargoClient = Client
self.CargoStatus = CARGO.STATUS.LOADING self.CargoStatus = CARGO.STATUS.LOADING
@ -405,7 +405,7 @@ self:T()
end end
function CARGO:StatusLoaded( Client ) function CARGO:StatusLoaded( Client )
self:T() self:F()
self.CargoClient = Client self.CargoClient = Client
self.CargoStatus = CARGO.STATUS.LOADED self.CargoStatus = CARGO.STATUS.LOADED
@ -415,7 +415,7 @@ self:T()
end end
function CARGO:StatusUnLoaded() function CARGO:StatusUnLoaded()
self:T() self:F()
self.CargoClient = nil self.CargoClient = nil
self.CargoStatus = CARGO.STATUS.UNLOADED self.CargoStatus = CARGO.STATUS.UNLOADED
@ -425,25 +425,25 @@ end
function CARGO:IsStatusNone() function CARGO:IsStatusNone()
self:T() self:F()
return self.CargoStatus == CARGO.STATUS.NONE return self.CargoStatus == CARGO.STATUS.NONE
end end
function CARGO:IsStatusLoading() function CARGO:IsStatusLoading()
self:T() self:F()
return self.CargoStatus == CARGO.STATUS.LOADING return self.CargoStatus == CARGO.STATUS.LOADING
end end
function CARGO:IsStatusLoaded() function CARGO:IsStatusLoaded()
self:T() self:F()
return self.CargoStatus == CARGO.STATUS.LOADED return self.CargoStatus == CARGO.STATUS.LOADED
end end
function CARGO:IsStatusUnLoaded() function CARGO:IsStatusUnLoaded()
self:T() self:F()
return self.CargoStatus == CARGO.STATUS.UNLOADED return self.CargoStatus == CARGO.STATUS.UNLOADED
end end
@ -455,7 +455,7 @@ CARGO_GROUP = {
function CARGO_GROUP:New( CargoType, CargoName, CargoWeight, CargoGroupTemplate, CargoZone ) local self = BASE:Inherit( self, CARGO:New( CargoType, CargoName, CargoWeight ) ) function CARGO_GROUP:New( CargoType, CargoName, CargoWeight, CargoGroupTemplate, CargoZone ) local self = BASE:Inherit( self, CARGO:New( CargoType, CargoName, CargoWeight ) )
self:T( { CargoType, CargoName, CargoWeight, CargoGroupTemplate, CargoZone } ) self:F( { CargoType, CargoName, CargoWeight, CargoGroupTemplate, CargoZone } )
self.CargoSpawn = SPAWN:NewWithAlias( CargoGroupTemplate, CargoName ) self.CargoSpawn = SPAWN:NewWithAlias( CargoGroupTemplate, CargoName )
self.CargoZone = CargoZone self.CargoZone = CargoZone
@ -467,7 +467,7 @@ function CARGO_GROUP:New( CargoType, CargoName, CargoWeight, CargoGroupTemplate,
end end
function CARGO_GROUP:Spawn( Client ) function CARGO_GROUP:Spawn( Client )
self:T( { Client } ) self:F( { Client } )
local SpawnCargo = true local SpawnCargo = true
@ -480,7 +480,7 @@ function CARGO_GROUP:Spawn( Client )
elseif self:IsStatusLoading() then elseif self:IsStatusLoading() then
local Client = self:IsLoadingToClient() local Client = self:IsLoadingToClient()
if Client and Client:ClientGroup() then if Client and Client:GetDCSGroup() then
SpawnCargo = false SpawnCargo = false
else else
local CargoGroup = Group.getByName( self.CargoName ) local CargoGroup = Group.getByName( self.CargoName )
@ -494,7 +494,7 @@ function CARGO_GROUP:Spawn( Client )
local ClientLoaded = self:IsLoadedInClient() local ClientLoaded = self:IsLoadedInClient()
-- Now test if another Client is alive (not this one), and it has the CARGO, then this cargo does not need to be initialized and spawned. -- Now test if another Client is alive (not this one), and it has the CARGO, then this cargo does not need to be initialized and spawned.
if ClientLoaded and ClientLoaded ~= Client then if ClientLoaded and ClientLoaded ~= Client then
local ClientGroup = Client:ClientGroup() local ClientGroup = Client:GetDCSGroup()
if ClientLoaded:GetClientGroupDCSUnit() and ClientLoaded:GetClientGroupDCSUnit():isExist() then if ClientLoaded:GetClientGroupDCSUnit() and ClientLoaded:GetClientGroupDCSUnit():isExist() then
SpawnCargo = false SpawnCargo = false
else else
@ -528,7 +528,7 @@ function CARGO_GROUP:Spawn( Client )
end end
function CARGO_GROUP:IsNear( Client, LandingZone ) function CARGO_GROUP:IsNear( Client, LandingZone )
self:T() self:F()
local Near = false local Near = false
@ -545,7 +545,7 @@ end
function CARGO_GROUP:OnBoard( Client, LandingZone, OnBoardSide ) function CARGO_GROUP:OnBoard( Client, LandingZone, OnBoardSide )
self:T() self:F()
local Valid = true local Valid = true
@ -624,7 +624,7 @@ end
function CARGO_GROUP:OnBoarded( Client, LandingZone ) function CARGO_GROUP:OnBoarded( Client, LandingZone )
self:T() self:F()
local OnBoarded = false local OnBoarded = false
@ -640,7 +640,7 @@ end
function CARGO_GROUP:UnLoad( Client, TargetZoneName ) function CARGO_GROUP:UnLoad( Client, TargetZoneName )
self:T() self:F()
self:T( 'self.CargoName = ' .. self.CargoName ) self:T( 'self.CargoName = ' .. self.CargoName )
@ -663,8 +663,7 @@ CARGO_PACKAGE = {
function CARGO_PACKAGE:New( CargoType, CargoName, CargoWeight, CargoClient ) local self = BASE:Inherit( self, CARGO:New( CargoType, CargoName, CargoWeight ) ) function CARGO_PACKAGE:New( CargoType, CargoName, CargoWeight, CargoClient ) local self = BASE:Inherit( self, CARGO:New( CargoType, CargoName, CargoWeight ) )
self:F( { CargoType, CargoName, CargoWeight, CargoClient } )
self:T( { CargoType, CargoName, CargoWeight, CargoClient } )
self.CargoClient = CargoClient self.CargoClient = CargoClient
@ -676,11 +675,11 @@ end
function CARGO_PACKAGE:Spawn( Client ) function CARGO_PACKAGE:Spawn( Client )
self:T( { self, Client } ) self:F( { self, Client } )
-- this needs to be checked thoroughly -- this needs to be checked thoroughly
local CargoClientGroup = self.CargoClient:ClientGroup() local CargoClientGroup = self.CargoClient:GetDCSGroup()
if not CargoClientGroup then if not CargoClientGroup then
if not self.CargoClientSpawn then if not self.CargoClientSpawn then
self.CargoClientSpawn = SPAWN:New( self.CargoClient:GetClientGroupName() ):Limit( 1, 1 ) self.CargoClientSpawn = SPAWN:New( self.CargoClient:GetClientGroupName() ):Limit( 1, 1 )
@ -695,7 +694,7 @@ function CARGO_PACKAGE:Spawn( Client )
elseif self:IsStatusLoading() or self:IsStatusLoaded() then elseif self:IsStatusLoading() or self:IsStatusLoaded() then
local CargoClientLoaded = self:IsLoadedInClient() local CargoClientLoaded = self:IsLoadedInClient()
if CargoClientLoaded and CargoClientLoaded:ClientGroup() then if CargoClientLoaded and CargoClientLoaded:GetDCSGroup() then
SpawnCargo = false SpawnCargo = false
end end
@ -716,11 +715,11 @@ end
function CARGO_PACKAGE:IsNear( Client, LandingZone ) function CARGO_PACKAGE:IsNear( Client, LandingZone )
self:T() self:F()
local Near = false local Near = false
if self.CargoClient and self.CargoClient:ClientGroup() then if self.CargoClient and self.CargoClient:GetDCSGroup() then
self:T( self.CargoClient.ClientName ) self:T( self.CargoClient.ClientName )
self:T( 'Client Exists.' ) self:T( 'Client Exists.' )
@ -735,7 +734,7 @@ end
function CARGO_PACKAGE:OnBoard( Client, LandingZone, OnBoardSide ) function CARGO_PACKAGE:OnBoard( Client, LandingZone, OnBoardSide )
self:T() self:F()
local Valid = true local Valid = true
@ -746,8 +745,8 @@ self:T()
local CarrierPosOnBoard = ClientUnit:getPoint() local CarrierPosOnBoard = ClientUnit:getPoint()
local CarrierPosMoveAway = ClientUnit:getPoint() local CarrierPosMoveAway = ClientUnit:getPoint()
local CargoHostGroup = self.CargoClient:ClientGroup() local CargoHostGroup = self.CargoClient:GetDCSGroup()
local CargoHostName = self.CargoClient:ClientGroup():getName() local CargoHostName = self.CargoClient:GetDCSGroup():getName()
local CargoHostUnits = CargoHostGroup:getUnits() local CargoHostUnits = CargoHostGroup:getUnits()
local CargoPos = CargoHostUnits[1]:getPoint() local CargoPos = CargoHostUnits[1]:getPoint()
@ -826,11 +825,11 @@ end
function CARGO_PACKAGE:OnBoarded( Client, LandingZone ) function CARGO_PACKAGE:OnBoarded( Client, LandingZone )
self:T() self:F()
local OnBoarded = false local OnBoarded = false
if self.CargoClient and self.CargoClient:ClientGroup() then if self.CargoClient and self.CargoClient:GetDCSGroup() then
if routines.IsUnitInRadius( self.CargoClient:GetClientGroupDCSUnit(), self.CargoClient:ClientPosition(), 10 ) then if routines.IsUnitInRadius( self.CargoClient:GetClientGroupDCSUnit(), self.CargoClient:ClientPosition(), 10 ) then
-- Switch Cargo from self.CargoClient to Client ... Each cargo can have only one client. So assigning the new client for the cargo is enough. -- Switch Cargo from self.CargoClient to Client ... Each cargo can have only one client. So assigning the new client for the cargo is enough.
@ -846,12 +845,12 @@ end
function CARGO_PACKAGE:UnLoad( Client, TargetZoneName ) function CARGO_PACKAGE:UnLoad( Client, TargetZoneName )
self:T() self:F()
self:T( 'self.CargoName = ' .. self.CargoName ) self:T( 'self.CargoName = ' .. self.CargoName )
--self:T( 'self.CargoHostName = ' .. self.CargoHostName ) --self:T( 'self.CargoHostName = ' .. self.CargoHostName )
--self.CargoSpawn:FromCarrier( Client:ClientGroup(), TargetZoneName, self.CargoHostName ) --self.CargoSpawn:FromCarrier( Client:GetDCSGroup(), TargetZoneName, self.CargoHostName )
self:StatusUnLoaded() self:StatusUnLoaded()
return Cargo return Cargo
@ -865,8 +864,7 @@ CARGO_SLINGLOAD = {
function CARGO_SLINGLOAD:New( CargoType, CargoName, CargoWeight, CargoZone, CargoHostName, CargoCountryID ) function CARGO_SLINGLOAD:New( CargoType, CargoName, CargoWeight, CargoZone, CargoHostName, CargoCountryID )
local self = BASE:Inherit( self, CARGO:New( CargoType, CargoName, CargoWeight ) ) local self = BASE:Inherit( self, CARGO:New( CargoType, CargoName, CargoWeight ) )
self:F( { CargoType, CargoName, CargoWeight, CargoZone, CargoHostName, CargoCountryID } )
self:T( { CargoType, CargoName, CargoWeight, CargoZone, CargoHostName, CargoCountryID } )
self.CargoHostName = CargoHostName self.CargoHostName = CargoHostName
@ -887,19 +885,19 @@ end
function CARGO_SLINGLOAD:IsLandingRequired() function CARGO_SLINGLOAD:IsLandingRequired()
self:T() self:F()
return false return false
end end
function CARGO_SLINGLOAD:IsSlingLoad() function CARGO_SLINGLOAD:IsSlingLoad()
self:T() self:F()
return true return true
end end
function CARGO_SLINGLOAD:Spawn( Client ) function CARGO_SLINGLOAD:Spawn( Client )
self:T( { self, Client } ) self:F( { self, Client } )
local Zone = trigger.misc.getZone( self.CargoZone ) local Zone = trigger.misc.getZone( self.CargoZone )
@ -949,7 +947,7 @@ end
function CARGO_SLINGLOAD:IsNear( Client, LandingZone ) function CARGO_SLINGLOAD:IsNear( Client, LandingZone )
self:T() self:F()
local Near = false local Near = false
@ -958,7 +956,7 @@ end
function CARGO_SLINGLOAD:IsInLandingZone( Client, LandingZone ) function CARGO_SLINGLOAD:IsInLandingZone( Client, LandingZone )
self:T() self:F()
local Near = false local Near = false
@ -974,7 +972,7 @@ end
function CARGO_SLINGLOAD:OnBoard( Client, LandingZone, OnBoardSide ) function CARGO_SLINGLOAD:OnBoard( Client, LandingZone, OnBoardSide )
self:T() self:F()
local Valid = true local Valid = true
@ -984,7 +982,7 @@ end
function CARGO_SLINGLOAD:OnBoarded( Client, LandingZone ) function CARGO_SLINGLOAD:OnBoarded( Client, LandingZone )
self:T() self:F()
local OnBoarded = false local OnBoarded = false
@ -1000,7 +998,7 @@ end
function CARGO_SLINGLOAD:UnLoad( Client, TargetZoneName ) function CARGO_SLINGLOAD:UnLoad( Client, TargetZoneName )
self:T() self:F()
self:T( 'self.CargoName = ' .. self.CargoName ) self:T( 'self.CargoName = ' .. self.CargoName )
self:T( 'self.CargoGroupName = ' .. self.CargoGroupName ) self:T( 'self.CargoGroupName = ' .. self.CargoGroupName )

View File

@ -28,7 +28,7 @@ CLEANUP = {
-- CleanUpTbilisi = CLEANUP:New( 'CLEAN Tbilisi', 150 ) -- CleanUpTbilisi = CLEANUP:New( 'CLEAN Tbilisi', 150 )
-- CleanUpKutaisi = CLEANUP:New( 'CLEAN Kutaisi', 600 ) -- CleanUpKutaisi = CLEANUP:New( 'CLEAN Kutaisi', 600 )
function CLEANUP:New( ZoneNames, TimeInterval ) local self = BASE:Inherit( self, BASE:New() ) function CLEANUP:New( ZoneNames, TimeInterval ) local self = BASE:Inherit( self, BASE:New() )
self:T( { ZoneNames, TimeInterval } ) self:F( { ZoneNames, TimeInterval } )
if type( ZoneNames ) == 'table' then if type( ZoneNames ) == 'table' then
self.ZoneNames = ZoneNames self.ZoneNames = ZoneNames
@ -57,7 +57,7 @@ end
--- Destroys a group from the simulator, but checks first if it is still existing! --- Destroys a group from the simulator, but checks first if it is still existing!
-- @see CLEANUP -- @see CLEANUP
function CLEANUP:_DestroyGroup( GroupObject, CleanUpGroupName ) function CLEANUP:_DestroyGroup( GroupObject, CleanUpGroupName )
self:T( { GroupObject, CleanUpGroupName } ) self:F( { GroupObject, CleanUpGroupName } )
if GroupObject then -- and GroupObject:isExist() then if GroupObject then -- and GroupObject:isExist() then
--MESSAGE:New( "Destroy Group " .. CleanUpGroupName, CleanUpGroupName, 1, CleanUpGroupName ):ToAll() --MESSAGE:New( "Destroy Group " .. CleanUpGroupName, CleanUpGroupName, 1, CleanUpGroupName ):ToAll()
@ -69,7 +69,7 @@ end
--- Destroys a unit from the simulator, but checks first if it is still existing! --- Destroys a unit from the simulator, but checks first if it is still existing!
-- @see CLEANUP -- @see CLEANUP
function CLEANUP:_DestroyUnit( CleanUpUnit, CleanUpUnitName ) function CLEANUP:_DestroyUnit( CleanUpUnit, CleanUpUnitName )
self:T( { CleanUpUnit, CleanUpUnitName } ) self:F( { CleanUpUnit, CleanUpUnitName } )
if CleanUpUnit then if CleanUpUnit then
--MESSAGE:New( "Destroy " .. CleanUpUnitName, CleanUpUnitName, 1, CleanUpUnitName ):ToAll() --MESSAGE:New( "Destroy " .. CleanUpUnitName, CleanUpUnitName, 1, CleanUpUnitName ):ToAll()
@ -96,7 +96,7 @@ end
--- Destroys a missile from the simulator, but checks first if it is still existing! --- Destroys a missile from the simulator, but checks first if it is still existing!
-- @see CLEANUP -- @see CLEANUP
function CLEANUP:_DestroyMissile( MissileObject ) function CLEANUP:_DestroyMissile( MissileObject )
self:T( { MissileObject } ) self:F( { MissileObject } )
if MissileObject and MissileObject:isExist() then if MissileObject and MissileObject:isExist() then
MissileObject:destroy() MissileObject:destroy()
@ -107,7 +107,7 @@ end
--- Detects if an SA site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME. --- Detects if an SA site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME.
-- @see CLEANUP -- @see CLEANUP
function CLEANUP:_EventCrash( event ) function CLEANUP:_EventCrash( event )
self:T( { event } ) self:F( { event } )
--MESSAGE:New( "Crash ", "Crash", 10, "Crash" ):ToAll() --MESSAGE:New( "Crash ", "Crash", 10, "Crash" ):ToAll()
-- self:T("before getGroup") -- self:T("before getGroup")
@ -137,7 +137,7 @@ end
--- Detects if an SA site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME. --- Detects if an SA site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME.
-- @see CLEANUP -- @see CLEANUP
function CLEANUP:_EventShot( event ) function CLEANUP:_EventShot( event )
self:T( { event } ) self:F( { event } )
local _grp = Unit.getGroup(event.initiator)-- Identify the group that fired local _grp = Unit.getGroup(event.initiator)-- Identify the group that fired
local _groupname = _grp:getName() -- return the name of the group local _groupname = _grp:getName() -- return the name of the group
@ -161,7 +161,7 @@ end
--- Detects if the Unit has an S_EVENT_HIT within the given ZoneNames. If this is the case, destroy the unit. --- Detects if the Unit has an S_EVENT_HIT within the given ZoneNames. If this is the case, destroy the unit.
function CLEANUP:_EventHitCleanUp( event ) function CLEANUP:_EventHitCleanUp( event )
self:T( { event } ) self:F( { event } )
local CleanUpUnit = event.initiator -- the Unit local CleanUpUnit = event.initiator -- the Unit
if CleanUpUnit and CleanUpUnit:isExist() and Object.getCategory(CleanUpUnit) == Object.Category.UNIT then if CleanUpUnit and CleanUpUnit:isExist() and Object.getCategory(CleanUpUnit) == Object.Category.UNIT then
@ -195,7 +195,7 @@ function CLEANUP:_EventHitCleanUp( event )
end end
function CLEANUP:_AddForCleanUp( CleanUpUnit, CleanUpUnitName ) function CLEANUP:_AddForCleanUp( CleanUpUnit, CleanUpUnitName )
self:T( { CleanUpUnit, CleanUpUnitName } ) self:F( { CleanUpUnit, CleanUpUnitName } )
self.CleanUpList[CleanUpUnitName] = {} self.CleanUpList[CleanUpUnitName] = {}
self.CleanUpList[CleanUpUnitName].CleanUpUnit = CleanUpUnit self.CleanUpList[CleanUpUnitName].CleanUpUnit = CleanUpUnit
@ -244,7 +244,7 @@ CleanUpSurfaceTypeText = {
--- At the defined time interval, CleanUp the Groups within the CleanUpList. --- At the defined time interval, CleanUp the Groups within the CleanUpList.
function CLEANUP:_Scheduler() function CLEANUP:_Scheduler()
self:T( "CleanUp Scheduler" ) self:F( "CleanUp Scheduler" )
for CleanUpUnitName, UnitData in pairs( self.CleanUpList ) do for CleanUpUnitName, UnitData in pairs( self.CleanUpList ) do

View File

@ -1,5 +1,6 @@
--- CLIENT Classes --- CLIENT Classes
-- @module CLIENT -- @module Client
-- @author FlightControl
Include.File( "Routines" ) Include.File( "Routines" )
Include.File( "Base" ) Include.File( "Base" )
@ -11,6 +12,7 @@ Include.File( "Message" )
--- The CLIENT class --- The CLIENT class
-- @type CLIENT -- @type CLIENT
-- @extends Base#BASE
CLIENT = { CLIENT = {
ONBOARDSIDE = { ONBOARDSIDE = {
NONE = 0, NONE = 0,
@ -32,9 +34,10 @@ CLIENT = {
--- Use this method to register new Clients within the MOF. --- Use this method to register new Clients within the MOF.
-- @param string ClientName Name of the Group as defined within the Mission Editor. The Group must have a Unit with the type Client. -- @param #CLIENT self
-- @param string ClientBriefing Text that describes the briefing of the mission when a Player logs into the Client. -- @param #string ClientName Name of the Group as defined within the Mission Editor. The Group must have a Unit with the type Client.
-- @return CLIENT -- @param #string ClientBriefing Text that describes the briefing of the mission when a Player logs into the Client.
-- @return #CLIENT
-- @usage -- @usage
-- -- Create new Clients. -- -- Create new Clients.
-- local Mission = MISSIONSCHEDULER.AddMission( 'Russia Transport Troops SA-6', 'Operational', 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 'Russia' ) -- local Mission = MISSIONSCHEDULER.AddMission( 'Russia Transport Troops SA-6', 'Operational', 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 'Russia' )
@ -46,7 +49,7 @@ CLIENT = {
-- Mission:AddClient( CLIENT:New( 'RU MI-8MTV2*RAMP-Deploy Troops 4' ):Transport() ) -- Mission:AddClient( CLIENT:New( 'RU MI-8MTV2*RAMP-Deploy Troops 4' ):Transport() )
function CLIENT:New( ClientName, ClientBriefing ) function CLIENT:New( ClientName, ClientBriefing )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T() self:F( ClientName, ClientBriefing )
self.ClientName = ClientName self.ClientName = ClientName
self:AddBriefing( ClientBriefing ) self:AddBriefing( ClientBriefing )
@ -58,15 +61,63 @@ end
--- Resets a CLIENT. --- Resets a CLIENT.
-- @param string ClientName Name of the Group as defined within the Mission Editor. The Group must have a Unit with the type Client. -- @param string ClientName Name of the Group as defined within the Mission Editor. The Group must have a Unit with the type Client.
function CLIENT:Reset( ClientName ) function CLIENT:Reset( ClientName )
self:T() self:F()
self._Menus = {} self._Menus = {}
end end
--- ClientGroup returns the Group of a Client. --- Checks for a client alive event and calls a function on a continuous basis.
-- @param #CLIENT self
-- @param #function CallBack Function.
function CLIENT:Alive( CallBack )
self:F()
self.ClientAlive2 = false
self.ClientCallBack = CallBack
self.AliveCheckFunction = routines.scheduleFunction( self._AliveCheckCallBack, { self }, timer.getTime() + 1, 5 )
return self
end
--- Checks if client is alive and returns true or false.
-- @param #CLIENT self
-- @param #boolean Returns true if client is alive.
function CLIENT:IsAlive()
self:F( self.ClientName )
local ClientDCSGroup = self:GetDCSGroup()
if ClientDCSGroup then
self:T("true")
return true
end
self:T( "false" )
return false
end
--- @param #CLIENT self
function CLIENT:_AliveCheckCallBack()
self:F( { self.ClientName, self.ClientAlive2 } )
if self:IsAlive() then
if self.ClientAlive2 == false then
self:T("Calling Callback function")
self.ClientCallBack( self )
self.ClientAlive2 = true
end
else
if self.ClientAlive2 == true then
self.ClientAlive2 = false
end
end
end
--- Return the DCSGroup of a Client.
-- This function is modified to deal with a couple of bugs in DCS 1.5.3 -- This function is modified to deal with a couple of bugs in DCS 1.5.3
-- @return Group -- @return DCSGroup#Group
function CLIENT:ClientGroup() function CLIENT:GetDCSGroup()
--self:T() self:F3()
-- local ClientData = Group.getByName( self.ClientName ) -- local ClientData = Group.getByName( self.ClientName )
-- if ClientData and ClientData:isExist() then -- if ClientData and ClientData:isExist() then
@ -78,33 +129,33 @@ function CLIENT:ClientGroup()
local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) } local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) }
for CoalitionId, CoalitionData in pairs( CoalitionsData ) do for CoalitionId, CoalitionData in pairs( CoalitionsData ) do
--self:T( { "CoalitionData:", CoalitionData } ) self:T3( { "CoalitionData:", CoalitionData } )
for UnitId, UnitData in pairs( CoalitionData ) do for UnitId, UnitData in pairs( CoalitionData ) do
--self:T( { "UnitData:", UnitData } ) self:T3( { "UnitData:", UnitData } )
if UnitData and UnitData:isExist() then if UnitData and UnitData:isExist() then
local ClientGroup = Group.getByName( self.ClientName ) local ClientGroup = Group.getByName( self.ClientName )
if ClientGroup then if ClientGroup then
self:T( "ClientGroup = " .. self.ClientName ) self:T3( "ClientGroup = " .. self.ClientName )
if ClientGroup:isExist() then if ClientGroup:isExist() then
if ClientGroup:getID() == UnitData:getGroup():getID() then if ClientGroup:getID() == UnitData:getGroup():getID() then
self:T( "Normal logic" ) self:T3( "Normal logic" )
self:T( self.ClientName .. " : group found!" ) self:T3( self.ClientName .. " : group found!" )
return ClientGroup return ClientGroup
end end
else else
-- Now we need to resolve the bugs in DCS 1.5 ... -- Now we need to resolve the bugs in DCS 1.5 ...
-- Consult the database for the units of the Client Group. (ClientGroup:getUnits() returns nil) -- Consult the database for the units of the Client Group. (ClientGroup:getUnits() returns nil)
self:T( "Bug 1.5 logic" ) self:T3( "Bug 1.5 logic" )
local ClientUnits = _Database.Groups[self.ClientName].Units local ClientUnits = _Database.Groups[self.ClientName].Units
self:T( { ClientUnits[1].name, env.getValueDictByKey(ClientUnits[1].name) } ) self:T3( { ClientUnits[1].name, env.getValueDictByKey(ClientUnits[1].name) } )
for ClientUnitID, ClientUnitData in pairs( ClientUnits ) do for ClientUnitID, ClientUnitData in pairs( ClientUnits ) do
self:T( { tonumber(UnitData:getID()), ClientUnitData.unitId } ) self:T3( { tonumber(UnitData:getID()), ClientUnitData.unitId } )
if tonumber(UnitData:getID()) == ClientUnitData.unitId then if tonumber(UnitData:getID()) == ClientUnitData.unitId then
local ClientGroupTemplate = _Database.Groups[self.ClientName].Template local ClientGroupTemplate = _Database.Groups[self.ClientName].Template
self.ClientGroupID = ClientGroupTemplate.groupId self.ClientID = ClientGroupTemplate.groupId
self.ClientGroupUnit = UnitData self.ClientGroupUnit = UnitData
self:T( self.ClientName .. " : group found in bug 1.5 resolvement logic!" ) self:T3( self.ClientName .. " : group found in bug 1.5 resolvement logic!" )
return ClientGroup return ClientGroup
end end
end end
@ -119,10 +170,10 @@ function CLIENT:ClientGroup()
-- For non player clients -- For non player clients
local ClientGroup = Group.getByName( self.ClientName ) local ClientGroup = Group.getByName( self.ClientName )
if ClientGroup then if ClientGroup then
self:T( "ClientGroup = " .. self.ClientName ) self:T3( "ClientGroup = " .. self.ClientName )
if ClientGroup:isExist() then if ClientGroup:isExist() then
self:T( "Normal logic" ) self:T3( "Normal logic" )
self:T( self.ClientName .. " : group found!" ) self:T3( self.ClientName .. " : group found!" )
return ClientGroup return ClientGroup
end end
end end
@ -135,87 +186,97 @@ end
function CLIENT:GetClientGroupID() function CLIENT:GetClientGroupID()
self:T()
ClientGroup = self:ClientGroup()
if not self.ClientGroupID then
if ClientGroup then local ClientGroup = self:GetDCSGroup()
if ClientGroup:isExist() then if ClientGroup and ClientGroup:isExist() then
return ClientGroup:getID() self.ClientGroupID = ClientGroup:getID()
else else
return self.ClientGroupID self.ClientGroupID = self.ClientID
end end
end end
return nil self:T( self.ClientGroupID )
return self.ClientGroupID
end end
function CLIENT:GetClientGroupName() function CLIENT:GetClientGroupName()
self:T()
ClientGroup = self:ClientGroup() if not self.ClientGroupName then
local ClientGroup = self:GetDCSGroup()
if ClientGroup then if ClientGroup and ClientGroup:isExist() then
if ClientGroup:isExist() then self.ClientGroupName = ClientGroup:getName()
self:T( ClientGroup:getName() ) else
return ClientGroup:getName() self.ClientGroupName = self.ClientName
else end
self:T( self.ClientName ) end
return self.ClientName
end self:T( self.ClientGroupName )
end return self.ClientGroupName
return nil
end end
--- Returns the Unit of the @{CLIENT}. --- Returns the Unit of the @{CLIENT}.
-- @return Unit -- @return Unit#UNIT
function CLIENT:GetClientGroupUnit() function CLIENT:GetClientGroupUnit()
self:T() self:F()
local ClientGroup = self:ClientGroup() local ClientGroup = self:GetDCSGroup()
if ClientGroup then if ClientGroup and ClientGroup:isExist() then
if ClientGroup:isExist() then return UNIT:New( ClientGroup:getUnit(1) )
return UNIT:New( ClientGroup:getUnit(1) ) else
else return UNIT:New( self.ClientGroupUnit )
return UNIT:New( self.ClientGroupUnit )
end
end end
return nil
end end
--- Returns the DCSUnit of the @{CLIENT}. --- Returns the DCSUnit of the @{CLIENT}.
-- @return DCSUnit -- @return DCSUnit
function CLIENT:GetClientGroupDCSUnit() function CLIENT:GetClientGroupDCSUnit()
self:T() self:F2()
local ClientGroup = self:ClientGroup() local ClientGroup = self:GetDCSGroup()
if ClientGroup then if ClientGroup and ClientGroup:isExist() then
if ClientGroup:isExist() then return ClientGroup:getUnit(1)
return ClientGroup:getUnits()[1] else
else return self.ClientGroupUnit
return self.ClientGroupUnit end
end
end
return nil
end end
function CLIENT:GetUnit() function CLIENT:GetUnit()
self:T() self:F()
return UNIT:New( self:GetClientGroupDCSUnit() ) return UNIT:New( self:GetClientGroupDCSUnit() )
end end
--- Returns the Point of the @{CLIENT}.
-- @return DCSTypes#Vec2
function CLIENT:GetPointVec2()
self:F()
ClientGroupUnit = self:GetClientGroupDCSUnit()
if ClientGroupUnit then
if ClientGroupUnit:isExist() then
local PointVec3 = ClientGroupUnit:getPoint() --DCSTypes#Vec3
local PointVec2 = {} --DCSTypes#Vec2
PointVec2.x = PointVec3.x
PointVec2.y = PointVec3.z
self:T( { PointVec2 } )
return PointVec2
end
end
return nil
end
--- Returns the Position of the @{CLIENT}. --- Returns the Position of the @{CLIENT}.
-- @return Position -- @return DCSTypes#Position
function CLIENT:ClientPosition() function CLIENT:ClientPosition()
--self:T() self:F()
ClientGroupUnit = self:GetClientGroupDCSUnit() ClientGroupUnit = self:GetClientGroupDCSUnit()
@ -228,10 +289,28 @@ function CLIENT:ClientPosition()
return nil return nil
end end
--- Returns the altitude of the @{CLIENT}.
-- @return DCSTypes#Distance
function CLIENT:GetAltitude()
self:F()
ClientGroupUnit = self:GetClientGroupDCSUnit()
if ClientGroupUnit then
if ClientGroupUnit:isExist() then
local PointVec3 = ClientGroupUnit:getPoint() --DCSTypes#Vec3
return PointVec3.y
end
end
return nil
end
--- Transport defines that the Client is a Transport. --- Transport defines that the Client is a Transport.
-- @return CLIENT -- @return CLIENT
function CLIENT:Transport() function CLIENT:Transport()
self:T() self:F()
self.ClientTransport = true self.ClientTransport = true
return self return self
@ -241,7 +320,7 @@ end
-- @param string ClientBriefing is the text defining the Mission briefing. -- @param string ClientBriefing is the text defining the Mission briefing.
-- @return CLIENT -- @return CLIENT
function CLIENT:AddBriefing( ClientBriefing ) function CLIENT:AddBriefing( ClientBriefing )
self:T() self:F()
self.ClientBriefing = ClientBriefing self.ClientBriefing = ClientBriefing
return self return self
end end
@ -249,14 +328,14 @@ end
--- IsTransport returns if a Client is a transport. --- IsTransport returns if a Client is a transport.
-- @return bool -- @return bool
function CLIENT:IsTransport() function CLIENT:IsTransport()
self:T() self:F()
return self.ClientTransport return self.ClientTransport
end end
--- ShowCargo shows the @{CARGO} within the CLIENT to the Player. --- ShowCargo shows the @{CARGO} within the CLIENT to the Player.
-- The @{CARGO} is shown throught the MESSAGE system of DCS World. -- The @{CARGO} is shown throught the MESSAGE system of DCS World.
function CLIENT:ShowCargo() function CLIENT:ShowCargo()
self:T() self:F()
local CargoMsg = "" local CargoMsg = ""
@ -287,13 +366,13 @@ end
-- @param string MessageCategory is the category of the message (the title). -- @param string MessageCategory is the category of the message (the title).
-- @param number MessageInterval is the interval in seconds between the display of the Message when the CLIENT is in the air. -- @param number MessageInterval is the interval in seconds between the display of the Message when the CLIENT is in the air.
function CLIENT:Message( Message, MessageDuration, MessageId, MessageCategory, MessageInterval ) function CLIENT:Message( Message, MessageDuration, MessageId, MessageCategory, MessageInterval )
self:T() self:F()
if not self.MenuMessages then if not self.MenuMessages then
if self:GetClientGroupID() then if self:GetClientGroupID() then
self.MenuMessages = MENU_SUB_GROUP:New( self:GetClientGroupID(), 'Messages' ) self.MenuMessages = MENU_CLIENT:New( self, 'Messages' )
self.MenuRouteMessageOn = MENU_COMMAND_GROUP:New( self:GetClientGroupID(), 'Messages On', self.MenuMessages, CLIENT.SwitchMessages, { self, true } ) self.MenuRouteMessageOn = MENU_CLIENT_COMMAND:New( self, 'Messages On', self.MenuMessages, CLIENT.SwitchMessages, { self, true } )
self.MenuRouteMessageOff = MENU_COMMAND_GROUP:New( self:GetClientGroupID(),'Messages Off', self.MenuMessages, CLIENT.SwitchMessages, { self, false } ) self.MenuRouteMessageOff = MENU_CLIENT_COMMAND:New( self,'Messages Off', self.MenuMessages, CLIENT.SwitchMessages, { self, false } )
end end
end end

View File

@ -1,6 +1,7 @@
--- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor. --- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.
-- Administers the Spawning of new Groups within the DCSRTE and administers these new Groups within the DATABASE object(s). -- Administers the Spawning of new Groups within the DCSRTE and administers these new Groups within the DATABASE object(s).
-- @module DATABASE -- @module Database
-- @author FlightControl
Include.File( "Routines" ) Include.File( "Routines" )
Include.File( "Base" ) Include.File( "Base" )
@ -158,7 +159,7 @@ end
--- Set a status to a Group within the Database, this to check crossing events for example. --- Set a status to a Group within the Database, this to check crossing events for example.
function DATABASE:SetStatusGroup( GroupName, Status ) function DATABASE:SetStatusGroup( GroupName, Status )
self:T( Status ) self:F( Status )
self.Groups[GroupName].Status = Status self.Groups[GroupName].Status = Status
end end
@ -166,7 +167,7 @@ end
--- Get a status to a Group within the Database, this to check crossing events for example. --- Get a status to a Group within the Database, this to check crossing events for example.
function DATABASE:GetStatusGroup( GroupName ) function DATABASE:GetStatusGroup( GroupName )
self:T( Status ) self:F( Status )
if self.Groups[GroupName] then if self.Groups[GroupName] then
return self.Groups[GroupName].Status return self.Groups[GroupName].Status
@ -319,7 +320,7 @@ end
--- Follows new players entering Clients within the DCSRTE. --- Follows new players entering Clients within the DCSRTE.
function DATABASE:_FollowPlayers() function DATABASE:_FollowPlayers()
self:T( "_FollowPlayers" ) self:F( "_FollowPlayers" )
local ClientUnit = 0 local ClientUnit = 0
local CoalitionsData = { AlivePlayersRed = coalition.getPlayers(coalition.side.RED), AlivePlayersBlue = coalition.getPlayers(coalition.side.BLUE) } local CoalitionsData = { AlivePlayersRed = coalition.getPlayers(coalition.side.RED), AlivePlayersBlue = coalition.getPlayers(coalition.side.BLUE) }
@ -342,7 +343,7 @@ end
--- Add a new player entering a Unit. --- Add a new player entering a Unit.
function DATABASE:_AddPlayerFromUnit( UnitData ) function DATABASE:_AddPlayerFromUnit( UnitData )
self:T( UnitData ) self:F( UnitData )
if UnitData:isExist() then if UnitData:isExist() then
local UnitName = UnitData:getName() local UnitName = UnitData:getName()
@ -420,7 +421,7 @@ end
--- Registers Scores the players completing a Mission Task. --- Registers Scores the players completing a Mission Task.
function DATABASE:_AddMissionTaskScore( PlayerUnit, MissionName, Score ) function DATABASE:_AddMissionTaskScore( PlayerUnit, MissionName, Score )
self:T( { PlayerUnit, MissionName, Score } ) self:F( { PlayerUnit, MissionName, Score } )
local PlayerName = PlayerUnit:getPlayerName() local PlayerName = PlayerUnit:getPlayerName()
@ -446,7 +447,7 @@ end
--- Registers Mission Scores for possible multiple players that contributed in the Mission. --- Registers Mission Scores for possible multiple players that contributed in the Mission.
function DATABASE:_AddMissionScore( MissionName, Score ) function DATABASE:_AddMissionScore( MissionName, Score )
self:T( { PlayerUnit, MissionName, Score } ) self:F( { PlayerUnit, MissionName, Score } )
for PlayerName, PlayerData in pairs( self.Players ) do for PlayerName, PlayerData in pairs( self.Players ) do
@ -467,7 +468,7 @@ end
function DATABASE:OnHit( event ) function DATABASE:OnHit( event )
self:T( { event } ) self:F( { event } )
local InitUnit = nil local InitUnit = nil
local InitUnitName = "" local InitUnitName = ""

View File

@ -18,7 +18,7 @@ DEPLOYTASK = {
-- @return #DEPLOYTASK The created DeployTask -- @return #DEPLOYTASK The created DeployTask
function DEPLOYTASK:New( CargoType ) function DEPLOYTASK:New( CargoType )
local self = BASE:Inherit( self, TASK:New() ) local self = BASE:Inherit( self, TASK:New() )
self:T() self:F()
local Valid = true local Valid = true
@ -35,7 +35,7 @@ function DEPLOYTASK:New( CargoType )
end end
function DEPLOYTASK:ToZone( LandingZone ) function DEPLOYTASK:ToZone( LandingZone )
self:T() self:F()
self.LandingZones.LandingZoneNames[LandingZone.CargoZoneName] = LandingZone.CargoZoneName self.LandingZones.LandingZoneNames[LandingZone.CargoZoneName] = LandingZone.CargoZoneName
self.LandingZones.LandingZones[LandingZone.CargoZoneName] = LandingZone self.LandingZones.LandingZones[LandingZone.CargoZoneName] = LandingZone
@ -45,7 +45,7 @@ end
function DEPLOYTASK:InitCargo( InitCargos ) function DEPLOYTASK:InitCargo( InitCargos )
self:T( { InitCargos } ) self:F( { InitCargos } )
if type( InitCargos ) == "table" then if type( InitCargos ) == "table" then
self.Cargos.InitCargos = InitCargos self.Cargos.InitCargos = InitCargos
@ -58,7 +58,7 @@ end
function DEPLOYTASK:LoadCargo( LoadCargos ) function DEPLOYTASK:LoadCargo( LoadCargos )
self:T( { LoadCargos } ) self:F( { LoadCargos } )
if type( LoadCargos ) == "table" then if type( LoadCargos ) == "table" then
self.Cargos.LoadCargos = LoadCargos self.Cargos.LoadCargos = LoadCargos
@ -73,7 +73,7 @@ end
--- When the cargo is unloaded, it will move to the target zone name. --- When the cargo is unloaded, it will move to the target zone name.
-- @param string TargetZoneName Name of the Zone to where the Cargo should move after unloading. -- @param string TargetZoneName Name of the Zone to where the Cargo should move after unloading.
function DEPLOYTASK:SetCargoTargetZoneName( TargetZoneName ) function DEPLOYTASK:SetCargoTargetZoneName( TargetZoneName )
self:T() self:F()
local Valid = true local Valid = true
@ -88,15 +88,15 @@ self:T()
end end
function DEPLOYTASK:AddCargoMenus( Client, Cargos, TransportRadius ) function DEPLOYTASK:AddCargoMenus( Client, Cargos, TransportRadius )
self:T() self:F()
local ClientGroupID = Client:GetClientGroupID() local ClientGroupID = Client:GetClientGroupID()
trace.i( self.ClassName, ClientGroupID ) self:T( ClientGroupID )
for CargoID, Cargo in pairs( Cargos ) do for CargoID, Cargo in pairs( Cargos ) do
trace.i( self.ClassName, { Cargo.ClassName, Cargo.CargoName, Cargo.CargoType, Cargo.CargoWeight } ) self:T( { Cargo.ClassName, Cargo.CargoName, Cargo.CargoType, Cargo.CargoWeight } )
if Cargo:IsStatusLoaded() and Client == Cargo:IsLoadedInClient() then if Cargo:IsStatusLoaded() and Client == Cargo:IsLoadedInClient() then
@ -110,7 +110,7 @@ self:T()
self.TEXT[1] .. " " .. Cargo.CargoType, self.TEXT[1] .. " " .. Cargo.CargoType,
nil nil
) )
trace.i( self.ClassName, 'Added DeployMenu ' .. self.TEXT[1] ) self:T( 'Added DeployMenu ' .. self.TEXT[1] )
end end
if Client._Menus[Cargo.CargoType].DeploySubMenus == nil then if Client._Menus[Cargo.CargoType].DeploySubMenus == nil then
@ -118,7 +118,7 @@ self:T()
end end
if Client._Menus[Cargo.CargoType].DeployMenu == nil then if Client._Menus[Cargo.CargoType].DeployMenu == nil then
trace.i( self.ClassName, 'deploymenu is nil' ) self:T( 'deploymenu is nil' )
end end
Client._Menus[Cargo.CargoType].DeploySubMenus[ #Client._Menus[Cargo.CargoType].DeploySubMenus + 1 ] = missionCommands.addCommandForGroup( Client._Menus[Cargo.CargoType].DeploySubMenus[ #Client._Menus[Cargo.CargoType].DeploySubMenus + 1 ] = missionCommands.addCommandForGroup(
@ -128,29 +128,29 @@ self:T()
self.MenuAction, self.MenuAction,
{ ReferenceTask = self, CargoTask = Cargo } { ReferenceTask = self, CargoTask = Cargo }
) )
trace.i( self.ClassName, 'Added DeploySubMenu ' .. Cargo.CargoType .. ":" .. Cargo.CargoName .. " ( " .. Cargo.CargoWeight .. "kg )" ) self:T( 'Added DeploySubMenu ' .. Cargo.CargoType .. ":" .. Cargo.CargoName .. " ( " .. Cargo.CargoWeight .. "kg )" )
end end
end end
end end
function DEPLOYTASK:RemoveCargoMenus( Client ) function DEPLOYTASK:RemoveCargoMenus( Client )
self:T() self:F()
local ClientGroupID = Client:GetClientGroupID() local ClientGroupID = Client:GetClientGroupID()
trace.i( self.ClassName, ClientGroupID ) self:T( ClientGroupID )
for MenuID, MenuData in pairs( Client._Menus ) do for MenuID, MenuData in pairs( Client._Menus ) do
if MenuData.DeploySubMenus ~= nil then if MenuData.DeploySubMenus ~= nil then
for SubMenuID, SubMenuData in pairs( MenuData.DeploySubMenus ) do for SubMenuID, SubMenuData in pairs( MenuData.DeploySubMenus ) do
missionCommands.removeItemForGroup( ClientGroupID, SubMenuData ) missionCommands.removeItemForGroup( ClientGroupID, SubMenuData )
trace.i( self.ClassName, "Removed DeploySubMenu " ) self:T( "Removed DeploySubMenu " )
SubMenuData = nil SubMenuData = nil
end end
end end
if MenuData.DeployMenu then if MenuData.DeployMenu then
missionCommands.removeItemForGroup( ClientGroupID, MenuData.DeployMenu ) missionCommands.removeItemForGroup( ClientGroupID, MenuData.DeployMenu )
trace.i( self.ClassName, "Removed DeployMenu " ) self:T( "Removed DeployMenu " )
MenuData.DeployMenu = nil MenuData.DeployMenu = nil
end end
end end

View File

@ -23,7 +23,7 @@ DESTROYBASETASK = {
-- @return DESTROYBASETASK -- @return DESTROYBASETASK
function DESTROYBASETASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupPrefixes, DestroyPercentage ) function DESTROYBASETASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupPrefixes, DestroyPercentage )
local self = BASE:Inherit( self, TASK:New() ) local self = BASE:Inherit( self, TASK:New() )
self:T() self:F()
self.Name = 'Destroy' self.Name = 'Destroy'
self.Destroyed = 0 self.Destroyed = 0
@ -45,7 +45,7 @@ end
--- Handle the S_EVENT_DEAD events to validate the destruction of units for the task monitoring. --- Handle the S_EVENT_DEAD events to validate the destruction of units for the task monitoring.
-- @param event Event structure of DCS world. -- @param event Event structure of DCS world.
function DESTROYBASETASK:EventDead( event ) function DESTROYBASETASK:EventDead( event )
self:T( { 'EventDead', event } ) self:F( { 'EventDead', event } )
if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then
local DestroyUnit = event.initiator local DestroyUnit = event.initiator
@ -76,7 +76,7 @@ end
-- @param DestroyGroup Group structure describing the group to be evaluated. -- @param DestroyGroup Group structure describing the group to be evaluated.
-- @param DestroyUnit Unit structure describing the Unit to be evaluated. -- @param DestroyUnit Unit structure describing the Unit to be evaluated.
function DESTROYBASETASK:ReportGoalProgress( DestroyGroup, DestroyUnit ) function DESTROYBASETASK:ReportGoalProgress( DestroyGroup, DestroyUnit )
self:T() self:F()
return 0 return 0
end end

View File

@ -17,27 +17,25 @@ DESTROYGROUPSTASK = {
-- @param ?number DestroyPercentage defines the %-tage that needs to be destroyed to achieve mission success. eg. If in the Group there are 10 units, then a value of 75 would require 8 units to be destroyed from the Group to complete the @{TASK}. -- @param ?number DestroyPercentage defines the %-tage that needs to be destroyed to achieve mission success. eg. If in the Group there are 10 units, then a value of 75 would require 8 units to be destroyed from the Group to complete the @{TASK}.
---@return DESTROYGROUPSTASK ---@return DESTROYGROUPSTASK
function DESTROYGROUPSTASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames, DestroyPercentage ) function DESTROYGROUPSTASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames, DestroyPercentage )
trace.f(self.ClassName) local self = BASE:Inherit( self, DESTROYBASETASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames, DestroyPercentage ) )
self:F()
-- Inheritance
local Child = BASE:Inherit( self, DESTROYBASETASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames, DestroyPercentage ) ) self.Name = 'Destroy Groups'
self.GoalVerb = "Destroy " .. DestroyGroupType
Child.Name = 'Destroy Groups'
Child.GoalVerb = "Destroy " .. DestroyGroupType
Child.AddEvent( Child, world.event.S_EVENT_DEAD, Child.EventDead ) self:AddEvent( world.event.S_EVENT_DEAD, self.EventDead )
Child.AddEvent( Child, world.event.S_EVENT_CRASH, Child.EventDead ) self:AddEvent( world.event.S_EVENT_CRASH, self.EventDead )
--Child.AddEvent( Child, world.event.S_EVENT_PILOT_DEAD, Child.EventDead ) --Child.AddEvent( Child, world.event.S_EVENT_PILOT_DEAD, Child.EventDead )
return Child return self
end end
--- Report Goal Progress. --- Report Goal Progress.
-- @param Group DestroyGroup Group structure describing the group to be evaluated. -- @param Group DestroyGroup Group structure describing the group to be evaluated.
-- @param Unit DestroyUnit Unit structure describing the Unit to be evaluated. -- @param Unit DestroyUnit Unit structure describing the Unit to be evaluated.
function DESTROYGROUPSTASK:ReportGoalProgress( DestroyGroup, DestroyUnit ) function DESTROYGROUPSTASK:ReportGoalProgress( DestroyGroup, DestroyUnit )
trace.f(self.ClassName) self:F( { DestroyGroup, DestroyUnit } )
trace.i( self.ClassName, DestroyGroup:getSize() ) self:T( DestroyGroup:getSize() )
local DestroyCount = 0 local DestroyCount = 0
if DestroyGroup then if DestroyGroup then

View File

@ -14,29 +14,26 @@ DESTROYRADARSTASK = {
-- @param table{string,...} DestroyGroupNames Table of string containing the group names of which the radars are be destroyed. -- @param table{string,...} DestroyGroupNames Table of string containing the group names of which the radars are be destroyed.
-- @return DESTROYRADARSTASK -- @return DESTROYRADARSTASK
function DESTROYRADARSTASK:New( DestroyGroupNames ) function DESTROYRADARSTASK:New( DestroyGroupNames )
trace.f(self.ClassName) local self = BASE:Inherit( self, DESTROYGROUPSTASK:New( 'radar installations', 'radars', DestroyGroupNames ) )
self:F()
-- Inheritance
local Child = BASE:Inherit( self, DESTROYGROUPSTASK:New( 'radar installations', 'radars', DestroyGroupNames ) )
Child.Name = 'Destroy Radars'
self.Name = 'Destroy Radars'
Child.AddEvent( Child, world.event.S_EVENT_DEAD, Child.EventDead ) self:AddEvent( world.event.S_EVENT_DEAD, self.EventDead )
return Child return self
end end
--- Report Goal Progress. --- Report Goal Progress.
-- @param Group DestroyGroup Group structure describing the group to be evaluated. -- @param Group DestroyGroup Group structure describing the group to be evaluated.
-- @param Unit DestroyUnit Unit structure describing the Unit to be evaluated. -- @param Unit DestroyUnit Unit structure describing the Unit to be evaluated.
function DESTROYRADARSTASK:ReportGoalProgress( DestroyGroup, DestroyUnit ) function DESTROYRADARSTASK:ReportGoalProgress( DestroyGroup, DestroyUnit )
trace.f(self.ClassName) self:F( { DestroyGroup, DestroyUnit } )
local DestroyCount = 0 local DestroyCount = 0
if DestroyUnit and DestroyUnit:hasSensors( Unit.SensorType.RADAR, Unit.RadarType.AS ) then if DestroyUnit and DestroyUnit:hasSensors( Unit.SensorType.RADAR, Unit.RadarType.AS ) then
if DestroyUnit and DestroyUnit:getLife() <= 1.0 then if DestroyUnit and DestroyUnit:getLife() <= 1.0 then
trace.i( self.ClassName, 'Destroyed a radar' ) self:T( 'Destroyed a radar' )
DestroyCount = 1 DestroyCount = 1
end end
end end

View File

@ -17,33 +17,28 @@ DESTROYUNITTYPESTASK = {
-- @param string DestroyUnitTypes Table of string containing the type names of the units to achieve mission success. -- @param string DestroyUnitTypes Table of string containing the type names of the units to achieve mission success.
-- @return DESTROYUNITTYPESTASK -- @return DESTROYUNITTYPESTASK
function DESTROYUNITTYPESTASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames, DestroyUnitTypes ) function DESTROYUNITTYPESTASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames, DestroyUnitTypes )
trace.f(self.ClassName) local self = BASE:Inherit( self, DESTROYBASETASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames ) )
self:F( { DestroyGroupType, DestroyUnitType, DestroyGroupNames, DestroyUnitTypes } )
-- Inheritance
local Child = BASE:Inherit( self, DESTROYBASETASK:New( DestroyGroupType, DestroyUnitType, DestroyGroupNames ) )
if type(DestroyUnitTypes) == 'table' then if type(DestroyUnitTypes) == 'table' then
Child.DestroyUnitTypes = DestroyUnitTypes self.DestroyUnitTypes = DestroyUnitTypes
else else
Child.DestroyUnitTypes = { DestroyUnitTypes } self.DestroyUnitTypes = { DestroyUnitTypes }
end end
Child.Name = 'Destroy Unit Types' self.Name = 'Destroy Unit Types'
Child.GoalVerb = "Destroy " .. DestroyGroupType self.GoalVerb = "Destroy " .. DestroyGroupType
--env.info( 'New Types Child = ' .. tostring(Child) ) self:AddEvent( world.event.S_EVENT_DEAD, self.EventDead )
--env.info( 'New Types self = ' .. tostring(self) )
Child.AddEvent( Child, world.event.S_EVENT_DEAD, Child.EventDead ) return self
return Child
end end
--- Report Goal Progress. --- Report Goal Progress.
-- @param Group DestroyGroup Group structure describing the group to be evaluated. -- @param Group DestroyGroup Group structure describing the group to be evaluated.
-- @param Unit DestroyUnit Unit structure describing the Unit to be evaluated. -- @param Unit DestroyUnit Unit structure describing the Unit to be evaluated.
function DESTROYUNITTYPESTASK:ReportGoalProgress( DestroyGroup, DestroyUnit ) function DESTROYUNITTYPESTASK:ReportGoalProgress( DestroyGroup, DestroyUnit )
trace.f(self.ClassName) self:F( { DestroyGroup, DestroyUnit } )
local DestroyCount = 0 local DestroyCount = 0
for UnitTypeID, UnitType in pairs( self.DestroyUnitTypes ) do for UnitTypeID, UnitType in pairs( self.DestroyUnitTypes ) do

602
Moose/Escort.lua Normal file
View File

@ -0,0 +1,602 @@
--- Taking the lead of AI escorting your flight.
-- The ESCORT class allows you to interact with escoring AI on your flight and take the lead.
-- The following commands will be available:
--
-- * Pop-up and Scan Area
-- * Re-Join Formation
-- * Hold Position in x km
-- * Report identified targets
-- * Perform tasks per identified target: Report vector to target, paint target, kill target
--
-- @module Escort
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Database" )
Include.File( "Group" )
Include.File( "Zone" )
--- ESCORT class
-- @type ESCORT
-- @extends Base#BASE
-- @field Client#CLIENT EscortClient
-- @field Group#GROUP EscortGroup
-- @field #string EscortName
-- @field #number FollowScheduler The id of the _FollowScheduler function.
-- @field #boolean ReportTargets If true, nearby targets are reported.
-- @Field DCSTypes#AI.Option.Air.val.ROE OptionROE Which ROE is set to the EscortGroup.
-- @field DCSTypes#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the EscortGroup.
ESCORT = {
ClassName = "ESCORT",
EscortName = nil, -- The Escort Name
EscortClient = nil,
EscortGroup = nil,
Targets = {}, -- The identified targets
FollowScheduler = nil,
ReportTargets = true,
OptionROE = AI.Option.Air.val.ROE.OPEN_FIRE,
OptionReactionOnThreat = AI.Option.Air.val.REACTION_ON_THREAT.ALLOW_ABORT_MISSION
}
--- MENUPARAM type
-- @type MENUPARAM
-- @field #ESCORT ParamSelf
-- @field #Distance ParamDistance
--- ESCORT class constructor for an AI group
-- @param self
-- @param Client#CLIENT EscortClient The client escorted by the EscortGroup.
-- @param Group#GROUP EscortGroup The group AI escorting the EscortClient.
-- @param #string EscortName Name of the escort.
-- @return #ESCORT self
function ESCORT:New( EscortClient, EscortGroup, EscortName )
local self = BASE:Inherit( self, BASE:New() )
self:F( { EscortClient, EscortGroup, EscortName } )
self.EscortClient = EscortClient -- Client#CLIENT
self.EscortGroup = EscortGroup -- Group#GROUP
self.EscortName = EscortName
self.EscortMenu = MENU_CLIENT:New( self.EscortClient, "Escort" .. self.EscortName )
-- Escort Navigation
self.EscortMenuReportNavigation = MENU_CLIENT:New( self.EscortClient, "Navigation", self.EscortMenu )
self.EscortMenuHoldPosition = MENU_CLIENT_COMMAND:New( self.EscortClient, "Hold Position and Stay Low", self.EscortMenuReportNavigation, ESCORT._HoldPosition, { ParamSelf = self } )
self.EscortMenuJoinUpAndHoldPosition = MENU_CLIENT_COMMAND:New( self.EscortClient, "Join-Up and Hold Position NearBy", self.EscortMenuReportNavigation, ESCORT._HoldPositionNearBy, { ParamSelf = self } )
self.EscortMenuJoinUpAndFollow50Meters = MENU_CLIENT_COMMAND:New( self.EscortClient, "Join-Up and Follow at 100", self.EscortMenuReportNavigation, ESCORT._JoinUpAndFollow, { ParamSelf = self, ParamDistance = 100 } )
self.EscortMenuJoinUpAndFollow100Meters = MENU_CLIENT_COMMAND:New( self.EscortClient, "Join-Up and Follow at 200", self.EscortMenuReportNavigation, ESCORT._JoinUpAndFollow, { ParamSelf = self, ParamDistance = 200 } )
self.EscortMenuJoinUpAndFollow150Meters = MENU_CLIENT_COMMAND:New( self.EscortClient, "Join-Up and Follow at 400", self.EscortMenuReportNavigation, ESCORT._JoinUpAndFollow, { ParamSelf = self, ParamDistance = 400 } )
self.EscortMenuJoinUpAndFollow200Meters = MENU_CLIENT_COMMAND:New( self.EscortClient, "Join-Up and Follow at 800", self.EscortMenuReportNavigation, ESCORT._JoinUpAndFollow, { ParamSelf = self, ParamDistance = 800 } )
-- Report Targets
self.EscortMenuReportNearbyTargets = MENU_CLIENT:New( self.EscortClient, "Report targets", self.EscortMenu )
self.EscortMenuReportNearbyTargetsOn = MENU_CLIENT_COMMAND:New( self.EscortClient, "Report targets on", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = true } )
self.EscortMenuReportNearbyTargetsOff = MENU_CLIENT_COMMAND:New( self.EscortClient, "Report targets off", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = false, } )
-- Scanning Targets
self.EscortMenuScanForTargets = MENU_CLIENT:New( self.EscortClient, "Scan targets", self.EscortMenu )
self.EscortMenuReportNearbyTargetsOn = MENU_CLIENT_COMMAND:New( self.EscortClient, "Scan targets 30 seconds", self.EscortMenuScanForTargets, ESCORT._ScanTargets30Seconds, { ParamSelf = self, ParamScanDuration = 30 } )
self.EscortMenuReportNearbyTargetsOn = MENU_CLIENT_COMMAND:New( self.EscortClient, "Scan targets 60 seconds", self.EscortMenuScanForTargets, ESCORT._ScanTargets60Seconds, { ParamSelf = self, ParamScanDuration = 30 } )
-- Attack Targets
self.EscortMenuAttackNearbyTargets = MENU_CLIENT:New( self.EscortClient, "Attack nearby targets", self.EscortMenu )
self.EscortMenuAttackTargets = {}
self.Targets = {}
-- Rules of Engagement
self.EscortMenuROE = MENU_CLIENT:New( self.EscortClient, "ROE", self.EscortMenu )
self.EscortMenuROEHoldFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Hold Fire", self.EscortMenuROE, ESCORT._ROEHoldFire, { ParamSelf = self, } )
self.EscortMenuROEReturnFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Return Fire", self.EscortMenuROE, ESCORT._ROEReturnFire, { ParamSelf = self, } )
self.EscortMenuROEOpenFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Open Fire", self.EscortMenuROE, ESCORT._ROEOpenFire, { ParamSelf = self, } )
self.EscortMenuROEWeaponFree = MENU_CLIENT_COMMAND:New( self.EscortClient, "Weapon Free", self.EscortMenuROE, ESCORT._ROEWeaponFree, { ParamSelf = self, } )
-- Reaction to Threats
self.EscortMenuEvasion = MENU_CLIENT:New( self.EscortClient, "Evasion", self.EscortMenu )
self.EscortMenuEvasionNoReaction = MENU_CLIENT_COMMAND:New( self.EscortClient, "Fight until death", self.EscortMenuEvasion, ESCORT._OptionROTNoReaction, { ParamSelf = self, } )
self.EscortMenuEvasionPassiveDefense = MENU_CLIENT_COMMAND:New( self.EscortClient, "Use flares, chaff and jammers", self.EscortMenuEvasion, ESCORT._OptionROTPassiveDefense, { ParamSelf = self, } )
self.EscortMenuEvasionEvadeFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Evade enemy fire", self.EscortMenuEvasion, ESCORT._OptionROTEvadeFire, { ParamSelf = self, } )
self.EscortMenuOptionEvasionVertical = MENU_CLIENT_COMMAND:New( self.EscortClient, "Go below radar and evade fire", self.EscortMenuEvasion, ESCORT._OptionROTVertical, { ParamSelf = self, } )
-- Cancel current Task
self.EscortMenuResumeMission = MENU_CLIENT:New( self.EscortClient, "Resume Mission", self.EscortMenu )
self.EscortMenuResumeWayPoints = {}
local TaskPoints = self:RegisterRoute()
for WayPointID, WayPoint in pairs( TaskPoints ) do
self.EscortMenuResumeWayPoints[WayPointID] = MENU_CLIENT_COMMAND:New( self.EscortClient, "Resume from waypoint " .. WayPointID, self.EscortMenuResumeMission, ESCORT._ResumeMission, { ParamSelf = self, ParamWayPoint = WayPointID } )
end
-- Initialize the EscortGroup
self.EscortGroup:OptionROTVertical()
self.EscortGroup:OptionROEOpenFire()
self.EscortGroup:PushTask( EscortGroup:TaskRoute( TaskPoints ) )
self.ReportTargetsScheduler = routines.scheduleFunction( self._ReportTargetsScheduler, { self }, timer.getTime() + 1, 30 )
end
--- @param #MENUPARAM MenuParam
function ESCORT._HoldPosition( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
routines.removeFunction( self.FollowScheduler )
EscortGroup:PushTask( EscortGroup:TaskHoldPosition( 300 ) )
MESSAGE:New( "Holding Position at ... for 5 minutes.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/TaskHoldPosition" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._HoldPositionNearBy( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
--MenuParam.ParamSelf.EscortGroup:TaskOrbitCircleAtVec2( MenuParam.ParamSelf.EscortClient:GetPointVec2(), 300, 30, 0 )
routines.removeFunction( self.FollowScheduler )
local PointFrom = {}
local GroupPoint = EscortGroup:GetPointVec2()
PointFrom = {}
PointFrom.x = GroupPoint.x
PointFrom.y = GroupPoint.y
PointFrom.speed = 250
PointFrom.type = AI.Task.WaypointType.TURNING_POINT
PointFrom.alt = EscortClient:GetAltitude()
PointFrom.alt_type = AI.Task.AltitudeType.BARO
local ClientPoint = MenuParam.ParamSelf.EscortClient:GetPointVec2()
local PointTo = {}
PointTo.x = ClientPoint.x
PointTo.y = ClientPoint.y
PointTo.speed = 250
PointTo.type = AI.Task.WaypointType.TURNING_POINT
PointTo.alt = EscortClient:GetAltitude()
PointTo.alt_type = AI.Task.AltitudeType.BARO
PointTo.task = EscortGroup:TaskOrbitCircleAtVec2( EscortClient:GetPointVec2(), 300, 30, 0 )
local Points = { PointFrom, PointTo }
EscortGroup:PushTask( EscortGroup:TaskRoute( Points ) )
MESSAGE:New( "Rejoining to your location. Please hold at your location.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/HoldPositionNearBy" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._JoinUpAndFollow( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
local Distance = MenuParam.ParamDistance
if self.FollowScheduler then
routines.removeFunction( self.FollowScheduler )
end
self.CT1 = 0
self.GT1 = 0
self.FollowScheduler = routines.scheduleFunction( self._FollowScheduler, { self, Distance }, timer.getTime() + 1, 1 )
EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient )
end
function ESCORT._ReportNearbyTargets( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
self.ReportTargets = MenuParam.ParamReportTargets
if self.ReportTargets then
if not self.ReportTargetsScheduler then
self.ReportTargetsScheduler = routines.scheduleFunction( self._ReportTargetsScheduler, { self }, timer.getTime() + 1, 30 )
end
else
routines.removeFunction( self.ReportTargetsScheduler )
self.ReportTargetsScheduler = nil
end
end
--- @param #MENUPARAM MenuParam
function ESCORT._ScanTargets30Seconds( MenuParam )
MenuParam.ParamSelf:T()
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
routines.removeFunction( self.FollowScheduler )
EscortGroup:PushTask(
EscortGroup:TaskControlled(
EscortGroup:TaskOrbitCircle( 200, 20 ),
EscortGroup:TaskCondition( nil, nil, nil, nil, 30, nil )
)
)
MESSAGE:New( "Scanning targets for 30 seconds.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/ScanTargets30Seconds" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._ScanTargets60Seconds( MenuParam )
MenuParam.ParamSelf:T()
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
routines.removeFunction( self.FollowScheduler )
EscortGroup:PushTask(
EscortGroup:TaskControlled(
EscortGroup:TaskOrbitCircle( 200, 20 ),
EscortGroup:TaskCondition( nil, nil, nil, nil, 60, nil )
)
)
MESSAGE:New( "Scanning targets for 60 seconds.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/ScanTargets60Seconds" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._AttackTarget( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
local AttackUnit = MenuParam.ParamUnit
routines.removeFunction( self.FollowScheduler )
self.FollowScheduler = nil
EscortGroup:OptionROEOpenFire()
EscortGroup:OptionROTVertical()
EscortGroup:PushTask( EscortGroup:TaskAttackUnit( AttackUnit ) )
MESSAGE:New( "Attacking Unit", MenuParam.ParamSelf.EscortName, 10, "ESCORT/AttackTarget" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._ROEHoldFire( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionROEHoldFire()
MESSAGE:New( "Holding weapons.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/ROEHoldFire" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._ROEReturnFire( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionROEReturnFire()
MESSAGE:New( "Returning enemy fire.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/ROEReturnFire" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._ROEOpenFire( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionROEOpenFire()
MESSAGE:New( "Open fire on ordered targets.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/ROEOpenFire" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._ROEWeaponFree( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionROEWeaponFree()
MESSAGE:New( "Engaging targets.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/ROEWeaponFree" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._OptionROTNoReaction( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionEvasionNoReaction()
MESSAGE:New( "We'll fight until death.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/OptionEvasionNoReaction" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._OptionROTPassiveDefense( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionROTPassiveDefense()
MESSAGE:New( "We will use flares, chaff and jammers.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/OptionROTPassiveDefense" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._OptionROTEvadeFire( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionROTEvadeFire()
MESSAGE:New( "We'll evade enemy fire.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/OptionROTEvadeFire" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._OptionROTVertical( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
EscortGroup:OptionROTVertical()
MESSAGE:New( "We'll perform vertical evasive manoeuvres.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/OptionROTVertical" ):ToClient( EscortClient )
end
--- @param #MENUPARAM MenuParam
function ESCORT._ResumeMission( MenuParam )
local self = MenuParam.ParamSelf
local EscortGroup = self.EscortGroup
local EscortClient = self.EscortClient
local WayPoint = MenuParam.ParamWayPoint
routines.removeFunction( self.FollowScheduler )
self.FollowScheduler = nil
local WayPoints = EscortGroup:GetTaskRoute()
self:T( WayPoint, WayPoints )
for WayPointIgnore = 1, WayPoint do
table.remove( WayPoints, 1 )
end
EscortGroup:PopCurrentTask()
EscortGroup:PushTask( EscortGroup:TaskRoute( WayPoints ) )
MESSAGE:New( "Resuming mission.", MenuParam.ParamSelf.EscortName, 10, "ESCORT/ResumeMission" ):ToClient( EscortClient )
end
function ESCORT:RegisterRoute()
local EscortGroup = self.EscortGroup -- Group#GROUP
local TaskPoints = EscortGroup:GetTaskRoute()
self:T( TaskPoints )
for TaskPointID, TaskPoint in pairs( TaskPoints ) do
self:T( TaskPointID )
TaskPoint.task.params.tasks[#TaskPoint.task.params.tasks+1] = EscortGroup:TaskRegisterWayPoint( TaskPointID )
self:T( TaskPoint.task.params.tasks[#TaskPoint.task.params.tasks] )
end
self:T( TaskPoints )
return TaskPoints
end
--- @param Escort#ESCORT self
function ESCORT:_FollowScheduler( FollowDistance )
self:F( { FollowDistance })
if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then
local ClientUnit = self.EscortClient:GetClientGroupUnit()
local GroupUnit = self.EscortGroup:GetUnit( 1 )
if self.CT1 == 0 and self.GT1 == 0 then
self.CV1 = ClientUnit:GetPositionVec3()
self.CT1 = timer.getTime()
self.GV1 = GroupUnit:GetPositionVec3()
self.GT1 = timer.getTime()
else
local CT1 = self.CT1
local CT2 = timer.getTime()
local CV1 = self.CV1
local CV2 = ClientUnit:GetPositionVec3()
self.CT1 = CT2
self.CV1 = CV2
local CD = ( ( CV2.x - CV1.x )^2 + ( CV2.y - CV1.y )^2 + ( CV2.z - CV1.z )^2 ) ^ 0.5
local CT = CT2 - CT1
local CS = ( 3600 / CT ) * ( CD / 1000 )
self:T2( { "Client:", CS, CD, CT, CV2, CV1, CT2, CT1 } )
local GT1 = self.GT1
local GT2 = timer.getTime()
local GV1 = self.GV1
local GV2 = GroupUnit:GetPositionVec3()
self.GT1 = GT2
self.GV1 = GV2
local GD = ( ( GV2.x - GV1.x )^2 + ( GV2.y - GV1.y )^2 + ( GV2.z - GV1.z )^2 ) ^ 0.5
local GT = GT2 - GT1
local GS = ( 3600 / GT ) * ( GD / 1000 )
self:T2( { "Group:", GS, GD, GT, GV2, GV1, GT2, GT1 } )
-- Calculate the group direction vector
local GV = { x = GV2.x - CV2.x, y = GV2.y - CV2.y, z = GV2.z - CV2.z }
-- Calculate GH2, GH2 with the same height as CV2.
local GH2 = { x = GV2.x, y = CV2.y, z = GV2.z }
-- Calculate the angle of GV to the orthonormal plane
local alpha = math.atan2( GV.z, GV.x )
-- Now we calculate the intersecting vector between the circle around CV2 with radius FollowDistance and GH2.
-- From the GeoGebra model: CVI = (x(CV2) + FollowDistance cos(alpha), y(GH2) + FollowDistance sin(alpha), z(CV2))
local CVI = { x = CV2.x + FollowDistance * math.cos(alpha),
y = GH2.y,
z = CV2.z + FollowDistance * math.sin(alpha),
}
-- Calculate the direction vector DV of the escort group. We use CVI as the base and CV2 as the direction.
local DV = { x = CV2.x - CVI.x, y = CV2.y - CVI.y, z = CV2.z - CVI.z }
-- We now calculate the unary direction vector DVu, so that we can multiply DVu with the speed, which is expressed in meters / s.
-- We need to calculate this vector to predict the point the escort group needs to fly to according its speed.
-- The distance of the destination point should be far enough not to have the aircraft starting to swipe left to right...
local DVu = { x = DV.x / FollowDistance, y = DV.y / FollowDistance, z = DV.z / FollowDistance }
-- Now we can calculate the group destination vector GDV.
local GDV = { x = DVu.x * CS * 2 + CVI.x, y = CVI.y, z = DVu.z * CS * 2 + CVI.z }
self:T2( { "CV2:", CV2 } )
self:T2( { "CVI:", CVI } )
self:T2( { "GDV:", GDV } )
-- Measure distance between client and group
local CatchUpDistance = ( ( GDV.x - GV2.x )^2 + ( GDV.y - GV2.y )^2 + ( GDV.z - GV2.z )^2 ) ^ 0.5
-- The calculation of the Speed would simulate that the group would take 30 seconds to overcome
-- the requested Distance).
local Time = 30
local CatchUpSpeed = ( CatchUpDistance - ( CS * 2 ) ) / Time
local Speed = CS + CatchUpSpeed
if Speed < 0 then
Speed = 0
end
self:T( { "Client Speed, Escort Speed, Speed, FlyDistance, Time:", CS, GS, Speed, Distance, Time } )
-- Now route the escort to the desired point with the desired speed.
self.EscortGroup:TaskRouteToVec3( GDV, Speed / 3.6 ) -- DCS models speed in Mps (Miles per second)
end
else
routines.removeFunction( self.FollowScheduler )
end
end
function ESCORT:_ReportTargetsScheduler()
self:F()
self.Targets = {}
if self.EscortGroup:IsAlive() then
local EscortTargets = self.EscortGroup:GetDetectedTargets()
local EscortTargetMessages = ""
for EscortTargetID, EscortTarget in pairs( EscortTargets ) do
local EscortObject = EscortTarget.object
self:T( EscortObject )
if EscortObject and EscortObject:isExist() and EscortObject.id_ < 50000000 then
local EscortTargetMessage = ""
local EscortTargetUnit = UNIT:New( EscortObject )
local EscortTargetCategoryName = EscortTargetUnit:GetCategoryName()
local EscortTargetCategoryType = EscortTargetUnit:GetTypeName()
-- local EscortTargetIsDetected,
-- EscortTargetIsVisible,
-- EscortTargetLastTime,
-- EscortTargetKnowType,
-- EscortTargetKnowDistance,
-- EscortTargetLastPos,
-- EscortTargetLastVelocity
-- = self.EscortGroup:IsTargetDetected( EscortObject )
--
-- self:T( { EscortTargetIsDetected,
-- EscortTargetIsVisible,
-- EscortTargetLastTime,
-- EscortTargetKnowType,
-- EscortTargetKnowDistance,
-- EscortTargetLastPos,
-- EscortTargetLastVelocity } )
if EscortTarget.distance then
local EscortTargetUnitPositionVec3 = EscortTargetUnit:GetPositionVec3()
local EscortPositionVec3 = self.EscortGroup:GetPositionVec3()
local Distance = routines.utils.get3DDist( EscortTargetUnitPositionVec3, EscortPositionVec3 ) / 1000
self:T( { self.EscortGroup:GetName(), EscortTargetUnit:GetName(), Distance, EscortTarget.visible } )
if Distance <= 8 then
if EscortTarget.type then
EscortTargetMessage = EscortTargetMessage .. " - " .. EscortTargetCategoryName .. " (" .. EscortTargetCategoryType .. ") at "
else
EscortTargetMessage = EscortTargetMessage .. " - Unknown target at "
end
EscortTargetMessage = EscortTargetMessage .. string.format( "%.2f", Distance ) .. " km"
if EscortTarget.visible then
EscortTargetMessage = EscortTargetMessage .. ", visual"
end
local TargetIndex = Distance*1000
self.Targets[TargetIndex] = {}
self.Targets[TargetIndex].AttackMessage = EscortTargetMessage
self.Targets[TargetIndex].AttackUnit = EscortTargetUnit
end
end
if EscortTargetMessage ~= "" then
EscortTargetMessages = EscortTargetMessages .. EscortTargetMessage .. "\n"
end
end
end
if EscortTargetMessages ~= "" and self.ReportTargets == true then
self.EscortClient:Message( EscortTargetMessages:gsub("\n$",""), 20, "/ESCORT.DetectedTargets", self.EscortName .. " reporting detected targets within 8 km range:", 0 )
end
self:T()
self:T( { "Sorting Targets Table:", self.Targets } )
table.sort( self.Targets )
self:T( { "Sorted Targets Table:", self.Targets } )
for MenuIndex = 1, #self.EscortMenuAttackTargets do
self:T( { "Remove Menu:", self.EscortMenuAttackTargets[MenuIndex] } )
self.EscortMenuAttackTargets[MenuIndex] = self.EscortMenuAttackTargets[MenuIndex]:Remove()
end
local MenuIndex = 1
for TargetID, TargetData in pairs( self.Targets ) do
self:T( { "Adding menu:", TargetID, "for Unit", self.Targets[TargetID].AttackUnit } )
if MenuIndex <= 10 then
self.EscortMenuAttackTargets[MenuIndex] =
MENU_CLIENT_COMMAND:New( self.EscortClient,
self.Targets[TargetID].AttackMessage,
self.EscortMenuAttackNearbyTargets,
ESCORT._AttackTarget,
{ ParamSelf = self,
ParamUnit = self.Targets[TargetID].AttackUnit
}
)
self:T( { "New Menu:", self.EscortMenuAttackTargets[TargetID] } )
MenuIndex = MenuIndex + 1
else
break
end
end
else
routines.removeFunction( self.ReportTargetsScheduler )
self.ReportTargetsScheduler = nil
end
end

View File

@ -13,26 +13,23 @@ GOHOMETASK = {
-- @param table{string,...}|string LandingZones Table of Landing Zone names where Home(s) are located. -- @param table{string,...}|string LandingZones Table of Landing Zone names where Home(s) are located.
-- @return GOHOMETASK -- @return GOHOMETASK
function GOHOMETASK:New( LandingZones ) function GOHOMETASK:New( LandingZones )
trace.f(self.ClassName) local self = BASE:Inherit( self, TASK:New() )
self:F( { LandingZones } )
-- Child holds the inherited instance of the PICKUPTASK Class to the BASE class.
local Child = BASE:Inherit( self, TASK:New() )
local Valid = true local Valid = true
Valid = routines.ValidateZone( LandingZones, "LandingZones", Valid ) Valid = routines.ValidateZone( LandingZones, "LandingZones", Valid )
if Valid then if Valid then
Child.Name = 'Fly Home' self.Name = 'Fly Home'
Child.TaskBriefing = "Task: Fly back to your home base. Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to your home base." self.TaskBriefing = "Task: Fly back to your home base. Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to your home base."
if type( LandingZones ) == "table" then if type( LandingZones ) == "table" then
Child.LandingZones = LandingZones self.LandingZones = LandingZones
else else
Child.LandingZones = { LandingZones } self.LandingZones = { LandingZones }
end end
Child.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEROUTE:New(), STAGEARRIVE:New(), STAGEDONE:New() } self.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEROUTE:New(), STAGEARRIVE:New(), STAGEDONE:New() }
Child.SetStage( Child, 1 ) self.SetStage( self, 1 )
end end
return Child return self
end end

View File

@ -1,9 +1,6 @@
--- A GROUP class abstraction of a DCSGroup class. --- A GROUP class abstraction of a DCSGroup class.
-- The GROUP class will take an abstraction of the DCSGroup class, providing more methods that can be done with a GROUP. -- The GROUP class will take an abstraction of the DCSGroup class, providing more methods that can be done with a GROUP.
-- -- @module Group
--
-- @module GROUP
-- @extends BASE#BASE
Include.File( "Routines" ) Include.File( "Routines" )
Include.File( "Base" ) Include.File( "Base" )
@ -12,7 +9,8 @@ Include.File( "Unit" )
--- The GROUP class --- The GROUP class
-- @type GROUP -- @type GROUP
-- @field #Group DCSGroup The DCS group class. -- @extends Base#BASE
-- @field DCSGroup#Group DCSGroup The DCS group class.
-- @field #string GroupName The name of the group. -- @field #string GroupName The name of the group.
-- @field #number GroupID the ID of the group. -- @field #number GroupID the ID of the group.
-- @field #table Controller The controller of the group. -- @field #table Controller The controller of the group.
@ -21,26 +19,34 @@ GROUP = {
GroupName = "", GroupName = "",
GroupID = 0, GroupID = 0,
Controller = nil, Controller = nil,
DCSGroup = nil,
} }
--- A DCSGroup --- A DCSGroup
-- @type Group -- @type DCSGroup
-- @field id_ The ID of the group in DCS -- @field id_ The ID of the group in DCS
GROUPS = {} --- The GROUPS structure contains references to all the created GROUP instances.
local GROUPS = {}
--- Create a new GROUP from a DCSGroup --- Create a new GROUP from a DCSGroup
-- @param self -- @param self
-- @param #Group DCSGroup The DCS Group -- @param DCSGroup#Group DCSGroup The DCS Group
-- @return #GROUP self -- @return #GROUP self
function GROUP:New( DCSGroup ) function GROUP:New( DCSGroup )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( DCSGroup:getName() ) self:F( DCSGroup )
self.DCSGroup = DCSGroup self.DCSGroup = DCSGroup
self.GroupName = DCSGroup:getName() if self.DCSGroup and self.DCSGroup:isExist() then
self.GroupID = DCSGroup:getID() self.GroupName = DCSGroup:getName()
self.Controller = DCSGroup:getController() self.GroupID = DCSGroup:getID()
self.Controller = DCSGroup:getController()
else
self:E( { "DCSGroup is nil or does not exist, cannot initialize GROUP!", self.DCSGroup } )
end
GROUPS[self.GroupID] = self
return self return self
end end
@ -52,7 +58,7 @@ end
-- @return #GROUP self -- @return #GROUP self
function GROUP:NewFromName( GroupName ) function GROUP:NewFromName( GroupName )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( GroupName ) self:F( GroupName )
self.DCSGroup = Group.getByName( GroupName ) self.DCSGroup = Group.getByName( GroupName )
if self.DCSGroup then if self.DCSGroup then
@ -61,6 +67,8 @@ function GROUP:NewFromName( GroupName )
self.Controller = self.DCSGroup:getController() self.Controller = self.DCSGroup:getController()
end end
GROUPS[self.GroupID] = self
return self return self
end end
@ -70,7 +78,7 @@ end
-- @return #GROUP self -- @return #GROUP self
function GROUP:NewFromDCSUnit( DCSUnit ) function GROUP:NewFromDCSUnit( DCSUnit )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( DCSUnit ) self:F( DCSUnit )
self.DCSGroup = DCSUnit:getGroup() self.DCSGroup = DCSUnit:getGroup()
if self.DCSGroup then if self.DCSGroup then
@ -79,6 +87,8 @@ function GROUP:NewFromDCSUnit( DCSUnit )
self.Controller = self.DCSGroup:getController() self.Controller = self.DCSGroup:getController()
end end
GROUPS[self.GroupID] = self
return self return self
end end
@ -86,7 +96,7 @@ end
-- @param self -- @param self
-- @return #Group The DCSGroup. -- @return #Group The DCSGroup.
function GROUP:GetDCSGroup() function GROUP:GetDCSGroup()
self:T( { self.GroupName } ) self:F( { self.GroupName } )
self.DCSGroup = Group.getByName( self.GroupName ) self.DCSGroup = Group.getByName( self.GroupName )
return self.DCSGroup return self.DCSGroup
end end
@ -98,7 +108,7 @@ end
-- @param #number UnitNumber The unit index to be returned from the GROUP. -- @param #number UnitNumber The unit index to be returned from the GROUP.
-- @return #Unit The DCS Unit. -- @return #Unit The DCS Unit.
function GROUP:GetDCSUnit( UnitNumber ) function GROUP:GetDCSUnit( UnitNumber )
self:T( { self.GroupName, UnitNumber } ) self:F( { self.GroupName, UnitNumber } )
return self.DCSGroup:getUnit( UnitNumber ) return self.DCSGroup:getUnit( UnitNumber )
end end
@ -106,36 +116,85 @@ end
--- Activates a GROUP. --- Activates a GROUP.
-- @param self -- @param self
function GROUP:Activate() function GROUP:Activate()
self:T( { self.GroupName } ) self:F( { self.GroupName } )
trigger.action.activateGroup( self:GetDCSGroup() ) trigger.action.activateGroup( self:GetDCSGroup() )
return self:GetDCSGroup() return self:GetDCSGroup()
end end
--- Gets the ID of the GROUP.
-- @param self
-- @return #number The ID of the GROUP.
function GROUP:GetID()
self:F( self.GroupName )
return self.GroupID
end
--- Gets the name of the GROUP. --- Gets the name of the GROUP.
-- @param self -- @param self
-- @return #string The name of the GROUP. -- @return #string The name of the GROUP.
function GROUP:GetName() function GROUP:GetName()
self:T( self.GroupName ) self:F( self.GroupName )
return self.GroupName return self.GroupName
end end
--- Gets the current Point of the GROUP in VEC2 format. --- Gets the type name of the group.
-- @return #Vec2 Current x and Y position of the group. -- @param #GROUP self
function GROUP:GetPoint() -- @return #string The type name of the group.
self:T( self.GroupName ) function GROUP:GetTypeName()
self:F( self.GroupName )
return self.DCSGroup:getUnit(1):getTypeName()
end
--- Gets the callsign of the fist unit of the group.
-- @param #GROUP self
-- @return #string The callsign of the first unit of the group.
function GROUP:GetCallsign()
self:F( self.GroupName )
return self.DCSGroup:getUnit(1):getCallsign()
end
--- Gets the current Point of the GROUP in VEC3 format.
-- @return #Vec3 Current x,y and z position of the group.
function GROUP:GetPointVec2()
self:F( self.GroupName )
local GroupPoint = self:GetUnit(1):GetPoint() local GroupPoint = self:GetUnit(1):GetPointVec2()
self:T( GroupPoint ) self:T( GroupPoint )
return GroupPoint return GroupPoint
end end
--- Gets the current Point of the GROUP in VEC2 format.
-- @return #Vec2 Current x and y position of the group in the 2D plane.
function GROUP:GetPointVec2()
self:F( self.GroupName )
local GroupPoint = self:GetUnit(1):GetPointVec2()
self:T( GroupPoint )
return GroupPoint
end
--- Gets the current Point of the GROUP in VEC3 format.
-- @return #Vec3 Current Vec3 position of the group.
function GROUP:GetPositionVec3()
self:F( self.GroupName )
local GroupPoint = self:GetUnit(1):GetPositionVec3()
self:T( GroupPoint )
return GroupPoint
end
--- Destroy a GROUP --- Destroy a GROUP
-- Note that this destroy method also raises a destroy event at run-time. -- Note that this destroy method also raises a destroy event at run-time.
-- So all event listeners will catch the destroy event of this GROUP. -- So all event listeners will catch the destroy event of this GROUP.
-- @param self -- @param self
function GROUP:Destroy() function GROUP:Destroy()
self:T( self.GroupName ) self:F( self.GroupName )
for Index, UnitData in pairs( self.DCSGroup:getUnits() ) do for Index, UnitData in pairs( self.DCSGroup:getUnits() ) do
self:CreateEventCrash( timer.getTime(), UnitData ) self:CreateEventCrash( timer.getTime(), UnitData )
@ -147,11 +206,11 @@ end
--- Gets the DCS Unit. --- Gets the DCS Unit.
-- @param self -- @param #GROUP self
-- @param #number UnitNumber The number of the Unit to be returned. -- @param #number UnitNumber The number of the Unit to be returned.
-- @return #Unit The DCS Unit. -- @return Unit#UNIT The DCS Unit.
function GROUP:GetUnit( UnitNumber ) function GROUP:GetUnit( UnitNumber )
self:T( { self.GroupName, UnitNumber } ) self:F( { self.GroupName, UnitNumber } )
return UNIT:New( self.DCSGroup:getUnit( UnitNumber ) ) return UNIT:New( self.DCSGroup:getUnit( UnitNumber ) )
end end
@ -160,7 +219,7 @@ end
-- @param self -- @param self
-- @return #boolean Air category evaluation result. -- @return #boolean Air category evaluation result.
function GROUP:IsAir() function GROUP:IsAir()
self:T() self:F()
local IsAirResult = self.DCSGroup:getCategory() == Group.Category.AIRPLANE or self.DCSGroup:getCategory() == Group.Category.HELICOPTER local IsAirResult = self.DCSGroup:getCategory() == Group.Category.AIRPLANE or self.DCSGroup:getCategory() == Group.Category.HELICOPTER
@ -173,7 +232,7 @@ end
-- @param self -- @param self
-- @return #boolean Alive result. -- @return #boolean Alive result.
function GROUP:IsAlive() function GROUP:IsAlive()
self:T() self:F()
local IsAliveResult = self.DCSGroup and self.DCSGroup:isExist() local IsAliveResult = self.DCSGroup and self.DCSGroup:isExist()
@ -186,7 +245,7 @@ end
-- @param self -- @param self
-- @return #boolean All units on the ground result. -- @return #boolean All units on the ground result.
function GROUP:AllOnGround() function GROUP:AllOnGround()
self:T() self:F()
local AllOnGroundResult = true local AllOnGroundResult = true
@ -202,10 +261,10 @@ end
--- Returns the current maximum velocity of the group. --- Returns the current maximum velocity of the group.
-- Each unit within the group gets evaluated, and the maximum velocity (= the unit which is going the fastest) is returned. -- Each unit within the group gets evaluated, and the maximum velocity (= the unit which is going the fastest) is returned.
-- @param self -- @param #GROUP self
-- @return #number Maximum velocity found. -- @return #number Maximum velocity found.
function GROUP:GetMaxVelocity() function GROUP:GetMaxVelocity()
self:T() self:F()
local MaxVelocity = 0 local MaxVelocity = 0
@ -228,7 +287,7 @@ end
-- @param self -- @param self
-- @return #number Minimum height found. -- @return #number Minimum height found.
function GROUP:GetMinHeight() function GROUP:GetMinHeight()
self:T() self:F()
end end
@ -238,87 +297,341 @@ end
-- @param self -- @param self
-- @return #number Maximum height found. -- @return #number Maximum height found.
function GROUP:GetMaxHeight() function GROUP:GetMaxHeight()
self:T() self:F()
end end
-- Tasks
--- Popping current Task from the group.
-- @param #GROUP self
-- @return Group#GROUP self
function GROUP:PopCurrentTask()
self:F()
local Controller = self:_GetController()
Controller:popTask()
return self
end
--- Pushing Task on the queue from the group.
-- @param #GROUP self
-- @return Group#GROUP self
function GROUP:PushTask( DCSTask )
self:F()
local Controller = self:_GetController()
Controller:pushTask( DCSTask )
return self
end
--- Return a condition section for a controlled task
-- @param #GROUP self
-- @param #Time time
-- @param #string userFlag
-- @param #boolean userFlagValue
-- @param #string condition
-- @param #Time duration
-- @param #number lastWayPoint
-- return #DCSTask
function GROUP:TaskCondition( time, userFlag, userFlagValue, condition, duration, lastWayPoint )
self:F( { time, userFlag, userFlagValue, condition, duration, lastWayPoint } )
local DCSStopCondition = {}
DCSStopCondition.time = time
DCSStopCondition.userFlag = userFlag
DCSStopCondition.userFlagValue = userFlagValue
DCSStopCondition.condition = condition
DCSStopCondition.duration = duration
DCSStopCondition.lastWayPoint = lastWayPoint
self:T( { DCSStopCondition } )
return DCSStopCondition
end
--- Return a Controlled Task taking a Task and a TaskCondition
-- @param #GROUP self
-- @param #DCSTask DCSTask
-- @param #DCSStopCondition DCSStopCondition
-- @return #DCSTask
function GROUP:TaskControlled( DCSTask, DCSStopCondition )
self:F( { DCSTask, DCSStopCondition } )
local DCSTaskControlled
DCSTaskControlled = {
id = 'ControlledTask',
params = {
task = DCSTask,
stopCondition = DCSStopCondition,
}
}
self:T( { DCSTaskControlled } )
return DCSTaskControlled
end
--- Orbit at a specified position at a specified alititude during a specified duration with a specified speed.
-- @param #GROUP self
-- @param #Vec2 Point The point to hold the position.
-- @param #number Altitude The altitude to hold the position.
-- @param #number Speed The speed flying when holding the position.
-- @return #GROUP self
function GROUP:TaskOrbitCircleAtVec2( Point, Altitude, Speed )
self:F( { self.GroupName, Point, Altitude, Speed } )
-- pattern = enum AI.Task.OribtPattern,
-- point = Vec2,
-- point2 = Vec2,
-- speed = Distance,
-- altitude = Distance
local LandHeight = land.getHeight( Point )
self:T( { LandHeight } )
local DCSTask = { id = 'Orbit',
params = { pattern = AI.Task.OrbitPattern.CIRCLE,
point = Point,
speed = Speed,
altitude = Altitude + LandHeight
}
}
-- local AITask = { id = 'ControlledTask',
-- params = { task = { id = 'Orbit',
-- params = { pattern = AI.Task.OrbitPattern.CIRCLE,
-- point = Point,
-- speed = Speed,
-- altitude = Altitude + LandHeight
-- }
-- },
-- stopCondition = { duration = Duration
-- }
-- }
-- }
-- )
return DCSTask
end
--- Orbit at the current position of the first unit of the group at a specified alititude
-- @param #GROUP self
-- @param #number Altitude The altitude to hold the position.
-- @param #number Speed The speed flying when holding the position.
-- @return #GROUP self
function GROUP:TaskOrbitCircle( Altitude, Speed )
self:F( { self.GroupName, Altitude, Speed } )
local GroupPoint = self:GetPointVec2()
return self:TaskOrbitCircleAtVec2( GroupPoint, Altitude, Speed )
end
--- Hold position at the current position of the first unit of the group.
-- @param #GROUP self
-- @param #number Duration The maximum duration in seconds to hold the position.
-- @return #GROUP self
function GROUP:TaskHoldPosition()
self:F( { self.GroupName } )
return self:TaskOrbitCircle( 30, 10 )
end
--- Land the group at a Vec2Point. --- Land the group at a Vec2Point.
-- @param self -- @param #GROUP self
-- @param #Vec2 Point The point where to land. -- @param #Vec2 Point 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 #GROUP self -- @return #GROUP self
function GROUP:Land( Point, Duration ) function GROUP:TaskLandAtVec2( Point, Duration )
trace.f( self.ClassName, { self.GroupName, Point, Duration } ) self:F( { self.GroupName, Point, Duration } )
local Controller = self:_GetController() local DCSTask
if Duration and Duration > 0 then if Duration and Duration > 0 then
Controller:pushTask( { id = 'Land', params = { point = Point, durationFlag = true, duration = Duration } } ) DCSTask = { id = 'Land', params = { point = Point, durationFlag = true, duration = Duration } }
else else
Controller:pushTask( { id = 'Land', params = { point = Point, durationFlag = false } } ) DCSTask = { id = 'Land', params = { point = Point, durationFlag = false } }
end end
return self self:T( DCSTask )
return DCSTask
end end
--- Land the group at a @{Zone#ZONE).
-- @param #GROUP self
-- @param Zone#ZONE Zone The zone where to land.
-- @param #number Duration The duration in seconds to stay on the ground.
-- @return #GROUP self
function GROUP:TaskLandAtZone( Zone, Duration )
self:F( { self.GroupName, Zone, Duration } )
local Point = Zone:GetPointVec2()
local DCSTask = self:TaskLandAtVec2( Point, Duration )
self:T( DCSTask )
return DCSTask
end
--- Attack the Unit.
-- @param #GROUP self
-- @param Unit#UNIT The unit.
-- @return #DCSTask The DCS task structure.
function GROUP:TaskAttackUnit( AttackUnit )
self:F( { self.GroupName, AttackUnit } )
-- AttackUnit = {
-- id = 'AttackUnit',
-- params = {
-- unitId = Unit.ID,
-- weaponType = number,
-- expend = enum AI.Task.WeaponExpend
-- attackQty = number,
-- direction = Azimuth,
-- attackQtyLimit = boolean,
-- groupAttack = boolean,
-- }
-- }
local DCSTask
DCSTask = { id = 'AttackUnit',
params = { unitId = AttackUnit:GetID(),
expend = AI.Task.WeaponExpend.TWO,
groupAttack = true,
}
}
self:T( { DCSTask } )
return self
end
--- Move the group to a Vec2 Point, wait for a defined duration and embark a group. --- Move the group to a Vec2 Point, wait for a defined duration and embark a group.
-- @param self -- @param #GROUP self
-- @param #Vec2 Point The point where to wait. -- @param #Vec2 Point The point where to wait.
-- @param #number Duration The duration in seconds to wait. -- @param #number Duration The duration in seconds to wait.
-- @param EmbarkingGroup The group to be embarked. -- @param #GROUP EmbarkingGroup The group to be embarked.
-- @return #GROUP self -- @return #DCSTask The DCS task structure
function GROUP:Embarking( Point, Duration, EmbarkingGroup ) function GROUP:TaskEmbarkingAtVec2( Point, Duration, EmbarkingGroup )
trace.f( self.ClassName, { self.GroupName, Point, Duration, EmbarkingGroup.DCSGroup } ) self:F( { self.GroupName, Point, Duration, EmbarkingGroup.DCSGroup } )
local Controller = self:_GetController() local DCSTask
DCSTask = { id = 'Embarking',
params = { x = Point.x,
y = Point.y,
duration = Duration,
groupsForEmbarking = { EmbarkingGroup.GroupID },
durationFlag = true,
distributionFlag = false,
distribution = {},
}
}
trace.i( self.ClassName, EmbarkingGroup.GroupID ) self:T( { DCSTask } )
trace.i( self.ClassName, EmbarkingGroup.DCSGroup:getID() ) return DCSTask
trace.i( self.ClassName, EmbarkingGroup.DCSGroup.id )
Controller:pushTask( { id = 'Embarking',
params = { x = Point.x,
y = Point.y,
duration = Duration,
groupsForEmbarking = { EmbarkingGroup.GroupID },
durationFlag = true,
distributionFlag = false,
distribution = {},
}
}
)
return self
end end
--- Move to a defined Vec2 Point, and embark to a group when arrived within a defined Radius. --- Move to a defined Vec2 Point, and embark to a group when arrived within a defined Radius.
-- @param self -- @param #GROUP self
-- @param #Vec2 Point The point where to wait. -- @param #Vec2 Point The point where to wait.
-- @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 #GROUP self -- @return #DCSTask The DCS task structure.
function GROUP:EmbarkToTransport( Point, Radius ) function GROUP:TaskEmbarkToTransportAtVec2( Point, Radius )
trace.f( self.ClassName, { self.GroupName, Point, Radius } ) self:F( { self.GroupName, Point, Radius } )
local Controller = self:_GetController() local DCSTask --#DCSTask
DCSTask = { id = 'EmbarkToTransport',
Controller:pushTask( { id = 'EmbarkToTransport', params = { x = Point.x,
params = { x = Point.x, y = Point.y,
y = Point.y, zoneRadius = Radius,
zoneRadius = Radius, }
} }
}
)
return self self:T( { DCSTask } )
return DCSTask
end end
--- Return a Misson task from a mission template.
-- @param #GROUP self
-- @param #table TaskMission A table containing the mission task.
-- @return #DCSTask
function GROUP:TaskMission( TaskMission )
self:F( Points )
local DCSTask
DCSTask = { id = 'Mission', params = { TaskMission, }, }
self:T( { DCSTask } )
return DCSTask
end
--- Return a Misson task to follow a given route defined by Points.
-- @param #GROUP self
-- @param #table Points A table of route points.
-- @return #DCSTask
function GROUP:TaskRoute( Points )
self:F( Points )
local DCSTask
DCSTask = { id = 'Mission', params = { route = { points = Points, }, }, }
self:T( { DCSTask } )
return DCSTask
end
--- Make the group to fly to a given point and hover.
-- @param #GROUP self
-- @param #Vec3 Point The destination point.
-- @param #number Speed The speed to travel.
-- @return #GROUP self
function GROUP:TaskRouteToVec3( Point, Speed )
self:F( { Point, Speed } )
local GroupPoint = self:GetUnit( 1 ):GetPositionVec3()
local PointFrom = {}
PointFrom.x = GroupPoint.x
PointFrom.y = GroupPoint.z
PointFrom.alt = GroupPoint.y
PointFrom.type = "Turning Point"
local PointTo = {}
PointTo.x = Point.x
PointTo.y = Point.z
PointTo.alt = Point.y
PointTo.type = "Turning Point"
PointTo.speed = Speed
PointTo.speed_locked = true
local Points = { PointFrom, PointTo }
self:T( Points )
self:Route( Points )
return self
end
--- Make the group to follow a given route. --- Make the group to follow a given route.
-- @param self -- @param #GROUP self
-- @param #table GoPoints A table of Route Points. -- @param #table GoPoints A table of Route Points.
-- @return #GROUP self -- @return #GROUP self
function GROUP:Route( GoPoints ) function GROUP:Route( GoPoints )
self:T( GoPoints ) self:F( GoPoints )
local Points = routines.utils.deepCopy( GoPoints ) local Points = routines.utils.deepCopy( GoPoints )
local MissionTask = { id = 'Mission', params = { route = { points = Points, }, }, } local MissionTask = { id = 'Mission', params = { route = { points = Points, }, }, }
@ -330,19 +643,46 @@ self:T( GoPoints )
return self return self
end end
function GROUP:TaskRegisterWayPoint( WayPoint )
local DCSTask
DCSTask = { id = "WrappedAction",
enabled = true,
auto = false,
number = 1,
params =
{
action =
{
id = "Script",
params =
{
command = "local MissionGroup = GROUP.FindGroup( ... ) " ..
"env.info( MissionGroup:GetName() ) " ..
"MissionGroup:RegisterWayPoint ( " .. WayPoint .. " )",
}, -- end of ["params"]
}, -- end of ["action"]
}, -- end of ["params"]
}
self:T( DCSTask )
return DCSTask
end
--- Route the group to a given zone. --- Route the group to a given zone.
-- The group final destination point can be randomized. -- The group final destination point can be randomized.
-- A speed can be given in km/h. -- A speed can be given in km/h.
-- A given formation can be given. -- A given formation can be given.
-- @param self -- @param #GROUP self
-- @param ZONE#ZONE Zone The zone where to route to. -- @param Zone#ZONE Zone The zone where to route to.
-- @param #boolean Randomize Defines whether to target point gets randomized within the Zone. -- @param #boolean Randomize Defines whether to target point gets randomized within the Zone.
-- @param #number Speed The speed. -- @param #number Speed The speed.
-- @param BASE#FORMATION Formation The formation string. -- @param Base#FORMATION Formation The formation string.
function GROUP:RouteToZone( Zone, Randomize, Speed, Formation ) function GROUP:TaskRouteToZone( Zone, Randomize, Speed, Formation )
self:T( Zone ) self:F( Zone )
local GroupPoint = self:GetPoint() local GroupPoint = self:GetPointVec2()
local PointFrom = {} local PointFrom = {}
PointFrom.x = GroupPoint.x PointFrom.x = GroupPoint.x
@ -358,7 +698,7 @@ function GROUP:RouteToZone( Zone, Randomize, Speed, Formation )
if Randomize then if Randomize then
ZonePoint = Zone:GetRandomPoint() ZonePoint = Zone:GetRandomPoint()
else else
ZonePoint = Zone:GetPoint() ZonePoint = Zone:GetPointVec2()
end end
PointTo.x = ZonePoint.x PointTo.x = ZonePoint.x
@ -386,14 +726,32 @@ function GROUP:RouteToZone( Zone, Randomize, Speed, Formation )
return self return self
end end
--- Return the route of a group. --- Return the mission template of the group.
-- @param self -- @param #GROUP self
-- @return #table The MissionTemplate
function GROUP:GetTaskMission()
self:F( self.GroupName )
return _Database.Groups[self.GroupName].Template
end
--- Return the mission route of the group.
-- @param #GROUP self
-- @return #table The mission route defined by points.
function GROUP:GetTaskRoute()
self:F( self.GroupName )
return _Database.Groups[self.GroupName].Template.route.points
end
--- Return the route of a group by using the @{Database#DATABASE} class.
-- @param #GROUP self
-- @param #number Begin The route point from where the copy will start. The base route point is 0. -- @param #number Begin The route point from where the copy will start. The base route point is 0.
-- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0. -- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.
-- @param #boolean Randomize Randomization of the route, when true. -- @param #boolean Randomize Randomization of the route, when true.
-- @param #number Radius When randomization is on, the randomization is within the radius. -- @param #number Radius When randomization is on, the randomization is within the radius.
function GROUP:CopyRoute( Begin, End, Randomize, Radius ) function GROUP:CopyRoute( Begin, End, Randomize, Radius )
self:T( { Begin, End } ) self:F( { Begin, End } )
local Points = {} local Points = {}
@ -436,8 +794,205 @@ self:T( { Begin, End } )
end end
--- Get the controller for the GROUP. --- Get the controller for the GROUP.
-- @function _GetController
-- @param #GROUP self
-- @return Controller#Controller
function GROUP:_GetController() function GROUP:_GetController()
return self.DCSGroup:getController() return self.DCSGroup:getController()
end end
function GROUP:GetDetectedTargets()
return self:_GetController():getDetectedTargets()
end
function GROUP:IsTargetDetected( DCSObject )
local TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity
= self:_GetController():isTargetDetected( DCSObject )
return TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity
end
-- Options
--- Holding weapons.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionROEHoldFire()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_HOLD )
return self
end
--- Return fire.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionROEReturnFire()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.RETURN_FIRE )
return self
end
--- Openfire.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionROEOpenFire()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.OPEN_FIRE )
return self
end
--- Weapon free.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionROEWeaponFree()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_FREE )
return self
end
--- No evasion on enemy threats.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionEvasionNoReaction()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.REACTION_ON_THREAT, AI.Option.Air.val.REACTION_ON_THREAT.NO_REACTION )
return self
end
--- Evasion passive defense.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionROTPassiveDefense()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.REACTION_ON_THREAT, AI.Option.Air.val.REACTION_ON_THREAT.PASSIVE_DEFENSE )
return self
end
--- Evade fire.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionROTEvadeFire()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.REACTION_ON_THREAT, AI.Option.Air.val.REACTION_ON_THREAT.EVADE_FIRE )
return self
end
--- Vertical manoeuvres.
-- @param #GROUP self
-- @return #GROUP self
function GROUP:OptionROTVertical()
self:F( { self.GroupName } )
local Controller = self:_GetController()
Controller:setOption( AI.Option.Air.id.REACTION_ON_THREAT, AI.Option.Air.val.REACTION_ON_THREAT.BYPASS_AND_ESCAPE )
return self
end
-- Message APIs
--- Returns a message for a coalition or a client.
-- @param #GROUP self
-- @param #string Message The message text
-- @param #Duration Duration The duration of the message.
-- @return Message#MESSAGE
function GROUP:Message( Message, Duration )
self:F( { Message, Duration } )
return MESSAGE:New( Message, self:GetCallsign() .. "(" .. self:GetTypeName() .. ")", Duration, self:GetClassNameAndID() )
end
--- Send a message to all coalitions.
-- The message will appear in the message area. The message will begin with the callsign of the group and the type of the first unit sending the message.
-- @param #GROUP self
-- @param #string Message The message text
-- @param #Duration Duration The duration of the message.
function GROUP:MessageToAll( Message, Duration )
self:F( { Message, Duration } )
self:Message( Message, Duration ):ToAll()
end
--- Send a message to the red coalition.
-- The message will appear in the message area. The message will begin with the callsign of the group and the type of the first unit sending the message.
-- @param #GROUP self
-- @param #string Message The message text
-- @param #Duration Duration The duration of the message.
function GROUP:MessageToRed( Message, Duration )
self:F( { Message, Duration } )
self:Message( Message, Duration ):ToRed()
end
--- Send a message to the blue coalition.
-- The message will appear in the message area. The message will begin with the callsign of the group and the type of the first unit sending the message.
-- @param #GROUP self
-- @param #string Message The message text
-- @param #Duration Duration The duration of the message.
function GROUP:MessageToBlue( Message, Duration )
self:F( { Message, Duration } )
self:Message( Message, Duration ):ToBlue()
end
--- Send a message to a client.
-- The message will appear in the message area. The message will begin with the callsign of the group and the type of the first unit sending the message.
-- @param #GROUP self
-- @param #string Message The message text
-- @param #Duration Duration The duration of the message.
-- @param Client#CLIENT Client The client object receiving the message.
function GROUP:MessageToClient( Message, Duration, Client )
self:F( { Message, Duration } )
self:Message( Message, Duration ):ToClient( Client )
end
function GROUP:RegisterWayPoint( WayPoint )
self:Message( "Moving over wayPoint " .. WayPoint, 20 ):ToAll()
self.WayPoint = WayPoint
end
--- Find the created GROUP using the DCSGroup ID. If a GROUP was created with the DCSGroupID, the the GROUP instance will be returned.
-- Otherwise nil will be returned.
-- @param DCSGroup#Group Group
-- @return #GROUP
function GROUP.FindGroup( DCSGroup )
local self = GROUPS[DCSGroup:getID()] -- Group#GROUP
self:T( self:GetClassNameAndID() )
return self
end

View File

@ -1,11 +1,12 @@
--- Encapsulation of DCS World Menu system in a set of MENU classes. --- Encapsulation of DCS World Menu system in a set of MENU classes.
-- @module MENU -- @module Menu
Include.File( "Routines" ) Include.File( "Routines" )
Include.File( "Base" ) Include.File( "Base" )
--- The MENU class --- The MENU class
-- @type -- @type MENU
-- @extends Base#BASE
MENU = { MENU = {
ClassName = "MENU", ClassName = "MENU",
MenuPath = nil, MenuPath = nil,
@ -26,7 +27,8 @@ function MENU:New( MenuText, MenuParentPath )
end end
--- The COMMANDMENU class --- The COMMANDMENU class
-- @type -- @type COMMANDMENU
-- @extends Menu#MENU
COMMANDMENU = { COMMANDMENU = {
ClassName = "COMMANDMENU", ClassName = "COMMANDMENU",
CommandMenuFunction = nil, CommandMenuFunction = nil,
@ -51,7 +53,8 @@ function COMMANDMENU:New( MenuText, ParentMenu, CommandMenuFunction, CommandMenu
end end
--- The SUBMENU class --- The SUBMENU class
-- @type -- @type SUBMENU
-- @extends Menu#MENU
SUBMENU = { SUBMENU = {
ClassName = "SUBMENU" ClassName = "SUBMENU"
} }
@ -70,45 +73,123 @@ function SUBMENU:New( MenuText, ParentMenu )
return Child return Child
end end
--- The MENU_SUB_GROUP class -- This local variable is used to cache the menus registered under clients.
-- @type -- Menus don't dissapear when clients are destroyed and restarted.
MENU_SUB_GROUP = { -- So every menu for a client created must be tracked so that program logic accidentally does not create
ClassName = "MENU_SUB_GROUP" -- the same menus twice during initialization logic.
-- These menu classes are handling this logic with this variable.
local _MENUCLIENTS = {}
--- The MENU_CLIENT class
-- @type MENU_CLIENT
-- @extends Menu#MENU
MENU_CLIENT = {
ClassName = "MENU_CLIENT"
} }
function MENU_SUB_GROUP:New( GroupID, MenuText, ParentMenu ) --- Creates a new menu item for a group
-- @param self
-- @param Client#CLIENT MenuClient The Client owning the menu.
-- @param #string MenuText The text for the menu.
-- @param #table ParentMenu The parent menu.
-- @return #MENU_CLIENT self
function MENU_CLIENT:New( MenuClient, MenuText, ParentMenu )
-- Arrange meta tables -- Arrange meta tables
local MenuParentPath = nil local MenuParentPath = {}
if ParentMenu ~= nil then if ParentMenu ~= nil then
MenuParentPath = ParentMenu.MenuPath MenuParentPath = ParentMenu.MenuPath
end end
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) ) local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
self:F( { MenuClient, MenuText, ParentMenu } )
self.MenuClient = MenuClient
self.MenuClientGroupID = MenuClient:GetClientGroupID()
self.MenuParentPath = MenuParentPath
self.MenuText = MenuText
if not _MENUCLIENTS[self.MenuClientGroupID] then
_MENUCLIENTS[self.MenuClientGroupID] = {}
end
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText } )
if not MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] then
self.MenuPath = missionCommands.addSubMenuForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath )
MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] = self.MenuPath
else
self.MenuPath = MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText]
end
self.MenuPath = missionCommands.addSubMenuForGroup( GroupID, MenuText, MenuParentPath )
return self return self
end end
--- The MENU_COMMAND_GROUP class
-- @type --- The MENU_CLIENT_COMMAND class
MENU_COMMAND_GROUP = { -- @type MENU_CLIENT_COMMAND
ClassName = "MENU_COMMAND_GROUP" -- @extends Menu#MENU
MENU_CLIENT_COMMAND = {
ClassName = "MENU_CLIENT_COMMAND"
} }
function MENU_COMMAND_GROUP:New( GroupID, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument ) --- Creates a new radio command item for a group
-- @param self
-- @param Client#CLIENT MenuClient The Client owning the menu.
-- @param MenuText The text for the menu.
-- @param ParentMenu The parent menu.
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
-- @param CommandMenuArgument An argument for the function.
-- @return Menu#MENU_CLIENT_COMMAND self
function MENU_CLIENT_COMMAND:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument )
-- Arrange meta tables -- Arrange meta tables
local MenuParentPath = nil local MenuParentPath = {}
if ParentMenu ~= nil then if ParentMenu ~= nil then
MenuParentPath = ParentMenu.MenuPath MenuParentPath = ParentMenu.MenuPath
end end
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) ) local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
self.MenuClient = MenuClient
self.MenuClientGroupID = MenuClient:GetClientGroupID()
self.MenuParentPath = MenuParentPath
self.MenuText = MenuText
if not _MENUCLIENTS[self.MenuClientGroupID] then
_MENUCLIENTS[self.MenuClientGroupID] = {}
end
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, CommandMenuArgument } )
if not MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] then
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, CommandMenuFunction, CommandMenuArgument )
MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] = self.MenuPath
else
self.MenuPath = MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText]
end
self.MenuPath = missionCommands.addCommandForGroup( GroupID, MenuText, MenuParentPath, CommandMenuFunction, CommandMenuArgument )
self.CommandMenuFunction = CommandMenuFunction self.CommandMenuFunction = CommandMenuFunction
self.CommandMenuArgument = CommandMenuArgument self.CommandMenuArgument = CommandMenuArgument
return self return self
end end
function MENU_CLIENT_COMMAND:Remove()
if not _MENUCLIENTS[self.MenuClientGroupID] then
_MENUCLIENTS[self.MenuClientGroupID] = {}
end
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
if MenuPath[table.concat(self.MenuParentPath) .. "/" .. self.MenuText] then
MenuPath[table.concat(self.MenuParentPath) .. "/" .. self.MenuText] = nil
end
missionCommands.removeItemForGroup( self.MenuClient:GetClientGroupID(), self.MenuPath )
return nil
end

View File

@ -6,13 +6,12 @@
-- Messages are sent to Clients with MESSAGE:@{ToClient}(). -- Messages are sent to Clients with MESSAGE:@{ToClient}().
-- Messages are sent to Coalitions with MESSAGE:@{ToCoalition}(). -- Messages are sent to Coalitions with MESSAGE:@{ToCoalition}().
-- Messages are sent to All Players with MESSAGE:@{ToAll}(). -- Messages are sent to All Players with MESSAGE:@{ToAll}().
-- @module MESSAGE -- @module Message
Include.File( "Trace" )
Include.File( "Base" ) Include.File( "Base" )
--- The MESSAGE class --- The MESSAGE class
-- @type -- @type MESSAGE
MESSAGE = { MESSAGE = {
ClassName = "MESSAGE", ClassName = "MESSAGE",
MessageCategory = 0, MessageCategory = 0,
@ -21,11 +20,12 @@ MESSAGE = {
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients. --- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients.
-- @param string MessageText is the text of the Message. -- @param self
-- @param string MessageCategory is a string expressing the Category of the Message. Messages are grouped on the display panel per Category to improve readability. -- @param #string MessageText is the text of the Message.
-- @param number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel. -- @param #string MessageCategory is a string expressing the Category of the Message. Messages are grouped on the display panel per Category to improve readability.
-- @param string MessageID is a string expressing the ID of the Message. -- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
-- @return MESSAGE -- @param #string MessageID is a string expressing the ID of the Message.
-- @return #MESSAGE
-- @usage -- @usage
-- -- Create a series of new Messages. -- -- Create a series of new Messages.
-- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score". -- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score".
@ -38,7 +38,7 @@ MESSAGE = {
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ) -- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" )
function MESSAGE:New( MessageText, MessageCategory, MessageDuration, MessageID ) function MESSAGE:New( MessageText, MessageCategory, MessageDuration, MessageID )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( { MessageText, MessageCategory, MessageDuration, MessageID } ) self:F( { MessageText, MessageCategory, MessageDuration, MessageID } )
-- When no messagecategory is given, we don't show it as a title... -- When no messagecategory is given, we don't show it as a title...
if MessageCategory and MessageCategory ~= "" then if MessageCategory and MessageCategory ~= "" then
@ -60,8 +60,9 @@ function MESSAGE:New( MessageText, MessageCategory, MessageDuration, MessageID )
end end
--- Sends a MESSAGE to a Client Group. Note that the Group needs to be defined within the ME with the skillset "Client" or "Player". --- Sends a MESSAGE to a Client Group. Note that the Group needs to be defined within the ME with the skillset "Client" or "Player".
-- @param CLIENT Client is the Group of the Client. -- @param #MESSAGE self
-- @return MESSAGE -- @param Client#CLIENT Client is the Group of the Client.
-- @return #MESSAGE
-- @usage -- @usage
-- -- Send the 2 messages created with the @{New} method to the Client Group. -- -- Send the 2 messages created with the @{New} method to the Client Group.
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1. -- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
@ -78,20 +79,21 @@ end
-- MessageClient1:ToClient( ClientGroup ) -- MessageClient1:ToClient( ClientGroup )
-- MessageClient2:ToClient( ClientGroup ) -- MessageClient2:ToClient( ClientGroup )
function MESSAGE:ToClient( Client ) function MESSAGE:ToClient( Client )
self:T( Client ) self:F( Client )
if Client and Client:GetClientGroupID() then if Client and Client:GetClientGroupID() then
local ClientGroupID = Client:GetClientGroupID() local ClientGroupID = Client:GetClientGroupID()
trace.i( self.ClassName, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration ) self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration ) trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
end end
return self return self
end end
--- Sends a MESSAGE to the Blue coalition. --- Sends a MESSAGE to the Blue coalition.
-- @return MESSAGE -- @param #MESSAGE self
-- @return #MESSAGE
-- @usage -- @usage
-- -- Send a message created with the @{New} method to the BLUE coalition. -- -- Send a message created with the @{New} method to the BLUE coalition.
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToBlue() -- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToBlue()
@ -101,7 +103,7 @@ end
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ) -- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
-- MessageBLUE:ToBlue() -- MessageBLUE:ToBlue()
function MESSAGE:ToBlue() function MESSAGE:ToBlue()
self:T() self:F()
self:ToCoalition( coalition.side.BLUE ) self:ToCoalition( coalition.side.BLUE )
@ -109,7 +111,8 @@ function MESSAGE:ToBlue()
end end
--- Sends a MESSAGE to the Red Coalition. --- Sends a MESSAGE to the Red Coalition.
-- @return MESSAGE -- @param #MESSAGE self
-- @return #MESSAGE
-- @usage -- @usage
-- -- Send a message created with the @{New} method to the RED coalition. -- -- Send a message created with the @{New} method to the RED coalition.
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToRed() -- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToRed()
@ -119,7 +122,7 @@ end
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ) -- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
-- MessageRED:ToRed() -- MessageRED:ToRed()
function MESSAGE:ToRed( ) function MESSAGE:ToRed( )
self:T() self:F()
self:ToCoalition( coalition.side.RED ) self:ToCoalition( coalition.side.RED )
@ -127,8 +130,9 @@ function MESSAGE:ToRed( )
end end
--- Sends a MESSAGE to a Coalition. --- Sends a MESSAGE to a Coalition.
-- @param #MESSAGE self
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}. -- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}.
-- @return MESSAGE -- @return #MESSAGE
-- @usage -- @usage
-- -- Send a message created with the @{New} method to the RED coalition. -- -- Send a message created with the @{New} method to the RED coalition.
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToCoalition( coalition.side.RED ) -- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToCoalition( coalition.side.RED )
@ -138,10 +142,10 @@ end
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ) -- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
-- MessageRED:ToCoalition( coalition.side.RED ) -- MessageRED:ToCoalition( coalition.side.RED )
function MESSAGE:ToCoalition( CoalitionSide ) function MESSAGE:ToCoalition( CoalitionSide )
self:T( CoalitionSide ) self:F( CoalitionSide )
if CoalitionSide then if CoalitionSide then
trace.i(self.ClassName, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration ) self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration ) trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
end end
@ -149,7 +153,8 @@ function MESSAGE:ToCoalition( CoalitionSide )
end end
--- Sends a MESSAGE to all players. --- Sends a MESSAGE to all players.
-- @return MESSAGE -- @param #MESSAGE self
-- @return #MESSAGE
-- @usage -- @usage
-- -- Send a message created to all players. -- -- Send a message created to all players.
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ):ToAll() -- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ):ToAll()
@ -159,7 +164,7 @@ end
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ) -- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" )
-- MessageAll:ToAll() -- MessageAll:ToAll()
function MESSAGE:ToAll() function MESSAGE:ToAll()
self:T() self:F()
self:ToCoalition( coalition.side.RED ) self:ToCoalition( coalition.side.RED )
self:ToCoalition( coalition.side.BLUE ) self:ToCoalition( coalition.side.BLUE )
@ -178,7 +183,7 @@ MESSAGEQUEUE = {
function MESSAGEQUEUE:New( RefreshInterval ) function MESSAGEQUEUE:New( RefreshInterval )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( { RefreshInterval } ) self:F( { RefreshInterval } )
self.RefreshInterval = RefreshInterval self.RefreshInterval = RefreshInterval

View File

@ -33,7 +33,7 @@ MISSION = {
function MISSION:Meta() function MISSION:Meta()
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T() self:F()
return self return self
end end
@ -79,13 +79,13 @@ end
--- Returns if a Mission has completed. --- Returns if a Mission has completed.
-- @return bool -- @return bool
function MISSION:IsCompleted() function MISSION:IsCompleted()
self:T() self:F()
return self.MissionStatus == "ACCOMPLISHED" return self.MissionStatus == "ACCOMPLISHED"
end end
--- Set a Mission to completed. --- Set a Mission to completed.
function MISSION:Completed() function MISSION:Completed()
self:T() self:F()
self.MissionStatus = "ACCOMPLISHED" self.MissionStatus = "ACCOMPLISHED"
self:StatusToClients() self:StatusToClients()
end end
@ -93,13 +93,13 @@ end
--- Returns if a Mission is ongoing. --- Returns if a Mission is ongoing.
-- treturn bool -- treturn bool
function MISSION:IsOngoing() function MISSION:IsOngoing()
self:T() self:F()
return self.MissionStatus == "ONGOING" return self.MissionStatus == "ONGOING"
end end
--- Set a Mission to ongoing. --- Set a Mission to ongoing.
function MISSION:Ongoing() function MISSION:Ongoing()
self:T() self:F()
self.MissionStatus = "ONGOING" self.MissionStatus = "ONGOING"
--self:StatusToClients() --self:StatusToClients()
end end
@ -107,13 +107,13 @@ end
--- Returns if a Mission is pending. --- Returns if a Mission is pending.
-- treturn bool -- treturn bool
function MISSION:IsPending() function MISSION:IsPending()
self:T() self:F()
return self.MissionStatus == "PENDING" return self.MissionStatus == "PENDING"
end end
--- Set a Mission to pending. --- Set a Mission to pending.
function MISSION:Pending() function MISSION:Pending()
self:T() self:F()
self.MissionStatus = "PENDING" self.MissionStatus = "PENDING"
self:StatusToClients() self:StatusToClients()
end end
@ -121,20 +121,20 @@ end
--- Returns if a Mission has failed. --- Returns if a Mission has failed.
-- treturn bool -- treturn bool
function MISSION:IsFailed() function MISSION:IsFailed()
self:T() self:F()
return self.MissionStatus == "FAILED" return self.MissionStatus == "FAILED"
end end
--- Set a Mission to failed. --- Set a Mission to failed.
function MISSION:Failed() function MISSION:Failed()
self:T() self:F()
self.MissionStatus = "FAILED" self.MissionStatus = "FAILED"
self:StatusToClients() self:StatusToClients()
end end
--- Send the status of the MISSION to all Clients. --- Send the status of the MISSION to all Clients.
function MISSION:StatusToClients() function MISSION:StatusToClients()
self:T() self:F()
if self.MissionReportFlash then if self.MissionReportFlash then
for ClientID, Client in pairs( self._Clients ) do for ClientID, Client in pairs( self._Clients ) do
Client:Message( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. '! ( ' .. self.MissionPriority .. ' mission ) ', 10, self.Name .. '/Status', "Mission Command: Mission Status") Client:Message( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. '! ( ' .. self.MissionPriority .. ' mission ) ', 10, self.Name .. '/Status', "Mission Command: Mission Status")
@ -144,37 +144,32 @@ end
--- Handles the reporting. After certain time intervals, a MISSION report MESSAGE will be shown to All Players. --- Handles the reporting. After certain time intervals, a MISSION report MESSAGE will be shown to All Players.
function MISSION:ReportTrigger() function MISSION:ReportTrigger()
self:T() self:F()
if self.MissionReportShow == true then if self.MissionReportShow == true then
self.MissionReportShow = false self.MissionReportShow = false
trace.r( "MISSION", "1", { true } )
return true return true
else else
if self.MissionReportFlash == true then if self.MissionReportFlash == true then
if timer.getTime() >= self.MissionReportTrigger then if timer.getTime() >= self.MissionReportTrigger then
self.MissionReportTrigger = timer.getTime() + self.MissionTimeInterval self.MissionReportTrigger = timer.getTime() + self.MissionTimeInterval
trace.r( "MISSION", "2", { true } )
return true return true
else else
trace.r( "MISSION", "3", { false } )
return false return false
end end
else else
trace.r( "MISSION", "4", { false } )
return false return false
end end
end end
trace.e()
end end
--- Report the status of all MISSIONs to all active Clients. --- Report the status of all MISSIONs to all active Clients.
function MISSION:ReportToAll() function MISSION:ReportToAll()
self:T() self:F()
local AlivePlayers = '' local AlivePlayers = ''
for ClientID, Client in pairs( self._Clients ) do for ClientID, Client in pairs( self._Clients ) do
if Client:ClientGroup() then if Client:GetDCSGroup() then
if Client:GetClientGroupDCSUnit() then if Client:GetClientGroupDCSUnit() then
if Client:GetClientGroupDCSUnit():getLife() > 0.0 then if Client:GetClientGroupDCSUnit():getLife() > 0.0 then
if AlivePlayers == '' then if AlivePlayers == '' then
@ -232,7 +227,7 @@ end
-- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' ) -- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' )
-- Mission:AddGoalFunction( DeployPatriotTroopsGoal ) -- Mission:AddGoalFunction( DeployPatriotTroopsGoal )
function MISSION:AddGoalFunction( GoalFunction ) function MISSION:AddGoalFunction( GoalFunction )
self:T() self:F()
self.GoalFunction = GoalFunction self.GoalFunction = GoalFunction
end end
@ -240,7 +235,7 @@ end
-- @param CLIENT Client to show briefing to. -- @param CLIENT Client to show briefing to.
-- @return CLIENT -- @return CLIENT
function MISSION:ShowBriefing( Client ) function MISSION:ShowBriefing( Client )
self:T( { Client.ClientName } ) self:F( { Client.ClientName } )
if not Client.ClientBriefingShown then if not Client.ClientBriefingShown then
Client.ClientBriefingShown = true Client.ClientBriefingShown = true
@ -265,7 +260,7 @@ end
-- Mission:AddClient( CLIENT:New( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) -- Mission:AddClient( CLIENT:New( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
-- Mission:AddClient( CLIENT:New( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) -- Mission:AddClient( CLIENT:New( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
function MISSION:AddClient( Client ) function MISSION:AddClient( Client )
self:T( { Client } ) self:F( { Client } )
local Valid = true local Valid = true
@ -273,7 +268,6 @@ function MISSION:AddClient( Client )
self._Clients[Client.ClientName] = Client self._Clients[Client.ClientName] = Client
end end
trace.r( self.ClassName, "" )
return Client return Client
end end
@ -284,7 +278,7 @@ end
-- -- Seach for Client "Bomber" within the Mission. -- -- Seach for Client "Bomber" within the Mission.
-- local BomberClient = Mission:FindClient( "Bomber" ) -- local BomberClient = Mission:FindClient( "Bomber" )
function MISSION:FindClient( ClientName ) function MISSION:FindClient( ClientName )
self:T( { self._Clients[ClientName] } ) self:F( { self._Clients[ClientName] } )
return self._Clients[ClientName] return self._Clients[ClientName]
end end
@ -315,7 +309,7 @@ end
-- Mission:AddTask( DeployTask, 2 ) -- Mission:AddTask( DeployTask, 2 )
function MISSION:AddTask( Task, TaskNumber ) function MISSION:AddTask( Task, TaskNumber )
self:T() self:F()
self._Tasks[TaskNumber] = Task self._Tasks[TaskNumber] = Task
self._Tasks[TaskNumber]:EnableEvents() self._Tasks[TaskNumber]:EnableEvents()
@ -332,7 +326,7 @@ function MISSION:AddTask( Task, TaskNumber )
-- Task2 = Mission:GetTask( 2 ) -- Task2 = Mission:GetTask( 2 )
function MISSION:GetTask( TaskNumber ) function MISSION:GetTask( TaskNumber )
self:T() self:F()
local Valid = true local Valid = true
@ -356,7 +350,7 @@ end
-- Tasks = Mission:GetTasks() -- Tasks = Mission:GetTasks()
-- env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" ) -- env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
function MISSION:GetTasks() function MISSION:GetTasks()
self:T() self:F()
return self._Tasks return self._Tasks
end end
@ -391,13 +385,10 @@ MISSIONSCHEDULER = {
--- This is the main MISSIONSCHEDULER Scheduler function. It is considered internal and is automatically created when the Mission.lua file is included. --- This is the main MISSIONSCHEDULER Scheduler function. It is considered internal and is automatically created when the Mission.lua file is included.
function MISSIONSCHEDULER.Scheduler() function MISSIONSCHEDULER.Scheduler()
trace.scheduled("MISSIONSCHEDULER","Scheduler")
-- loop through the missions in the TransportTasks -- loop through the missions in the TransportTasks
for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do
trace.i( "MISSIONSCHEDULER", MissionName )
if not Mission:IsCompleted() then if not Mission:IsCompleted() then
-- This flag will monitor if for this mission, there are clients alive. If this flag is still false at the end of the loop, the mission status will be set to Pending (if not Failed or Completed). -- This flag will monitor if for this mission, there are clients alive. If this flag is still false at the end of the loop, the mission status will be set to Pending (if not Failed or Completed).
@ -405,9 +396,7 @@ trace.scheduled("MISSIONSCHEDULER","Scheduler")
for ClientID, Client in pairs( Mission._Clients ) do for ClientID, Client in pairs( Mission._Clients ) do
trace.i( "MISSIONSCHEDULER", "Client: " .. Client.ClientName ) if Client:GetDCSGroup() then
if Client:ClientGroup() then
-- There is at least one Client that is alive... So the Mission status is set to Ongoing. -- There is at least one Client that is alive... So the Mission status is set to Ongoing.
ClientsAlive = true ClientsAlive = true
@ -470,7 +459,6 @@ trace.scheduled("MISSIONSCHEDULER","Scheduler")
end end
if Task:IsDone() then if Task:IsDone() then
trace.i( "MISSIONSCHEDULER", "Task " .. Task.Name .. " is Done." )
--env.info( 'Scheduler: Mission '.. Mission.Name .. ' Task ' .. Task.Name .. ' Stage ' .. Task.Stage.Name .. ' done. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) ) --env.info( 'Scheduler: Mission '.. Mission.Name .. ' Task ' .. Task.Name .. ' Stage ' .. Task.Stage.Name .. ' done. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) )
TaskComplete = true -- when a task is not yet completed, a mission cannot be completed TaskComplete = true -- when a task is not yet completed, a mission cannot be completed
@ -546,29 +534,22 @@ trace.scheduled("MISSIONSCHEDULER","Scheduler")
if Mission:ReportTrigger() then if Mission:ReportTrigger() then
Mission:ReportToAll() Mission:ReportToAll()
end end
end end
trace.e()
end end
--- Start the MISSIONSCHEDULER. --- Start the MISSIONSCHEDULER.
function MISSIONSCHEDULER.Start() function MISSIONSCHEDULER.Start()
trace.f("MISSIONSCHEDULER")
if MISSIONSCHEDULER ~= nil then if MISSIONSCHEDULER ~= nil then
MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 ) MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 )
end end
trace.e()
end end
--- Stop the MISSIONSCHEDULER. --- Stop the MISSIONSCHEDULER.
function MISSIONSCHEDULER.Stop() function MISSIONSCHEDULER.Stop()
trace.f("MISSIONSCHEDULER")
if MISSIONSCHEDULER.SchedulerId then if MISSIONSCHEDULER.SchedulerId then
routines.removeFunction(MISSIONSCHEDULER.SchedulerId) routines.removeFunction(MISSIONSCHEDULER.SchedulerId)
MISSIONSCHEDULER.SchedulerId = nil MISSIONSCHEDULER.SchedulerId = nil
end end
trace.e()
end end
--- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc. --- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.
@ -582,13 +563,11 @@ end
-- 'Russia' ) -- 'Russia' )
-- MISSIONSCHEDULER:AddMission( Mission ) -- MISSIONSCHEDULER:AddMission( Mission )
function MISSIONSCHEDULER.AddMission( Mission ) function MISSIONSCHEDULER.AddMission( Mission )
trace.f("MISSIONSCHEDULER")
MISSIONSCHEDULER.Missions[Mission.Name] = Mission MISSIONSCHEDULER.Missions[Mission.Name] = Mission
MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount + 1 MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount + 1
-- Add an overall AI Client for the AI tasks... This AI Client will facilitate the Events in the background for each Task. -- Add an overall AI Client for the AI tasks... This AI Client will facilitate the Events in the background for each Task.
--MissionAdd:AddClient( CLIENT:New( 'AI' ) ) --MissionAdd:AddClient( CLIENT:New( 'AI' ) )
trace.r( "MISSIONSCHEDULER", "" )
return Mission return Mission
end end
@ -605,10 +584,8 @@ end
-- -- Now remove the Mission. -- -- Now remove the Mission.
-- MISSIONSCHEDULER:RemoveMission( 'Russia Transport Troops SA-6' ) -- MISSIONSCHEDULER:RemoveMission( 'Russia Transport Troops SA-6' )
function MISSIONSCHEDULER.RemoveMission( MissionName ) function MISSIONSCHEDULER.RemoveMission( MissionName )
trace.f("MISSIONSCHEDULER")
MISSIONSCHEDULER.Missions[MissionName] = nil MISSIONSCHEDULER.Missions[MissionName] = nil
MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount - 1 MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount - 1
trace.e()
end end
--- Find a MISSION within the MISSIONSCHEDULER. --- Find a MISSION within the MISSIONSCHEDULER.
@ -625,24 +602,19 @@ end
-- -- Now find the Mission. -- -- Now find the Mission.
-- MissionFind = MISSIONSCHEDULER:FindMission( 'Russia Transport Troops SA-6' ) -- MissionFind = MISSIONSCHEDULER:FindMission( 'Russia Transport Troops SA-6' )
function MISSIONSCHEDULER.FindMission( MissionName ) function MISSIONSCHEDULER.FindMission( MissionName )
trace.f("MISSIONSCHEDULER")
trace.r( "MISSIONSCHEDULER", "" )
return MISSIONSCHEDULER.Missions[MissionName] return MISSIONSCHEDULER.Missions[MissionName]
end end
-- Internal function used by the MISSIONSCHEDULER menu. -- Internal function used by the MISSIONSCHEDULER menu.
function MISSIONSCHEDULER.ReportMissionsShow( ) function MISSIONSCHEDULER.ReportMissionsShow( )
trace.menu("MISSIONSCHEDULER","ReportMissionsShow")
for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do
Mission.MissionReportShow = true Mission.MissionReportShow = true
Mission.MissionReportFlash = false Mission.MissionReportFlash = false
end end
trace.e()
end end
-- Internal function used by the MISSIONSCHEDULER menu. -- Internal function used by the MISSIONSCHEDULER menu.
function MISSIONSCHEDULER.ReportMissionsFlash( TimeInterval ) function MISSIONSCHEDULER.ReportMissionsFlash( TimeInterval )
trace.menu("MISSIONSCHEDULER","ReportMissionsFlash")
local Count = 0 local Count = 0
for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do
Mission.MissionReportShow = false Mission.MissionReportShow = false
@ -652,49 +624,40 @@ trace.menu("MISSIONSCHEDULER","ReportMissionsFlash")
env.info( "TimeInterval = " .. Mission.MissionTimeInterval ) env.info( "TimeInterval = " .. Mission.MissionTimeInterval )
Count = Count + 1 Count = Count + 1
end end
trace.e()
end end
-- Internal function used by the MISSIONSCHEDULER menu. -- Internal function used by the MISSIONSCHEDULER menu.
function MISSIONSCHEDULER.ReportMissionsHide( Prm ) function MISSIONSCHEDULER.ReportMissionsHide( Prm )
trace.menu("MISSIONSCHEDULER","ReportMissionsHide")
for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do
Mission.MissionReportShow = false Mission.MissionReportShow = false
Mission.MissionReportFlash = false Mission.MissionReportFlash = false
end end
trace.e()
end end
--- Enables a MENU option in the communications menu under F10 to control the status of the active missions. --- Enables a MENU option in the communications menu under F10 to control the status of the active missions.
-- This function should be called only once when starting the MISSIONSCHEDULER. -- This function should be called only once when starting the MISSIONSCHEDULER.
function MISSIONSCHEDULER.ReportMenu() function MISSIONSCHEDULER.ReportMenu()
trace.f("MISSIONSCHEDULER")
local ReportMenu = SUBMENU:New( 'Status' ) local ReportMenu = SUBMENU:New( 'Status' )
local ReportMenuShow = COMMANDMENU:New( 'Show Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsShow, 0 ) local ReportMenuShow = COMMANDMENU:New( 'Show Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsShow, 0 )
local ReportMenuFlash = COMMANDMENU:New('Flash Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsFlash, 120 ) local ReportMenuFlash = COMMANDMENU:New('Flash Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsFlash, 120 )
local ReportMenuHide = COMMANDMENU:New( 'Hide Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsHide, 0 ) local ReportMenuHide = COMMANDMENU:New( 'Hide Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsHide, 0 )
trace.e()
end end
--- Show the remaining mission time. --- Show the remaining mission time.
function MISSIONSCHEDULER:TimeShow() function MISSIONSCHEDULER:TimeShow()
trace.f("MISSIONSCHEDULER")
self.TimeIntervalCount = self.TimeIntervalCount + 1 self.TimeIntervalCount = self.TimeIntervalCount + 1
if self.TimeIntervalCount >= self.TimeTriggerShow then if self.TimeIntervalCount >= self.TimeTriggerShow then
local TimeMsg = string.format("%00d", ( self.TimeSeconds / 60 ) - ( timer.getTime() / 60 )) .. ' minutes left until mission reload.' local TimeMsg = string.format("%00d", ( self.TimeSeconds / 60 ) - ( timer.getTime() / 60 )) .. ' minutes left until mission reload.'
MESSAGE:New( TimeMsg, "Mission time", self.TimeShow, '/TimeMsg' ):ToAll() MESSAGE:New( TimeMsg, "Mission time", self.TimeShow, '/TimeMsg' ):ToAll()
self.TimeIntervalCount = 0 self.TimeIntervalCount = 0
end end
trace.e()
end end
function MISSIONSCHEDULER:Time( TimeSeconds, TimeIntervalShow, TimeShow ) function MISSIONSCHEDULER:Time( TimeSeconds, TimeIntervalShow, TimeShow )
trace.f("MISSIONSCHEDULER")
self.TimeIntervalCount = 0 self.TimeIntervalCount = 0
self.TimeSeconds = TimeSeconds self.TimeSeconds = TimeSeconds
self.TimeIntervalShow = TimeIntervalShow self.TimeIntervalShow = TimeIntervalShow
self.TimeShow = TimeShow self.TimeShow = TimeShow
trace.e()
end end

View File

@ -23,7 +23,7 @@ MOVEMENT = {
function MOVEMENT:New( MovePrefixes, MoveMaximum ) function MOVEMENT:New( MovePrefixes, MoveMaximum )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( { MovePrefixes, MoveMaximum } ) self:F( { MovePrefixes, MoveMaximum } )
if type( MovePrefixes ) == 'table' then if type( MovePrefixes ) == 'table' then
self.MovePrefixes = MovePrefixes self.MovePrefixes = MovePrefixes
@ -35,34 +35,34 @@ function MOVEMENT:New( MovePrefixes, MoveMaximum )
self.AliveUnits = 0 -- Contains the counter how many units are currently alive self.AliveUnits = 0 -- Contains the counter how many units are currently alive
self.MoveUnits = {} -- Reflects if the Moving for this MovePrefixes is going to be scheduled or not. self.MoveUnits = {} -- Reflects if the Moving for this MovePrefixes is going to be scheduled or not.
self.AddEvent( self, world.event.S_EVENT_BIRTH, self.OnBirth ) self:AddEvent( world.event.S_EVENT_BIRTH, self.OnBirth )
self.AddEvent( self, world.event.S_EVENT_DEAD, self.OnDeadOrCrash ) self:AddEvent( world.event.S_EVENT_DEAD, self.OnDeadOrCrash )
self.AddEvent( self, world.event.S_EVENT_CRASH, self.OnDeadOrCrash ) self:AddEvent( world.event.S_EVENT_CRASH, self.OnDeadOrCrash )
self.EnableEvents( self ) self:EnableEvents()
self.ScheduleStart( self ) self:ScheduleStart()
return self return self
end end
--- Call this function to start the MOVEMENT scheduling. --- Call this function to start the MOVEMENT scheduling.
function MOVEMENT:ScheduleStart() function MOVEMENT:ScheduleStart()
self:T() self:F()
self.MoveFunction = routines.scheduleFunction( self._Scheduler, { self }, timer.getTime() + 1, 120 ) self.MoveFunction = routines.scheduleFunction( self._Scheduler, { self }, timer.getTime() + 1, 120 )
end end
--- Call this function to stop the MOVEMENT scheduling. --- Call this function to stop the MOVEMENT scheduling.
-- @todo need to implement it ... Forgot. -- @todo need to implement it ... Forgot.
function MOVEMENT:ScheduleStop() function MOVEMENT:ScheduleStop()
self:T() self:F()
end end
--- Captures the birth events when new Units were spawned. --- Captures the birth events when new Units were spawned.
-- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration. -- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration.
function MOVEMENT:OnBirth( event ) function MOVEMENT:OnBirth( event )
self:T( { event } ) self:F( { event } )
if timer.getTime0() < timer.getAbsTime() then -- dont need to add units spawned in at the start of the mission if mist is loaded in init line if timer.getTime0() < timer.getAbsTime() then -- dont need to add units spawned in at the start of the mission if mist is loaded in init line
if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then
@ -88,7 +88,7 @@ end
--- Captures the Dead or Crash events when Units crash or are destroyed. --- Captures the Dead or Crash events when Units crash or are destroyed.
-- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration. -- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration.
function MOVEMENT:OnDeadOrCrash( event ) function MOVEMENT:OnDeadOrCrash( event )
self:T( { event } ) self:F( { event } )
if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then if event.initiator and Object.getCategory(event.initiator) == Object.Category.UNIT then
local MovementUnit = event.initiator local MovementUnit = event.initiator
@ -106,7 +106,7 @@ end
--- This function is called automatically by the MOVEMENT scheduler. A new function is scheduled when MoveScheduled is true. --- This function is called automatically by the MOVEMENT scheduler. A new function is scheduled when MoveScheduled is true.
function MOVEMENT:_Scheduler() function MOVEMENT:_Scheduler()
self:T( { self.MovePrefixes, self.MoveMaximum, self.AliveUnits, self.MovementGroups } ) self:F( { self.MovePrefixes, self.MoveMaximum, self.AliveUnits, self.MovementGroups } )
if self.AliveUnits > 0 then if self.AliveUnits > 0 then
local MoveProbability = ( self.MoveMaximum * 100 ) / self.AliveUnits local MoveProbability = ( self.MoveMaximum * 100 ) / self.AliveUnits

View File

@ -11,19 +11,17 @@ NOTASK = {
--- Creates a new NOTASK. --- Creates a new NOTASK.
function NOTASK:New() function NOTASK:New()
trace.f(self.ClassName) local self = BASE:Inherit( self, TASK:New() )
self:F()
-- Child holds the inherited instance of the PICKUPTASK Class to the BASE class.
local Child = BASE:Inherit( self, TASK:New() )
local Valid = true local Valid = true
if Valid then if Valid then
Child.Name = 'Nothing' self.Name = 'Nothing'
Child.TaskBriefing = "Task: Execute your mission." self.TaskBriefing = "Task: Execute your mission."
Child.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEDONE:New() } self.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEDONE:New() }
Child.SetStage( Child, 1 ) self.SetStage( self, 1 )
end end
return Child return self
end end

View File

@ -19,7 +19,7 @@ PICKUPTASK = {
-- @param number OnBoardSide Reflects from which side the cargo Group will be on-boarded on the Carrier. -- @param number OnBoardSide Reflects from which side the cargo Group will be on-boarded on the Carrier.
function PICKUPTASK:New( CargoType, OnBoardSide ) function PICKUPTASK:New( CargoType, OnBoardSide )
local self = BASE:Inherit( self, TASK:New() ) local self = BASE:Inherit( self, TASK:New() )
self:T() self:F()
-- self holds the inherited instance of the PICKUPTASK Class to the BASE class. -- self holds the inherited instance of the PICKUPTASK Class to the BASE class.
@ -41,7 +41,7 @@ function PICKUPTASK:New( CargoType, OnBoardSide )
end end
function PICKUPTASK:FromZone( LandingZone ) function PICKUPTASK:FromZone( LandingZone )
self:T() self:F()
self.LandingZones.LandingZoneNames[LandingZone.CargoZoneName] = LandingZone.CargoZoneName self.LandingZones.LandingZoneNames[LandingZone.CargoZoneName] = LandingZone.CargoZoneName
self.LandingZones.LandingZones[LandingZone.CargoZoneName] = LandingZone self.LandingZones.LandingZones[LandingZone.CargoZoneName] = LandingZone
@ -50,7 +50,7 @@ self:T()
end end
function PICKUPTASK:InitCargo( InitCargos ) function PICKUPTASK:InitCargo( InitCargos )
self:T( { InitCargos } ) self:F( { InitCargos } )
if type( InitCargos ) == "table" then if type( InitCargos ) == "table" then
self.Cargos.InitCargos = InitCargos self.Cargos.InitCargos = InitCargos
@ -62,7 +62,7 @@ self:T( { InitCargos } )
end end
function PICKUPTASK:LoadCargo( LoadCargos ) function PICKUPTASK:LoadCargo( LoadCargos )
self:T( { LoadCargos } ) self:F( { LoadCargos } )
if type( LoadCargos ) == "table" then if type( LoadCargos ) == "table" then
self.Cargos.LoadCargos = LoadCargos self.Cargos.LoadCargos = LoadCargos
@ -74,7 +74,7 @@ self:T( { LoadCargos } )
end end
function PICKUPTASK:AddCargoMenus( Client, Cargos, TransportRadius ) function PICKUPTASK:AddCargoMenus( Client, Cargos, TransportRadius )
self:T() self:F()
for CargoID, Cargo in pairs( Cargos ) do for CargoID, Cargo in pairs( Cargos ) do
@ -121,7 +121,7 @@ self:T()
end end
function PICKUPTASK:RemoveCargoMenus( Client ) function PICKUPTASK:RemoveCargoMenus( Client )
self:T() self:F()
for MenuID, MenuData in pairs( Client._Menus ) do for MenuID, MenuData in pairs( Client._Menus ) do
for SubMenuID, SubMenuData in pairs( MenuData.PickupSubMenus ) do for SubMenuID, SubMenuData in pairs( MenuData.PickupSubMenus ) do
@ -148,7 +148,7 @@ end
function PICKUPTASK:HasFailed( ClientDead ) function PICKUPTASK:HasFailed( ClientDead )
self:T() self:F()
local TaskHasFailed = self.TaskFailed local TaskHasFailed = self.TaskFailed
return TaskHasFailed return TaskHasFailed

View File

@ -13,31 +13,29 @@ ROUTETASK = {
-- @param string TaskBriefing (optional) Defines a text describing the briefing of the task. -- @param string TaskBriefing (optional) Defines a text describing the briefing of the task.
-- @return ROUTETASK -- @return ROUTETASK
function ROUTETASK:New( LandingZones, TaskBriefing ) function ROUTETASK:New( LandingZones, TaskBriefing )
trace.f(self.ClassName, { LandingZones, TaskBriefing } ) local self = BASE:Inherit( self, TASK:New() )
self:F( { LandingZones, TaskBriefing } )
-- Child holds the inherited instance of the PICKUPTASK Class to the BASE class.
local Child = BASE:Inherit( self, TASK:New() )
local Valid = true local Valid = true
Valid = routines.ValidateZone( LandingZones, "LandingZones", Valid ) Valid = routines.ValidateZone( LandingZones, "LandingZones", Valid )
if Valid then if Valid then
Child.Name = 'Route To Zone' self.Name = 'Route To Zone'
if TaskBriefing then if TaskBriefing then
Child.TaskBriefing = TaskBriefing .. " Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to the target objective." self.TaskBriefing = TaskBriefing .. " Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to the target objective."
else else
Child.TaskBriefing = "Task: Fly to specified zone(s). Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to the target objective." self.TaskBriefing = "Task: Fly to specified zone(s). Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to the target objective."
end end
if type( LandingZones ) == "table" then if type( LandingZones ) == "table" then
Child.LandingZones = LandingZones self.LandingZones = LandingZones
else else
Child.LandingZones = { LandingZones } self.LandingZones = { LandingZones }
end end
Child.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEROUTE:New(), STAGEARRIVE:New(), STAGEDONE:New() } self.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEROUTE:New(), STAGEARRIVE:New(), STAGEDONE:New() }
Child.SetStage( Child, 1 ) self.SetStage( self, 1 )
end end
return Child return self
end end

View File

@ -2,7 +2,7 @@
-- @module routines -- @module routines
-- @author Flightcontrol -- @author Flightcontrol
Include.File( "Trace" ) --Include.File( "Trace" )
--Include.File( "Message" ) --Include.File( "Message" )
@ -422,7 +422,7 @@ routines.tostringBR = function(az, dist, alt, metric)
dist = routines.utils.round(routines.utils.metersToNM(dist), 2) dist = routines.utils.round(routines.utils.metersToNM(dist), 2)
end end
local s = string.format('%03d°', az) .. ' for ' .. dist local s = string.format('%03d', az) .. ' for ' .. dist
if alt then if alt then
if metric then if metric then
@ -1455,7 +1455,7 @@ end
function routines.IsPartOfGroupInZones( CargoGroup, LandingZones ) function routines.IsPartOfGroupInZones( CargoGroup, LandingZones )
trace.f() --trace.f()
local CurrentZoneID = nil local CurrentZoneID = nil
@ -1471,14 +1471,14 @@ trace.f()
end end
end end
trace.r( "", "", { CurrentZoneID } ) --trace.r( "", "", { CurrentZoneID } )
return CurrentZoneID return CurrentZoneID
end end
function routines.IsUnitInZones( TransportUnit, LandingZones ) function routines.IsUnitInZones( TransportUnit, LandingZones )
trace.f("", "routines.IsUnitInZones" ) --trace.f("", "routines.IsUnitInZones" )
local TransportZoneResult = nil local TransportZoneResult = nil
local TransportZonePos = nil local TransportZonePos = nil
@ -1506,19 +1506,19 @@ trace.f("", "routines.IsUnitInZones" )
end end
end end
if TransportZoneResult then if TransportZoneResult then
trace.i( "routines", "TransportZone:" .. TransportZoneResult ) --trace.i( "routines", "TransportZone:" .. TransportZoneResult )
else else
trace.i( "routines", "TransportZone:nil logic" ) --trace.i( "routines", "TransportZone:nil logic" )
end end
return TransportZoneResult return TransportZoneResult
else else
trace.i( "routines", "TransportZone:nil hard" ) --trace.i( "routines", "TransportZone:nil hard" )
return nil return nil
end end
end end
function routines.IsStaticInZones( TransportStatic, LandingZones ) function routines.IsStaticInZones( TransportStatic, LandingZones )
trace.f() --trace.f()
local TransportZoneResult = nil local TransportZoneResult = nil
local TransportZonePos = nil local TransportZonePos = nil
@ -1545,13 +1545,13 @@ trace.f()
end end
end end
trace.r( "", "", { TransportZoneResult } ) --trace.r( "", "", { TransportZoneResult } )
return TransportZoneResult return TransportZoneResult
end end
function routines.IsUnitInRadius( CargoUnit, ReferencePosition, Radius ) function routines.IsUnitInRadius( CargoUnit, ReferencePosition, Radius )
trace.f() --trace.f()
local Valid = true local Valid = true
@ -1568,7 +1568,7 @@ trace.f()
end end
function routines.IsPartOfGroupInRadius( CargoGroup, ReferencePosition, Radius ) function routines.IsPartOfGroupInRadius( CargoGroup, ReferencePosition, Radius )
trace.f() --trace.f()
local Valid = true local Valid = true
@ -1594,7 +1594,7 @@ end
function routines.ValidateString( Variable, VariableName, Valid ) function routines.ValidateString( Variable, VariableName, Valid )
trace.f() --trace.f()
if type( Variable ) == "string" then if type( Variable ) == "string" then
if Variable == "" then if Variable == "" then
@ -1606,12 +1606,12 @@ trace.f()
Valid = false Valid = false
end end
trace.r( "", "", { Valid } ) --trace.r( "", "", { Valid } )
return Valid return Valid
end end
function routines.ValidateNumber( Variable, VariableName, Valid ) function routines.ValidateNumber( Variable, VariableName, Valid )
trace.f() --trace.f()
if type( Variable ) == "number" then if type( Variable ) == "number" then
else else
@ -1619,25 +1619,25 @@ trace.f()
Valid = false Valid = false
end end
trace.r( "", "", { Valid } ) --trace.r( "", "", { Valid } )
return Valid return Valid
end end
function routines.ValidateGroup( Variable, VariableName, Valid ) function routines.ValidateGroup( Variable, VariableName, Valid )
trace.f() --trace.f()
if Variable == nil then if Variable == nil then
error( "routines.ValidateGroup: error: " .. VariableName .. " is a nil value!" ) error( "routines.ValidateGroup: error: " .. VariableName .. " is a nil value!" )
Valid = false Valid = false
end end
trace.r( "", "", { Valid } ) --trace.r( "", "", { Valid } )
return Valid return Valid
end end
function routines.ValidateZone( LandingZones, VariableName, Valid ) function routines.ValidateZone( LandingZones, VariableName, Valid )
trace.f() --trace.f()
if LandingZones == nil then if LandingZones == nil then
error( "routines.ValidateGroup: error: " .. VariableName .. " is a nil value!" ) error( "routines.ValidateGroup: error: " .. VariableName .. " is a nil value!" )
@ -1659,12 +1659,12 @@ trace.f()
end end
end end
trace.r( "", "", { Valid } ) --trace.r( "", "", { Valid } )
return Valid return Valid
end end
function routines.ValidateEnumeration( Variable, VariableName, Enum, Valid ) function routines.ValidateEnumeration( Variable, VariableName, Enum, Valid )
trace.f() --trace.f()
local ValidVariable = false local ValidVariable = false
@ -1681,7 +1681,7 @@ trace.f()
Valid = false Valid = false
end end
trace.r( "", "", { Valid } ) --trace.r( "", "", { Valid } )
return Valid return Valid
end end
@ -1859,7 +1859,7 @@ routines.ground.patrol = function(gpData, pType, form, speed)
end end
function routines.GetUnitHeight( CheckUnit ) function routines.GetUnitHeight( CheckUnit )
trace.f( "routines" ) --trace.f( "routines" )
local UnitPoint = CheckUnit:getPoint() local UnitPoint = CheckUnit:getPoint()
local UnitPosition = { x = UnitPoint.x, y = UnitPoint.z } local UnitPosition = { x = UnitPoint.x, y = UnitPoint.z }
@ -1869,7 +1869,7 @@ trace.f( "routines" )
--env.info(( 'CarrierHeight: LandHeight = ' .. LandHeight .. ' CarrierHeight = ' .. CarrierHeight )) --env.info(( 'CarrierHeight: LandHeight = ' .. LandHeight .. ' CarrierHeight = ' .. CarrierHeight ))
trace.f( "routines", "Unit Height = " .. UnitHeight - LandHeight ) --trace.f( "routines", "Unit Height = " .. UnitHeight - LandHeight )
return UnitHeight - LandHeight return UnitHeight - LandHeight
@ -1886,7 +1886,7 @@ Su34Menus = 0
function Su34AttackCarlVinson(groupName) function Su34AttackCarlVinson(groupName)
trace.menu("", "Su34AttackCarlVinson") --trace.menu("", "Su34AttackCarlVinson")
local groupSu34 = Group.getByName( groupName ) local groupSu34 = Group.getByName( groupName )
local controllerSu34 = groupSu34.getController(groupSu34) local controllerSu34 = groupSu34.getController(groupSu34)
local groupCarlVinson = Group.getByName("US Carl Vinson #001") local groupCarlVinson = Group.getByName("US Carl Vinson #001")
@ -1900,7 +1900,7 @@ trace.menu("", "Su34AttackCarlVinson")
end end
function Su34AttackWest(groupName) function Su34AttackWest(groupName)
trace.f("","Su34AttackWest") --trace.f("","Su34AttackWest")
local groupSu34 = Group.getByName( groupName ) local groupSu34 = Group.getByName( groupName )
local controllerSu34 = groupSu34.getController(groupSu34) local controllerSu34 = groupSu34.getController(groupSu34)
local groupShipWest1 = Group.getByName("US Ship West #001") local groupShipWest1 = Group.getByName("US Ship West #001")
@ -1918,7 +1918,7 @@ trace.f("","Su34AttackWest")
end end
function Su34AttackNorth(groupName) function Su34AttackNorth(groupName)
trace.menu("","Su34AttackNorth") --trace.menu("","Su34AttackNorth")
local groupSu34 = Group.getByName( groupName ) local groupSu34 = Group.getByName( groupName )
local controllerSu34 = groupSu34.getController(groupSu34) local controllerSu34 = groupSu34.getController(groupSu34)
local groupShipNorth1 = Group.getByName("US Ship North #001") local groupShipNorth1 = Group.getByName("US Ship North #001")
@ -1940,7 +1940,7 @@ trace.menu("","Su34AttackNorth")
end end
function Su34Orbit(groupName) function Su34Orbit(groupName)
trace.menu("","Su34Orbit") --trace.menu("","Su34Orbit")
local groupSu34 = Group.getByName( groupName ) local groupSu34 = Group.getByName( groupName )
local controllerSu34 = groupSu34:getController() local controllerSu34 = groupSu34:getController()
controllerSu34.setOption( controllerSu34, AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_HOLD ) controllerSu34.setOption( controllerSu34, AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_HOLD )
@ -1951,7 +1951,7 @@ trace.menu("","Su34Orbit")
end end
function Su34TakeOff(groupName) function Su34TakeOff(groupName)
trace.menu("","Su34TakeOff") --trace.menu("","Su34TakeOff")
local groupSu34 = Group.getByName( groupName ) local groupSu34 = Group.getByName( groupName )
local controllerSu34 = groupSu34:getController() local controllerSu34 = groupSu34:getController()
controllerSu34.setOption( controllerSu34, AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_HOLD ) controllerSu34.setOption( controllerSu34, AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_HOLD )
@ -1961,7 +1961,7 @@ trace.menu("","Su34TakeOff")
end end
function Su34Hold(groupName) function Su34Hold(groupName)
trace.menu("","Su34Hold") --trace.menu("","Su34Hold")
local groupSu34 = Group.getByName( groupName ) local groupSu34 = Group.getByName( groupName )
local controllerSu34 = groupSu34:getController() local controllerSu34 = groupSu34:getController()
controllerSu34.setOption( controllerSu34, AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_HOLD ) controllerSu34.setOption( controllerSu34, AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_HOLD )
@ -1971,19 +1971,19 @@ trace.menu("","Su34Hold")
end end
function Su34RTB(groupName) function Su34RTB(groupName)
trace.menu("","Su34RTB") --trace.menu("","Su34RTB")
Su34Status.status[groupName] = 6 Su34Status.status[groupName] = 6
MessageToRed( string.format('%s: ',groupName) .. 'Return to Krasnodar. ', 10, 'RedStatus' .. groupName ) MessageToRed( string.format('%s: ',groupName) .. 'Return to Krasnodar. ', 10, 'RedStatus' .. groupName )
end end
function Su34Destroyed(groupName) function Su34Destroyed(groupName)
trace.menu("","Su34Destroyed") --trace.menu("","Su34Destroyed")
Su34Status.status[groupName] = 7 Su34Status.status[groupName] = 7
MessageToRed( string.format('%s: ',groupName) .. 'Destroyed. ', 30, 'RedStatus' .. groupName ) MessageToRed( string.format('%s: ',groupName) .. 'Destroyed. ', 30, 'RedStatus' .. groupName )
end end
function GroupAlive( groupName ) function GroupAlive( groupName )
trace.menu("","GroupAlive") --trace.menu("","GroupAlive")
local groupTest = Group.getByName( groupName ) local groupTest = Group.getByName( groupName )
local groupExists = false local groupExists = false
@ -1992,17 +1992,17 @@ trace.menu("","GroupAlive")
groupExists = groupTest:isExist() groupExists = groupTest:isExist()
end end
trace.r( "", "", { groupExists } ) --trace.r( "", "", { groupExists } )
return groupExists return groupExists
end end
function Su34IsDead() function Su34IsDead()
trace.f() --trace.f()
end end
function Su34OverviewStatus() function Su34OverviewStatus()
trace.menu("","Su34OverviewStatus") --trace.menu("","Su34OverviewStatus")
local msg = "" local msg = ""
local currentStatus = 0 local currentStatus = 0
local Exists = false local Exists = false
@ -2053,25 +2053,25 @@ end
function UpdateBoardMsg() function UpdateBoardMsg()
trace.f() --trace.f()
Su34OverviewStatus() Su34OverviewStatus()
MessageToRed( boardMsgRed.statusMsg, 15, 'RedStatus' ) MessageToRed( boardMsgRed.statusMsg, 15, 'RedStatus' )
end end
function MusicReset( flg ) function MusicReset( flg )
trace.f() --trace.f()
trigger.action.setUserFlag(95,flg) trigger.action.setUserFlag(95,flg)
end end
function PlaneActivate(groupNameFormat, flg) function PlaneActivate(groupNameFormat, flg)
trace.f() --trace.f()
local groupName = groupNameFormat .. string.format("#%03d", trigger.misc.getUserFlag(flg)) local groupName = groupNameFormat .. string.format("#%03d", trigger.misc.getUserFlag(flg))
--trigger.action.outText(groupName,10) --trigger.action.outText(groupName,10)
trigger.action.activateGroup(Group.getByName(groupName)) trigger.action.activateGroup(Group.getByName(groupName))
end end
function Su34Menu(groupName) function Su34Menu(groupName)
trace.f() --trace.f()
--env.info(( 'Su34Menu(' .. groupName .. ')' )) --env.info(( 'Su34Menu(' .. groupName .. ')' ))
local groupSu34 = Group.getByName( groupName ) local groupSu34 = Group.getByName( groupName )
@ -2144,7 +2144,7 @@ end
--- Obsolete function, but kept to rework in framework. --- Obsolete function, but kept to rework in framework.
function ChooseInfantry ( TeleportPrefixTable, TeleportMax ) function ChooseInfantry ( TeleportPrefixTable, TeleportMax )
trace.f("Spawn") --trace.f("Spawn")
--env.info(( 'ChooseInfantry: ' )) --env.info(( 'ChooseInfantry: ' ))
TeleportPrefixTableCount = #TeleportPrefixTable TeleportPrefixTableCount = #TeleportPrefixTable
@ -2229,7 +2229,7 @@ end
SpawnedInfantry = 0 SpawnedInfantry = 0
function LandCarrier ( CarrierGroup, LandingZonePrefix ) function LandCarrier ( CarrierGroup, LandingZonePrefix )
trace.f() --trace.f()
--env.info(( 'LandCarrier: ' )) --env.info(( 'LandCarrier: ' ))
--env.info(( 'LandCarrier: CarrierGroup = ' .. CarrierGroup:getName() )) --env.info(( 'LandCarrier: CarrierGroup = ' .. CarrierGroup:getName() ))
--env.info(( 'LandCarrier: LandingZone = ' .. LandingZonePrefix )) --env.info(( 'LandCarrier: LandingZone = ' .. LandingZonePrefix ))
@ -2248,7 +2248,7 @@ end
EscortCount = 0 EscortCount = 0
function EscortCarrier ( CarrierGroup, EscortPrefix, EscortLastWayPoint, EscortEngagementDistanceMax, EscortTargetTypes ) function EscortCarrier ( CarrierGroup, EscortPrefix, EscortLastWayPoint, EscortEngagementDistanceMax, EscortTargetTypes )
trace.f() --trace.f()
--env.info(( 'EscortCarrier: ' )) --env.info(( 'EscortCarrier: ' ))
--env.info(( 'EscortCarrier: CarrierGroup = ' .. CarrierGroup:getName() )) --env.info(( 'EscortCarrier: CarrierGroup = ' .. CarrierGroup:getName() ))
--env.info(( 'EscortCarrier: EscortPrefix = ' .. EscortPrefix )) --env.info(( 'EscortCarrier: EscortPrefix = ' .. EscortPrefix ))
@ -2314,7 +2314,7 @@ trace.f()
end end
function SendMessageToCarrier( CarrierGroup, CarrierMessage ) function SendMessageToCarrier( CarrierGroup, CarrierMessage )
trace.f() --trace.f()
if CarrierGroup ~= nil then if CarrierGroup ~= nil then
MessageToGroup( CarrierGroup, CarrierMessage, 30, 'Carrier/' .. CarrierGroup:getName() ) MessageToGroup( CarrierGroup, CarrierMessage, 30, 'Carrier/' .. CarrierGroup:getName() )
@ -2323,7 +2323,7 @@ trace.f()
end end
function MessageToGroup( MsgGroup, MsgText, MsgTime, MsgName ) function MessageToGroup( MsgGroup, MsgText, MsgTime, MsgName )
trace.f() --trace.f()
if type(MsgGroup) == 'string' then if type(MsgGroup) == 'string' then
--env.info( 'MessageToGroup: Converted MsgGroup string "' .. MsgGroup .. '" into a Group structure.' ) --env.info( 'MessageToGroup: Converted MsgGroup string "' .. MsgGroup .. '" into a Group structure.' )
@ -2342,7 +2342,7 @@ trace.f()
end end
function MessageToUnit( UnitName, MsgText, MsgTime, MsgName ) function MessageToUnit( UnitName, MsgText, MsgTime, MsgName )
trace.f() --trace.f()
if UnitName ~= nil then if UnitName ~= nil then
local MsgTable = {} local MsgTable = {}
@ -2355,25 +2355,25 @@ trace.f()
end end
function MessageToAll( MsgText, MsgTime, MsgName ) function MessageToAll( MsgText, MsgTime, MsgName )
trace.f() --trace.f()
MESSAGE:New( MsgText, "Message", MsgTime, MsgName ):ToCoalition( coalition.side.RED ):ToCoalition( coalition.side.BLUE ) MESSAGE:New( MsgText, "Message", MsgTime, MsgName ):ToCoalition( coalition.side.RED ):ToCoalition( coalition.side.BLUE )
end end
function MessageToRed( MsgText, MsgTime, MsgName ) function MessageToRed( MsgText, MsgTime, MsgName )
trace.f() --trace.f()
MESSAGE:New( MsgText, "To Red Coalition", MsgTime, MsgName ):ToCoalition( coalition.side.RED ) MESSAGE:New( MsgText, "To Red Coalition", MsgTime, MsgName ):ToCoalition( coalition.side.RED )
end end
function MessageToBlue( MsgText, MsgTime, MsgName ) function MessageToBlue( MsgText, MsgTime, MsgName )
trace.f() --trace.f()
MESSAGE:New( MsgText, "To Blue Coalition", MsgTime, MsgName ):ToCoalition( coalition.side.RED ) MESSAGE:New( MsgText, "To Blue Coalition", MsgTime, MsgName ):ToCoalition( coalition.side.RED )
end end
function getCarrierHeight( CarrierGroup ) function getCarrierHeight( CarrierGroup )
trace.f() --trace.f()
if CarrierGroup ~= nil then if CarrierGroup ~= nil then
if table.getn(CarrierGroup:getUnits()) == 1 then if table.getn(CarrierGroup:getUnits()) == 1 then
@ -2398,7 +2398,7 @@ trace.f()
end end
function GetUnitHeight( CheckUnit ) function GetUnitHeight( CheckUnit )
trace.f() --trace.f()
local UnitPoint = CheckUnit:getPoint() local UnitPoint = CheckUnit:getPoint()
local UnitPosition = { x = CurrentPoint.x, y = CurrentPoint.z } local UnitPosition = { x = CurrentPoint.x, y = CurrentPoint.z }
@ -2420,7 +2420,7 @@ _MusicTable.FileCnt = 0
function MusicRegister( SndRef, SndFile, SndTime ) function MusicRegister( SndRef, SndFile, SndTime )
trace.f() --trace.f()
env.info(( 'MusicRegister: SndRef = ' .. SndRef )) env.info(( 'MusicRegister: SndRef = ' .. SndRef ))
env.info(( 'MusicRegister: SndFile = ' .. SndFile )) env.info(( 'MusicRegister: SndFile = ' .. SndFile ))
@ -2441,7 +2441,7 @@ trace.f()
end end
function MusicToPlayer( SndRef, PlayerName, SndContinue ) function MusicToPlayer( SndRef, PlayerName, SndContinue )
trace.f() --trace.f()
--env.info(( 'MusicToPlayer: SndRef = ' .. SndRef )) --env.info(( 'MusicToPlayer: SndRef = ' .. SndRef ))
@ -2464,7 +2464,7 @@ trace.f()
end end
function MusicToGroup( SndRef, SndGroup, SndContinue ) function MusicToGroup( SndRef, SndGroup, SndContinue )
trace.f() --trace.f()
--env.info(( 'MusicToGroup: SndRef = ' .. SndRef )) --env.info(( 'MusicToGroup: SndRef = ' .. SndRef ))
@ -2507,7 +2507,7 @@ trace.f()
end end
function MusicCanStart(PlayerName) function MusicCanStart(PlayerName)
trace.f() --trace.f()
--env.info(( 'MusicCanStart:' )) --env.info(( 'MusicCanStart:' ))
@ -2549,7 +2549,7 @@ trace.f()
end end
function MusicScheduler() function MusicScheduler()
trace.scheduled("", "MusicScheduler") --trace.scheduled("", "MusicScheduler")
--env.info(( 'MusicScheduler:' )) --env.info(( 'MusicScheduler:' ))
if _MusicTable['Queue'] ~= nil and _MusicTable.FileCnt > 0 then if _MusicTable['Queue'] ~= nil and _MusicTable.FileCnt > 0 then

View File

@ -1,5 +1,5 @@
--- Provides defensive behaviour to a set of SAM sites within a running Mission. --- Provides defensive behaviour to a set of SAM sites within a running Mission.
-- @module SEAD -- @module Sead
-- @author to be searched on the forum -- @author to be searched on the forum
-- @author (co) Flightcontrol (Modified and enriched with functionality) -- @author (co) Flightcontrol (Modified and enriched with functionality)
@ -10,7 +10,8 @@ Include.File( "Client" )
Include.File( "Task" ) Include.File( "Task" )
--- The SEAD class --- The SEAD class
-- @type -- @type SEAD
-- @extends Base#BASE
SEAD = { SEAD = {
ClassName = "SEAD", ClassName = "SEAD",
TargetSkill = { TargetSkill = {
@ -33,7 +34,7 @@ SEAD = {
-- SEAD_RU_SAM_Defenses = SEAD:New( { 'RU SA-6 Kub', 'RU SA-6 Defenses', 'RU MI-26 Troops', 'RU Attack Gori' } ) -- SEAD_RU_SAM_Defenses = SEAD:New( { 'RU SA-6 Kub', 'RU SA-6 Defenses', 'RU MI-26 Troops', 'RU Attack Gori' } )
function SEAD:New( SEADGroupPrefixes ) function SEAD:New( SEADGroupPrefixes )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( SEADGroupPrefixes ) self:F( SEADGroupPrefixes )
if type( SEADGroupPrefixes ) == 'table' then if type( SEADGroupPrefixes ) == 'table' then
for SEADGroupPrefixID, SEADGroupPrefix in pairs( SEADGroupPrefixes ) do for SEADGroupPrefixID, SEADGroupPrefix in pairs( SEADGroupPrefixes ) do
self.SEADGroupPrefixes[SEADGroupPrefix] = SEADGroupPrefix self.SEADGroupPrefixes[SEADGroupPrefix] = SEADGroupPrefix
@ -41,8 +42,8 @@ function SEAD:New( SEADGroupPrefixes )
else else
self.SEADGroupNames[SEADGroupPrefixes] = SEADGroupPrefixes self.SEADGroupNames[SEADGroupPrefixes] = SEADGroupPrefixes
end end
self.AddEvent( self, world.event.S_EVENT_SHOT, self.EventShot ) self:AddEvent( world.event.S_EVENT_SHOT, self.EventShot )
self.EnableEvents( self ) self:EnableEvents()
return self return self
end end
@ -50,7 +51,7 @@ end
--- Detects if an SA site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME. --- Detects if an SA site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME.
-- @see SEAD -- @see SEAD
function SEAD:EventShot( event ) function SEAD:EventShot( event )
self:T( { event } ) self:F( { event } )
local SEADUnit = event.initiator local SEADUnit = event.initiator
local SEADUnitName = SEADUnit:getName() local SEADUnitName = SEADUnit:getName()

View File

@ -67,7 +67,7 @@
-- This models AI that has succesfully returned to their airbase, to restart their combat activities. -- This models AI that has succesfully returned to their airbase, to restart their combat activities.
-- Check the @{#SPAWN.CleanUp} for further info. -- Check the @{#SPAWN.CleanUp} for further info.
-- --
-- @module SPAWN -- @module Spawn
-- @author FlightControl -- @author FlightControl
Include.File( "Routines" ) Include.File( "Routines" )
@ -78,6 +78,7 @@ Include.File( "Zone" )
--- SPAWN Class --- SPAWN Class
-- @type SPAWN -- @type SPAWN
-- @extends Base#BASE
-- @field ClassName -- @field ClassName
SPAWN = { SPAWN = {
ClassName = "SPAWN", ClassName = "SPAWN",
@ -95,7 +96,7 @@ SPAWN = {
-- @usage local Plane = SPAWN:New( "Plane" ) -- Creates a new local variable that can initiate new planes with the name "Plane#ddd" using the template "Plane" as defined within the ME. -- @usage local Plane = SPAWN:New( "Plane" ) -- Creates a new local variable that can initiate new planes with the name "Plane#ddd" using the template "Plane" as defined within the ME.
function SPAWN:New( SpawnTemplatePrefix ) function SPAWN:New( SpawnTemplatePrefix )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( { SpawnTemplatePrefix } ) self:F( { SpawnTemplatePrefix } )
local TemplateGroup = Group.getByName( SpawnTemplatePrefix ) local TemplateGroup = Group.getByName( SpawnTemplatePrefix )
if TemplateGroup then if TemplateGroup then
@ -117,11 +118,11 @@ function SPAWN:New( SpawnTemplatePrefix )
error( "SPAWN:New: There is no group declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" ) error( "SPAWN:New: There is no group declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
end end
self.AddEvent( self, world.event.S_EVENT_BIRTH, self._OnBirth ) self:AddEvent( world.event.S_EVENT_BIRTH, self._OnBirth )
self.AddEvent( self, world.event.S_EVENT_DEAD, self._OnDeadOrCrash ) self:AddEvent( world.event.S_EVENT_DEAD, self._OnDeadOrCrash )
self.AddEvent( self, world.event.S_EVENT_CRASH, self._OnDeadOrCrash ) self:AddEvent( world.event.S_EVENT_CRASH, self._OnDeadOrCrash )
self.EnableEvents( self ) self:EnableEvents()
return self return self
end end
@ -137,7 +138,7 @@ end
-- @usage local PlaneWithAlias = SPAWN:NewWithAlias( "Plane", "Bomber" ) -- Creates a new local variable that can instantiate new planes with the name "Bomber#ddd" using the template "Plane" as defined within the ME. -- @usage local PlaneWithAlias = SPAWN:NewWithAlias( "Plane", "Bomber" ) -- Creates a new local variable that can instantiate new planes with the name "Bomber#ddd" using the template "Plane" as defined within the ME.
function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix ) function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( { SpawnTemplatePrefix, SpawnAliasPrefix } ) self:F( { SpawnTemplatePrefix, SpawnAliasPrefix } )
local TemplateGroup = Group.getByName( SpawnTemplatePrefix ) local TemplateGroup = Group.getByName( SpawnTemplatePrefix )
if TemplateGroup then if TemplateGroup then
@ -160,11 +161,11 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
error( "SPAWN:New: There is no group declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" ) error( "SPAWN:New: There is no group declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
end end
self.AddEvent( self, world.event.S_EVENT_BIRTH, self._OnBirth ) self:AddEvent( world.event.S_EVENT_BIRTH, self._OnBirth )
self.AddEvent( self, world.event.S_EVENT_DEAD, self._OnDeadOrCrash ) self:AddEvent( world.event.S_EVENT_DEAD, self._OnDeadOrCrash )
self.AddEvent( self, world.event.S_EVENT_CRASH, self._OnDeadOrCrash ) self:AddEvent( world.event.S_EVENT_CRASH, self._OnDeadOrCrash )
self.EnableEvents( self ) self:EnableEvents()
return self return self
end end
@ -186,7 +187,7 @@ end
-- -- There will be maximum 24 groups spawned during the whole mission lifetime. -- -- There will be maximum 24 groups spawned during the whole mission lifetime.
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Limit( 2, 24 ) -- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Limit( 2, 24 )
function SPAWN:Limit( SpawnMaxUnitsAlive, SpawnMaxGroups ) function SPAWN:Limit( SpawnMaxUnitsAlive, SpawnMaxGroups )
self:T( { self.SpawnTemplatePrefix, SpawnMaxUnitsAlive, SpawnMaxGroups } ) self:F( { self.SpawnTemplatePrefix, SpawnMaxUnitsAlive, SpawnMaxGroups } )
self.SpawnMaxUnitsAlive = SpawnMaxUnitsAlive -- The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time. self.SpawnMaxUnitsAlive = SpawnMaxUnitsAlive -- The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time.
self.SpawnMaxGroups = SpawnMaxGroups -- The maximum amount of groups that can be spawned. self.SpawnMaxGroups = SpawnMaxGroups -- The maximum amount of groups that can be spawned.
@ -214,7 +215,7 @@ end
-- -- The randomization of waypoint 2 and 3 will take place within a radius of 2000 meters. -- -- The randomization of waypoint 2 and 3 will take place within a radius of 2000 meters.
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):RandomizeRoute( 2, 2, 2000 ) -- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):RandomizeRoute( 2, 2, 2000 )
function SPAWN:RandomizeRoute( SpawnStartPoint, SpawnEndPoint, SpawnRadius ) function SPAWN:RandomizeRoute( SpawnStartPoint, SpawnEndPoint, SpawnRadius )
self:T( { self.SpawnTemplatePrefix, SpawnStartPoint, SpawnEndPoint, SpawnRadius } ) self:F( { self.SpawnTemplatePrefix, SpawnStartPoint, SpawnEndPoint, SpawnRadius } )
self.SpawnRandomizeRoute = true self.SpawnRandomizeRoute = true
self.SpawnRandomizeRouteStartPoint = SpawnStartPoint self.SpawnRandomizeRouteStartPoint = SpawnStartPoint
@ -249,7 +250,7 @@ end
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):Limit( 12, 150 ):Schedule( 200, 0.4 ):RandomizeTemplate( Spawn_US_Platoon ):RandomizeRoute( 3, 3, 2000 ) -- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):Limit( 12, 150 ):Schedule( 200, 0.4 ):RandomizeTemplate( Spawn_US_Platoon ):RandomizeRoute( 3, 3, 2000 )
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):Limit( 12, 150 ):Schedule( 200, 0.4 ):RandomizeTemplate( Spawn_US_Platoon ):RandomizeRoute( 3, 3, 2000 ) -- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):Limit( 12, 150 ):Schedule( 200, 0.4 ):RandomizeTemplate( Spawn_US_Platoon ):RandomizeRoute( 3, 3, 2000 )
function SPAWN:RandomizeTemplate( SpawnTemplatePrefixTable ) function SPAWN:RandomizeTemplate( SpawnTemplatePrefixTable )
self:T( { self.SpawnTemplatePrefix, SpawnTemplatePrefixTable } ) self:F( { self.SpawnTemplatePrefix, SpawnTemplatePrefixTable } )
self.SpawnTemplatePrefixTable = SpawnTemplatePrefixTable self.SpawnTemplatePrefixTable = SpawnTemplatePrefixTable
self.SpawnRandomizeTemplate = true self.SpawnRandomizeTemplate = true
@ -277,7 +278,7 @@ end
-- -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically. -- -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
-- SpawnRU_SU34 = SPAWN:New( 'TF1 RU Su-34 Krymsk@AI - Attack Ships' ):Schedule( 2, 3, 1800, 0.4 ):SpawnUncontrolled():RandomizeRoute( 1, 1, 3000 ):RepeatOnEngineShutDown() -- SpawnRU_SU34 = SPAWN:New( 'TF1 RU Su-34 Krymsk@AI - Attack Ships' ):Schedule( 2, 3, 1800, 0.4 ):SpawnUncontrolled():RandomizeRoute( 1, 1, 3000 ):RepeatOnEngineShutDown()
function SPAWN:Repeat() function SPAWN:Repeat()
self:T( { self.SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix } )
self.SpawnRepeat = true self.SpawnRepeat = true
self.RepeatOnEngineShutDown = false self.RepeatOnEngineShutDown = false
@ -296,7 +297,7 @@ end
-- @see Repeat -- @see Repeat
function SPAWN:RepeatOnLanding() function SPAWN:RepeatOnLanding()
self:T( { self.SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix } )
self:Repeat() self:Repeat()
self.RepeatOnEngineShutDown = false self.RepeatOnEngineShutDown = false
@ -308,7 +309,7 @@ end
--- Same as the @{#SPAWN.Repeat) method, but now the Group will respawn after its engines have shut down. --- Same as the @{#SPAWN.Repeat) method, but now the Group will respawn after its engines have shut down.
-- @return SPAWN -- @return SPAWN
function SPAWN:RepeatOnEngineShutDown() function SPAWN:RepeatOnEngineShutDown()
self:T( { self.SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix } )
self:Repeat() self:Repeat()
self.RepeatOnEngineShutDown = true self.RepeatOnEngineShutDown = true
@ -325,7 +326,7 @@ end
-- @return #SPAWN self -- @return #SPAWN self
-- @usage Spawn_Helicopter:CleanUp( 20 ) -- CleanUp the spawning of the helicopters every 20 seconds when they become inactive. -- @usage Spawn_Helicopter:CleanUp( 20 ) -- CleanUp the spawning of the helicopters every 20 seconds when they become inactive.
function SPAWN:CleanUp( SpawnCleanUpInterval ) function SPAWN:CleanUp( SpawnCleanUpInterval )
self:T( { self.SpawnTemplatePrefix, SpawnCleanUpInterval } ) self:F( { self.SpawnTemplatePrefix, SpawnCleanUpInterval } )
self.SpawnCleanUpInterval = SpawnCleanUpInterval self.SpawnCleanUpInterval = SpawnCleanUpInterval
self.SpawnCleanUpTimeStamps = {} self.SpawnCleanUpTimeStamps = {}
@ -348,7 +349,7 @@ end
-- -- Define an array of Groups. -- -- Define an array of Groups.
-- Spawn_BE_Ground = SPAWN:New( 'BE Ground' ):Limit( 2, 24 ):Visible( 90, "Diamond", 10, 100, 50 ) -- Spawn_BE_Ground = SPAWN:New( 'BE Ground' ):Limit( 2, 24 ):Visible( 90, "Diamond", 10, 100, 50 )
function SPAWN:Array( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) function SPAWN:Array( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY )
self:T( { self.SpawnTemplatePrefix, SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY } ) self:F( { self.SpawnTemplatePrefix, SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY } )
self.SpawnVisible = true -- When the first Spawn executes, all the Groups need to be made visible before start. self.SpawnVisible = true -- When the first Spawn executes, all the Groups need to be made visible before start.
@ -396,7 +397,7 @@ end
-- @param self -- @param self
-- @return GROUP#GROUP The group that was spawned. You can use this group for further actions. -- @return GROUP#GROUP The group that was spawned. You can use this group for further actions.
function SPAWN:Spawn() function SPAWN:Spawn()
self:T( { self.SpawnTemplatePrefix, self.SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, self.SpawnIndex } )
return self:SpawnWithIndex( self.SpawnIndex + 1 ) return self:SpawnWithIndex( self.SpawnIndex + 1 )
end end
@ -407,7 +408,7 @@ end
-- @param #string SpawnIndex The index of the group to be spawned. -- @param #string SpawnIndex The index of the group to be spawned.
-- @return GROUP#GROUP The group that was spawned. You can use this group for further actions. -- @return GROUP#GROUP The group that was spawned. You can use this group for further actions.
function SPAWN:ReSpawn( SpawnIndex ) function SPAWN:ReSpawn( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, SpawnIndex } )
if not SpawnIndex then if not SpawnIndex then
SpawnIndex = 1 SpawnIndex = 1
@ -425,7 +426,7 @@ end
-- Uses @{DATABASE} global object defined in MOOSE. -- Uses @{DATABASE} global object defined in MOOSE.
-- @return GROUP#GROUP The group that was spawned. You can use this group for further actions. -- @return GROUP#GROUP The group that was spawned. You can use this group for further actions.
function SPAWN:SpawnWithIndex( SpawnIndex ) function SPAWN:SpawnWithIndex( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnMaxGroups } ) self:F( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnMaxGroups } )
if self:_GetSpawnIndex( SpawnIndex ) then if self:_GetSpawnIndex( SpawnIndex ) then
@ -465,7 +466,7 @@ end
-- -- Between these two values, a random amount of seconds will be choosen for each new spawn of the helicopters. -- -- Between these two values, a random amount of seconds will be choosen for each new spawn of the helicopters.
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 ) -- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
function SPAWN:SpawnScheduled( SpawnTime, SpawnTimeVariation ) function SPAWN:SpawnScheduled( SpawnTime, SpawnTimeVariation )
self:T( { SpawnTime, SpawnTimeVariation } ) self:F( { SpawnTime, SpawnTimeVariation } )
self.SpawnCurrentTimer = 0 -- The internal timer counter to trigger a scheduled spawning of SpawnTemplatePrefix. self.SpawnCurrentTimer = 0 -- The internal timer counter to trigger a scheduled spawning of SpawnTemplatePrefix.
self.SpawnSetTimer = 0 -- The internal timer value when a scheduled spawning of SpawnTemplatePrefix occurs. self.SpawnSetTimer = 0 -- The internal timer value when a scheduled spawning of SpawnTemplatePrefix occurs.
@ -489,7 +490,7 @@ end
--- Will start the spawning scheduler. --- Will start the spawning scheduler.
-- Note: This function is called automatically when @{#SPAWN.Scheduled} is called. -- Note: This function is called automatically when @{#SPAWN.Scheduled} is called.
function SPAWN:SpawnScheduleStart() function SPAWN:SpawnScheduleStart()
self:T( { self.SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix } )
--local ClientUnit = #AlivePlayerUnits() --local ClientUnit = #AlivePlayerUnits()
@ -506,7 +507,7 @@ end
--- Will stop the scheduled spawning scheduler. --- Will stop the scheduled spawning scheduler.
function SPAWN:SpawnScheduleStop() function SPAWN:SpawnScheduleStop()
self:T( { self.SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix } )
self.SpawnIsScheduled = false self.SpawnIsScheduled = false
end end
@ -515,14 +516,14 @@ end
-- Note that each point in the route assigned to the spawning group is reset to the point of the spawn. -- Note that each point in the route assigned to the spawning group is reset to the point of the spawn.
-- You can use the returned group to further define the route to be followed. -- You can use the returned group to further define the route to be followed.
-- @param self -- @param self
-- @param #UNIT HostUnit The air or ground unit dropping or unloading the group. -- @param Unit#UNIT HostUnit The air or ground unit dropping or unloading the group.
-- @param #number OuterRadius The outer radius in meters where the new group will be spawned. -- @param #number OuterRadius The outer radius in meters where the new group will be spawned.
-- @param #number InnerRadius The inner radius in meters where the new group will NOT be spawned. -- @param #number InnerRadius The inner radius in meters where the new group will NOT be spawned.
-- @param #number SpawnIndex (Optional) The index which group to spawn within the given zone. -- @param #number SpawnIndex (Optional) The index which group to spawn within the given zone.
-- @return GROUP#GROUP that was spawned. -- @return Group#GROUP that was spawned.
-- @return #nil Nothing was spawned. -- @return #nil Nothing was spawned.
function SPAWN:SpawnFromUnit( HostUnit, OuterRadius, InnerRadius, SpawnIndex ) function SPAWN:SpawnFromUnit( HostUnit, OuterRadius, InnerRadius, SpawnIndex )
self:T( { self.SpawnTemplatePrefix, HostUnit, OuterRadius, InnerRadius, SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, HostUnit, OuterRadius, InnerRadius, SpawnIndex } )
if HostUnit and HostUnit:IsAlive() then -- and HostUnit:getUnit(1):inAir() == false then if HostUnit and HostUnit:IsAlive() then -- and HostUnit:getUnit(1):inAir() == false then
@ -537,7 +538,7 @@ function SPAWN:SpawnFromUnit( HostUnit, OuterRadius, InnerRadius, SpawnIndex )
if SpawnTemplate then if SpawnTemplate then
local UnitPoint = HostUnit:GetPoint() local UnitPoint = HostUnit:GetPointVec2()
--for PointID, Point in pairs( SpawnTemplate.route.points ) do --for PointID, Point in pairs( SpawnTemplate.route.points ) do
--Point.x = UnitPoint.x --Point.x = UnitPoint.x
--Point.y = UnitPoint.y --Point.y = UnitPoint.y
@ -565,14 +566,14 @@ function SPAWN:SpawnFromUnit( HostUnit, OuterRadius, InnerRadius, SpawnIndex )
SpawnTemplate.units[UnitID].x = UnitPoint.x SpawnTemplate.units[UnitID].x = UnitPoint.x
SpawnTemplate.units[UnitID].y = UnitPoint.y SpawnTemplate.units[UnitID].y = UnitPoint.y
else else
local CirclePos = routines.getRandPointInCircle( UnitPoint, InnerRadius+1, InnerRadius ) local CirclePos = routines.getRandPointInCircle( UnitPoint, OuterRadius, InnerRadius )
SpawnTemplate.units[UnitID].x = CirclePos.x SpawnTemplate.units[UnitID].x = CirclePos.x
SpawnTemplate.units[UnitID].y = CirclePos.y SpawnTemplate.units[UnitID].y = CirclePos.y
end end
self:T( 'SpawnTemplate.units['..UnitID..'].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units['..UnitID..'].y = ' .. SpawnTemplate.units[UnitID].y ) self:T( 'SpawnTemplate.units['..UnitID..'].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units['..UnitID..'].y = ' .. SpawnTemplate.units[UnitID].y )
end end
local SpawnPos = routines.getRandPointInCircle( UnitPoint, InnerRadius+1, InnerRadius ) local SpawnPos = routines.getRandPointInCircle( UnitPoint, OuterRadius, InnerRadius )
local Point = {} local Point = {}
Point.type = "Turning Point" Point.type = "Turning Point"
Point.x = SpawnPos.x Point.x = SpawnPos.x
@ -597,7 +598,7 @@ end
-- @return GROUP#GROUP that was spawned. -- @return GROUP#GROUP that was spawned.
-- @return #nil when nothing was spawned. -- @return #nil when nothing was spawned.
function SPAWN:SpawnInZone( Zone, SpawnIndex ) function SPAWN:SpawnInZone( Zone, SpawnIndex )
self:T( { self.SpawnTemplatePrefix, Zone, SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, Zone, SpawnIndex } )
if Zone then if Zone then
@ -612,7 +613,7 @@ function SPAWN:SpawnInZone( Zone, SpawnIndex )
if SpawnTemplate then if SpawnTemplate then
local ZonePoint = Zone:GetPoint() local ZonePoint = Zone:GetPointVec2()
SpawnTemplate.route.points = nil SpawnTemplate.route.points = nil
SpawnTemplate.route.points = {} SpawnTemplate.route.points = {}
@ -651,7 +652,7 @@ end
-- This will be similar to the uncontrolled flag setting in the ME. -- This will be similar to the uncontrolled flag setting in the ME.
-- @return #SPAWN self -- @return #SPAWN self
function SPAWN:UnControlled() function SPAWN:UnControlled()
self:T( { self.SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix } )
self.SpawnUnControlled = true self.SpawnUnControlled = true
@ -669,7 +670,7 @@ end
-- @param #number SpawnIndex Is the number of the Group that is to be spawned. -- @param #number SpawnIndex Is the number of the Group that is to be spawned.
-- @return string SpawnGroupName -- @return string SpawnGroupName
function SPAWN:SpawnGroupName( SpawnIndex ) function SPAWN:SpawnGroupName( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, SpawnIndex } )
local SpawnPrefix = self.SpawnTemplatePrefix local SpawnPrefix = self.SpawnTemplatePrefix
if self.SpawnAliasPrefix then if self.SpawnAliasPrefix then
@ -693,7 +694,7 @@ end
-- @return GROUP#GROUP, #number The group found, the new index where the group was found. -- @return GROUP#GROUP, #number The group found, the new index where the group was found.
-- @return #nil, #nil When no group is found, #nil is returned. -- @return #nil, #nil When no group is found, #nil is returned.
function SPAWN:GetFirstAliveGroup( SpawnCursor ) function SPAWN:GetFirstAliveGroup( SpawnCursor )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnCursor } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnCursor } )
for SpawnIndex = 1, self.SpawnCount do for SpawnIndex = 1, self.SpawnCount do
local SpawnGroup = self:GetGroupFromIndex( SpawnIndex ) local SpawnGroup = self:GetGroupFromIndex( SpawnIndex )
@ -713,7 +714,7 @@ end
-- @return GROUP#GROUP, #number The group found, the new index where the group was found. -- @return GROUP#GROUP, #number The group found, the new index where the group was found.
-- @return #nil, #nil When no group is found, #nil is returned. -- @return #nil, #nil When no group is found, #nil is returned.
function SPAWN:GetNextAliveGroup( SpawnCursor ) function SPAWN:GetNextAliveGroup( SpawnCursor )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnCursor } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnCursor } )
SpawnCursor = SpawnCursor + 1 SpawnCursor = SpawnCursor + 1
for SpawnIndex = SpawnCursor, self.SpawnCount do for SpawnIndex = SpawnCursor, self.SpawnCount do
@ -729,7 +730,7 @@ end
--- Find the last alive group during runtime. --- Find the last alive group during runtime.
function SPAWN:GetLastAliveGroup() function SPAWN:GetLastAliveGroup()
self:T( { self.SpawnTemplatePrefixself.SpawnAliasPrefix } ) self:F( { self.SpawnTemplatePrefixself.SpawnAliasPrefix } )
self.SpawnIndex = self:_GetLastIndex() self.SpawnIndex = self:_GetLastIndex()
for SpawnIndex = self.SpawnIndex, 1, -1 do for SpawnIndex = self.SpawnIndex, 1, -1 do
@ -753,7 +754,7 @@ end
-- @param #number SpawnIndex The index of the group to return. -- @param #number SpawnIndex The index of the group to return.
-- @return GROUP#GROUP -- @return GROUP#GROUP
function SPAWN:GetGroupFromIndex( SpawnIndex ) function SPAWN:GetGroupFromIndex( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnIndex } )
if SpawnIndex then if SpawnIndex then
local SpawnGroup = self.SpawnGroups[SpawnIndex].Group local SpawnGroup = self.SpawnGroups[SpawnIndex].Group
@ -772,7 +773,7 @@ end
-- @return #string The prefix -- @return #string The prefix
-- @return #nil Nothing found -- @return #nil Nothing found
function SPAWN:_GetGroupIndexFromDCSUnit( DCSUnit ) function SPAWN:_GetGroupIndexFromDCSUnit( DCSUnit )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, DCSUnit } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, DCSUnit } )
if DCSUnit and DCSUnit:getName() then if DCSUnit and DCSUnit:getName() then
local IndexString = string.match( DCSUnit:getName(), "#.*-" ):sub( 2, -2 ) local IndexString = string.match( DCSUnit:getName(), "#.*-" ):sub( 2, -2 )
@ -796,7 +797,7 @@ end
-- @return #string The prefix -- @return #string The prefix
-- @return #nil Nothing found -- @return #nil Nothing found
function SPAWN:_GetPrefixFromDCSUnit( DCSUnit ) function SPAWN:_GetPrefixFromDCSUnit( DCSUnit )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, DCSUnit } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, DCSUnit } )
if DCSUnit and DCSUnit:getName() then if DCSUnit and DCSUnit:getName() then
local SpawnPrefix = string.match( DCSUnit:getName(), ".*#" ) local SpawnPrefix = string.match( DCSUnit:getName(), ".*#" )
@ -812,7 +813,7 @@ end
--- Return the group within the SpawnGroups collection with input a DCSUnit. --- Return the group within the SpawnGroups collection with input a DCSUnit.
function SPAWN:_GetGroupFromDCSUnit( DCSUnit ) function SPAWN:_GetGroupFromDCSUnit( DCSUnit )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, DCSUnit } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, DCSUnit } )
if DCSUnit then if DCSUnit then
local SpawnPrefix = self:_GetPrefixFromDCSUnit( DCSUnit ) local SpawnPrefix = self:_GetPrefixFromDCSUnit( DCSUnit )
@ -832,7 +833,7 @@ end
--- Get the index from a given group. --- Get the index from a given group.
-- The function will search the name of the group for a #, and will return the number behind the #-mark. -- The function will search the name of the group for a #, and will return the number behind the #-mark.
function SPAWN:GetSpawnIndexFromGroup( SpawnGroup ) function SPAWN:GetSpawnIndexFromGroup( SpawnGroup )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnGroup } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnGroup } )
local IndexString = string.match( SpawnGroup:GetName(), "#.*$" ):sub( 2 ) local IndexString = string.match( SpawnGroup:GetName(), "#.*$" ):sub( 2 )
local Index = tonumber( IndexString ) local Index = tonumber( IndexString )
@ -844,14 +845,14 @@ end
--- Return the last maximum index that can be used. --- Return the last maximum index that can be used.
function SPAWN:_GetLastIndex() function SPAWN:_GetLastIndex()
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
return self.SpawnMaxGroups return self.SpawnMaxGroups
end end
--- Initalize the SpawnGroups collection. --- Initalize the SpawnGroups collection.
function SPAWN:_InitializeSpawnGroups( SpawnIndex ) function SPAWN:_InitializeSpawnGroups( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnIndex } )
if not self.SpawnGroups[SpawnIndex] then if not self.SpawnGroups[SpawnIndex] then
self.SpawnGroups[SpawnIndex] = {} self.SpawnGroups[SpawnIndex] = {}
@ -898,7 +899,7 @@ end
--- Gets the CountryID of the Group with the given SpawnPrefix --- Gets the CountryID of the Group with the given SpawnPrefix
function SPAWN:_GetGroupCountryID( SpawnPrefix ) function SPAWN:_GetGroupCountryID( SpawnPrefix )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnPrefix } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnPrefix } )
local TemplateGroup = Group.getByName( SpawnPrefix ) local TemplateGroup = Group.getByName( SpawnPrefix )
@ -913,7 +914,7 @@ end
--- Gets the Group Template from the ME environment definition. --- Gets the Group Template from the ME environment definition.
-- This method used the @{DATABASE} object, which contains ALL initial and new spawned object in MOOSE. -- This method used the @{DATABASE} object, which contains ALL initial and new spawned object in MOOSE.
function SPAWN:_GetTemplate( SpawnTemplatePrefix ) function SPAWN:_GetTemplate( SpawnTemplatePrefix )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnTemplatePrefix } )
local SpawnTemplate = nil local SpawnTemplate = nil
@ -933,7 +934,7 @@ end
--- Prepares the new Group Template. --- Prepares the new Group Template.
function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex )
self:T( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
local SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix ) local SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex ) SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
@ -966,7 +967,7 @@ end
-- @param #number SpawnIndex The index of the group to be spawned. -- @param #number SpawnIndex The index of the group to be spawned.
-- @return #SPAWN -- @return #SPAWN
function SPAWN:_RandomizeRoute( SpawnIndex ) function SPAWN:_RandomizeRoute( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnRandomizeRoute, self.SpawnRandomizeRouteStartPoint, self.SpawnRandomizeRouteEndPoint, self.SpawnRandomizeRouteRadius } ) self:F( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnRandomizeRoute, self.SpawnRandomizeRouteStartPoint, self.SpawnRandomizeRouteEndPoint, self.SpawnRandomizeRouteRadius } )
if self.SpawnRandomizeRoute then if self.SpawnRandomizeRoute then
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
@ -987,7 +988,7 @@ end
function SPAWN:_RandomizeTemplate( SpawnIndex ) function SPAWN:_RandomizeTemplate( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex } ) self:F( { self.SpawnTemplatePrefix, SpawnIndex } )
if self.SpawnRandomizeTemplate then if self.SpawnRandomizeTemplate then
self.SpawnGroups[SpawnIndex].SpawnTemplatePrefix = self.SpawnTemplatePrefixTable[ math.random( 1, #self.SpawnTemplatePrefixTable ) ] self.SpawnGroups[SpawnIndex].SpawnTemplatePrefix = self.SpawnTemplatePrefixTable[ math.random( 1, #self.SpawnTemplatePrefixTable ) ]
@ -1006,7 +1007,7 @@ function SPAWN:_RandomizeTemplate( SpawnIndex )
end end
function SPAWN:_TranslateRotate( SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle ) function SPAWN:_TranslateRotate( SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle )
self:T( { self.SpawnTemplatePrefix, SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle } ) self:F( { self.SpawnTemplatePrefix, SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle } )
-- Translate -- Translate
local TranslatedX = SpawnX local TranslatedX = SpawnX
@ -1050,7 +1051,7 @@ end
--- Get the next index of the groups to be spawned. This function is complicated, as it is used at several spaces. --- Get the next index of the groups to be spawned. This function is complicated, as it is used at several spaces.
function SPAWN:_GetSpawnIndex( SpawnIndex ) function SPAWN:_GetSpawnIndex( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnMaxGroups, self.SpawnMaxUnitsAlive, self.AliveUnits, #self.SpawnTemplate.units } ) self:F( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnMaxGroups, self.SpawnMaxUnitsAlive, self.AliveUnits, #self.SpawnTemplate.units } )
if ( self.SpawnMaxGroups == 0 ) or ( SpawnIndex <= self.SpawnMaxGroups ) then if ( self.SpawnMaxGroups == 0 ) or ( SpawnIndex <= self.SpawnMaxGroups ) then
@ -1169,7 +1170,7 @@ end
--- This function is called automatically by the Spawning scheduler. --- This function is called automatically by the Spawning scheduler.
-- It is the internal worker method SPAWNing new Groups on the defined time intervals. -- It is the internal worker method SPAWNing new Groups on the defined time intervals.
function SPAWN:_Scheduler() function SPAWN:_Scheduler()
self:T( { "_Scheduler", self.SpawnTemplatePrefix, self.SpawnAliasPrefix, self.SpawnIndex, self.SpawnMaxGroups, self.SpawnMaxUnitsAlive } ) self:F( { "_Scheduler", self.SpawnTemplatePrefix, self.SpawnAliasPrefix, self.SpawnIndex, self.SpawnMaxGroups, self.SpawnMaxUnitsAlive } )
if self.SpawnInit or self.SpawnCurrentTimer == self.SpawnSetTimer then if self.SpawnInit or self.SpawnCurrentTimer == self.SpawnSetTimer then
-- Validate if there are still groups left in the batch... -- Validate if there are still groups left in the batch...
@ -1187,7 +1188,7 @@ self:T( { "_Scheduler", self.SpawnTemplatePrefix, self.SpawnAliasPrefix, self.Sp
end end
function SPAWN:_SpawnCleanUpScheduler() function SPAWN:_SpawnCleanUpScheduler()
self:T( { "CleanUp Scheduler:", self.SpawnTemplatePrefix } ) self:F( { "CleanUp Scheduler:", self.SpawnTemplatePrefix } )
local SpawnCursor local SpawnCursor
local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup( SpawnCursor ) local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup( SpawnCursor )

View File

@ -29,7 +29,7 @@ STAGE = {
function STAGE:New() function STAGE:New()
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T() self:F()
return self return self
end end
@ -61,14 +61,14 @@ STAGEBRIEF = {
function STAGEBRIEF:New() function STAGEBRIEF:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGEBRIEF:Execute( Mission, Client, Task ) function STAGEBRIEF:Execute( Mission, Client, Task )
local Valid = BASE:Inherited(self):Execute( Mission, Client, Task ) local Valid = BASE:Inherited(self):Execute( Mission, Client, Task )
self:T() self:F()
Mission:ShowBriefing( Client ) Mission:ShowBriefing( Client )
self.StageBriefingTime = timer.getTime() self.StageBriefingTime = timer.getTime()
return Valid return Valid
@ -98,13 +98,13 @@ STAGESTART = {
function STAGESTART:New() function STAGESTART:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGESTART:Execute( Mission, Client, Task ) function STAGESTART:Execute( Mission, Client, Task )
self:T() self:F()
local Valid = BASE:Inherited(self):Execute( Mission, Client, Task ) local Valid = BASE:Inherited(self):Execute( Mission, Client, Task )
if Task.TaskBriefing then if Task.TaskBriefing then
Client:Message( Task.TaskBriefing, 30, Mission.Name .. "/Stage", "Mission Command: Tasking" ) Client:Message( Task.TaskBriefing, 30, Mission.Name .. "/Stage", "Mission Command: Tasking" )
@ -116,7 +116,7 @@ self:T()
end end
function STAGESTART:Validate( Mission, Client, Task ) function STAGESTART:Validate( Mission, Client, Task )
self:T() self:F()
local Valid = STAGE:Validate( Mission, Client, Task ) local Valid = STAGE:Validate( Mission, Client, Task )
if timer.getTime() - self.StageStartTime <= self.StageStartDuration then if timer.getTime() - self.StageStartTime <= self.StageStartDuration then
@ -136,13 +136,13 @@ STAGE_CARGO_LOAD = {
function STAGE_CARGO_LOAD:New() function STAGE_CARGO_LOAD:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGE_CARGO_LOAD:Execute( Mission, Client, Task ) function STAGE_CARGO_LOAD:Execute( Mission, Client, Task )
self:T() self:F()
local Valid = BASE:Inherited(self):Execute( Mission, Client, Task ) local Valid = BASE:Inherited(self):Execute( Mission, Client, Task )
for LoadCargoID, LoadCargo in pairs( Task.Cargos.LoadCargos ) do for LoadCargoID, LoadCargo in pairs( Task.Cargos.LoadCargos ) do
@ -157,7 +157,7 @@ self:T()
end end
function STAGE_CARGO_LOAD:Validate( Mission, Client, Task ) function STAGE_CARGO_LOAD:Validate( Mission, Client, Task )
self:T() self:F()
local Valid = STAGE:Validate( Mission, Client, Task ) local Valid = STAGE:Validate( Mission, Client, Task )
return 1 return 1
@ -170,13 +170,13 @@ STAGE_CARGO_INIT = {
function STAGE_CARGO_INIT:New() function STAGE_CARGO_INIT:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGE_CARGO_INIT:Execute( Mission, Client, Task ) function STAGE_CARGO_INIT:Execute( Mission, Client, Task )
self:T() self:F()
local Valid = BASE:Inherited(self):Execute( Mission, Client, Task ) local Valid = BASE:Inherited(self):Execute( Mission, Client, Task )
for InitLandingZoneID, InitLandingZone in pairs( Task.LandingZones.LandingZones ) do for InitLandingZoneID, InitLandingZone in pairs( Task.LandingZones.LandingZones ) do
@ -196,7 +196,7 @@ end
function STAGE_CARGO_INIT:Validate( Mission, Client, Task ) function STAGE_CARGO_INIT:Validate( Mission, Client, Task )
self:T() self:F()
local Valid = STAGE:Validate( Mission, Client, Task ) local Valid = STAGE:Validate( Mission, Client, Task )
return 1 return 1
@ -213,7 +213,7 @@ STAGEROUTE = {
function STAGEROUTE:New() function STAGEROUTE:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
self.MessageSwitch = true self.MessageSwitch = true
return self return self
@ -221,7 +221,7 @@ end
function STAGEROUTE:Execute( Mission, Client, Task ) function STAGEROUTE:Execute( Mission, Client, Task )
self:T() self:F()
local Valid = BASE:Inherited(self):Execute( Mission, Client, Task ) local Valid = BASE:Inherited(self):Execute( Mission, Client, Task )
local RouteMessage = "Fly to " local RouteMessage = "Fly to "
@ -239,7 +239,7 @@ self:T()
end end
function STAGEROUTE:Validate( Mission, Client, Task ) function STAGEROUTE:Validate( Mission, Client, Task )
self:T() self:F()
local Valid = STAGE:Validate( Mission, Client, Task ) local Valid = STAGE:Validate( Mission, Client, Task )
-- check if the Client is in the landing zone -- check if the Client is in the landing zone
@ -274,13 +274,13 @@ STAGELANDING = {
function STAGELANDING:New() function STAGELANDING:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGELANDING:Execute( Mission, Client, Task ) function STAGELANDING:Execute( Mission, Client, Task )
self:T() self:F()
Client:Message( "We have arrived at the landing zone.", self.MSG.TIME, Mission.Name .. "/StageArrived", "Co-Pilot: Arrived", 10 ) Client:Message( "We have arrived at the landing zone.", self.MSG.TIME, Mission.Name .. "/StageArrived", "Co-Pilot: Arrived", 10 )
@ -332,7 +332,7 @@ self:T()
end end
function STAGELANDING:Validate( Mission, Client, Task ) function STAGELANDING:Validate( Mission, Client, Task )
self:T() self:F()
Task.CurrentLandingZoneName = routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.LandingZones.LandingZoneNames ) Task.CurrentLandingZoneName = routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.LandingZones.LandingZoneNames )
if Task.CurrentLandingZoneName then if Task.CurrentLandingZoneName then
@ -376,13 +376,13 @@ STAGELANDED = {
function STAGELANDED:New() function STAGELANDED:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGELANDED:Execute( Mission, Client, Task ) function STAGELANDED:Execute( Mission, Client, Task )
self:T() self:F()
if Task.IsLandingRequired then if Task.IsLandingRequired then
Client:Message( 'We have landed within the landing zone. Use the radio menu (F10) to ' .. Task.TEXT[1] .. ' the ' .. Task.CargoType .. '.', Client:Message( 'We have landed within the landing zone. Use the radio menu (F10) to ' .. Task.TEXT[1] .. ' the ' .. Task.CargoType .. '.',
@ -398,7 +398,7 @@ end
function STAGELANDED:Validate( Mission, Client, Task ) function STAGELANDED:Validate( Mission, Client, Task )
self:T() self:F()
if not routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.CurrentLandingZoneName ) then if not routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.CurrentLandingZoneName ) then
self:T( "Client is not anymore in the landing zone, go back to stage Route, and remove cargo menus." ) self:T( "Client is not anymore in the landing zone, go back to stage Route, and remove cargo menus." )
@ -431,20 +431,20 @@ STAGEUNLOAD = {
function STAGEUNLOAD:New() function STAGEUNLOAD:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGEUNLOAD:Execute( Mission, Client, Task ) function STAGEUNLOAD:Execute( Mission, Client, Task )
self:T() self:F()
Client:Message( 'The ' .. Task.CargoType .. ' are being ' .. Task.TEXT[2] .. ' within the landing zone. Wait until the helicopter is ' .. Task.TEXT[3] .. '.', Client:Message( 'The ' .. Task.CargoType .. ' are being ' .. Task.TEXT[2] .. ' within the landing zone. Wait until the helicopter is ' .. Task.TEXT[3] .. '.',
self.MSG.TIME, Mission.Name .. "/StageUnLoad", "Co-Pilot: Unload" ) self.MSG.TIME, Mission.Name .. "/StageUnLoad", "Co-Pilot: Unload" )
Task:RemoveCargoMenus( Client ) Task:RemoveCargoMenus( Client )
end end
function STAGEUNLOAD:Executing( Mission, Client, Task ) function STAGEUNLOAD:Executing( Mission, Client, Task )
self:T() self:F()
env.info( 'STAGEUNLOAD:Executing() Task.Cargo.CargoName = ' .. Task.Cargo.CargoName ) env.info( 'STAGEUNLOAD:Executing() Task.Cargo.CargoName = ' .. Task.Cargo.CargoName )
local TargetZoneName local TargetZoneName
@ -464,7 +464,7 @@ self:T()
end end
function STAGEUNLOAD:Validate( Mission, Client, Task ) function STAGEUNLOAD:Validate( Mission, Client, Task )
self:T() self:F()
env.info( 'STAGEUNLOAD:Validate()' ) env.info( 'STAGEUNLOAD:Validate()' )
if routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.CurrentLandingZoneName ) then if routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.CurrentLandingZoneName ) then
@ -503,13 +503,13 @@ STAGELOAD = {
function STAGELOAD:New() function STAGELOAD:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGELOAD:Execute( Mission, Client, Task ) function STAGELOAD:Execute( Mission, Client, Task )
self:T() self:F()
if not Task.IsSlingLoad then if not Task.IsSlingLoad then
Client:Message( 'The ' .. Task.CargoType .. ' are being ' .. Task.TEXT[2] .. ' within the landing zone. Wait until the helicopter is ' .. Task.TEXT[3] .. '.', Client:Message( 'The ' .. Task.CargoType .. ' are being ' .. Task.TEXT[2] .. ' within the landing zone. Wait until the helicopter is ' .. Task.TEXT[3] .. '.',
@ -524,13 +524,13 @@ self:T()
end end
function STAGELOAD:Executing( Mission, Client, Task ) function STAGELOAD:Executing( Mission, Client, Task )
self:T() self:F()
-- If the Cargo is ready to be loaded, load it into the Client. -- If the Cargo is ready to be loaded, load it into the Client.
if not Task.IsSlingLoad then if not Task.IsSlingLoad then
trace.i(self.ClassName, Task.Cargo.CargoName) self:T( Task.Cargo.CargoName)
if Task.Cargo:OnBoarded( Client, Task.CurrentCargoZone ) then if Task.Cargo:OnBoarded( Client, Task.CurrentCargoZone ) then
@ -553,12 +553,12 @@ self:T()
if Cargo:IsSlingLoad() then if Cargo:IsSlingLoad() then
local CargoStatic = StaticObject.getByName( Cargo.CargoStaticName ) local CargoStatic = StaticObject.getByName( Cargo.CargoStaticName )
if CargoStatic then if CargoStatic then
trace.i(self.ClassName, "Cargo is found in the DCS simulator.") self:T( "Cargo is found in the DCS simulator.")
local CargoStaticPosition = CargoStatic:getPosition().p local CargoStaticPosition = CargoStatic:getPosition().p
trace.i(self.ClassName, "Cargo Position x = " .. CargoStaticPosition.x .. ", y = " .. CargoStaticPosition.y .. ", z = " .. CargoStaticPosition.z ) self:T( "Cargo Position x = " .. CargoStaticPosition.x .. ", y = " .. CargoStaticPosition.y .. ", z = " .. CargoStaticPosition.z )
local CargoStaticHeight = routines.GetUnitHeight( CargoStatic ) local CargoStaticHeight = routines.GetUnitHeight( CargoStatic )
if CargoStaticHeight > 5 then if CargoStaticHeight > 5 then
trace.i(self.ClassName, "Cargo is airborne.") self:T( "Cargo is airborne.")
Cargo:StatusLoaded() Cargo:StatusLoaded()
Task.Cargo = Cargo Task.Cargo = Cargo
Client:Message( 'The Cargo has been successfully hooked onto the helicopter and is now being sling loaded. Fly outside the landing zone.', Client:Message( 'The Cargo has been successfully hooked onto the helicopter and is now being sling loaded. Fly outside the landing zone.',
@ -576,7 +576,7 @@ self:T()
end end
function STAGELOAD:Validate( Mission, Client, Task ) function STAGELOAD:Validate( Mission, Client, Task )
self:T() self:F()
self:T( "Task.CurrentLandingZoneName = " .. Task.CurrentLandingZoneName ) self:T( "Task.CurrentLandingZoneName = " .. Task.CurrentLandingZoneName )
@ -635,18 +635,18 @@ STAGEDONE = {
function STAGEDONE:New() function STAGEDONE:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'AI' self.StageType = 'AI'
return self return self
end end
function STAGEDONE:Execute( Mission, Client, Task ) function STAGEDONE:Execute( Mission, Client, Task )
self:T() self:F()
end end
function STAGEDONE:Validate( Mission, Client, Task ) function STAGEDONE:Validate( Mission, Client, Task )
self:T() self:F()
Task:Done() Task:Done()
@ -661,20 +661,20 @@ STAGEARRIVE = {
function STAGEARRIVE:New() function STAGEARRIVE:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'CLIENT' self.StageType = 'CLIENT'
return self return self
end end
function STAGEARRIVE:Execute( Mission, Client, Task ) function STAGEARRIVE:Execute( Mission, Client, Task )
self:T() self:F()
Client:Message( 'We have arrived at ' .. Task.CurrentLandingZoneName .. ".", self.MSG.TIME, Mission.Name .. "/Stage", "Co-Pilot: Arrived" ) Client:Message( 'We have arrived at ' .. Task.CurrentLandingZoneName .. ".", self.MSG.TIME, Mission.Name .. "/Stage", "Co-Pilot: Arrived" )
end end
function STAGEARRIVE:Validate( Mission, Client, Task ) function STAGEARRIVE:Validate( Mission, Client, Task )
self:T() self:F()
Task.CurrentLandingZoneID = routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.LandingZones ) Task.CurrentLandingZoneID = routines.IsUnitInZones( Client:GetClientGroupDCSUnit(), Task.LandingZones )
if ( Task.CurrentLandingZoneID ) then if ( Task.CurrentLandingZoneID ) then
@ -695,7 +695,7 @@ STAGEGROUPSDESTROYED = {
function STAGEGROUPSDESTROYED:New() function STAGEGROUPSDESTROYED:New()
local self = BASE:Inherit( self, STAGE:New() ) local self = BASE:Inherit( self, STAGE:New() )
self:T() self:F()
self.StageType = 'AI' self.StageType = 'AI'
return self return self
end end
@ -707,7 +707,7 @@ end
--end --end
function STAGEGROUPSDESTROYED:Validate( Mission, Client, Task ) function STAGEGROUPSDESTROYED:Validate( Mission, Client, Task )
self:T() self:F()
if Task.MissionTask:IsGoalReached() then if Task.MissionTask:IsGoalReached() then
return 1 return 1
@ -717,7 +717,7 @@ self:T()
end end
function STAGEGROUPSDESTROYED:Execute( Mission, Client, Task ) function STAGEGROUPSDESTROYED:Execute( Mission, Client, Task )
self:T() self:F()
self:T( { Task.ClassName, Task.Destroyed } ) self:T( { Task.ClassName, Task.Destroyed } )
--env.info( 'Event Table Task = ' .. tostring(Task) ) --env.info( 'Event Table Task = ' .. tostring(Task) )

View File

@ -8,7 +8,8 @@ Include.File( "Client" )
Include.File( "Stage" ) Include.File( "Stage" )
--- The TASK class --- The TASK class
-- @type -- @type TASK
-- @extends Base#BASE
TASK = { TASK = {
-- Defines the different signal types with a Task. -- Defines the different signal types with a Task.
@ -47,10 +48,9 @@ TASK = {
--- Instantiates a new TASK Base. Should never be used. Interface Class. --- Instantiates a new TASK Base. Should never be used. Interface Class.
-- @return TASK -- @return TASK
function TASK:New() function TASK:New()
trace.f(self.ClassName)
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:F()
-- assign Task default values during construction -- assign Task default values during construction
self.TaskBriefing = "Task: No Task." self.TaskBriefing = "Task: No Task."
self.Time = timer.getTime() self.Time = timer.getTime()
@ -60,14 +60,14 @@ trace.f(self.ClassName)
end end
function TASK:SetStage( StageSequenceIncrement ) function TASK:SetStage( StageSequenceIncrement )
trace.f(self.ClassName, { StageSequenceIncrement } ) self:F( { StageSequenceIncrement } )
local Valid = false local Valid = false
if StageSequenceIncrement ~= 0 then if StageSequenceIncrement ~= 0 then
self.ActiveStage = self.ActiveStage + StageSequenceIncrement self.ActiveStage = self.ActiveStage + StageSequenceIncrement
if 1 <= self.ActiveStage and self.ActiveStage <= #self.Stages then if 1 <= self.ActiveStage and self.ActiveStage <= #self.Stages then
self.Stage = self.Stages[self.ActiveStage] self.Stage = self.Stages[self.ActiveStage]
trace.i( self.ClassName, { self.Stage.Name } ) self:T( { self.Stage.Name } )
self.Frequency = self.Stage.Frequency self.Frequency = self.Stage.Frequency
Valid = true Valid = true
else else
@ -80,7 +80,7 @@ trace.f(self.ClassName, { StageSequenceIncrement } )
end end
function TASK:Init() function TASK:Init()
trace.f(self.ClassName) self:F()
self.ActiveStage = 0 self.ActiveStage = 0
self:SetStage(1) self:SetStage(1)
self.TaskDone = false self.TaskDone = false
@ -91,7 +91,7 @@ end
--- Get progress of a TASK. --- Get progress of a TASK.
-- @return string GoalsText -- @return string GoalsText
function TASK:GetGoalProgress() function TASK:GetGoalProgress()
trace.f(self.ClassName) self:F()
local GoalsText = "" local GoalsText = ""
for GoalVerb, GoalVerbData in pairs( self.GoalTasks ) do for GoalVerb, GoalVerbData in pairs( self.GoalTasks ) do
@ -115,7 +115,7 @@ end
-- @param MISSION Mission Group structure describing the Mission. -- @param MISSION Mission Group structure describing the Mission.
-- @param CLIENT Client Group structure describing the Client. -- @param CLIENT Client Group structure describing the Client.
function TASK:ShowGoalProgress( Mission, Client ) function TASK:ShowGoalProgress( Mission, Client )
trace.f(self.ClassName) self:F()
local GoalsText = "" local GoalsText = ""
for GoalVerb, GoalVerbData in pairs( self.GoalTasks ) do for GoalVerb, GoalVerbData in pairs( self.GoalTasks ) do
@ -137,32 +137,32 @@ end
--- Sets a TASK to status Done. --- Sets a TASK to status Done.
function TASK:Done() function TASK:Done()
trace.f(self.ClassName) self:F()
self.TaskDone = true self.TaskDone = true
end end
--- Returns if a TASK is done. --- Returns if a TASK is done.
-- @return bool -- @return bool
function TASK:IsDone() function TASK:IsDone()
trace.i( self.ClassName, self.TaskDone ) self:F( self.TaskDone )
return self.TaskDone return self.TaskDone
end end
--- Sets a TASK to status failed. --- Sets a TASK to status failed.
function TASK:Failed() function TASK:Failed()
trace.f(self.ClassName) self:F()
self.TaskFailed = true self.TaskFailed = true
end end
--- Returns if a TASk has failed. --- Returns if a TASk has failed.
-- @return bool -- @return bool
function TASK:IsFailed() function TASK:IsFailed()
trace.i( self.ClassName, self.TaskFailed ) self:F( self.TaskFailed )
return self.TaskFailed return self.TaskFailed
end end
function TASK:Reset( Mission, Client ) function TASK:Reset( Mission, Client )
trace.f(self.ClassName) self:F()
self.ExecuteStage = _TransportExecuteStage.NONE self.ExecuteStage = _TransportExecuteStage.NONE
end end
@ -176,7 +176,7 @@ end
-- @param ?string GoalVerb is the name of the Goal of the TASK. -- @param ?string GoalVerb is the name of the Goal of the TASK.
-- @return bool -- @return bool
function TASK:Goal( GoalVerb ) function TASK:Goal( GoalVerb )
trace.f(self.ClassName) self:F()
if not GoalVerb then if not GoalVerb then
GoalVerb = self.GoalVerb GoalVerb = self.GoalVerb
end end
@ -191,7 +191,7 @@ end
-- @param number GoalTotal is the number of times the GoalVerb needs to be achieved. -- @param number GoalTotal is the number of times the GoalVerb needs to be achieved.
-- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used. -- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used.
function TASK:SetGoalTotal( GoalTotal, GoalVerb ) function TASK:SetGoalTotal( GoalTotal, GoalVerb )
trace.f(self.ClassName, { GoalTotal, GoalVerb } ) self:F( { GoalTotal, GoalVerb } )
if not GoalVerb then if not GoalVerb then
GoalVerb = self.GoalVerb GoalVerb = self.GoalVerb
@ -206,7 +206,7 @@ end
--- Gets the total of Goals to be achieved within the TASK of the GoalVerb. --- Gets the total of Goals to be achieved within the TASK of the GoalVerb.
-- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used. -- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used.
function TASK:GetGoalTotal( GoalVerb ) function TASK:GetGoalTotal( GoalVerb )
trace.f(self.ClassName) self:F()
if not GoalVerb then if not GoalVerb then
GoalVerb = self.GoalVerb GoalVerb = self.GoalVerb
end end
@ -222,7 +222,7 @@ end
-- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used. -- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used.
-- @return TASK -- @return TASK
function TASK:SetGoalCount( GoalCount, GoalVerb ) function TASK:SetGoalCount( GoalCount, GoalVerb )
trace.f(self.ClassName) self:F()
if not GoalVerb then if not GoalVerb then
GoalVerb = self.GoalVerb GoalVerb = self.GoalVerb
end end
@ -237,7 +237,7 @@ end
-- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used. -- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used.
-- @return TASK -- @return TASK
function TASK:IncreaseGoalCount( GoalCountIncrease, GoalVerb ) function TASK:IncreaseGoalCount( GoalCountIncrease, GoalVerb )
trace.f(self.ClassName) self:F()
if not GoalVerb then if not GoalVerb then
GoalVerb = self.GoalVerb GoalVerb = self.GoalVerb
end end
@ -251,7 +251,7 @@ end
-- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used. -- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used.
-- @return TASK -- @return TASK
function TASK:GetGoalCount( GoalVerb ) function TASK:GetGoalCount( GoalVerb )
trace.f(self.ClassName) self:F()
if not GoalVerb then if not GoalVerb then
GoalVerb = self.GoalVerb GoalVerb = self.GoalVerb
end end
@ -266,7 +266,7 @@ end
-- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used. -- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used.
-- @return TASK -- @return TASK
function TASK:GetGoalPercentage( GoalVerb ) function TASK:GetGoalPercentage( GoalVerb )
trace.f(self.ClassName) self:F()
if not GoalVerb then if not GoalVerb then
GoalVerb = self.GoalVerb GoalVerb = self.GoalVerb
end end
@ -284,10 +284,10 @@ function TASK:IsGoalReached( )
local GoalReached = true local GoalReached = true
for GoalVerb, Goals in pairs( self.GoalTasks ) do for GoalVerb, Goals in pairs( self.GoalTasks ) do
trace.i( self.ClassName, { "GoalVerb", GoalVerb } ) self:T( { "GoalVerb", GoalVerb } )
if self:Goal( GoalVerb ) then if self:Goal( GoalVerb ) then
local GoalToDo = self:GetGoalTotal( GoalVerb ) - self:GetGoalCount( GoalVerb ) local GoalToDo = self:GetGoalTotal( GoalVerb ) - self:GetGoalCount( GoalVerb )
trace.i( self.ClassName, "GoalToDo = " .. GoalToDo ) self:T( "GoalToDo = " .. GoalToDo )
if GoalToDo <= 0 then if GoalToDo <= 0 then
else else
GoalReached = false GoalReached = false
@ -298,7 +298,7 @@ function TASK:IsGoalReached( )
end end
end end
trace.i( self.ClassName, GoalReached ) self:T( GoalReached )
return GoalReached return GoalReached
end end
@ -307,7 +307,7 @@ end
-- @param string GoalTask is a text describing the Goal of the TASK to be achieved. -- @param string GoalTask is a text describing the Goal of the TASK to be achieved.
-- @param number GoalIncrease is a number by which the Goal achievement is increasing. -- @param number GoalIncrease is a number by which the Goal achievement is increasing.
function TASK:AddGoalCompletion( GoalVerb, GoalTask, GoalIncrease ) function TASK:AddGoalCompletion( GoalVerb, GoalTask, GoalIncrease )
trace.f( self.ClassName, { GoalVerb, GoalTask, GoalIncrease } ) self:F( { GoalVerb, GoalTask, GoalIncrease } )
if self:Goal( GoalVerb ) then if self:Goal( GoalVerb ) then
self.GoalTasks[GoalVerb].Goals[#self.GoalTasks[GoalVerb].Goals+1] = GoalTask self.GoalTasks[GoalVerb].Goals[#self.GoalTasks[GoalVerb].Goals+1] = GoalTask
@ -320,7 +320,7 @@ end
-- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used. -- @param ?string GoalVerb is the name of the Goal of the TASK. If the GoalVerb is not given, then the default TASK Goals will be used.
-- @return string Goals -- @return string Goals
function TASK:GetGoalCompletion( GoalVerb ) function TASK:GetGoalCompletion( GoalVerb )
trace.f( self.ClassName, { GoalVerb } ) self:F( { GoalVerb } )
if self:Goal( GoalVerb ) then if self:Goal( GoalVerb ) then
local Goals = "" local Goals = ""
@ -330,14 +330,12 @@ trace.f( self.ClassName, { GoalVerb } )
end end
function TASK.MenuAction( Parameter ) function TASK.MenuAction( Parameter )
trace.menu("TASK","MenuAction")
trace.l( "TASK", "MenuAction" )
Parameter.ReferenceTask.ExecuteStage = _TransportExecuteStage.EXECUTING Parameter.ReferenceTask.ExecuteStage = _TransportExecuteStage.EXECUTING
Parameter.ReferenceTask.Cargo = Parameter.CargoTask Parameter.ReferenceTask.Cargo = Parameter.CargoTask
end end
function TASK:StageExecute() function TASK:StageExecute()
trace.f(self.ClassName) self:F()
local Execute = false local Execute = false
@ -356,7 +354,7 @@ end
--- Work function to set signal events within a TASK. --- Work function to set signal events within a TASK.
function TASK:AddSignal( SignalUnitNames, SignalType, SignalColor, SignalHeight ) function TASK:AddSignal( SignalUnitNames, SignalType, SignalColor, SignalHeight )
trace.f(self.ClassName) self:F()
local Valid = true local Valid = true
@ -387,7 +385,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddSmokeRed( SignalUnitNames, SignalHeight ) function TASK:AddSmokeRed( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.RED, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.RED, SignalHeight )
end end
@ -395,7 +393,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddSmokeGreen( SignalUnitNames, SignalHeight ) function TASK:AddSmokeGreen( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.GREEN, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.GREEN, SignalHeight )
end end
@ -403,7 +401,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddSmokeBlue( SignalUnitNames, SignalHeight ) function TASK:AddSmokeBlue( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.BLUE, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.BLUE, SignalHeight )
end end
@ -411,7 +409,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddSmokeWhite( SignalUnitNames, SignalHeight ) function TASK:AddSmokeWhite( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.WHITE, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.WHITE, SignalHeight )
end end
@ -419,7 +417,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddSmokeOrange( SignalUnitNames, SignalHeight ) function TASK:AddSmokeOrange( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.ORANGE, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.SMOKE, TASK.SIGNAL.COLOR.ORANGE, SignalHeight )
end end
@ -427,7 +425,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddFlareRed( SignalUnitNames, SignalHeight ) function TASK:AddFlareRed( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.RED, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.RED, SignalHeight )
end end
@ -435,7 +433,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddFlareGreen( SignalUnitNames, SignalHeight ) function TASK:AddFlareGreen( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.GREEN, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.GREEN, SignalHeight )
end end
@ -443,7 +441,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddFlareBlue( SignalUnitNames, SignalHeight ) function TASK:AddFlareBlue( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.BLUE, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.BLUE, SignalHeight )
end end
@ -451,7 +449,7 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddFlareWhite( SignalUnitNames, SignalHeight ) function TASK:AddFlareWhite( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.WHITE, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.WHITE, SignalHeight )
end end
@ -459,6 +457,6 @@ end
-- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone. -- @param table|string SignalUnitNames Name of the Group that will fire the signal. If this parameter is NIL, the signal will be fired from the center of the landing zone.
-- @param number SignalHeight Altitude that the Signal should be fired... -- @param number SignalHeight Altitude that the Signal should be fired...
function TASK:AddFlareOrange( SignalUnitNames, SignalHeight ) function TASK:AddFlareOrange( SignalUnitNames, SignalHeight )
trace.f(self.ClassName) self:F()
self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.ORANGE, SignalHeight ) self:AddSignal( SignalUnitNames, TASK.SIGNAL.TYPE.FLARE, TASK.SIGNAL.COLOR.ORANGE, SignalHeight )
end end

View File

@ -1,19 +1,27 @@
--- UNIT Classes --- UNIT Classes
-- @module UNIT -- @module Unit
Include.File( "Routines" ) Include.File( "Routines" )
Include.File( "Base" ) Include.File( "Base" )
Include.File( "Message" ) Include.File( "Message" )
--- The UNIT class --- The UNIT class
-- @type -- @type UNIT
-- @Extends Base#BASE
UNIT = { UNIT = {
ClassName="UNIT", ClassName="UNIT",
CategoryName = {
[Unit.Category.AIRPLANE] = "Airplane",
[Unit.Category.HELICOPTER] = "Helicoper",
[Unit.Category.GROUND_UNIT] = "Ground Unit",
[Unit.Category.SHIP] = "Ship",
[Unit.Category.STRUCTURE] = "Structure",
}
} }
function UNIT:New( DCSUnit ) function UNIT:New( DCSUnit )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:T( DCSUnit:getName() ) self:F( DCSUnit:getName() )
self.DCSUnit = DCSUnit self.DCSUnit = DCSUnit
self.UnitName = DCSUnit:getName() self.UnitName = DCSUnit:getName()
@ -23,39 +31,39 @@ function UNIT:New( DCSUnit )
end end
function UNIT:IsAlive() function UNIT:IsAlive()
self:T( self.UnitName ) self:F( self.UnitName )
return ( self.DCSUnit and self.DCSUnit:isExist() ) return ( self.DCSUnit and self.DCSUnit:isExist() )
end end
function UNIT:GetDCSUnit() function UNIT:GetDCSUnit()
self:T( self.DCSUnit ) self:F( self.DCSUnit )
return self.DCSUnit return self.DCSUnit
end end
function UNIT:GetID() function UNIT:GetID()
self:T( self.UnitID ) self:F( self.UnitID )
return self.UnitID return self.UnitID
end end
function UNIT:GetName() function UNIT:GetName()
self:T( self.UnitName ) self:F( self.UnitName )
return self.UnitName return self.UnitName
end end
function UNIT:GetTypeName() function UNIT:GetTypeName()
self:T( self.UnitName ) self:F( self.UnitName )
return self.DCSUnit:getTypeName() return self.DCSUnit:getTypeName()
end end
function UNIT:GetPrefix() function UNIT:GetPrefix()
self:T( self.UnitName ) self:F( self.UnitName )
local UnitPrefix = string.match( self.UnitName, ".*#" ):sub( 1, -2 ) local UnitPrefix = string.match( self.UnitName, ".*#" ):sub( 1, -2 )
self:T( UnitPrefix ) self:T( UnitPrefix )
@ -65,14 +73,14 @@ end
function UNIT:GetCallSign() function UNIT:GetCallSign()
self:T( self.UnitName ) self:F( self.UnitName )
return self.DCSUnit:getCallsign() return self.DCSUnit:getCallsign()
end end
function UNIT:GetPoint() function UNIT:GetPointVec2()
self:T( self.UnitName ) self:F( self.UnitName )
local UnitPos = self.DCSUnit:getPosition().p local UnitPos = self.DCSUnit:getPosition().p
@ -86,7 +94,7 @@ end
function UNIT:GetPositionVec3() function UNIT:GetPositionVec3()
self:T( self.UnitName ) self:F( self.UnitName )
local UnitPos = self.DCSUnit:getPosition().p local UnitPos = self.DCSUnit:getPosition().p
@ -95,7 +103,7 @@ function UNIT:GetPositionVec3()
end end
function UNIT:OtherUnitInRadius( AwaitUnit, Radius ) function UNIT:OtherUnitInRadius( AwaitUnit, Radius )
self:T( { self.UnitName, AwaitUnit.UnitName, Radius } ) self:F( { self.UnitName, AwaitUnit.UnitName, Radius } )
local UnitPos = self:GetPositionVec3() local UnitPos = self:GetPositionVec3()
local AwaitUnitPos = AwaitUnit:GetPositionVec3() local AwaitUnitPos = AwaitUnit:GetPositionVec3()
@ -112,3 +120,7 @@ function UNIT:OtherUnitInRadius( AwaitUnit, Radius )
return false return false
end end
function UNIT:GetCategoryName()
return self.CategoryName[ self.DCSUnit:getDesc().category ]
end

View File

@ -1,20 +1,20 @@
--- ZONE Classes --- ZONE Classes
-- @module ZONE -- @module Zone
Include.File( "Routines" ) Include.File( "Routines" )
Include.File( "Base" ) Include.File( "Base" )
Include.File( "Message" ) Include.File( "Message" )
--- The ZONE class --- The ZONE class
-- @type -- @type ZONE
-- @Extends Base#BASE
ZONE = { ZONE = {
ClassName="ZONE", ClassName="ZONE",
} }
function ZONE:New( ZoneName ) function ZONE:New( ZoneName )
trace.f( self.ClassName, ZoneName )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:F( ZoneName )
local Zone = trigger.misc.getZone( ZoneName ) local Zone = trigger.misc.getZone( ZoneName )
@ -29,8 +29,8 @@ trace.f( self.ClassName, ZoneName )
return self return self
end end
function ZONE:GetPoint() function ZONE:GetPointVec2()
self:T( self.ZoneName ) self:F( self.ZoneName )
local Zone = trigger.misc.getZone( self.ZoneName ) local Zone = trigger.misc.getZone( self.ZoneName )
local Point = { x = Zone.point.x, y = Zone.point.z } local Point = { x = Zone.point.x, y = Zone.point.z }
@ -41,7 +41,7 @@ function ZONE:GetPoint()
end end
function ZONE:GetRandomPoint() function ZONE:GetRandomPoint()
trace.f( self.ClassName, self.ZoneName ) self:F( self.ZoneName )
local Point = {} local Point = {}
@ -50,18 +50,17 @@ trace.f( self.ClassName, self.ZoneName )
Point.x = Zone.point.x + math.random( Zone.radius * -1, Zone.radius ) Point.x = Zone.point.x + math.random( Zone.radius * -1, Zone.radius )
Point.y = Zone.point.z + math.random( Zone.radius * -1, Zone.radius ) Point.y = Zone.point.z + math.random( Zone.radius * -1, Zone.radius )
trace.i( self.ClassName, { Zone } ) self:T( { Zone, Point } )
trace.i( self.ClassName, { Point } )
return Point return Point
end end
function ZONE:GetRadius() function ZONE:GetRadius()
trace.f( self.ClassName, self.ZoneName ) self:F( self.ZoneName )
local Zone = trigger.misc.getZone( self.ZoneName ) local Zone = trigger.misc.getZone( self.ZoneName )
trace.i( self.ClassName, { Zone } ) self:T( { Zone } )
return Zone.radius return Zone.radius
end end

View File

@ -0,0 +1,38 @@
Include.File( "Mission" )
Include.File( "Client" )
Include.File( "Spawn" )
Include.File( "Escort" )
do
local function EventAliveHelicopter( Client )
local SpawnEscortHeli = SPAWN:New( "Escort Helicopter" )
local EscortGroupHeli1 = SpawnEscortHeli:Spawn()
local EscortGroupHeli2 = SpawnEscortHeli:Spawn()
local EscortGroupHeli3 = SpawnEscortHeli:Spawn()
local EscortGroupHeli4 = SpawnEscortHeli:Spawn()
local EscortHeli1 = ESCORT:New( Client, EscortGroupHeli1, "Escort Alpha" )
local EscortHeli2 = ESCORT:New( Client, EscortGroupHeli2, "Escort Bravo" )
local EscortHeli3 = ESCORT:New( Client, EscortGroupHeli3, "Escort Delta" )
local EscortHeli4 = ESCORT:New( Client, EscortGroupHeli4, "Escort Gamma" )
end
local function EventAlivePlane( Client )
local SpawnEscortPlane = SPAWN:New( "Escort Plane" )
local EscortGroupPlane = SpawnEscortPlane:Spawn()
local EscortPlane = ESCORT:New( Client, EscortGroupPlane, "Escort Test Plane" )
end
local EscortClientHeli = CLIENT:New( "Lead Helicopter", "Fly around and observe the behaviour of the escort helicopter" ):Alive( EventAliveHelicopter )
local EscortClientPlane = CLIENT:New( "Lead Plane", "Fly around and observe the behaviour of the escort airplane. Select Navigate->Joun-Up and airplane should follow you. Change speed and directions." )
:Alive( EventAlivePlane )
end
-- MISSION SCHEDULER STARTUP
MISSIONSCHEDULER.Start()
MISSIONSCHEDULER.ReportMenu()
MISSIONSCHEDULER.ReportMissionsHide()
env.info( "Test Mission loaded" )

View File

@ -32,8 +32,8 @@ Group_Plane:Route( Route_Plane )
--Route_Helicopter[#Route_Helicopter].linkUnit = Group_Ship1:GetDCSUnit(1) --Route_Helicopter[#Route_Helicopter].linkUnit = Group_Ship1:GetDCSUnit(1)
--Route_Helicopter[#Route_Helicopter].helipadId = Group_Ship1:GetDCSUnit(1) --Route_Helicopter[#Route_Helicopter].helipadId = Group_Ship1:GetDCSUnit(1)
--Route_Helicopter[#Route_Helicopter].x = Group_Ship1:GetUnit(1):GetPoint().x --Route_Helicopter[#Route_Helicopter].x = Group_Ship1:GetUnit(1):GetPointVec2().x
--Route_Helicopter[#Route_Helicopter].y = Group_Ship1:GetUnit(1):GetPoint().y --Route_Helicopter[#Route_Helicopter].y = Group_Ship1:GetUnit(1):GetPointVec2().y
--env.info( Route_Helicopter[#Route_Helicopter].type .. " on " .. Group_Ship1:GetUnit(1):GetID() ) --env.info( Route_Helicopter[#Route_Helicopter].type .. " on " .. Group_Ship1:GetUnit(1):GetID() )
--Group_Helicopter:Route( Route_Helicopter ) --Group_Helicopter:Route( Route_Helicopter )

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
routes=
{
}

View File

@ -0,0 +1,209 @@
-- View scripts
-- Copyright (C) 2004, Eagle Dynamics.
DisableCombatViews = false -- F5 & Ctrl-F5
ExternalObjectsLockDistance = 10000.0
ShowTargetInfo = false
CameraTerrainRestriction = true
hAngleRearDefault = 180
vAngleRearDefault = -8.0
vAngleRearMin = -90 -- -8.0
vAngleRearMax = 90.0
dbg_shell = "weapons.shells.PKT_7_62_T" -- 23mm shell
-- dbg_shell = "weapons.shells.2A64_152" -- 152mm shell
dbg_shell_v0 = -1 -- Muzzle speed m/s (-1 - speed from shall database)
dbg_shell_fire_rate = 60
--reformatted per-unit data to be mod system friendly
--this file is no longer should be edited for adding new flyable aircraft , DCS automatically check core database (i.e. where you define your aircraft in aircraft table just define ViewSettings and SnapViews tables)
function default_fighter_player(t)
local res = {
CameraViewAngleLimits = {20.000000,140.000000},
CameraAngleRestriction = {false ,90.000000,0.500000},
EyePoint = {0.05 ,0.000000 ,0.000000},
limits_6DOF = {x = {-0.050000,0.4500000},y ={-0.300000,0.100000},z = {-0.220000,0.220000},roll = 90.000000},
Allow360rotation = false,
CameraAngleLimits = {200,-80.000000,110.000000},
ShoulderSize = 0.2, -- move body when azimuth value more then 90 degrees
}
if t then
for i,o in pairs(t) do
res[i] = o
end
end
return res
end
function fulcrum()
return {
Cockpit = {
default_fighter_player({CockpitLocalPoint = {4.71,1.28,0.000000}})
},
Chase = {
LocalPoint = {1.220000,3.750000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-15.080000,6.350000,0.000000},
AnglesDefault = {0.000000,-8.000000},
}, -- Arcade
}
end
ViewSettings = {}
ViewSettings["A-10A"] = {
Cockpit = {
[1] = default_fighter_player({CockpitLocalPoint = {4.300000,1.282000,0.000000},
EyePoint = {0.000000,0.000000,0.000000},
limits_6DOF = {x = {-0.050000,0.600000},
y = {-0.300000,0.100000},
z = {-0.250000,0.250000},
roll = 90.000000}}),
}, -- Cockpit
Chase = {
LocalPoint = {0.600000,3.682000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-27.000000,12.000000,0.000000},
AnglesDefault = {0.000000,-12.000000},
}, -- Arcade
}
ViewSettings["A-10C"] = {
Cockpit = {
[1] = default_fighter_player({CockpitLocalPoint = {4.300000,1.282000,0.000000},
EyePoint = {0.000000,0.000000,0.000000},
limits_6DOF = {x = {-0.050000,0.600000},
y = {-0.300000,0.100000},
z = {-0.250000,0.250000},
roll = 90.000000}}),
}, -- Cockpit
Chase = {
LocalPoint = {0.600000,3.682000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-27.000000,12.000000,0.000000},
AnglesDefault = {0.000000,-12.000000},
}, -- Arcade
}
ViewSettings["F-15C"] = {
Cockpit = {
[1] = default_fighter_player({CockpitLocalPoint = {6.210000,1.204000,0.000000}})-- player slot 1
}, -- Cockpit
Chase = {
LocalPoint = {2.510000,3.604000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-13.790000,6.204000,0.000000},
AnglesDefault = {0.000000,-8.000000},
}, -- Arcade
}
ViewSettings["Ka-50"] = {
Cockpit = {
[1] = {-- player slot 1
CockpitLocalPoint = {3.188000,0.390000,0.000000},
CameraViewAngleLimits = {20.000000,120.000000},
CameraAngleRestriction = {false,60.000000,0.400000},
CameraAngleLimits = {140.000000,-65.000000,90.000000},
EyePoint = {0.090000,0.000000,0.000000},
limits_6DOF = {x = {-0.020000,0.350000},y ={-0.150000,0.165000},z = {-0.170000,0.170000},roll = 90.000000},
},
}, -- Cockpit
Chase = {
LocalPoint = {-0.512000,2.790000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-16.812000,5.390000,0.000000},
AnglesDefault = {0.000000,-8.000000},
}, -- Arcade
}
ViewSettings["MiG-29A"] = fulcrum()
ViewSettings["MiG-29G"] = fulcrum()
ViewSettings["MiG-29S"] = fulcrum()
ViewSettings["P-51D"] = {
Cockpit = {
[1] = {-- player slot 1
CockpitLocalPoint = {-1.500000,0.618000,0.000000},
CameraViewAngleLimits = {20.000000,120.000000},
CameraAngleRestriction = {false,90.000000,0.500000},
CameraAngleLimits = {200,-80.000000,90.000000},
EyePoint = {0.025000,0.100000,0.000000},
ShoulderSize = 0.15,
Allow360rotation = false,
limits_6DOF = {x = {-0.050000,0.450000},y ={-0.200000,0.200000},z = {-0.220000,0.220000},roll = 90.000000},
},
}, -- Cockpit
Chase = {
LocalPoint = {0.200000,-0.652000,-0.650000},
AnglesDefault = {0.000000,0.000000},
}, -- Chase
Arcade = {
LocalPoint = {-21.500000,5.618000,0.000000},
AnglesDefault = {0.000000,-8.000000},
}, -- Arcade
}
ViewSettings["Su-25"] = {
Cockpit = {
[1] = default_fighter_player({CockpitLocalPoint = {3.352000,0.506000,0.000000}}),-- player slot 1
}, -- Cockpit
Chase = {
LocalPoint = {-0.348000,2.906000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-16.648001,5.506000,0.000000},
AnglesDefault = {0.000000,-8.000000},
}, -- Arcade
}
ViewSettings["Su-25T"] = {
Cockpit = {
[1] = default_fighter_player({CockpitLocalPoint = {3.406000,0.466000,0.000000}}),-- player slot 1
}, -- Cockpit
Chase = {
LocalPoint = {-0.294000,2.866000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-16.594000,5.466000,0.000000},
AnglesDefault = {0.000000,-8.000000},
}, -- Arcade
}
ViewSettings["Su-25TM"] = {
Cockpit = {
[1] = {-- player slot 1
CockpitLocalPoint = {4.000000,1.000000,0.000000},
CameraViewAngleLimits = {20.000000,140.000000},
CameraAngleRestriction = {true,90.000000,0.400000},
CameraAngleLimits = {160.000000,-70.000000,90.000000},
EyePoint = {0.000000,0.000000,0.000000},
limits_6DOF = {x = {-0.200000,0.200000},y ={-0.200000,0.200000},z = {-0.200000,0.200000},roll = 60.000000},
},
}, -- Cockpit
Chase = {
LocalPoint = {4.000000,2.000000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {4.000000,2.000000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Arcade
}
ViewSettings["Su-27"] = {
Cockpit = {
[1] = default_fighter_player({CockpitLocalPoint = {7.959000,1.419000,0.000000}})-- player slot 1
}, -- Cockpit
Chase = {
LocalPoint = {4.259000,3.819000,0.000000},
AnglesDefault = {180.000000,-8.000000},
}, -- Chase
Arcade = {
LocalPoint = {-12.041000,6.419000,0.000000},
AnglesDefault = {0.000000,-8.000000},
}, -- Arcade
}
ViewSettings["Su-33"] = ViewSettings["Su-27"]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,128 @@
-- View scripts
-- Copyright (C) 2004, Eagle Dynamics.
CockpitMouse = true --false
CockpitMouseSpeedSlow = 1.0
CockpitMouseSpeedNormal = 10.0
CockpitMouseSpeedFast = 20.0
CockpitKeyboardAccelerationSlow = 5.0
CockpitKeyboardAccelerationNormal = 30.0
CockpitKeyboardAccelerationFast = 80.0
CockpitKeyboardZoomAcceleration = 300.0
DisableSnapViewsSaving = false
UseDefaultSnapViews = true
CockpitPanStepHor = 45.0
CockpitPanStepVert = 30.0
CockpitNyMove = true
CockpitHAngleAccelerateTimeMax = 0.15
CockpitVAngleAccelerateTimeMax = 0.15
CockpitZoomAccelerateTimeMax = 0.2
function NaturalHeadMoving(tang, roll, omz)
local r = roll
if r > 90.0 then
r = 180.0 - r
elseif roll < -90.0 then
r = -180.0 - r
end
local hAngle = -0.25 * r
local vAngle = math.min(math.max(0.0, 0.4 * tang + 45.0 * omz), 90.0)
return hAngle, vAngle
end
ExternalMouse = true
ExternalMouseSpeedSlow = 1.0
ExternalMouseSpeedNormal = 5.0
ExternalMouseSpeedFast = 20.0
ExternalViewAngleMin = 3.0
ExternalViewAngleMax = 170.0
ExternalViewAngleDefault = 60.0
ExternalKeyboardZoomAcceleration = 30.0
ExternalKeyboardZoomAccelerateTimeMax = 1.0
ExplosionExpoTime = 4.0
ExternalKeyboardAccelerationSlow = 1.0
ExternalKeyboardAccelerationNormal = 10.0
ExternalKeyboardAccelerationFast = 30.0
ExternalHAngleAccelerateTimeMax = 3.0
ExternalVAngleAccelerateTimeMax = 3.0
ExternalDistAccelerateTimeMax = 3.0
ExternalHAngleLocalAccelerateTimeMax = 3.0
ExternalVAngleLocalAccelerateTimeMax = 3.0
ExternalAngleNormalDiscreteStep = 15.0/ExternalKeyboardAccelerationNormal -- When 'S' is pressed only
ChaseCameraNyMove = true
FreeCameraAngleIncrement = 3.0
FreeCameraDistanceIncrement = 200.0
FreeCameraLeftRightIncrement = 2.0
FreeCameraAltitudeIncrement = 2.0
FreeCameraScalarSpeedAcceleration = 0.1
xMinMap = -300000
xMaxMap = 500000
yMinMap = -400000
yMaxMap = 200000
dxMap = 150000
dyMap = 100000
head_roll_shaking = true
head_roll_shaking_max = 30.0
head_roll_shaking_compensation_gain = 0.3
-- CameraJiggle() and CameraFloat() functions make camera position
-- dependent on FPS so be careful in using the Shift-J command with tracks, please.
-- uncomment to use custom jiggle functions
--[[
function CameraJiggle(t,rnd1,rnd2,rnd3)
local rotX, rotY, rotZ
rotX = 0.05 * rnd1 * math.sin(37.0 * (t - 0.0))
rotY = 0.05 * rnd2 * math.sin(41.0 * (t - 1.0))
rotZ = 0.05 * rnd3 * math.sin(53.0 * (t - 2.0))
return rotX, rotY, rotZ
end
function CameraFloat(t)
local dX, dY, dZ
dX = 0.61 * math.sin(0.7 * t) + 0.047 * math.sin(1.6 * t);
dY = 0.43 * math.sin(0.6 * t) + 0.067 * math.sin(1.7 * t);
dZ = 0.53 * math.sin(1.0 * t) + 0.083 * math.sin(1.9 * t);
return dX, dY, dZ
end
--]]
--Debug keys
DEBUG_TEXT = 1
DEBUG_GEOMETRY = 2
debug_keys = {
[DEBUG_TEXT] = 1,
[DEBUG_GEOMETRY] = 1
}
function onDebugCommand(command)
if command == 10000 then
if debug_keys[DEBUG_TEXT] ~= 0 or debug_keys[DEBUG_GEOMETRY] ~= 0 then
debug_keys[DEBUG_GEOMETRY] = 0
debug_keys[DEBUG_TEXT] = 0
else
debug_keys[DEBUG_GEOMETRY] = 1
debug_keys[DEBUG_TEXT] = 1
end
elseif command == 10001 then
if debug_keys[DEBUG_TEXT] ~= 0 then
debug_keys[DEBUG_TEXT] = 0
else
debug_keys[DEBUG_TEXT] = 1
end
elseif command == 10002 then
if debug_keys[DEBUG_GEOMETRY] ~= 0 then
debug_keys[DEBUG_GEOMETRY] = 0
else
debug_keys[DEBUG_GEOMETRY] = 1
end
end
end
-- gain values for TrackIR , to unify responce on diffrent types of aircraft
TrackIR_gain_x = -0.6
TrackIR_gain_y = 0.3
TrackIR_gain_z = -0.25
TrackIR_gain_roll = -90

View File

@ -0,0 +1,53 @@
mode = ADF_ADF
receiver_mode = ADF_RECEIVER_TLF
homer_selection_method = ADF_HOMER_SELECTION_AUTO
channel = 1
volume = 0.5
local theatre = theatre or "none"
if theatre == 'Caucasus' then
channels = {
[1] = runway_homer_pair(Airdrome[Krasnodar],nil,localizedAirdromeName(terrainAirdromes[Krasnodar])),
[2] = runway_homer_pair(Airdrome[Maykop] ,nil,localizedAirdromeName(terrainAirdromes[Maykop])),
[3] = runway_homer_pair(Airdrome[Krymsk] ,nil,localizedAirdromeName(terrainAirdromes[Krymsk])),
[4] = runway_homer_pair(Airdrome[Anapa] ,nil,localizedAirdromeName(terrainAirdromes[Anapa])),
[5] = runway_homer_pair(Airdrome[Mozdok] ,nil,localizedAirdromeName(terrainAirdromes[Mozdok])),
[6] = runway_homer_pair(Airdrome[Nalchick] ,nil,localizedAirdromeName(terrainAirdromes[Nalchick])),
[7] = runway_homer_pair(Airdrome[MinVody] ,nil,localizedAirdromeName(terrainAirdromes[MinVody])),
[8] = {
[ADF_HOMER_FAR] = NDB(beacons["NDB_KISLOVODSK"]),
[ADF_HOMER_NEAR] = NDB(beacons["NDB_PEREDOVAIA"])
}
}
elseif theatre == 'Nevada' then
local beacons_by_name = {}
for i,o in pairs(beacons) do
if o.name == '' then
beacons_by_name[o.beaconId] = o
else
beacons_by_name[o.name] = o
end
end
local nevada_pair = function (id_1,id_2) return {
[ADF_HOMER_FAR] = NDB(beacons_by_name[id_1]),
[ADF_HOMER_NEAR] = NDB(beacons_by_name[id_2])
}
end
channels = {
nevada_pair('IndianSprings','Groom_Lake'),
nevada_pair('LasVegas','Nellis'),
nevada_pair("Milford","GOFFS"),
nevada_pair("Tonopah","Mina"),
nevada_pair("WilsonCreek","CedarCity"),
nevada_pair("BryceCanyon","MormonMesa"),
nevada_pair("Beatty","Bishop"),
nevada_pair("Coaldale","PeachSprings"),
nevada_pair("BoulderCity","Mercury"),
}
end

View File

@ -0,0 +1,880 @@
SAT_SYS_GLONASS = 0
SAT_SYS_GPS = 1
almanac = {}
--GPS
almanac[0] = {}
almanac[0]["System"] = SAT_SYS_GPS
almanac[0]["Number"] = 1
almanac[0]["Orbital"] = "F"
almanac[0]["Eccentricity"] = 6.294000e-003
almanac[0]["Time_of_Applicability"] = 5.898240e+005
almanac[0]["Orbital_Inclination"] = 9.885676e-001
almanac[0]["Rate_of_Right_Ascen"] = -7.862702e-009
almanac[0]["SQRT_A"] = 5.153700e+003
almanac[0]["Right_Ascen_at_Week"] = 8.096750e-001
almanac[0]["Argument_of_Perigee"] = -1.777773e+000
almanac[0]["Mean_Anom"] = -5.315745e-001
almanac[0]["week"] = 1390
almanac[1] = {}
almanac[1]["System"] = SAT_SYS_GPS
almanac[1]["Number"] = 2
almanac[1]["Orbital"] = "C"
almanac[1]["Eccentricity"] = 8.794000e-003
almanac[1]["Time_of_Applicability"] = 5.898240e+005
almanac[1]["Orbital_Inclination"] = 9.487811e-001
almanac[1]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[1]["SQRT_A"] = 5.153700e+003
almanac[1]["Right_Ascen_at_Week"] = -1.329172e+000
almanac[1]["Argument_of_Perigee"] = 2.138637e+000
almanac[1]["Mean_Anom"] = 7.311702e-001
almanac[1]["week"] = 1390
almanac[2] = {}
almanac[2]["System"] = SAT_SYS_GPS
almanac[2]["Number"] = 3
almanac[2]["Orbital"] = "F"
almanac[2]["Eccentricity"] = 8.424000e-003
almanac[2]["Time_of_Applicability"] = 5.898240e+005
almanac[2]["Orbital_Inclination"] = 9.262804e-001
almanac[2]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[2]["SQRT_A"] = 5.153600e+003
almanac[2]["Right_Ascen_at_Week"] = -2.341514e+000
almanac[2]["Argument_of_Perigee"] = 6.749357e-001
almanac[2]["Mean_Anom"] = -2.296153e-001
almanac[2]["week"] = 1389
almanac[3] = {}
almanac[3]["System"] = SAT_SYS_GPS
almanac[3]["Number"] = 4
almanac[3]["Orbital"] = "D"
almanac[3]["Eccentricity"] = 7.413000e-003
almanac[3]["Time_of_Applicability"] = 5.898240e+005
almanac[3]["Orbital_Inclination"] = 9.482889e-001
almanac[3]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[3]["SQRT_A"] = 5.153600e+003
almanac[3]["Right_Ascen_at_Week"] = -1.309589e+000
almanac[3]["Argument_of_Perigee"] = 1.623504e-001
almanac[3]["Mean_Anom"] = -3.022943e+000
almanac[3]["week"] = 1390
almanac[4] = {}
almanac[4]["System"] = SAT_SYS_GPS
almanac[4]["Number"] = 5
almanac[4]["Orbital"] = "B"
almanac[4]["Eccentricity"] = 7.432000e-003
almanac[4]["Time_of_Applicability"] = 5.898240e+005
almanac[4]["Orbital_Inclination"] = 9.387437e-001
almanac[4]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[4]["SQRT_A"] = 5.153700e+003
almanac[4]["Right_Ascen_at_Week"] = 2.779487e+000
almanac[4]["Argument_of_Perigee"] = 1.099033e+000
almanac[4]["Mean_Anom"] = 2.970984e+000
almanac[4]["week"] = 1390
almanac[5] = {}
almanac[5]["System"] = SAT_SYS_GPS
almanac[5]["Number"] = 6
almanac[5]["Orbital"] = "C"
almanac[5]["Eccentricity"] = 6.020000e-003
almanac[5]["Time_of_Applicability"] = 5.898240e+005
almanac[5]["Orbital_Inclination"] = 9.337591e-001
almanac[5]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[5]["SQRT_A"] = 5.153600e+003
almanac[5]["Right_Ascen_at_Week"] = -2.407627e+000
almanac[5]["Argument_of_Perigee"] = -1.788263e+000
almanac[5]["Mean_Anom"] = -2.149877e+000
almanac[5]["week"] = 1390
almanac[6] = {}
almanac[6]["System"] = SAT_SYS_GPS
almanac[6]["Number"] = 7
almanac[6]["Orbital"] = "C"
almanac[6]["Eccentricity"] = 1.052400e-002
almanac[6]["Time_of_Applicability"] = 5.898240e+005
almanac[6]["Orbital_Inclination"] = 9.353229e-001
almanac[6]["Rate_of_Right_Ascen"] = -8.080868e-009
almanac[6]["SQRT_A"] = 5.153700e+003
almanac[6]["Right_Ascen_at_Week"] = -2.433580e+000
almanac[6]["Argument_of_Perigee"] = -1.767301e+000
almanac[6]["Mean_Anom"] = -3.141503e+000
almanac[6]["week"] = 1390
almanac[7] = {}
almanac[7]["System"] = SAT_SYS_GPS
almanac[7]["Number"] = 8
almanac[7]["Orbital"] = "A"
almanac[7]["Eccentricity"] = 9.822000e-003
almanac[7]["Time_of_Applicability"] = 5.898240e+005
almanac[7]["Orbital_Inclination"] = 9.741390e-001
almanac[7]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[7]["SQRT_A"] = 5.153600e+003
almanac[7]["Right_Ascen_at_Week"] = 1.857849e+000
almanac[7]["Argument_of_Perigee"] = 2.674034e+000
almanac[7]["Mean_Anom"] = -2.009745e+000
almanac[7]["week"] = 1390
almanac[8] = {}
almanac[8]["System"] = SAT_SYS_GPS
almanac[8]["Number"] = 9
almanac[8]["Orbital"] = "A"
almanac[8]["Eccentricity"] = 1.839300e-002
almanac[8]["Time_of_Applicability"] = 5.898240e+005
almanac[8]["Orbital_Inclination"] = 9.617541e-001
almanac[8]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[8]["SQRT_A"] = 5.153600e+003
almanac[8]["Right_Ascen_at_Week"] = 1.777005e+000
almanac[8]["Argument_of_Perigee"] = 1.274962e+000
almanac[8]["Mean_Anom"] = -2.349578e+000
almanac[8]["week"] = 1390
almanac[9] = {}
almanac[9]["System"] = SAT_SYS_GPS
almanac[9]["Number"] = 10
almanac[9]["Orbital"] = "E"
almanac[9]["Eccentricity"] = 7.061000e-003
almanac[9]["Time_of_Applicability"] = 5.898240e+005
almanac[9]["Orbital_Inclination"] = 9.728876e-001
almanac[9]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[9]["SQRT_A"] = 5.153600e+003
almanac[9]["Right_Ascen_at_Week"] = -2.563014e-001
almanac[9]["Argument_of_Perigee"] = 4.377980e-001
almanac[9]["Mean_Anom"] = 1.210716e+000
almanac[9]["week"] = 1390
almanac[10] = {}
almanac[10]["System"] = SAT_SYS_GPS
almanac[10]["Number"] = 11
almanac[10]["Orbital"] = "D"
almanac[10]["Eccentricity"] = 5.744000e-003
almanac[10]["Time_of_Applicability"] = 5.898240e+005
almanac[10]["Orbital_Inclination"] = 8.959309e-001
almanac[10]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[10]["SQRT_A"] = 5.153600e+003
almanac[10]["Right_Ascen_at_Week"] = -1.478816e+000
almanac[10]["Argument_of_Perigee"] = 3.750011e-001
almanac[10]["Mean_Anom"] = -1.522048e+000
almanac[10]["week"] = 1390
almanac[11] = {}
almanac[11]["System"] = SAT_SYS_GPS
almanac[11]["Number"] = 13
almanac[11]["Orbital"] = "F"
almanac[11]["Eccentricity"] = 3.088000e-003
almanac[11]["Time_of_Applicability"] = 5.898240e+005
almanac[11]["Orbital_Inclination"] = 9.927564e-001
almanac[11]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[11]["SQRT_A"] = 5.153700e+003
almanac[11]["Right_Ascen_at_Week"] = 7.956600e-001
almanac[11]["Argument_of_Perigee"] = 1.279395e+000
almanac[11]["Mean_Anom"] = 1.004349e+000
almanac[11]["week"] = 1390
almanac[12] = {}
almanac[12]["System"] = SAT_SYS_GPS
almanac[12]["Number"] = 14
almanac[12]["Orbital"] = "F"
almanac[12]["Eccentricity"] = 2.591000e-003
almanac[12]["Time_of_Applicability"] = 5.898240e+005
almanac[12]["Orbital_Inclination"] = 9.868729e-001
almanac[12]["Rate_of_Right_Ascen"] = -7.885391e-009
almanac[12]["SQRT_A"] = 5.153600e+003
almanac[12]["Right_Ascen_at_Week"] = 7.819592e-001
almanac[12]["Argument_of_Perigee"] = -2.158621e+000
almanac[12]["Mean_Anom"] = 5.412611e-001
almanac[12]["week"] = 1390
almanac[13] = {}
almanac[13]["System"] = SAT_SYS_GPS
almanac[13]["Number"] = 15
almanac[13]["Orbital"] = "D"
almanac[13]["Eccentricity"] = 9.828000e-003
almanac[13]["Time_of_Applicability"] = 3.194880e+005
almanac[13]["Orbital_Inclination"] = 9.554204e-001
almanac[13]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[13]["SQRT_A"] = 5.153600e+003
almanac[13]["Right_Ascen_at_Week"] = -1.123869e+000
almanac[13]["Argument_of_Perigee"] = 2.690266e+000
almanac[13]["Mean_Anom"] = 2.220476e+000
almanac[13]["week"] = 1389
almanac[14] = {}
almanac[14]["System"] = SAT_SYS_GPS
almanac[14]["Number"] = 16
almanac[14]["Orbital"] = "B"
almanac[14]["Eccentricity"] = 3.494000e-003
almanac[14]["Time_of_Applicability"] = 5.898240e+005
almanac[14]["Orbital_Inclination"] = 9.629340e-001
almanac[14]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[14]["SQRT_A"] = 5.153700e+003
almanac[14]["Right_Ascen_at_Week"] = 2.873124e+000
almanac[14]["Argument_of_Perigee"] = -7.819243e-001
almanac[14]["Mean_Anom"] = 2.623629e+000
almanac[14]["week"] = 1390
almanac[15] = {}
almanac[15]["System"] = SAT_SYS_GPS
almanac[15]["Number"] = 17
almanac[15]["Orbital"] = "C"
almanac[15]["Eccentricity"] = 2.141000e-003
almanac[15]["Time_of_Applicability"] = 5.898240e+005
almanac[15]["Orbital_Inclination"] = 9.601170e-001
almanac[15]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[15]["SQRT_A"] = 5.153700e+003
almanac[15]["Right_Ascen_at_Week"] = -2.371499e+000
almanac[15]["Argument_of_Perigee"] = 3.087694e+000
almanac[15]["Mean_Anom"] = 1.611217e+000
almanac[15]["week"] = 1390
almanac[16] = {}
almanac[16]["System"] = SAT_SYS_GPS
almanac[16]["Number"] = 18
almanac[16]["Orbital"] = "E"
almanac[16]["Eccentricity"] = 7.636000e-003
almanac[16]["Time_of_Applicability"] = 5.898240e+005
almanac[16]["Orbital_Inclination"] = 9.569597e-001
almanac[16]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[16]["SQRT_A"] = 5.153700e+003
almanac[16]["Right_Ascen_at_Week"] = -2.359858e-001
almanac[16]["Argument_of_Perigee"] = -2.649216e+000
almanac[16]["Mean_Anom"] = 2.675029e+000
almanac[16]["week"] = 1390
almanac[17] = {}
almanac[17]["System"] = SAT_SYS_GPS
almanac[17]["Number"] = 19
almanac[17]["Orbital"] = "C"
almanac[17]["Eccentricity"] = 3.602000e-003
almanac[17]["Time_of_Applicability"] = 5.898240e+005
almanac[17]["Orbital_Inclination"] = 9.580209e-001
almanac[17]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[17]["SQRT_A"] = 5.153600e+003
almanac[17]["Right_Ascen_at_Week"] = -2.312385e+000
almanac[17]["Argument_of_Perigee"] = -1.161079e+000
almanac[17]["Mean_Anom"] = 1.310619e+000
almanac[17]["week"] = 1390
almanac[18] = {}
almanac[18]["System"] = SAT_SYS_GPS
almanac[18]["Number"] = 20
almanac[18]["Orbital"] = "E"
almanac[18]["Eccentricity"] = 2.796000e-003
almanac[18]["Time_of_Applicability"] = 5.898240e+005
almanac[18]["Orbital_Inclination"] = 9.564693e-001
almanac[18]["Rate_of_Right_Ascen"] = -7.908080e-009
almanac[18]["SQRT_A"] = 5.153600e+003
almanac[18]["Right_Ascen_at_Week"] = -2.889565e-001
almanac[18]["Argument_of_Perigee"] = 1.379612e+000
almanac[18]["Mean_Anom"] = 2.461750e+000
almanac[18]["week"] = 1390
almanac[19] = {}
almanac[19]["System"] = SAT_SYS_GPS
almanac[19]["Number"] = 21
almanac[19]["Orbital"] = "D"
almanac[19]["Eccentricity"] = 1.162900e-002
almanac[19]["Time_of_Applicability"] = 5.898240e+005
almanac[19]["Orbital_Inclination"] = 9.418592e-001
almanac[19]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[19]["SQRT_A"] = 5.153600e+003
almanac[19]["Right_Ascen_at_Week"] = -1.289972e+000
almanac[19]["Argument_of_Perigee"] = -2.923686e+000
almanac[19]["Mean_Anom"] = -2.349194e+000
almanac[19]["week"] = 1390
almanac[20] = {}
almanac[20]["System"] = SAT_SYS_GPS
almanac[20]["Number"] = 22
almanac[20]["Orbital"] = "E"
almanac[20]["Eccentricity"] = 4.893000e-003
almanac[20]["Time_of_Applicability"] = 5.898240e+005
almanac[20]["Orbital_Inclination"] = 9.545093e-001
almanac[20]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[20]["SQRT_A"] = 5.153600e+003
almanac[20]["Right_Ascen_at_Week"] = -2.280969e-001
almanac[20]["Argument_of_Perigee"] = -1.674502e+000
almanac[20]["Mean_Anom"] = 1.106852e+000
almanac[20]["week"] = 1390
almanac[21] = {}
almanac[21]["System"] = SAT_SYS_GPS
almanac[21]["Number"] = 23
almanac[21]["Orbital"] = "F"
almanac[21]["Eccentricity"] = 4.822000e-003
almanac[21]["Time_of_Applicability"] = 5.898240e+005
almanac[21]["Orbital_Inclination"] = 9.691247e-001
almanac[21]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[21]["SQRT_A"] = 5.153700e+003
almanac[21]["Right_Ascen_at_Week"] = 7.667399e-001
almanac[21]["Argument_of_Perigee"] = 2.497634e+000
almanac[21]["Mean_Anom"] = 3.184700e-001
almanac[21]["week"] = 1390
almanac[22] = {}
almanac[22]["System"] = SAT_SYS_GPS
almanac[22]["Number"] = 24
almanac[22]["Orbital"] = "D"
almanac[22]["Eccentricity"] = 9.277000e-003
almanac[22]["Time_of_Applicability"] = 5.898240e+005
almanac[22]["Orbital_Inclination"] = 9.585183e-001
almanac[22]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[22]["SQRT_A"] = 5.153900e+003
almanac[22]["Right_Ascen_at_Week"] = -1.274840e+000
almanac[22]["Argument_of_Perigee"] = -8.815651e-001
almanac[22]["Mean_Anom"] = -1.695551e+000
almanac[22]["week"] = 1390
almanac[23] = {}
almanac[23]["System"] = SAT_SYS_GPS
almanac[23]["Number"] = 25
almanac[23]["Orbital"] = "A"
almanac[23]["Eccentricity"] = 1.257400e-002
almanac[23]["Time_of_Applicability"] = 5.898240e+005
almanac[23]["Orbital_Inclination"] = 9.551027e-001
almanac[23]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[23]["SQRT_A"] = 5.153600e+003
almanac[23]["Right_Ascen_at_Week"] = 1.721853e+000
almanac[23]["Argument_of_Perigee"] = -1.329870e+000
almanac[23]["Mean_Anom"] = -1.769623e+000
almanac[23]["week"] = 1390
almanac[24] = {}
almanac[24]["System"] = SAT_SYS_GPS
almanac[24]["Number"] = 26
almanac[24]["Orbital"] = "F"
almanac[24]["Eccentricity"] = 1.745700e-002
almanac[24]["Time_of_Applicability"] = 5.898240e+005
almanac[24]["Orbital_Inclination"] = 9.908749e-001
almanac[24]["Rate_of_Right_Ascen"] = -7.840012e-009
almanac[24]["SQRT_A"] = 5.153700e+003
almanac[24]["Right_Ascen_at_Week"] = 7.961836e-001
almanac[24]["Argument_of_Perigee"] = 8.161502e-001
almanac[24]["Mean_Anom"] = -5.841961e-001
almanac[24]["week"] = 1390
almanac[25] = {}
almanac[25]["System"] = SAT_SYS_GPS
almanac[25]["Number"] = 27
almanac[25]["Orbital"] = "A"
almanac[25]["Eccentricity"] = 1.991000e-002
almanac[25]["Time_of_Applicability"] = 5.898240e+005
almanac[25]["Orbital_Inclination"] = 9.596563e-001
almanac[25]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[25]["SQRT_A"] = 5.153600e+003
almanac[25]["Right_Ascen_at_Week"] = 1.754124e+000
almanac[25]["Argument_of_Perigee"] = -1.900854e+000
almanac[25]["Mean_Anom"] = 3.046487e+000
almanac[25]["week"] = 1390
almanac[26] = {}
almanac[26]["System"] = SAT_SYS_GPS
almanac[26]["Number"] = 28
almanac[26]["Orbital"] = "B"
almanac[26]["Eccentricity"] = 1.162800e-002
almanac[26]["Time_of_Applicability"] = 5.898240e+005
almanac[26]["Orbital_Inclination"] = 9.610106e-001
almanac[26]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[26]["SQRT_A"] = 5.153600e+003
almanac[26]["Right_Ascen_at_Week"] = 2.882583e+000
almanac[26]["Argument_of_Perigee"] = -2.242868e+000
almanac[26]["Mean_Anom"] = 1.860642e+000
almanac[26]["week"] = 1390
almanac[27] = {}
almanac[27]["System"] = SAT_SYS_GPS
almanac[27]["Number"] = 29
almanac[27]["Orbital"] = "F"
almanac[27]["Eccentricity"] = 9.462000e-003
almanac[27]["Time_of_Applicability"] = 1.474560e+005
almanac[27]["Orbital_Inclination"] = 9.874838e-001
almanac[27]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[27]["SQRT_A"] = 5.153700e+003
almanac[27]["Right_Ascen_at_Week"] = 7.647503e-001
almanac[27]["Argument_of_Perigee"] = -8.614589e-001
almanac[27]["Mean_Anom"] = -4.488983e-001
almanac[27]["week"] = 1390
almanac[28] = {}
almanac[28]["System"] = SAT_SYS_GPS
almanac[28]["Number"] = 30
almanac[28]["Orbital"] = "B"
almanac[28]["Eccentricity"] = 9.296000e-003
almanac[28]["Time_of_Applicability"] = 5.898240e+005
almanac[28]["Orbital_Inclination"] = 9.452992e-001
almanac[28]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[28]["SQRT_A"] = 5.153600e+003
almanac[28]["Right_Ascen_at_Week"] = 2.826698e+000
almanac[28]["Argument_of_Perigee"] = 1.306413e+000
almanac[28]["Mean_Anom"] = 2.148725e+000
almanac[28]["week"] = 1390
--GLONASS
--1 îðáèòàëüíàÿ ïëîñêîñòü, íîìåðà 1-8
almanac[29] = {}
almanac[29]["System"] = SAT_SYS_GLONASS
almanac[29]["Number"] = 1
almanac[29]["Orbital"] = 1
almanac[29]["GLONASS_Data"] = {}
almanac[29]["GLONASS_Data"]["NKU_Number"] = 796
almanac[29]["GLONASS_Data"]["Cosmos_Number"] = 2411
almanac[29]["Eccentricity"] = 1.184000e-003
almanac[29]["Time_of_Applicability"] = 0.000000e+000
almanac[29]["Orbital_Inclination"] = 1.126443e+000
almanac[29]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[29]["SQRT_A"] = 5.050500e+003
almanac[29]["Right_Ascen_at_Week"] = 5.979807e+000
almanac[29]["Argument_of_Perigee"] = 2.622634e+000
almanac[29]["Mean_Anom"] = -5.519651e+000
almanac[29]["week"] = 1390
almanac[29]["Commit_date"] = "06.02.2005"
almanac[29]["Life_dates"] = {}
almanac[30] = {}
almanac[30]["System"] = SAT_SYS_GLONASS
almanac[30]["Number"] = 2
almanac[30]["Orbital"] = 1
almanac[30]["GLONASS_Data"] = {}
almanac[30]["GLONASS_Data"]["NKU_Number"] = 794
almanac[30]["GLONASS_Data"]["Cosmos_Number"] = 2401
almanac[30]["Eccentricity"] = 4.486000e-003
almanac[30]["Time_of_Applicability"] = 0.000000e+000
almanac[30]["Orbital_Inclination"] = 1.128459e+000
almanac[30]["Rate_of_Right_Ascen"] = -6.759654e-009
almanac[30]["SQRT_A"] = 5.050500e+003
almanac[30]["Right_Ascen_at_Week"] = 5.997871e+000
almanac[30]["Argument_of_Perigee"] = 1.709531e+000
almanac[30]["Mean_Anom"] = -5.367633e+000
almanac[30]["week"] = 1390
almanac[30]["Commit_date"] = "02.02.2004"
almanac[30]["Life_dates"] = {}
almanac[31] = {}
almanac[31]["System"] = SAT_SYS_GLONASS
almanac[31]["Number"] = 3
almanac[31]["Orbital"] = 1
almanac[31]["GLONASS_Data"] = {}
almanac[31]["GLONASS_Data"]["NKU_Number"] = 789
almanac[31]["GLONASS_Data"]["Cosmos_Number"] = 2381
almanac[31]["Eccentricity"] = 2.459000e-003
almanac[31]["Time_of_Applicability"] = 0.000000e+000
almanac[31]["Orbital_Inclination"] = 1.122958e+000
almanac[31]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[31]["SQRT_A"] = 5.050500e+003
almanac[31]["Right_Ascen_at_Week"] = 5.960713e+000
almanac[31]["Argument_of_Perigee"] = -2.683407e+000
almanac[31]["Mean_Anom"] = -1.791788e+000
almanac[31]["week"] = 1390
almanac[31]["Commit_date"] = "04.01.2002"
almanac[31]["Life_dates"] = {}
almanac[32] = {}
almanac[32]["System"] = SAT_SYS_GLONASS
almanac[32]["Number"] = 4
almanac[32]["Orbital"] = 1
almanac[32]["GLONASS_Data"] = {}
almanac[32]["GLONASS_Data"]["NKU_Number"] = 795
almanac[29]["GLONASS_Data"]["Cosmos_Number"] = 2403
almanac[32]["Eccentricity"] = 4.054000e-003
almanac[32]["Time_of_Applicability"] = 0.000000e+000
almanac[32]["Orbital_Inclination"] = 1.128543e+000
almanac[32]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[32]["SQRT_A"] = 5.050500e+003
almanac[32]["Right_Ascen_at_Week"] = 5.998081e+000
almanac[32]["Argument_of_Perigee"] = 1.497160e+000
almanac[32]["Mean_Anom"] = -4.293681e-001
almanac[32]["week"] = 1390
almanac[32]["Commit_date"] = "29.01.2004"
almanac[32]["Life_dates"] = {}
almanac[33] = {}
almanac[33]["System"] = SAT_SYS_GLONASS
almanac[33]["Number"] = 5
almanac[33]["Orbital"] = 1
almanac[33]["GLONASS_Data"] = {}
almanac[33]["GLONASS_Data"]["NKU_Number"] = 711
almanac[33]["GLONASS_Data"]["Cosmos_Number"] = 2382
almanac[33]["Eccentricity"] = 7.040000e-004
almanac[33]["Time_of_Applicability"] = 0.000000e+000
almanac[33]["Orbital_Inclination"] = 1.122886e+000
almanac[33]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[33]["SQRT_A"] = 5.050600e+003
almanac[33]["Right_Ascen_at_Week"] = 5.960713e+000
almanac[33]["Argument_of_Perigee"] = 2.740933e+000
almanac[33]["Mean_Anom"] = -2.523604e+000
almanac[33]["week"] = 1390
almanac[33]["Commit_date"] = "13.02.2003"
almanac[33]["Life_dates"] = {}
almanac[34] = {}
almanac[34]["System"] = SAT_SYS_GLONASS
almanac[34]["Number"] = 6
almanac[34]["Orbital"] = 1
almanac[34]["GLONASS_Data"] = {}
almanac[34]["GLONASS_Data"]["NKU_Number"] = 701
almanac[34]["GLONASS_Data"]["Cosmos_Number"] = 2404
almanac[34]["Eccentricity"] = 4.766000e-003
almanac[34]["Time_of_Applicability"] = 0.000000e+000
almanac[34]["Orbital_Inclination"] = 1.128276e+000
almanac[34]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[34]["SQRT_A"] = 5.050500e+003
almanac[34]["Right_Ascen_at_Week"] = 5.997906e+000
almanac[34]["Argument_of_Perigee"] = 1.802417e+000
almanac[34]["Mean_Anom"] = -2.426512e+000
almanac[34]["week"] = 1390
almanac[34]["Commit_date"] = "08.12.2004"
almanac[34]["Life_dates"] = {}
almanac[35] = {}
almanac[35]["System"] = SAT_SYS_GLONASS
almanac[35]["Number"] = 7
almanac[35]["Orbital"] = 1
almanac[35]["GLONASS_Data"] = {}
almanac[35]["GLONASS_Data"]["NKU_Number"] = 712
almanac[35]["GLONASS_Data"]["Cosmos_Number"] = 2413
almanac[35]["Eccentricity"] = 7.570000e-004
almanac[35]["Time_of_Applicability"] = 0.000000e+000
almanac[35]["Orbital_Inclination"] = 1.126344e+000
almanac[35]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[35]["SQRT_A"] = 5.050500e+003
almanac[35]["Right_Ascen_at_Week"] = 5.979388e+000
almanac[35]["Argument_of_Perigee"] = 2.566068e+000
almanac[35]["Mean_Anom"] = -3.921228e+000
almanac[35]["week"] = 1390
almanac[35]["Commit_date"] = "07.10.2005"
almanac[35]["Life_dates"] = {}
almanac[36] = {}
almanac[36]["System"] = SAT_SYS_GLONASS
almanac[36]["GLONASS_Data"] = {}
almanac[36]["Number"] = 8
almanac[36]["Orbital"] = 1
almanac[36]["GLONASS_Data"] = {}
almanac[36]["GLONASS_Data"]["NKU_Number"] = 797
almanac[36]["GLONASS_Data"]["Cosmos_Number"] = 2412
almanac[36]["Eccentricity"] = 4.060000e-004
almanac[36]["Time_of_Applicability"] = 0.000000e+000
almanac[36]["Orbital_Inclination"] = 1.126564e+000
almanac[36]["Rate_of_Right_Ascen"] = -6.785834e-009
almanac[36]["SQRT_A"] = 5.050600e+003
almanac[36]["Right_Ascen_at_Week"] = 5.980069e+000
almanac[36]["Argument_of_Perigee"] = 2.673633e+000
almanac[36]["Mean_Anom"] = -4.812026e+000
almanac[36]["week"] = 1390
almanac[36]["Commit_date"] = "06.02.2005"
almanac[36]["Life_dates"] = {}
--3 îðáèòàëüíàÿ ïëîñêîñòü, íîìåðà 17-24
almanac[37] = {}
almanac[37]["System"] = SAT_SYS_GLONASS
almanac[37]["Number"] = 17
almanac[37]["Orbital"] = 3
almanac[37]["GLONASS_Data"] = {}
almanac[37]["GLONASS_Data"]["NKU_Number"] = 787
almanac[37]["GLONASS_Data"]["Cosmos_Number"] = 2375
almanac[37]["Eccentricity"] = 5.670000e-004
almanac[37]["Time_of_Applicability"] = 0.000000e+000
almanac[37]["Orbital_Inclination"] = 1.126524e+000
almanac[37]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[37]["SQRT_A"] = 5.050500e+003
almanac[37]["Right_Ascen_at_Week"] = 3.895554e+000
almanac[37]["Argument_of_Perigee"] = 6.085085e-001
almanac[37]["Mean_Anom"] = -2.977407e+000
almanac[37]["week"] = 1390
almanac[37]["Commit_date"] = "04.11.2000"
almanac[37]["Life_dates"] = {}
almanac[38] = {}
almanac[38]["System"] = SAT_SYS_GLONASS
almanac[38]["Number"] = 18
almanac[38]["Orbital"] = 3
almanac[38]["GLONASS_Data"] = {}
almanac[38]["GLONASS_Data"]["NKU_Number"] = 783
almanac[38]["GLONASS_Data"]["Cosmos_Number"] = 2374
almanac[38]["Eccentricity"] = 4.520000e-003
almanac[38]["Time_of_Applicability"] = 0.000000e+000
almanac[38]["Orbital_Inclination"] = 1.126239e+000
almanac[38]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[38]["SQRT_A"] = 5.050600e+003
almanac[38]["Right_Ascen_at_Week"] = 3.894071e+000
almanac[38]["Argument_of_Perigee"] = -2.509589e+000
almanac[38]["Mean_Anom"] = -1.020057e+000
almanac[38]["week"] = 1390
almanac[38]["Commit_date"] = "05.01.2001"
almanac[38]["Life_dates"] = {}
almanac[39] = {}
almanac[39]["System"] = SAT_SYS_GLONASS
almanac[39]["Number"] = 19
almanac[39]["Orbital"] = 3
almanac[39]["GLONASS_Data"] = {}
almanac[39]["GLONASS_Data"]["NKU_Number"] = 798
almanac[39]["GLONASS_Data"]["Cosmos_Number"] = 2417
almanac[39]["Eccentricity"] = 2.023000e-003
almanac[39]["Time_of_Applicability"] = 0.000000e+000
almanac[39]["Orbital_Inclination"] = 1.132205e+000
almanac[39]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[39]["SQRT_A"] = 5.050500e+003
almanac[39]["Right_Ascen_at_Week"] = 3.884018e+000
almanac[39]["Argument_of_Perigee"] = 2.718313e+000
almanac[39]["Mean_Anom"] = -3.933620e-001
almanac[39]["week"] = 1390
almanac[39]["Commit_date"] = "22.01.2006"
almanac[39]["Life_dates"] = {}
almanac[40] = {}
almanac[40]["System"] = SAT_SYS_GLONASS
almanac[40]["Number"] = 20
almanac[40]["Orbital"] = 3
almanac[40]["GLONASS_Data"] = {}
almanac[40]["GLONASS_Data"]["NKU_Number"] = 793
almanac[40]["GLONASS_Data"]["Cosmos_Number"] = 2396
almanac[40]["Eccentricity"] = 1.822000e-003
almanac[40]["Time_of_Applicability"] = 0.000000e+000
almanac[40]["Orbital_Inclination"] = 1.129789e+000
almanac[40]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[40]["SQRT_A"] = 5.050500e+003
almanac[40]["Right_Ascen_at_Week"] = 3.896863e+000
almanac[40]["Argument_of_Perigee"] = 2.723776e+000
almanac[40]["Mean_Anom"] = -1.193647e+000
almanac[40]["week"] = 1390
almanac[40]["Commit_date"] = "31.01.2003"
almanac[40]["Life_dates"] = {}
almanac[41] = {}
almanac[41]["System"] = SAT_SYS_GLONASS
almanac[41]["Number"] = 21
almanac[41]["Orbital"] = 3
almanac[41]["GLONASS_Data"] = {}
almanac[41]["GLONASS_Data"]["NKU_Number"] = 792
almanac[41]["GLONASS_Data"]["Cosmos_Number"] = 2395
almanac[41]["Eccentricity"] = 5.290000e-004
almanac[41]["Time_of_Applicability"] = 0.000000e+000
almanac[41]["Orbital_Inclination"] = 1.129957e+000
almanac[41]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[41]["SQRT_A"] = 5.050500e+003
almanac[41]["Right_Ascen_at_Week"] = 3.897806e+000
almanac[41]["Argument_of_Perigee"] = -9.519367e-001
almanac[41]["Mean_Anom"] = -4.578920e+000
almanac[41]["week"] = 1390
almanac[41]["Commit_date"] = "31.01.2003"
almanac[41]["Life_dates"] = {}
almanac[42] = {}
almanac[42]["System"] = SAT_SYS_GLONASS
almanac[42]["Number"] = 22
almanac[42]["Orbital"] = 3
almanac[42]["GLONASS_Data"] = {}
almanac[42]["GLONASS_Data"]["NKU_Number"] = 791
almanac[42]["GLONASS_Data"]["Cosmos_Number"] = 2394
almanac[42]["Eccentricity"] = 9.200000e-005
almanac[42]["Time_of_Applicability"] = 0.000000e+000
almanac[42]["Orbital_Inclination"] = 1.129742e+000
almanac[42]["Rate_of_Right_Ascen"] = -6.740456e-009
almanac[42]["SQRT_A"] = 5.050500e+003
almanac[42]["Right_Ascen_at_Week"] = 3.897404e+000
almanac[42]["Argument_of_Perigee"] = 2.518211e+000
almanac[42]["Mean_Anom"] = -2.530167e+000
almanac[42]["week"] = 1390
almanac[42]["Commit_date"] = "21.01.2003"
almanac[42]["Life_dates"] = {}
almanac[43] = {}
almanac[43]["System"] = SAT_SYS_GLONASS
almanac[43]["Number"] = 23
almanac[43]["Orbital"] = 3
almanac[43]["GLONASS_Data"] = {}
almanac[43]["GLONASS_Data"]["NKU_Number"] = 714
almanac[43]["GLONASS_Data"]["Cosmos_Number"] = 2419
almanac[43]["Eccentricity"] = 8.730000e-004
almanac[43]["Time_of_Applicability"] = 0.000000e+000
almanac[43]["Orbital_Inclination"] = 1.132105e+000
almanac[43]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[43]["SQRT_A"] = 5.050500e+003
almanac[43]["Right_Ascen_at_Week"] = 3.883808e+000
almanac[43]["Argument_of_Perigee"] = -3.039139e-001
almanac[43]["Mean_Anom"] = -5.228304e-001
almanac[43]["week"] = 1390
almanac[43]["Commit_date"] = "31.08.2006"
almanac[43]["Life_dates"] = {}
almanac[44] = {}
almanac[44]["System"] = SAT_SYS_GLONASS
almanac[44]["Number"] = 24
almanac[44]["Orbital"] = 3
almanac[44]["GLONASS_Data"] = {}
almanac[44]["GLONASS_Data"]["NKU_Number"] = 713
almanac[44]["GLONASS_Data"]["Cosmos_Number"] = 2418
almanac[44]["Eccentricity"] = 2.044000e-003
almanac[44]["Time_of_Applicability"] = 0.000000e+000
almanac[44]["Orbital_Inclination"] = 1.132430e+000
almanac[44]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[44]["SQRT_A"] = 5.050500e+003
almanac[44]["Right_Ascen_at_Week"] = 3.883983e+000
almanac[44]["Argument_of_Perigee"] = -3.722784e-001
almanac[44]["Mean_Anom"] = -1.240457e+000
almanac[44]["week"] = 1390
almanac[44]["Commit_date"] = "31.08.2006"
almanac[44]["Life_dates"] = {}
--2 îðáèòàëüíàÿ ïëîñêîñòü, íîìåðà 9-16
almanac[45] = {}
almanac[45]["System"] = SAT_SYS_GLONASS
almanac[45]["Number"] = 9
almanac[45]["Orbital"] = 2
almanac[45]["GLONASS_Data"] = {}
almanac[45]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[45]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[45]["Eccentricity"] = 1.184000e-003
almanac[45]["Time_of_Applicability"] = 0.000000e+000
almanac[45]["Orbital_Inclination"] = 1.126443e+000
almanac[45]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[45]["SQRT_A"] = 5.050500e+003
almanac[45]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[45]["Argument_of_Perigee"] = 2.88430067
almanac[45]["Mean_Anom"] = -5.519651e+000
almanac[45]["week"] = 1390
almanac[45]["Commit_date"] = "N/A"
almanac[45]["Life_dates"] = {}
almanac[46] = {}
almanac[46]["System"] = SAT_SYS_GLONASS
almanac[46]["Number"] = 10
almanac[46]["Orbital"] = 2
almanac[46]["GLONASS_Data"] = {}
almanac[46]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[46]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[46]["Eccentricity"] = 1.184000e-003
almanac[46]["Time_of_Applicability"] = 0.000000e+000
almanac[46]["Orbital_Inclination"] = 1.126443e+000
almanac[46]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[46]["SQRT_A"] = 5.050500e+003
almanac[46]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[46]["Argument_of_Perigee"] = 3.66930067
almanac[46]["Mean_Anom"] = -5.519651e+000
almanac[46]["week"] = 1390
almanac[46]["Commit_date"] = "N/A"
almanac[46]["Life_dates"] = {}
almanac[47] = {}
almanac[47]["System"] = SAT_SYS_GLONASS
almanac[47]["Number"] = 11
almanac[47]["Orbital"] = 2
almanac[47]["GLONASS_Data"] = {}
almanac[47]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[47]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[47]["Eccentricity"] = 1.184000e-003
almanac[47]["Time_of_Applicability"] = 0.000000e+000
almanac[47]["Orbital_Inclination"] = 1.126443e+000
almanac[47]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[47]["SQRT_A"] = 5.050500e+003
almanac[47]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[47]["Argument_of_Perigee"] = 4.45430067
almanac[47]["Mean_Anom"] = -5.519651e+000
almanac[47]["week"] = 1390
almanac[47]["Commit_date"] = "N/A"
almanac[47]["Life_dates"] = {}
almanac[48] = {}
almanac[48]["System"] = SAT_SYS_GLONASS
almanac[48]["Number"] = 12
almanac[48]["Orbital"] = 2
almanac[48]["GLONASS_Data"] = {}
almanac[48]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[48]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[48]["Eccentricity"] = 1.184000e-003
almanac[48]["Time_of_Applicability"] = 0.000000e+000
almanac[48]["Orbital_Inclination"] = 1.126443e+000
almanac[48]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[48]["SQRT_A"] = 5.050500e+003
almanac[48]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[48]["Argument_of_Perigee"] = 5.23930067
almanac[48]["Mean_Anom"] = -5.519651e+000
almanac[48]["week"] = 1390
almanac[48]["Commit_date"] = "N/A"
almanac[48]["Life_dates"] = {}
almanac[49] = {}
almanac[49]["System"] = SAT_SYS_GLONASS
almanac[49]["Number"] = 13
almanac[49]["Orbital"] = 2
almanac[49]["GLONASS_Data"] = {}
almanac[49]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[49]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[49]["Eccentricity"] = 1.184000e-003
almanac[49]["Time_of_Applicability"] = 0.000000e+000
almanac[49]["Orbital_Inclination"] = 1.126443e+000
almanac[49]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[49]["SQRT_A"] = 5.050500e+003
almanac[49]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[49]["Argument_of_Perigee"] = 6.02430067
almanac[49]["Mean_Anom"] = -5.519651e+000
almanac[49]["week"] = 1390
almanac[49]["Commit_date"] = "N/A"
almanac[49]["Life_dates"] = {}
almanac[50] = {}
almanac[50]["System"] = SAT_SYS_GLONASS
almanac[50]["Number"] = 14
almanac[50]["Orbital"] = 2
almanac[50]["GLONASS_Data"] = {}
almanac[50]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[50]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[50]["Eccentricity"] = 1.184000e-003
almanac[50]["Time_of_Applicability"] = 0.000000e+000
almanac[50]["Orbital_Inclination"] = 1.126443e+000
almanac[50]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[50]["SQRT_A"] = 5.050500e+003
almanac[50]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[50]["Argument_of_Perigee"] = 0.52930067
almanac[50]["Mean_Anom"] = -5.519651e+000
almanac[50]["week"] = 1390
almanac[50]["Commit_date"] = "N/A"
almanac[50]["Life_dates"] = {}
almanac[51] = {}
almanac[51]["System"] = SAT_SYS_GLONASS
almanac[51]["Number"] = 15
almanac[51]["Orbital"] = 2
almanac[51]["GLONASS_Data"] = {}
almanac[51]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[51]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[51]["Eccentricity"] = 1.184000e-003
almanac[51]["Time_of_Applicability"] = 0.000000e+000
almanac[51]["Orbital_Inclination"] = 1.126443e+000
almanac[51]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[51]["SQRT_A"] = 5.050500e+003
almanac[51]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[51]["Argument_of_Perigee"] = 1.31430067
almanac[51]["Mean_Anom"] = -5.519651e+000
almanac[51]["week"] = 1390
almanac[51]["Commit_date"] = "N/A"
almanac[51]["Life_dates"] = {}
almanac[52] = {}
almanac[52]["System"] = SAT_SYS_GLONASS
almanac[52]["Number"] = 16
almanac[52]["Orbital"] = 2
almanac[52]["GLONASS_Data"] = {}
almanac[52]["GLONASS_Data"]["NKU_Number"] = "N/A"
almanac[52]["GLONASS_Data"]["Cosmos_Number"] = "N/A"
almanac[52]["Eccentricity"] = 1.184000e-003
almanac[52]["Time_of_Applicability"] = 0.000000e+000
almanac[52]["Orbital_Inclination"] = 1.126443e+000
almanac[52]["Rate_of_Right_Ascen"] = 0.000000e+000
almanac[52]["SQRT_A"] = 5.050500e+003
almanac[52]["Right_Ascen_at_Week"] = 1.79067e+000
almanac[52]["Argument_of_Perigee"] = 2.09930067
almanac[52]["Mean_Anom"] = -5.519651e+000
almanac[52]["week"] = 1390
almanac[52]["Commit_date"] = "N/A"
almanac[52]["Life_dates"] = {}
SA_mode = false
AS_mode = false

View File

@ -0,0 +1,27 @@
birds_avail = true --Birds availability. false - there is no birds
birds_maximum_hrad = 200 --Maximum altitude above ground al sea level bird could be met
birds_maximum_absolute_height = 8000 --Maximum absolute altitude bird could be met
birds_minimum_velocity = 40 --Minimum velocity bird could be met
birds_delta_time = 3.55
birds_probability = {0.006333333*150,
0.004166667*150,
0.001966667*150,
0.001090909*150,
0.000741818*150,
0.0006*150,
0.000510545*150,
0.000447273*150,
0.000389455*150,
0.000349091*150,
0.000310909*150,
0.000282545*150,
0.000250909*150,
0.000220364*150,
0.000196364*150,
0.000174545*150,
0.000152727*150,
0.000128727*150,
0.000103636*150,
7.63636E-05*150,
0*150
}

View File

@ -0,0 +1,38 @@
Include.File( "Mission" )
Include.File( "Client" )
Include.File( "Spawn" )
Include.File( "Escort" )
do
local function EventAliveHelicopter( Client )
local SpawnEscortHeli = SPAWN:New( "Escort Helicopter" )
local EscortGroupHeli1 = SpawnEscortHeli:Spawn()
local EscortGroupHeli2 = SpawnEscortHeli:Spawn()
local EscortGroupHeli3 = SpawnEscortHeli:Spawn()
local EscortGroupHeli4 = SpawnEscortHeli:Spawn()
local EscortHeli1 = ESCORT:New( Client, EscortGroupHeli1, "Escort Alpha" )
local EscortHeli2 = ESCORT:New( Client, EscortGroupHeli2, "Escort Bravo" )
local EscortHeli3 = ESCORT:New( Client, EscortGroupHeli3, "Escort Delta" )
local EscortHeli4 = ESCORT:New( Client, EscortGroupHeli4, "Escort Gamma" )
end
local function EventAlivePlane( Client )
local SpawnEscortPlane = SPAWN:New( "Escort Plane" )
local EscortGroupPlane = SpawnEscortPlane:Spawn()
local EscortPlane = ESCORT:New( Client, EscortGroupPlane, "Escort Test Plane" )
end
local EscortClientHeli = CLIENT:New( "Lead Helicopter", "Fly around and observe the behaviour of the escort helicopter" ):Alive( EventAliveHelicopter )
local EscortClientPlane = CLIENT:New( "Lead Plane", "Fly around and observe the behaviour of the escort airplane. Select Navigate->Joun-Up and airplane should follow you. Change speed and directions." )
:Alive( EventAlivePlane )
end
-- MISSION SCHEDULER STARTUP
MISSIONSCHEDULER.Start()
MISSIONSCHEDULER.ReportMenu()
MISSIONSCHEDULER.ReportMissionsHide()
env.info( "Test Mission loaded" )

View File

@ -0,0 +1,43 @@
local base = _G
env.info("Loading MOOSE " .. base.timer.getAbsTime() )
Include = {}
Include.Path = function()
local str = debug.getinfo(2, "S").source
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
end
Include.File = function( IncludeFile )
if not Include.Files[ IncludeFile ] then
Include.Files[IncludeFile] = IncludeFile
env.info( "Include:" .. IncludeFile .. " from " .. Include.ProgramPath )
local f = assert( base.loadfile( Include.ProgramPath .. IncludeFile .. ".lua" ) )
if f == nil then
env.info( "Include:" .. IncludeFile .. " from " .. Include.MissionPath )
local f = assert( base.loadfile( Include.MissionPath .. IncludeFile .. ".lua" ) )
if f == nil then
error ("Could not load MOOSE file " .. IncludeFile .. ".lua" )
else
env.info( "Include:" .. IncludeFile .. " loaded from " .. Include.MissionPath )
return f()
end
else
env.info( "Include:" .. IncludeFile .. " loaded from " .. Include.ProgramPath )
return f()
end
end
end
Include.ProgramPath = "Scripts/Moose/Moose/"
Include.MissionPath = Include.Path()
env.info( "Include.ProgramPath = " .. Include.ProgramPath)
env.info( "Include.MissionPath = " .. Include.MissionPath)
Include.Files = {}
Include.File( "Database" )
env.info("Loaded MOOSE Include Engine")

View File

@ -0,0 +1,23 @@
local base = _G
env.info("Loading MOOSE " .. base.timer.getAbsTime() )
Include = {}
Include.Path = function()
local str = debug.getinfo(2, "S").source
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
end
Include.File = function( IncludeFile )
end
Include.ProgramPath = "Scripts/Moose/Moose/"
Include.MissionPath = Include.Path()
env.info( "Include.ProgramPath = " .. Include.ProgramPath)
env.info( "Include.MissionPath = " .. Include.MissionPath)
Include.Files = {}
env.info("Loaded MOOSE Include Engine")

View File

@ -0,0 +1,33 @@
dictionary =
{
["DictKey_GroupName_19"] = "Escort Plane",
["DictKey_WptName_11"] = "",
["DictKey_UnitName_20"] = "Escort Plane",
["DictKey_GroupName_12"] = "Escort Helicopter",
["DictKey_WptName_30"] = "",
["DictKey_sortie_4"] = "",
["DictKey_WptName_28"] = "",
["DictKey_WptName_14"] = "",
["DictKey_WptName_29"] = "",
["DictKey_WptName_23"] = "",
["DictKey_GroupName_15"] = "Lead Plane",
["DictKey_descriptionRedTask_2"] = "",
["DictKey_GroupName_9"] = "Lead Helicopter",
["DictKey_GroupName_31"] = "Test Attack",
["DictKey_descriptionText_1"] = "",
["DictKey_UnitName_13"] = "Escort Helicopter",
["DictKey_UnitName_32"] = "Unit #1",
["DictKey_WptName_21"] = "",
["DictKey_descriptionBlueTask_3"] = "",
["DictKey_WptName_22"] = "",
["DictKey_WptName_18"] = "",
["DictKey_UnitName_10"] = "Lead Helicopter",
["DictKey_WptName_17"] = "",
["DictKey_WptName_33"] = "",
["DictKey_WptName_26"] = "",
["DictKey_WptName_25"] = "",
["DictKey_UnitName_16"] = "Lead Plane",
["DictKey_WptName_24"] = "",
["DictKey_WptName_34"] = "",
["DictKey_WptName_27"] = "",
} -- end of dictionary

View File

@ -0,0 +1,6 @@
mapResource =
{
["ResKey_Action_5"] = "Moose_Load_Dynamic.lua",
["ResKey_Action_6"] = "Moose_Load_Embedded.lua",
["ResKey_Action_8"] = "MOOSE_Escort_Test_Follow.lua",
} -- end of mapResource

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,203 @@
options =
{
["difficulty"] =
{
["fuel"] = false,
["labels"] = true,
["easyRadar"] = false,
["easyCommunication"] = true,
["miniHUD"] = false,
["setGlobal"] = true,
["birds"] = 0,
["optionsView"] = "optview_all",
["permitCrash"] = true,
["immortal"] = true,
["avionicsLanguage"] = "native",
["cockpitVisualRM"] = true,
["padlock"] = true,
["reports"] = true,
["hideStick"] = false,
["radio"] = true,
["map"] = true,
["externalViews"] = true,
["spectatorExternalViews"] = true,
["cockpitLanguage"] = "english",
["tips"] = true,
["userSnapView"] = true,
["units"] = "metric",
["impostors"] = "medium",
["iconsTheme"] = "nato",
["easyFlight"] = false,
["weapons"] = true,
["cockpitStatusBarAllowed"] = false,
["geffect"] = "realistic",
}, -- end of ["difficulty"]
["playerName"] = "Killer",
["graphics"] =
{
["OculusRift"] = false,
["color"] = "32",
["preloadRadius"] = 150000,
["heatBlr"] = 1,
["scenes"] = "high",
["water"] = 2,
["visibRange"] = "Medium",
["treesVisibility"] = 10505,
["aspect"] = 1.7777777777778,
["lights"] = 2,
["HDR"] = 1,
["MSAA"] = 3,
["civTraffic"] = "medium",
["clutterMaxDistance"] = 920,
["terrainTextures"] = "max",
["multiMonitorSetup"] = "1camera",
["shadowTree"] = true,
["fullScreen"] = false,
["disableAero"] = false,
["DOF"] = 0,
["clouds"] = 1,
["flatTerrainShadows"] = 0,
["cockpitShadows"] = true,
["height"] = 1080,
["width"] = 1920,
["shadows"] = 3,
["textures"] = 2,
["sync"] = true,
["LensEffects"] = 3,
["anisotropy"] = 4,
["TranspSSAA"] = false,
["haze"] = 1,
["effects"] = 3,
}, -- end of ["graphics"]
["plugins"] =
{
["CA"] =
{
["kompass_options"] = 1,
["ground_target_info"] = true,
["ground_aim_helper"] = true,
["ground_platform_shake"] = true,
["ground_automatic"] = true,
}, -- end of ["CA"]
["MiG-15bis"] =
{
["autoLeanToAimMiG15"] = true,
["CPLocalList"] = "chinese",
["gunCamera"] = 0,
["aiHelper"] = false,
}, -- end of ["MiG-15bis"]
["A-10C"] =
{
["CPLocalList"] = "default",
}, -- end of ["A-10C"]
["Ka-50"] =
{
["altTrimmingMethod"] = false,
["Ka50RudderTrimmer"] = false,
["CPLocalList"] = "english",
}, -- end of ["Ka-50"]
["P-51D"] =
{
["assistance"] = 100,
["CPLocalList"] = "default",
["autoRudder"] = false,
}, -- end of ["P-51D"]
["MiG-21Bis"] =
{
["Engine"] = false,
["CustomCockpit"] = false,
["Shake"] = 100,
["Reticle"] = false,
["Freeze"] = false,
}, -- end of ["MiG-21Bis"]
["F-86F"] =
{
["landSeatAdjustF86"] = true,
["CPLocalList"] = "default",
["NoseWheelSteeringSimpleBehaviourF86"] = true,
["gunCamera"] = 0,
}, -- end of ["F-86F"]
["FC3"] =
{
["CPLocalList_F-15C"] = "default",
["CPLocalList_MiG-29S"] = "default",
["CPLocalList_MiG-29A"] = "default",
["CPLocalList_Su-25"] = "default",
["CPLocalList_A-10A"] = "default",
["CPLocalList_Su-27"] = "chinese",
["CPLocalList_MiG-29G"] = "default",
["CPLocalList_Su-33"] = "default",
}, -- end of ["FC3"]
["Mi-8MTV2"] =
{
["altMi8TrimmingMethod"] = false,
["Mi8AutopilotAdjustment"] = false,
["Mi8RudderTrimmer"] = false,
["controlHelperMi8"] = false,
["CPLocalList"] = "default",
["weapTooltipsMi8"] = true,
["Mi8FOV"] = 120,
}, -- end of ["Mi-8MTV2"]
["TF-51D"] =
{
["assistance"] = 100,
["CPLocalList"] = "default",
["autoRudder"] = false,
}, -- end of ["TF-51D"]
["FW-190D9"] =
{
["assistance"] = 100,
["CPLocalList"] = "default",
["autoRudder"] = false,
}, -- end of ["FW-190D9"]
["UH-1H"] =
{
["UHRudderTrimmer"] = false,
["autoPilot"] = true,
["altUHTrimmingMethod"] = false,
["CPLocalList"] = "default",
["weapTooltips"] = true,
["UHTrackIRAiming"] = true,
}, -- end of ["UH-1H"]
["Su-25T"] =
{
["CPLocalList"] = "default",
}, -- end of ["Su-25T"]
}, -- end of ["plugins"]
["views"] =
{
["cockpit"] =
{
["mirrors"] = false,
["reflections"] = false,
["avionics"] = 3,
["russianHud"] = false,
}, -- end of ["cockpit"]
}, -- end of ["views"]
["sound"] =
{
["hear_in_helmet"] = true,
["headphones"] = -15,
["cockpit"] = 0,
["GBreathEffect"] = true,
["gui"] = 0,
["volume"] = 0,
["radioSpeech"] = true,
["music"] = -100,
["subtitles"] = true,
["world"] = 0,
}, -- end of ["sound"]
["miscellaneous"] =
{
["headmove"] = true,
["f5_nearest_ac"] = true,
["f11_free_camera"] = true,
["F2_view_effects"] = 2,
["f10_awacs"] = true,
["Coordinate_Display"] = "Lat Long",
["accidental_failures"] = false,
["force_feedback_enabled"] = true,
["synchronize_controls"] = false,
["show_pilot_body"] = true,
}, -- end of ["miscellaneous"]
} -- end of options

View File

@ -0,0 +1,807 @@
warehouses =
{
["airports"] =
{
[12] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [12]
[13] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [13]
[14] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [14]
[15] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [15]
[16] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [16]
[17] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [17]
[18] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [18]
[19] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [19]
[20] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [20]
[21] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [21]
[22] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [22]
[23] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "BLUE",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [23]
[24] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [24]
[25] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [25]
[26] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [26]
[27] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [27]
[28] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [28]
[29] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [29]
[30] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [30]
[31] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [31]
[32] =
{
["gasoline"] =
{
["InitFuel"] = 100,
}, -- end of ["gasoline"]
["unlimitedMunitions"] = true,
["methanol_mixture"] =
{
["InitFuel"] = 100,
}, -- end of ["methanol_mixture"]
["OperatingLevel_Air"] = 10,
["diesel"] =
{
["InitFuel"] = 100,
}, -- end of ["diesel"]
["speed"] = 16.666666,
["size"] = 100,
["periodicity"] = 30,
["suppliers"] =
{
}, -- end of ["suppliers"]
["coalition"] = "NEUTRAL",
["jet_fuel"] =
{
["InitFuel"] = 100,
}, -- end of ["jet_fuel"]
["OperatingLevel_Eqp"] = 10,
["unlimitedFuel"] = true,
["aircrafts"] =
{
}, -- end of ["aircrafts"]
["weapons"] =
{
}, -- end of ["weapons"]
["OperatingLevel_Fuel"] = 10,
["unlimitedAircrafts"] = true,
}, -- end of [32]
}, -- end of ["airports"]
["warehouses"] =
{
}, -- end of ["warehouses"]
} -- end of warehouses