mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-11 11:48:38 +00:00
Merge branch 'FF/Develop' into FF/Fox2
This commit is contained in:
@@ -127,7 +127,7 @@ AI_A2A_PATROL = {
|
||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
||||
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
||||
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to BARO
|
||||
-- @return #AI_A2A_PATROL self
|
||||
-- @usage
|
||||
-- -- Define a new AI_A2A_PATROL Object. This PatrolArea will patrol a Group within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h.
|
||||
@@ -151,8 +151,8 @@ function AI_A2A_PATROL:New( AIPatrol, PatrolZone, PatrolFloorAltitude, PatrolCei
|
||||
self.PatrolMinSpeed = PatrolMinSpeed
|
||||
self.PatrolMaxSpeed = PatrolMaxSpeed
|
||||
|
||||
-- defafult PatrolAltType to "RADIO" if not specified
|
||||
self.PatrolAltType = PatrolAltType or "RADIO"
|
||||
-- defafult PatrolAltType to "BARO" if not specified
|
||||
self.PatrolAltType = PatrolAltType or "BARO"
|
||||
|
||||
self:AddTransition( { "Started", "Airborne", "Refuelling" }, "Patrol", "Patrolling" )
|
||||
|
||||
|
||||
@@ -178,8 +178,8 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
|
||||
self.PatrolMinSpeed = PatrolMinSpeed
|
||||
self.PatrolMaxSpeed = PatrolMaxSpeed
|
||||
|
||||
-- defafult PatrolAltType to "RADIO" if not specified
|
||||
self.PatrolAltType = PatrolAltType or "RADIO"
|
||||
-- defafult PatrolAltType to "BARO" if not specified
|
||||
self.PatrolAltType = PatrolAltType or "BARO"
|
||||
|
||||
self:SetRefreshTimeInterval( 30 )
|
||||
|
||||
|
||||
@@ -455,7 +455,8 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
|
||||
end
|
||||
|
||||
|
||||
--- Limits the Maximum amount of Units that can be alive at the same time, and the maximum amount of groups that can be spawned.
|
||||
--- Stops any more repeat spawns from happening once the UNIT count of Alive units, spawned by the same SPAWN object, exceeds the first parameter. Also can stop spawns from happening once a total GROUP still alive is met.
|
||||
-- Exceptionally powerful when combined with SpawnSchedule for Respawning.
|
||||
-- Note that this method is exceptionally important to balance the performance of the mission. Depending on the machine etc, a mission can only process a maximum amount of units.
|
||||
-- If the time interval must be short, but there should not be more Units or Groups alive than a maximum amount of units, then this method should be used...
|
||||
-- When a @{#SPAWN.New} is executed and the limit of the amount of units alive is reached, then no new spawn will happen of the group, until some of these units of the spawn object will be destroyed.
|
||||
@@ -815,9 +816,9 @@ end
|
||||
-- Spawn_US_Platoon = { 'US Tank Platoon 1', 'US Tank Platoon 2', 'US Tank Platoon 3', 'US Tank Platoon 4', 'US Tank Platoon 5',
|
||||
-- 'US Tank Platoon 6', 'US Tank Platoon 7', 'US Tank Platoon 8', 'US Tank Platoon 9', 'US Tank Platoon 10',
|
||||
-- 'US Tank Platoon 11', 'US Tank Platoon 12', 'US Tank Platoon 13' }
|
||||
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
function SPAWN:InitRandomizeTemplate( SpawnTemplatePrefixTable )
|
||||
self:F( { self.SpawnTemplatePrefix, SpawnTemplatePrefixTable } )
|
||||
|
||||
@@ -851,9 +852,9 @@ end
|
||||
-- Spawn_US_PlatoonSet = SET_GROUP:New():FilterPrefixes( "US Tank Platoon Templates" ):FilterOnce()
|
||||
--
|
||||
-- --- Now use the Spawn_US_PlatoonSet to define the templates using InitRandomizeTemplateSet.
|
||||
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
function SPAWN:InitRandomizeTemplateSet( SpawnTemplateSet ) -- R2.3
|
||||
self:F( { self.SpawnTemplatePrefix } )
|
||||
|
||||
@@ -884,9 +885,9 @@ end
|
||||
-- -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
|
||||
-- -- with a limit set of maximum 12 Units alive simulteneously and 150 Groups to be spawned during the whole mission.
|
||||
--
|
||||
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):Schedule( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
|
||||
function SPAWN:InitRandomizeTemplatePrefixes( SpawnTemplatePrefixes ) --R2.3
|
||||
self:F( { self.SpawnTemplatePrefix } )
|
||||
|
||||
@@ -978,11 +979,9 @@ end
|
||||
-- -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
|
||||
-- SpawnRU_SU34 = SPAWN
|
||||
-- :New( 'Su-34' )
|
||||
-- :Schedule( 2, 3, 1800, 0.4 )
|
||||
-- :SpawnUncontrolled()
|
||||
-- :InitRandomizeRoute( 1, 1, 3000 )
|
||||
-- :InitRepeatOnLanding()
|
||||
--
|
||||
-- :Spawn()
|
||||
function SPAWN:InitRepeatOnLanding()
|
||||
self:F( { self.SpawnTemplatePrefix } )
|
||||
|
||||
@@ -1002,11 +1001,10 @@ end
|
||||
-- -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
|
||||
-- SpawnRU_SU34 = SPAWN
|
||||
-- :New( 'Su-34' )
|
||||
-- :Schedule( 2, 3, 1800, 0.4 )
|
||||
-- :SpawnUncontrolled()
|
||||
-- :InitRandomizeRoute( 1, 1, 3000 )
|
||||
-- :InitRepeatOnEngineShutDown()
|
||||
--
|
||||
-- :Spawn()
|
||||
function SPAWN:InitRepeatOnEngineShutDown()
|
||||
self:F( { self.SpawnTemplatePrefix } )
|
||||
|
||||
@@ -1018,7 +1016,8 @@ function SPAWN:InitRepeatOnEngineShutDown()
|
||||
end
|
||||
|
||||
|
||||
--- CleanUp groups when they are still alive, but inactive.
|
||||
--- Delete groups that have not moved for X seconds - AIR ONLY!!!
|
||||
-- DO NOT USE ON GROUPS THAT DO NOT MOVE OR YOUR SERVER WILL BURN IN HELL (Pikes - April 2020)
|
||||
-- When groups are still alive and have become inactive due to damage and are unable to contribute anything, then this group will be removed at defined intervals in seconds.
|
||||
-- @param #SPAWN self
|
||||
-- @param #string SpawnCleanUpInterval The interval to check for inactive groups within seconds.
|
||||
@@ -1198,7 +1197,7 @@ function SPAWN:ReSpawn( SpawnIndex )
|
||||
SpawnIndex = 1
|
||||
end
|
||||
|
||||
-- TODO: This logic makes DCS crash and i don't know why (yet).
|
||||
-- TODO: This logic makes DCS crash and i don't know why (yet). -- ED (Pikes -- not in the least bit scary to see this, right?)
|
||||
local SpawnGroup = self:GetGroupFromIndex( SpawnIndex )
|
||||
local WayPoints = SpawnGroup and SpawnGroup.WayPoints or nil
|
||||
if SpawnGroup then
|
||||
@@ -1463,7 +1462,7 @@ end
|
||||
-- -- Low limit: 600 * ( 1 - 0.5 / 2 ) = 450
|
||||
-- -- High limit: 600 * ( 1 + 0.5 / 2 ) = 750
|
||||
-- -- 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' ):SpawnScheduled( 600, 0.5 )
|
||||
function SPAWN:SpawnScheduled( SpawnTime, SpawnTimeVariation )
|
||||
self:F( { SpawnTime, SpawnTimeVariation } )
|
||||
|
||||
@@ -2327,7 +2326,7 @@ function SPAWN:ParkAircraft( SpawnAirbase, TerminalType, Parkingdata, SpawnIndex
|
||||
end
|
||||
end
|
||||
|
||||
-- Set gereral spawnpoint position.
|
||||
-- Set general spawnpoint position.
|
||||
SpawnPoint.x = PointVec3.x
|
||||
SpawnPoint.y = PointVec3.z
|
||||
SpawnPoint.alt = PointVec3.y
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1056,14 +1056,14 @@ function CONTROLLABLE:TaskFollowBigFormation(FollowControllable, Vec3, LastWaypo
|
||||
end
|
||||
|
||||
|
||||
--- (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable.
|
||||
--- (AIR HELICOPTER) Move the controllable to a Vec2 Point, wait for a defined duration and embark infantry groups.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param DCS#Vec2 Vec2 The point where to wait. Needs to have x and y components.
|
||||
-- @param Core.Point#COORDINATE Coordinate The point where to pickup the troops.
|
||||
-- @param Core.Set#SET_GROUP GroupSetForEmbarking Set of groups to embark.
|
||||
-- @param #number Duration (Optional) The maximum duration in seconds to wait until all groups have embarked.
|
||||
-- @param Core.Set#SET_GROUP DistributionGroupSet (Optional) Set of groups identifying the groups needing to board specific helicopters.
|
||||
-- @param #table Distribution (Optional) Distribution used to put the infantry groups into specific carrier units.
|
||||
-- @return DCS#Task The DCS task structure.
|
||||
function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, DistributionGroupSet)
|
||||
function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distribution)
|
||||
|
||||
-- Table of group IDs for embarking.
|
||||
local g4e={}
|
||||
@@ -1079,25 +1079,25 @@ function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distri
|
||||
end
|
||||
|
||||
-- Table of group IDs for embarking.
|
||||
local Distribution={}
|
||||
--local Distribution={}
|
||||
|
||||
if DistributionGroupSet then
|
||||
for _,_group in pairs(DistributionGroupSet:GetSet()) do
|
||||
local group=_group --Wrapper.Group#GROUP
|
||||
table.insert(Distribution, group:GetID())
|
||||
end
|
||||
end
|
||||
-- Distribution
|
||||
--local distribution={}
|
||||
--distribution[id]=gids
|
||||
|
||||
local groupID=self and self:GetID()
|
||||
|
||||
local DCSTask = {
|
||||
id = 'Embarking',
|
||||
params = {
|
||||
selectedTransport = groupID,
|
||||
Vec2 = Vec2,
|
||||
x = Vec2.x,
|
||||
y = Vec2.y,
|
||||
groupsForEmbarking = g4e,
|
||||
durationFlag = Duration and true or false,
|
||||
duration = Duration,
|
||||
distributionFlag = DistributionGroupSet and true or false,
|
||||
distributionFlag = Distribution and true or false,
|
||||
distribution = Distribution,
|
||||
}
|
||||
}
|
||||
@@ -1106,6 +1106,62 @@ function CONTROLLABLE:TaskEmbarking(Vec2, GroupSetForEmbarking, Duration, Distri
|
||||
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. Default 200 m.
|
||||
-- @param #string UnitType The unit type name of the carrier, e.g. "UH-1H". Must not be specified.
|
||||
-- @return DCS#Task Embark to transport task.
|
||||
function CONTROLLABLE:TaskEmbarkToTransport(Coordinate, Radius, UnitType)
|
||||
|
||||
local EmbarkToTransport = {
|
||||
id = "EmbarkToTransport",
|
||||
params={
|
||||
x = Coordinate.x,
|
||||
y = Coordinate.z,
|
||||
zoneRadius = Radius or 200,
|
||||
selectedType = UnitType,
|
||||
}
|
||||
}
|
||||
|
||||
return EmbarkToTransport
|
||||
end
|
||||
|
||||
|
||||
--- Specifies the location infantry groups that is being transported by helicopters will be unloaded at. Used in conjunction with the EmbarkToTransport task.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param Core.Point#COORDINATE Coordinate Coordinates where AI is expecting to be picked up.
|
||||
-- @return DCS#Task Embark to transport task.
|
||||
function CONTROLLABLE:TaskDisembarking(Coordinate, GroupSetToDisembark)
|
||||
|
||||
-- Table of group IDs for disembarking.
|
||||
local g4e={}
|
||||
|
||||
if GroupSetToDisembark then
|
||||
for _,_group in pairs(GroupSetToDisembark:GetSet()) do
|
||||
local group=_group --Wrapper.Group#GROUP
|
||||
table.insert(g4e, group:GetID())
|
||||
end
|
||||
else
|
||||
self:E("ERROR: No groups for disembarking specified!")
|
||||
return nil
|
||||
end
|
||||
|
||||
local DisembarkFromTransport={
|
||||
id="DisembarkFromTransport",
|
||||
params = {
|
||||
x = Coordinate.x,
|
||||
y = Coordinate.z,
|
||||
groupsForEmbarking = g4e, -- This is no bug, the entry is really "groupsForEmbarking" even if we disembark the troops.
|
||||
}
|
||||
}
|
||||
|
||||
return DisembarkFromTransport
|
||||
end
|
||||
|
||||
|
||||
--- (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param DCS#Vec2 Point The point to hold the position.
|
||||
@@ -1687,125 +1743,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
|
||||
|
||||
@@ -76,7 +76,7 @@ end
|
||||
-- @param #string StaticName Name of the DCS **Static** as defined within the Mission Editor.
|
||||
-- @param #boolean RaiseError Raise an error if not found.
|
||||
-- @return #STATIC self or *nil*
|
||||
function STATIC:FindByName( StaticName )
|
||||
function STATIC:FindByName( StaticName, RaiseError )
|
||||
|
||||
-- Find static in DB.
|
||||
local StaticFound = _DATABASE:FindStatic( StaticName )
|
||||
@@ -87,6 +87,10 @@ function STATIC:FindByName( StaticName )
|
||||
if StaticFound then
|
||||
return StaticFound
|
||||
end
|
||||
|
||||
if RaiseError == nil or RaiseError == true then
|
||||
error( "STATIC not found for: " .. StaticName )
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user