diff --git a/Moose Development/Moose/DCS.lua b/Moose Development/Moose/DCS.lua index 0c8e87a23..206165bd3 100644 --- a/Moose Development/Moose/DCS.lua +++ b/Moose Development/Moose/DCS.lua @@ -47,9 +47,13 @@ do -- world -- @field S_EVENT_PLAYER_COMMENT -- @field S_EVENT_SHOOTING_START [https://wiki.hoggitworld.com/view/DCS_event_shooting_start](https://wiki.hoggitworld.com/view/DCS_event_shooting_start) -- @field S_EVENT_SHOOTING_END [https://wiki.hoggitworld.com/view/DCS_event_shooting_end](https://wiki.hoggitworld.com/view/DCS_event_shooting_end) - -- @field S_EVENT_MARK ADDED [https://wiki.hoggitworld.com/view/DCS_event_mark_added](https://wiki.hoggitworld.com/view/DCS_event_mark_added) - -- @field S_EVENT_MARK CHANGE [https://wiki.hoggitworld.com/view/DCS_event_mark_change](https://wiki.hoggitworld.com/view/DCS_event_mark_change) - -- @field S_EVENT_MARK REMOVE [https://wiki.hoggitworld.com/view/DCS_event_mark_remove](https://wiki.hoggitworld.com/view/DCS_event_mark_remove) + -- @field S_EVENT_MARK ADDED [https://wiki.hoggitworld.com/view/DCS_event_mark_added](https://wiki.hoggitworld.com/view/DCS_event_mark_added) DCS>=2.5.1 + -- @field S_EVENT_MARK CHANGE [https://wiki.hoggitworld.com/view/DCS_event_mark_change](https://wiki.hoggitworld.com/view/DCS_event_mark_change) DCS>=2.5.1 + -- @field S_EVENT_MARK REMOVE [https://wiki.hoggitworld.com/view/DCS_event_mark_remove](https://wiki.hoggitworld.com/view/DCS_event_mark_remove) DCS>=2.5.1 + -- @field S_EVENT_KILL [https://wiki.hoggitworld.com/view/DCS_event_kill](https://wiki.hoggitworld.com/view/DCS_event_kill) DCS>=2.5.6 + -- @field S_EVENT_SCORE [https://wiki.hoggitworld.com/view/DCS_event_score](https://wiki.hoggitworld.com/view/DCS_event_score) DCS>=2.5.6 + -- @field S_EVENT_UNIT_LOST [https://wiki.hoggitworld.com/view/DCS_event_unit_lost](https://wiki.hoggitworld.com/view/DCS_event_unit_lost) DCS>=2.5.6 + -- @field S_EVENT_LANDING_AFTER_EJECTION [https://wiki.hoggitworld.com/view/DCS_event_landing_after_ejection](https://wiki.hoggitworld.com/view/DCS_event_landing_after_ejection) DCS>=2.5.6 -- @field S_EVENT_MAX --- The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events. diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 9f34f8cf6..3847cdf47 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -1091,6 +1091,7 @@ function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distri local DCSTask = { id = 'Embarking', params = { + --selectedTransport = self:GetID(), Vec2 = Vec2, x = Vec2.x, y = Vec2.y, @@ -1105,6 +1106,123 @@ function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distri return DCSTask 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={ + + distributionFlag=true, + distribution=distribution, + groupsForEmbarking=gids, + durationFlag=durationFlag, + distribution=distribution, + duration=Duration, + x=Coordinate.x, + y=Coordinate.z, + } + } + + self:E(DCStask) + + return DCStask +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 + + + +--- 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 + + +--- (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. +-- @param #CONTROLLABLE self +-- @param DCS#Vec2 Point The point where to wait. +-- @param #number Radius The radius of the embarking zone around the Point. +-- @return DCS#Task The DCS task structure. +function CONTROLLABLE:TaskEmbarkToTransport( Point, Radius ) + + local DCSTask = { + id = 'EmbarkToTransport', + params = { + point = Point, + x = Point.x, + y = Point.y, + zoneRadius = Radius, + } + } + + return DCSTask +end + --- (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed. -- @param #CONTROLLABLE self @@ -1687,125 +1805,6 @@ function CONTROLLABLE:EnRouteTaskFAC( Radius, Priority ) 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 -]] - - ---- (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. --- @param #CONTROLLABLE self --- @param DCS#Vec2 Point The point where to wait. --- @param #number Radius The radius of the embarking zone around the Point. --- @return DCS#Task The DCS task structure. -function CONTROLLABLE:TaskEmbarkToTransport( Point, Radius ) - - local DCSTask = { - id = 'EmbarkToTransport', - params = { - point = Point, - x = Point.x, - y = Point.y, - zoneRadius = 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}. -- @param #CONTROLLABLE self