diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index c54bc60cb..1aa0b1f6f 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -226,6 +226,7 @@ -- @field #boolean trapsheet If true, players can save their trap sheets. -- @field #string trappath Path where to save the trap sheets. -- @field #string trapprefix File prefix for trap sheet files. +-- @field #number initialmaxalt Max altitude in meters to register in the inital zone. -- @extends Core.Fsm#FSM --- Be the boss! @@ -267,7 +268,9 @@ -- their current stack to the next lower stack. -- -- The flight that transitions form the holding pattern to the landing approach, it should leave the Marshal stack at the 3 position and make a left hand turn to the *Initial* --- position, which is 3 NM astern of the boat. +-- position, which is 3 NM astern of the boat. Note that you need to be below 1300 feet to be registered in the initial zone. +-- The altitude can be set via the function @{AIRBOSS.SetInitialMaxAlt}(*altitude*) function. +-- As described belwo, the initial zone can be smoked or flared via the AIRBOSS F10 Help radio menu. -- -- ### Landing Pattern -- @@ -1193,7 +1196,7 @@ AIRBOSS = { marshalradius = nil, airbossnice = nil, staticweather = nil, - windowcount = 0, + windowcount = 0, LSOdT = nil, senderac = nil, radiorelayLSO = nil, @@ -1221,6 +1224,7 @@ AIRBOSS = { trapsheet = nil, trappath = nil, trapprefix = nil, + initialmaxalt = nil, } --- Aircraft types capable of landing on carrier (human+AI). @@ -1850,7 +1854,10 @@ function AIRBOSS:New(carriername, alias) self:SetHoldingOffsetAngle() -- Set Marshal stack radius. Default 2.75 NM, which gives a diameter of 5.5 NM. - self:SetMarshalRadius() + self:SetMarshalRadius() + + -- Set max alt at initial. Default 1300 ft. + self:SetInitialMaxAlt() -- Default player skill EASY. self:SetDefaultPlayerSkill(AIRBOSS.Difficulty.EASY) @@ -2531,6 +2538,15 @@ function AIRBOSS:SetRefuelAI(lowfuelthreshold) return self end +--- Set max alitude to register flights in the initial zone. Aircraft above this altitude will not be registerered. +-- @param #AIRBOSS self +-- @param #number altitude Max alitude in feet. Default 1300 ft. +-- @return #AIRBOSS self +function AIRBOSS:SetInitialMaxAlt(altitude) + self.initialmaxalt=UTILS.FeetToMeters(altitude or 1300) + return self +end + --- Set folder where the airboss sound files are located **within you mission (miz) file**. -- The default path is "l10n/DEFAULT/" but sound files simply copied there will be removed by DCS the next time you save the mission. @@ -8862,10 +8878,10 @@ function AIRBOSS:_Initial(playerData) local relheading=self:_GetRelativeHeading(playerData.unit, false) -- Alitude of player in feet. - local altitude=UTILS.MetersToFeet(playerData.unit:GetAltitude()) + local altitude=playerData.unit:GetAltitude() -- Check if player is in zone and flying roughly in the right direction. - if inzone and math.abs(relheading)<60 and altitude<=1300 then + if inzone and math.abs(relheading)<60 and altitude<=self.initialmaxalt then -- Send message for normal and easy difficulty. if playerData.showhints then diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 039afe898..7cfb56abb 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -830,100 +830,6 @@ function CONTROLLABLE:TaskEPLRS(SwitchOnOff, idx) end ---- Used in conjunction with the embarking task for a transport helicopter group. The Ground units will move to the specified location and wait to be picked up by a helicopter. --- The helicopter will then fly them to their dropoff point defined by another task for the ground forces; DisembarkFromTransport task. --- The controllable has to be an infantry group! --- @param #CONTROLLABLE self --- @param Core.Point#COORDINATE Coordinate Coordinates where AI is expecting to be picked up. --- @param #number Radius Radius in meters. --- @return #table Embark to transport task. -function CONTROLLABLE:TaskEmbarkToTransport(Coordinate, Radius) - - local EmbarkToTransport = { - id="EmbarkToTransport ", - enabled=true, - auto=false, - params={ - x=Coordinate.x, - y=Coordinate.z, - zoneRadius=Radius, - selectedType="UH-1H", - } - } - - self:E(EmbarkToTransport) - return EmbarkToTransport -end - ---- Specifies the location an infantry group that is being transported by helicopters will be unloaded at. Used in conjunction with the EmbarkToTransport task. --- The CONTROLLABLE has to be an infantry group! --- @param #CONTROLLABLE self --- @param Core.Point#COORDINATE Coordinate Coordinates where AI is expecting to be picked up. --- @param #number Radius Radius in meters. --- @return #table Embark to transport task. -function CONTROLLABLE:TaskDisembarkFromTransport(Coordinate, Radius) - - local DisembarkFromTransport={ - id="DisembarkFromTransport", - params = { - x=Coordinate.x, - y=Coordinate.y, - zoneRadius=Radius, - }} - - return DisembarkFromTransport -end - ---- Used in conjunction with the EmbarkToTransport task for a ground infantry group, the controlled helicopter flight will land at the specified coordinates, --- pick up boarding troops and transport them to that groups DisembarkFromTransport task. --- The CONTROLLABLE has to be a helicopter group! --- @param #CONTROLLABLE self --- @param Core.Set#SET_GROUP GroupSet Set of groups to be embarked by the controllable. --- @param Core.Point#COORDINATE Coordinate Coordinate of embarking. --- @param #number Duration Duration of embarking in seconds. --- @return #table Embarking task. -function CONTROLLABLE:TaskEmbarking(GroupSet, Coordinate, Duration) - - -- Create table of group IDs. - local gids={} - for _,_group in pairs(GroupSet:GetAliveSet()) do - local group=_group --Wrapper.Group#GROUP - table.insert(gids, group:GetID()) - end - - -- Group ID of controllable. - local id=self:GetID() - - -- Distribution - local distribution={} - distribution[id]=gids - - local durationFlag=false - if Duration then - durationFlag=true - else - Duration=300 - end - - local DCStask={ - id="Embarking", - params={ - selectedTransport=self:GetID(), - distributionFlag=true, - distribution=distribution, - groupsForEmbarking=gids, - durationFlag=durationFlag, - distribution=distribution, - duration=Duration, - x=Coordinate.x, - y=Coordinate.z, - } - } - - self:E(DCStask) - - return DCStask -end -- TASKS FOR AIR CONTROLLABLES --- (AIR) Attack a Controllable. @@ -1892,6 +1798,99 @@ end --[[ +--- Used in conjunction with the embarking task for a transport helicopter group. The Ground units will move to the specified location and wait to be picked up by a helicopter. +-- The helicopter will then fly them to their dropoff point defined by another task for the ground forces; DisembarkFromTransport task. +-- The controllable has to be an infantry group! +-- @param #CONTROLLABLE self +-- @param Core.Point#COORDINATE Coordinate Coordinates where AI is expecting to be picked up. +-- @param #number Radius Radius in meters. +-- @return #table Embark to transport task. +function CONTROLLABLE:TaskEmbarkToTransport(Coordinate, Radius) + + local EmbarkToTransport = { + id="EmbarkToTransport", + params={ + x=Coordinate.x, + y=Coordinate.z, + zoneRadius=Radius, + --selectedType="UH-1H", + } + } + + self:E(EmbarkToTransport) + return EmbarkToTransport +end + +--- Used in conjunction with the EmbarkToTransport task for a ground infantry group, the controlled helicopter flight will land at the specified coordinates, +-- pick up boarding troops and transport them to that groups DisembarkFromTransport task. +-- The CONTROLLABLE has to be a helicopter group! +-- @param #CONTROLLABLE self +-- @param Core.Set#SET_GROUP GroupSet Set of groups to be embarked by the controllable. +-- @param Core.Point#COORDINATE Coordinate Coordinate of embarking. +-- @param #number Duration Duration of embarking in seconds. +-- @return #table Embarking task. +function CONTROLLABLE:TaskEmbarking(GroupSet, Coordinate, Duration) + + -- Create table of group IDs. + local gids={} + for _,_group in pairs(GroupSet:GetAliveSet()) do + local group=_group --Wrapper.Group#GROUP + table.insert(gids, group:GetID()) + end + + -- Group ID of controllable. + local id=self:GetID() + + -- Distribution + local distribution={} + distribution[id]=gids + + local durationFlag=false + if Duration then + durationFlag=true + else + Duration=300 + end + + local DCStask={ + id="Embarking", + params={ + selectedTransport=self:GetID(), + distributionFlag=true, + distribution=distribution, + groupsForEmbarking=gids, + durationFlag=durationFlag, + distribution=distribution, + duration=Duration, + x=Coordinate.x, + y=Coordinate.z, + } + } + + self:E(DCStask) + + return DCStask +end + +--- Specifies the location an infantry group that is being transported by helicopters will be unloaded at. Used in conjunction with the EmbarkToTransport task. +-- The CONTROLLABLE has to be an infantry group! +-- @param #CONTROLLABLE self +-- @param Core.Point#COORDINATE Coordinate Coordinates where AI is expecting to be picked up. +-- @param #number Radius Radius in meters. +-- @return #table Embark to transport task. +function CONTROLLABLE:TaskDisembarkFromTransport(Coordinate, Radius) + + local DisembarkFromTransport={ + id="DisembarkFromTransport", + params = { + x=Coordinate.x, + y=Coordinate.y, + zoneRadius=Radius, + }} + + return DisembarkFromTransport +end +]] --- (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable. -- @param #CONTROLLABLE self @@ -1919,8 +1918,7 @@ function CONTROLLABLE:TaskEmbarking( Point, Duration, EmbarkingControllable ) end --- (GROUND) Embark to a Transport landed at a location. - ---- Move to a defined Vec2 Point, and embark to a controllable when arrived within a defined Radius. +-- Move to a defined Vec2 Point, and embark to a controllable when arrived within a defined Radius. -- @param #CONTROLLABLE self -- @param DCS#Vec2 Point The point where to wait. -- @param #number Radius The radius of the embarking zone around the Point. @@ -1940,7 +1938,6 @@ function CONTROLLABLE:TaskEmbarkToTransport( Point, Radius ) return DCSTask end -]] --- This creates a Task element, with an action to call a function as part of a Wrapped Task. -- This Task can then be embedded at a Waypoint by calling the method @{#CONTROLLABLE.SetTaskWaypoint}.