mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-21 21:17:30 +00:00
ZCC, ATIS, CONTROLLABLE
This commit is contained in:
@@ -875,8 +875,8 @@ do -- ZONE_CAPTURE_COALITION
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get red and blue unit sets.
|
-- Get red and blue unit sets.
|
||||||
local unitsetRed=self:GetScannedSetUnit():FilterCoalitions(coalition.side.RED):FilterActive(true):FilterOnce()
|
local unitsetRed=self:GetScannedSetUnit():FilterCoalitions("red"):FilterActive(true):FilterOnce()
|
||||||
local unitsetBlu=self:GetScannedSetUnit():FilterCoalitions(coalition.side.BLUE):FilterActive(true):FilterOnce()
|
local unitsetBlu=self:GetScannedSetUnit():FilterCoalitions("blue"):FilterActive(true):FilterOnce()
|
||||||
|
|
||||||
-- Count number of units.
|
-- Count number of units.
|
||||||
local nRed=unitsetRed:Count()
|
local nRed=unitsetRed:Count()
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ _ATIS={}
|
|||||||
|
|
||||||
--- ATIS class version.
|
--- ATIS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ATIS.version="0.6.1"
|
ATIS.version="0.6.2"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -1000,7 +1000,9 @@ function ATIS:onafterStatus(From, Event, To)
|
|||||||
local relayunitstatus="N/A"
|
local relayunitstatus="N/A"
|
||||||
if self.relayunitname then
|
if self.relayunitname then
|
||||||
local ru=UNIT:FindByName(self.relayunitname)
|
local ru=UNIT:FindByName(self.relayunitname)
|
||||||
relayunitstatus=tostring(ru:IsAlive())
|
if ru then
|
||||||
|
relayunitstatus=tostring(ru:IsAlive())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Info text.
|
-- Info text.
|
||||||
|
|||||||
@@ -2136,8 +2136,10 @@ do -- Patrol methods
|
|||||||
-- @param #table ZoneList Table of zones.
|
-- @param #table ZoneList Table of zones.
|
||||||
-- @param #number Speed Speed in km/h the group moves at.
|
-- @param #number Speed Speed in km/h the group moves at.
|
||||||
-- @param #string Formation (Optional) Formation the group should use.
|
-- @param #string Formation (Optional) Formation the group should use.
|
||||||
|
-- @param #number DelayMin Delay in seconds before the group progresses to the next route point. Default 1 sec.
|
||||||
|
-- @param #number DelayMax Max. delay in seconds. Actual delay is randomly chosen between DelayMin and DelayMax. Default equal to DelayMin.
|
||||||
-- @return #CONTROLLABLE
|
-- @return #CONTROLLABLE
|
||||||
function CONTROLLABLE:PatrolZones( ZoneList, Speed, Formation )
|
function CONTROLLABLE:PatrolZones( ZoneList, Speed, Formation, DelayMin, DelayMax )
|
||||||
|
|
||||||
if not type( ZoneList ) == "table" then
|
if not type( ZoneList ) == "table" then
|
||||||
ZoneList = { ZoneList }
|
ZoneList = { ZoneList }
|
||||||
@@ -2149,13 +2151,17 @@ do -- Patrol methods
|
|||||||
PatrolGroup = self:GetGroup() -- Wrapper.Group#GROUP
|
PatrolGroup = self:GetGroup() -- Wrapper.Group#GROUP
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DelayMin=DelayMin or 1
|
||||||
|
if not DelayMax or DelayMax<DelayMin then
|
||||||
|
DelayMax=DelayMin
|
||||||
|
end
|
||||||
|
|
||||||
|
local Delay=math.random(DelayMin, DelayMax)
|
||||||
|
|
||||||
self:F( { PatrolGroup = PatrolGroup:GetName() } )
|
self:F( { PatrolGroup = PatrolGroup:GetName() } )
|
||||||
|
|
||||||
if PatrolGroup:IsGround() or PatrolGroup:IsShip() then
|
if PatrolGroup:IsGround() or PatrolGroup:IsShip() then
|
||||||
|
|
||||||
local Waypoints = PatrolGroup:GetTemplateRoutePoints()
|
|
||||||
local Waypoint = Waypoints[math.random( 1, #Waypoints )] -- Select random waypoint.
|
|
||||||
|
|
||||||
-- Calculate the new Route.
|
-- Calculate the new Route.
|
||||||
local FromCoord = PatrolGroup:GetCoordinate()
|
local FromCoord = PatrolGroup:GetCoordinate()
|
||||||
|
|
||||||
@@ -2169,11 +2175,11 @@ do -- Patrol methods
|
|||||||
Route[#Route+1] = ToCoord:WaypointGround( Speed, Formation )
|
Route[#Route+1] = ToCoord:WaypointGround( Speed, Formation )
|
||||||
|
|
||||||
|
|
||||||
local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolZones", ZoneList, Speed, Formation )
|
local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolZones", ZoneList, Speed, Formation, DelayMin, DelayMax )
|
||||||
|
|
||||||
PatrolGroup:SetTaskWaypoint( Route[#Route], TaskRouteToZone ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone.
|
PatrolGroup:SetTaskWaypoint( Route[#Route], TaskRouteToZone ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone.
|
||||||
|
|
||||||
PatrolGroup:Route( Route, 1 ) -- Move after a random seconds to the Route. See the Route method for details.
|
PatrolGroup:Route( Route, Delay ) -- Move after a random seconds to the Route. See the Route method for details.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2374,7 +2380,7 @@ do -- Route methods
|
|||||||
|
|
||||||
local FromCoordinate = self:GetCoordinate()
|
local FromCoordinate = self:GetCoordinate()
|
||||||
|
|
||||||
local FromWP = FromCoordinate:WaypointGround()
|
local FromWP = FromCoordinate:WaypointGround(Speed, Formation)
|
||||||
local ToWP = ToCoordinate:WaypointGround( Speed, Formation )
|
local ToWP = ToCoordinate:WaypointGround( Speed, Formation )
|
||||||
|
|
||||||
self:Route( { FromWP, ToWP }, DelaySeconds )
|
self:Route( { FromWP, ToWP }, DelaySeconds )
|
||||||
|
|||||||
Reference in New Issue
Block a user