mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user