diff --git a/Moose Development/Moose/DCS.lua b/Moose Development/Moose/DCS.lua index 267b2f4e2..26a0a99e7 100644 --- a/Moose Development/Moose/DCS.lua +++ b/Moose Development/Moose/DCS.lua @@ -135,6 +135,22 @@ do -- env end -- env +do -- radio + + ---@type radio + -- @field #radio.modulation modulation + + --- + -- @type radio.modulation + -- @field AM + -- @field FM + + radio = {} + radio.modulation = {} + radio.modulation.AM = 0 + radio.modulation.FM = 1 + +end do -- timer @@ -329,11 +345,11 @@ end -- country do -- Command - --- @type Command + -- @type Command -- @field #string id -- @field #Command.params params - --- @type Command.params + -- @type Command.params end -- Command @@ -374,7 +390,7 @@ end -- coalition do -- Types - --- @type Desc + -- @type Desc -- @field #number speedMax0 Max speed in meters/second at zero altitude. -- @field #number massEmpty Empty mass in kg. -- @field #number tankerType Type of refueling system: 0=boom, 1=probe. @@ -471,16 +487,16 @@ do -- Types -- @type AttributeNameArray -- @list <#AttributeName> - --- @type Zone + -- @type Zone -- @field DCSVec3#Vec3 point -- @field #number radius Zone = {} - --- @type ModelTime + -- @type ModelTime -- @extends #number - --- @type Time + -- @type Time -- @extends #number --- A task descriptor (internal structure for DCS World). See [https://wiki.hoggitworld.com/view/Category:Tasks](https://wiki.hoggitworld.com/view/Category:Tasks). @@ -489,7 +505,7 @@ do -- Types -- @field #string id -- @field #Task.param param - --- @type Task.param + -- @type Task.param --- List of @{#Task} -- @type TaskArray @@ -536,7 +552,7 @@ do -- Object -- @field SCENERY -- @field CARGO - --- @type Object.Desc + -- @type Object.Desc -- @extends #Desc -- @field #number life initial life level -- @field #Box3 box bounding box of collision geometry @@ -1085,7 +1101,7 @@ end -- Controller do -- Unit - --- @type Unit + -- @type Unit -- @extends #CoalitionObject -- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically. -- @field #Unit.Category Category @@ -1200,15 +1216,18 @@ do -- Unit -- @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 + --- A radar. + -- @type Unit.Radar.detectionDistanceAir -- @field #Unit.Radar.detectionDistanceAir.upperHemisphere upperHemisphere -- @field #Unit.Radar.detectionDistanceAir.lowerHemisphere lowerHemisphere - --- @type Unit.Radar.detectionDistanceAir.upperHemisphere + --- A radar. + -- @type Unit.Radar.detectionDistanceAir.upperHemisphere -- @field #Distance headOn -- @field #Distance tailOn - --- @type Unit.Radar.detectionDistanceAir.lowerHemisphere + --- A radar. + -- @type Unit.Radar.detectionDistanceAir.lowerHemisphere -- @field #Distance headOn -- @field #Distance tailOn @@ -1510,22 +1529,26 @@ do -- AI -- @field IR_POINTER -- @field LASER - --- @type AI.Task.WaypointType + --- + -- @type AI.Task.WaypointType -- @field TAKEOFF -- @field TAKEOFF_PARKING -- @field TURNING_POINT -- @field TAKEOFF_PARKING_HOT -- @field LAND - --- @type AI.Task.TurnMethod + --- + -- @type AI.Task.TurnMethod -- @field FLY_OVER_POINT -- @field FIN_POINT - --- @type AI.Task.AltitudeType + --- + -- @type AI.Task.AltitudeType -- @field BARO -- @field RADIO - --- @type AI.Task.VehicleFormation + --- + -- @type AI.Task.VehicleFormation -- @field OFF_ROAD -- @field ON_ROAD -- @field RANK @@ -1535,27 +1558,30 @@ do -- AI -- @field ECHELON_LEFT -- @field ECHELON_RIGHT - --- @type AI.Option + --- + -- @type AI.Option -- @field #AI.Option.Air Air -- @field #AI.Option.Ground Ground -- @field #AI.Option.Naval Naval - --- @type AI.Option.Air + --- + -- @type AI.Option.Air -- @field #AI.Option.Air.id id -- @field #AI.Option.Air.val val - --- @type AI.Option.Ground + --- + -- @type AI.Option.Ground -- @field #AI.Option.Ground.id id -- @field #AI.Option.Ground.val val -- @field #AI.Option.Ground.mid mid -- @field #AI.Option.Ground.mval mval -- - --- @type AI.Option.Naval + -- @type AI.Option.Naval -- @field #AI.Option.Naval.id id -- @field #AI.Option.Naval.val val - - --- @type AI.Option.Air.id + --- + -- @type AI.Option.Air.id -- @field NO_OPTION -- @field ROE -- @field REACTION_ON_THREAT @@ -1577,73 +1603,61 @@ do -- AI -- @field OPTION_RADIO_USAGE_KILL -- @field JETT_TANKS_IF_EMPTY -- @field FORCED_ATTACK - - --- @type AI.Option.Air.id.FORMATION - -- @field LINE_ABREAST - -- @field TRAIL - -- @field WEDGE - -- @field ECHELON_RIGHT - -- @field ECHELON_LEFT - -- @field FINGER_FOUR - -- @field SPREAD_FOUR - -- @field WW2_BOMBER_ELEMENT - -- @field WW2_BOMBER_ELEMENT_HEIGHT - -- @field WW2_FIGHTER_VIC - -- @field HEL_WEDGE - -- @field HEL_ECHELON - -- @field HEL_FRONT - -- @field HEL_COLUMN - -- @field COMBAT_BOX - -- @field JAVELIN_DOWN - - --- @type AI.Option.Air.val + --- + -- @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 + --- + -- @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 + + --- + -- @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 + --- + -- @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 + --- + -- @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.Air.val.ECM_USING + + --- + -- @type AI.Option.Air.val.ECM_USING -- @field NEVER_USE -- @field USE_IF_ONLY_LOCK_BY_RADAR -- @field USE_IF_DETECTED_LOCK_BY_RADAR -- @field ALWAYS_USE - - --- @type AI.Option.Air.val.MISSILE_ATTACK + + --- + -- @type AI.Option.Air.val.MISSILE_ATTACK -- @field MAX_RANGE -- @field NEZ_RANGE -- @field HALF_WAY_RMAX_NEZ -- @field TARGET_THREAT_EST -- @field RANDOM_RANGE - - --- @type AI.Option.Ground.id + --- + -- @type AI.Option.Ground.id -- @field NO_OPTION -- @field ROE @{#AI.Option.Ground.val.ROE} -- @field FORMATION @@ -1652,42 +1666,51 @@ do -- AI -- @field ENGAGE_AIR_WEAPONS -- @field AC_ENGAGEMENT_RANGE_RESTRICTION - --- @type AI.Option.Ground.mid -- Moose added + --- + -- @type AI.Option.Ground.mid -- Moose added -- @field RESTRICT_AAA_MIN 27 -- @field RESTRICT_AAA_MAX 29 -- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28 - --- @type AI.Option.Ground.val + --- + -- @type AI.Option.Ground.val -- @field #AI.Option.Ground.val.ROE ROE -- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE -- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS - --- @type AI.Option.Ground.val.ROE + --- + -- @type AI.Option.Ground.val.ROE -- @field OPEN_FIRE -- @field RETURN_FIRE -- @field WEAPON_HOLD - --- @type AI.Option.Ground.mval -- Moose added + --- + -- @type AI.Option.Ground.mval -- Moose added -- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS - --- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added + --- + -- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added -- @field ANY_TARGET -- 0 -- @field AIR_UNITS_ONLY -- 1 -- @field GROUND_UNITS_ONLY -- 2 - --- @type AI.Option.Ground.val.ALARM_STATE + --- + -- @type AI.Option.Ground.val.ALARM_STATE -- @field AUTO -- @field GREEN -- @field RED - --- @type AI.Option.Naval.id + --- + -- @type AI.Option.Naval.id -- @field NO_OPTION -- @field ROE - --- @type AI.Option.Naval.val + --- + -- @type AI.Option.Naval.val -- @field #AI.Option.Naval.val.ROE ROE - --- @type AI.Option.Naval.val.ROE + --- + -- @type AI.Option.Naval.val.ROE -- @field OPEN_FIRE -- @field RETURN_FIRE -- @field WEAPON_HOLD diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 1c5f02e0f..97222cd6f 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -3616,9 +3616,10 @@ function WAREHOUSE:onafterStatus(From, Event, To) end -- Print queue after processing requests. - self:_PrintQueue(self.queue, "Queue waiting") - self:_PrintQueue(self.pending, "Queue pending") - + if self.verbosity > 2 then + self:_PrintQueue(self.queue, "Queue waiting") + self:_PrintQueue(self.pending, "Queue pending") + end -- Check fuel for all assets. --self:_CheckFuel() @@ -8234,7 +8235,7 @@ end -- @return #number Request ID. function WAREHOUSE:_GetIDsFromGroupName(groupname) - ---@param #string text The text to analyse. + -- @param #string text The text to analyse. local function analyse(text) -- Get rid of #0001 tail from spawn. diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 9c9a68d58..20abf3e2a 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -5329,3 +5329,51 @@ function CONTROLLABLE:TaskAerobaticsBarrelRoll(TaskAerobatics,Repeats,InitAltitu return TaskAerobatics end + +--- [Air] Make an airplane or helicopter patrol between two points in a racetrack - resulting in a much tighter track around the start and end points. +-- @param #CONTROLLABLE self +-- @param Core.Point#COORDINATE Point1 Start point. +-- @param Core.Point#COORDINATE Point2 End point. +-- @param #number Altitude (Optional) Altitude in meters. Defaults to the altitude of the coordinate. +-- @param #number Speed (Optional) Speed in kph. Defaults to 500 kph. +-- @param #number Formation (Optional) Formation to take, e.g. ENUMS.Formation.FixedWing.Trail.Close, also see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_option_formation). +-- @param #number Delay (Optional) Set the task after delay seconds only. +-- @return #CONTROLLABLE self +function CONTROLLABLE:PatrolRaceTrack(Point1, Point2, Altitude, Speed, Formation, Delay) + + local PatrolGroup = self -- Wrapper.Group#GROUP + + if not self:IsInstanceOf( "GROUP" ) then + PatrolGroup = self:GetGroup() -- Wrapper.Group#GROUP + end + + local delay = Delay or 1 + + self:F( { PatrolGroup = PatrolGroup:GetName() } ) + + if PatrolGroup:IsAir() then + if Formation then + PatrolGroup:SetOption(AI.Option.Air.id.FORMATION,Formation) -- https://wiki.hoggitworld.com/view/DCS_option_formation + end + + local FromCoord = PatrolGroup:GetCoordinate() + local ToCoord = Point1:GetCoordinate() + + -- Calculate the new Route + if Altitude then + FromCoord:SetAltitude(Altitude) + ToCoord:SetAltitude(Altitude) + end + + -- Create a "air waypoint", which is a "point" structure that can be given as a parameter to a Task + local Route = {} + Route[#Route + 1] = FromCoord:WaypointAir( AltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true, nil, DCSTasks, description, timeReFuAr ) + Route[#Route + 1] = ToCoord:WaypointAir( AltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true, nil, DCSTasks, description, timeReFuAr ) + + local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolRaceTrack", Point2, Point1, Altitude, Speed, Formation, Delay ) + PatrolGroup:SetTaskWaypoint( Route[#Route], TaskRouteToZone ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone. + PatrolGroup:Route( Route, Delay ) -- Move after delay seconds to the Route. See the Route method for details. + end + + return self +end