mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Static and Delay
This commit is contained in:
@@ -830,6 +830,101 @@ 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.
|
||||
-- @param #CONTROLLABLE self
|
||||
@@ -890,17 +985,16 @@ end
|
||||
|
||||
--- (AIR) Attack the Unit.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param Wrapper.Unit#UNIT AttackUnit The UNIT.
|
||||
-- @param #boolean GroupAttack (optional) If true, all units in the group will attack the Unit when found.
|
||||
-- @param DCS#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
||||
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
|
||||
-- @param DCS#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
|
||||
-- @param #number Altitude (optional) The altitude from where to attack.
|
||||
-- @param #boolean Visible (optional) not a clue.
|
||||
-- @param #number WeaponType (optional) The WeaponType.
|
||||
-- @param Wrapper.Unit#UNIT AttackUnit The UNIT to be attacked
|
||||
-- @param #boolean GroupAttack (Optional) If true, all units in the group will attack the Unit when found. Default false.
|
||||
-- @param DCS#AI.Task.WeaponExpend WeaponExpend (Optional) Determines how many weapons will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
||||
-- @param #number AttackQty (Optional) Limits maximal quantity of attack. The aicraft/controllable will not make more attacks than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
|
||||
-- @param DCS#Azimuth Direction (Optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction.
|
||||
-- @param #number Altitude (Optional) The (minimum) altitude in meters from where to attack. Default 2000 m.
|
||||
-- @param #number WeaponType (optional) The WeaponType. See [DCS Enumerator Weapon Type](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag) on Hoggit.
|
||||
-- @return DCS#Task The DCS task structure.
|
||||
function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, WeaponType )
|
||||
self:F2( { self.ControllableName, AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, WeaponType } )
|
||||
function CONTROLLABLE:TaskAttackUnit(AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType)
|
||||
self:F2({self.ControllableName, AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, WeaponType})
|
||||
|
||||
local DCSTask
|
||||
DCSTask = {
|
||||
@@ -908,12 +1002,11 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, Att
|
||||
params = {
|
||||
unitId = AttackUnit:GetID(),
|
||||
groupAttack = GroupAttack or false,
|
||||
visible = Visible or false,
|
||||
expend = WeaponExpend or "Auto",
|
||||
directionEnabled = Direction and true or false,
|
||||
direction = Direction,
|
||||
direction = math.rad(Direction or 0),
|
||||
altitudeEnabled = Altitude and true or false,
|
||||
altitude = Altitude or 30,
|
||||
altitude = Altitude or 2000,
|
||||
attackQtyLimit = AttackQty and true or false,
|
||||
attackQty = AttackQty,
|
||||
weaponType = WeaponType
|
||||
@@ -1798,6 +1891,7 @@ end
|
||||
|
||||
|
||||
|
||||
--[[
|
||||
|
||||
--- (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable.
|
||||
-- @param #CONTROLLABLE self
|
||||
@@ -1846,6 +1940,8 @@ 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}.
|
||||
-- @param #CONTROLLABLE self
|
||||
|
||||
Reference in New Issue
Block a user