-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
330 changed files
with
7,000 additions
and
7,051 deletions.
There are no files selected for viewing
160 changes: 80 additions & 80 deletions
160
...ones/PAT-001 - Switching Patrol Zones.lua → ...ones/PAT-001 - Switching Patrol Zones.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,80 @@ | ||
-- This test mission models the behaviour of the AI_PATROL_ZONE class. | ||
-- | ||
-- It creates a 2 AI_PATROL_ZONE objects with the name Patrol1 and Patrol2. | ||
-- Patrol1 will govern a GROUP object to patrol the zone defined by PatrolZone1, within 3000 meters and 6000 meters, within a speed of 400 and 600 km/h. | ||
-- When the GROUP object that is assigned to Patrol has fuel below 20%, the GROUP object will orbit for 60 secondes, before returning to base. | ||
-- | ||
-- Patrol2 will goven a GROUP object to patrol the zone defined by PatrolZone2, within 600 meters and 1000 meters, within a speed of 300 and 400 km/h. | ||
-- When the GROUP object that is assigned to Patrol has fuel below 20%, the GROUP object will orbit for 0 secondes, before returning to base. | ||
-- | ||
-- The Patrol1 and Patrol2 object have 2 state transition functions defined, which customize the default behaviour of the RTB state. | ||
-- When Patrol1 goes RTB, it will create a new GROUP object, that will be assigned to Patrol2. | ||
-- When Patrol2 goes RTB, it will create a new GROUP object, that will be assgined to Patrol1. | ||
-- | ||
-- In this way, the Patrol1 and Patrol2 objects are fluctuating the patrol pattern from PatrolZone1 and PatrolZone2 :-) | ||
|
||
|
||
PatrolZoneGroup1 = GROUP:FindByName( "Patrol Zone 1" ) | ||
PatrolZone1 = ZONE_POLYGON:New( "Patrol Zone 1", PatrolZoneGroup1 ) | ||
|
||
PatrolZoneGroup2 = GROUP:FindByName( "Patrol Zone 2" ) | ||
PatrolZone2 = ZONE_POLYGON:New( "Patrol Zone 2", PatrolZoneGroup2 ) | ||
|
||
PatrolSpawn = SPAWN:New( "Patrol Group" ) | ||
PatrolGroup = PatrolSpawn:Spawn() | ||
|
||
Patrol1 = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) | ||
Patrol1:ManageFuel( 0.2, 60 ) | ||
Patrol1:SetControllable( PatrolGroup ) | ||
Patrol1:__Start( 5 ) | ||
|
||
Patrol2 = AI_PATROL_ZONE:New( PatrolZone2, 600, 1000, 300, 400 ) | ||
Patrol2:ManageFuel( 0.2, 0 ) | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object | ||
-- @param #AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
-- @return #boolean If false is returned, then the OnAfter state transition function will not be called. | ||
function Patrol1:OnLeaveRTB( AIGroup ) | ||
AIGroup:MessageToRed( "Returning to base", 20 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol1:OnAfterRTB( AIGroup ) | ||
local NewGroup = PatrolSpawn:Spawn() | ||
Patrol2:SetControllable( NewGroup ) | ||
Patrol2:__Start( 1 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol1:OnEnterPatrol( AIGroup ) | ||
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone1:GetName() , 20 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object | ||
-- @param #AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
-- @return #boolean If false is returned, then the OnEnter state transition function will not be called. | ||
function Patrol2:OnBeforeRTB( AIGroup ) | ||
AIGroup:MessageToRed( "Returning to base", 20 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol2:OnEnterRTB( AIGroup ) | ||
local NewGroup = PatrolSpawn:Spawn() | ||
Patrol1:SetControllable( NewGroup ) | ||
Patrol1:__Start( 1 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol2:OnEnterPatrol( AIGroup ) | ||
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone2:GetName() , 20 ) | ||
end | ||
-- This test mission models the behaviour of the AI_PATROL_ZONE class. | ||
-- | ||
-- It creates a 2 AI_PATROL_ZONE objects with the name Patrol1 and Patrol2. | ||
-- Patrol1 will govern a GROUP object to patrol the zone defined by PatrolZone1, within 3000 meters and 6000 meters, within a speed of 400 and 600 km/h. | ||
-- When the GROUP object that is assigned to Patrol has fuel below 20%, the GROUP object will orbit for 60 secondes, before returning to base. | ||
-- | ||
-- Patrol2 will goven a GROUP object to patrol the zone defined by PatrolZone2, within 600 meters and 1000 meters, within a speed of 300 and 400 km/h. | ||
-- When the GROUP object that is assigned to Patrol has fuel below 20%, the GROUP object will orbit for 0 secondes, before returning to base. | ||
-- | ||
-- The Patrol1 and Patrol2 object have 2 state transition functions defined, which customize the default behaviour of the RTB state. | ||
-- When Patrol1 goes RTB, it will create a new GROUP object, that will be assigned to Patrol2. | ||
-- When Patrol2 goes RTB, it will create a new GROUP object, that will be assgined to Patrol1. | ||
-- | ||
-- In this way, the Patrol1 and Patrol2 objects are fluctuating the patrol pattern from PatrolZone1 and PatrolZone2 :-) | ||
|
||
|
||
PatrolZoneGroup1 = GROUP:FindByName( "Patrol Zone 1" ) | ||
PatrolZone1 = ZONE_POLYGON:New( "Patrol Zone 1", PatrolZoneGroup1 ) | ||
|
||
PatrolZoneGroup2 = GROUP:FindByName( "Patrol Zone 2" ) | ||
PatrolZone2 = ZONE_POLYGON:New( "Patrol Zone 2", PatrolZoneGroup2 ) | ||
|
||
PatrolSpawn = SPAWN:New( "Patrol Group" ) | ||
PatrolGroup = PatrolSpawn:Spawn() | ||
|
||
Patrol1 = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) | ||
Patrol1:ManageFuel( 0.2, 60 ) | ||
Patrol1:SetControllable( PatrolGroup ) | ||
Patrol1:__Start( 5 ) | ||
|
||
Patrol2 = AI_PATROL_ZONE:New( PatrolZone2, 600, 1000, 300, 400 ) | ||
Patrol2:ManageFuel( 0.2, 0 ) | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object | ||
-- @param #AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
-- @return #boolean If false is returned, then the OnAfter state transition function will not be called. | ||
function Patrol1:OnLeaveRTB( AIGroup ) | ||
AIGroup:MessageToRed( "Returning to base", 20 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol1:OnAfterRTB( AIGroup ) | ||
local NewGroup = PatrolSpawn:Spawn() | ||
Patrol2:SetControllable( NewGroup ) | ||
Patrol2:__Start( 1 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol1:OnEnterPatrol( AIGroup ) | ||
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone1:GetName() , 20 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object | ||
-- @param #AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
-- @return #boolean If false is returned, then the OnEnter state transition function will not be called. | ||
function Patrol2:OnBeforeRTB( AIGroup ) | ||
AIGroup:MessageToRed( "Returning to base", 20 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol2:OnEnterRTB( AIGroup ) | ||
local NewGroup = PatrolSpawn:Spawn() | ||
Patrol1:SetControllable( NewGroup ) | ||
Patrol1:__Start( 1 ) | ||
end | ||
|
||
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object | ||
-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self | ||
-- @param Wrapper.Group#GROUP AIGroup | ||
function Patrol2:OnEnterPatrol( AIGroup ) | ||
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone2:GetName() , 20 ) | ||
end |
File renamed without changes.
66 changes: 33 additions & 33 deletions
66
...cheduling/SCH-000 - Simple Scheduling.lua → ...cheduling/SCH-000 - Simple Scheduling.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
--- Simple function scheduling | ||
-- | ||
-- === | ||
-- | ||
-- Author: FlightControl | ||
-- Date Created: 12 Dec 2016 | ||
-- | ||
-- # Situation | ||
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results. | ||
-- Create a new SCHEDULER object. | ||
-- Check the DCS.log. | ||
-- | ||
-- # Test cases: | ||
-- | ||
-- 1. The log should contain a "Hello World" line that is fired off 10 seconds after mission start. | ||
-- | ||
-- | ||
-- # Status: TESTED - 12 Dec 2016 | ||
|
||
local TestScheduler = SCHEDULER:New( nil, | ||
function() | ||
BASE:E( "Hello World 1") | ||
end, {}, 1 | ||
) | ||
|
||
SCHEDULER:New( nil, | ||
function() | ||
BASE:E( "Hello World 2") | ||
end, {}, 2 | ||
) | ||
|
||
collectgarbage() | ||
|
||
--- Simple function scheduling | ||
-- | ||
-- === | ||
-- | ||
-- Author: FlightControl | ||
-- Date Created: 12 Dec 2016 | ||
-- | ||
-- # Situation | ||
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results. | ||
-- Create a new SCHEDULER object. | ||
-- Check the DCS.log. | ||
-- | ||
-- # Test cases: | ||
-- | ||
-- 1. The log should contain a "Hello World" line that is fired off 10 seconds after mission start. | ||
-- | ||
-- | ||
-- # Status: TESTED - 12 Dec 2016 | ||
|
||
local TestScheduler = SCHEDULER:New( nil, | ||
function() | ||
BASE:E( "Hello World 1") | ||
end, {}, 1 | ||
) | ||
|
||
SCHEDULER:New( nil, | ||
function() | ||
BASE:E( "Hello World 2") | ||
end, {}, 2 | ||
) | ||
|
||
collectgarbage() | ||
|
File renamed without changes.
66 changes: 33 additions & 33 deletions
66
...ng/SCH-001 - Simple Object Scheduling.lua → ...ng/SCH-001 - Simple Object Scheduling.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
--- Simple Object Scheduling | ||
-- | ||
-- === | ||
-- | ||
-- Author: FlightControl | ||
-- Date Created: 12 Dec 2016 | ||
-- | ||
-- # Situation | ||
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results. | ||
-- Create a new SCHEDULER object. | ||
-- Check the DCS.log. | ||
-- | ||
-- # Test cases: | ||
-- | ||
-- 1. Tracing of a scheduler in an Object. | ||
-- The log should contain a "Hello World" line of the object, that is fired off 1 seconds after mission start. | ||
-- | ||
-- # Status: TESTED - 12 Dec 2016 | ||
|
||
local TEST_BASE = { | ||
ClassName = "TEST_BASE", | ||
} | ||
|
||
function TEST_BASE:New( Message ) | ||
self = BASE:Inherit( self, BASE:New() ) | ||
|
||
local TestScheduler = SCHEDULER:New( self, | ||
function( Object, Message ) | ||
Object:E( Message ) | ||
end, { Message }, 1 | ||
) | ||
end | ||
|
||
--- Simple Object Scheduling | ||
-- | ||
-- === | ||
-- | ||
-- Author: FlightControl | ||
-- Date Created: 12 Dec 2016 | ||
-- | ||
-- # Situation | ||
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results. | ||
-- Create a new SCHEDULER object. | ||
-- Check the DCS.log. | ||
-- | ||
-- # Test cases: | ||
-- | ||
-- 1. Tracing of a scheduler in an Object. | ||
-- The log should contain a "Hello World" line of the object, that is fired off 1 seconds after mission start. | ||
-- | ||
-- # Status: TESTED - 12 Dec 2016 | ||
|
||
local TEST_BASE = { | ||
ClassName = "TEST_BASE", | ||
} | ||
|
||
function TEST_BASE:New( Message ) | ||
self = BASE:Inherit( self, BASE:New() ) | ||
|
||
local TestScheduler = SCHEDULER:New( self, | ||
function( Object, Message ) | ||
Object:E( Message ) | ||
end, { Message }, 1 | ||
) | ||
end | ||
|
||
local Test = TEST_BASE:New( "Hello World" ) |
File renamed without changes.
46 changes: 23 additions & 23 deletions
46
...ng/SCH-100 - Simple Repeat Scheduling.lua → ...ng/SCH-100 - Simple Repeat Scheduling.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
--- Simple repeat scheduling of a function. | ||
-- | ||
-- === | ||
-- | ||
-- Author: FlightControl | ||
-- Date Created: 13 Dec 2016 | ||
-- | ||
-- # Situation | ||
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results. | ||
-- Create a new SCHEDULER object. | ||
-- Check the DCS.log. | ||
-- | ||
-- # Test cases: | ||
-- | ||
-- 1. The log should contain "Hello World Repeat" lines that is fired off 1 second after mission start and is repeated every 1 seconds. | ||
-- | ||
-- | ||
-- # Status: TESTED - 13 Dec 2016 | ||
|
||
local TestScheduler = SCHEDULER:New( nil, | ||
function() | ||
BASE:E( "Hello World Repeat") | ||
end, {}, 1, 1 | ||
--- Simple repeat scheduling of a function. | ||
-- | ||
-- === | ||
-- | ||
-- Author: FlightControl | ||
-- Date Created: 13 Dec 2016 | ||
-- | ||
-- # Situation | ||
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results. | ||
-- Create a new SCHEDULER object. | ||
-- Check the DCS.log. | ||
-- | ||
-- # Test cases: | ||
-- | ||
-- 1. The log should contain "Hello World Repeat" lines that is fired off 1 second after mission start and is repeated every 1 seconds. | ||
-- | ||
-- | ||
-- # Status: TESTED - 13 Dec 2016 | ||
|
||
local TestScheduler = SCHEDULER:New( nil, | ||
function() | ||
BASE:E( "Hello World Repeat") | ||
end, {}, 1, 1 | ||
) |
File renamed without changes.
Oops, something went wrong.