Documentation of SetState and GetState and BASE documentation update.

-- SetState documented.
-- GetState documented.
-- BASE main documentation.
-- Test mission updated and documentation.
This commit is contained in:
FlightControl
2017-01-20 20:15:02 +01:00
parent 65f4902029
commit 84a1fc1ac7
6 changed files with 124 additions and 40 deletions

View File

@@ -12,33 +12,39 @@
--
--
-- MOOSE wraps each Group alive in the mission into a GROUP class object. The GROUP class object is a wrapper object, wrapping
-- the Group object from DCS and adding methods to it.
-- Get the GROUP wrapper objects that were created by MOOSE at mission startup, by using the GROUP:FindByName() method.
-- The Group name is the parameter to be searched for.
-- Note that late activated groups are also "alive" and have a corresponding GROUP object in the running mission.
local PolyZoneGroup1 = GROUP:FindByName("PolyZone1")
local PolyZoneGroup2 = GROUP:FindByName("PolyZone2")
-- Create 2 Polygon objects, using the ZONE_POLYGON:New constructor.
-- The first parameter gives a name to the zone, the second is the GROUP object that defines the zone form.
local PolyZone1 = ZONE_POLYGON:New( "PolyZone1", PolyZoneGroup1 )
local PolyZone2 = ZONE_POLYGON:New( "PolyZone2", PolyZoneGroup2 )
-- Create a SET of Moose CLIENT wrapper objects. At mission startup, a SET of Moose client wrapper objects is created.
-- Note that CLIENT objects don't necessarily need to be alive!!!
-- So this set contains EVERY RED coalition client defined within the mission.
local RedClients = SET_CLIENT:New():FilterCoalitions("red"):FilterStart()
SchedulerInit, SchedulerInitID = SCHEDULER:New( nil,
function()
RedClients:ForEachClient(
function( MooseClient )
-- Here we register the state of the client in which step he is in.
-- We set the state of the client "ZoneStep" to 0, indicating that he is not out of the first zone.
local function ResetClientForZone( MooseClient )
BASE:E("Reset")
MooseClient:SetState( MooseClient, "ZoneStep", "0" )
end
BASE:E( { "Alive Init", Client = MooseClient } )
MooseClient:Alive( ResetClientForZone )
end
)
end, {}, 1
RedClients:ForEachClient(
function( MooseClient )
-- Here we register the state of the client in which step he is in.
-- We set the state of the client "ZoneStep" to 0, indicating that he is not out of the first zone.
local function ResetClientForZone( MooseClient )
BASE:E("Reset")
MooseClient:SetState( MooseClient, "ZoneStep", "0" )
end
BASE:E( { "Alive Init", Client = MooseClient } )
MooseClient:Alive( ResetClientForZone )
end
)
Scheduler, SchedulerID = SCHEDULER:New( nil,