From 6a28902305c1176e5e9af3b38b82741333d02621 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 30 Apr 2016 07:22:48 +0200 Subject: [PATCH] Applied proper documentation --- Documentation/DCSCoalitionObject.html | 113 ++- Documentation/Database.html | 659 +++++++++++++++++- Documentation/Escort.html | 1 + Documentation/Event.html | 20 - Documentation/Spawn.html | 80 ++- Moose/Database.lua | 415 ++++++----- Moose/Routines.lua | 4 +- Moose/Spawn.lua | 16 +- Moose/Zone.lua | 7 +- .../Moose_Test_DATABASE.lua | 22 +- .../Moose_Test_DATABASE.miz | Bin 101312 -> 104294 bytes 11 files changed, 1038 insertions(+), 299 deletions(-) diff --git a/Documentation/DCSCoalitionObject.html b/Documentation/DCSCoalitionObject.html index e0a1741e8..8f4146e80 100644 --- a/Documentation/DCSCoalitionObject.html +++ b/Documentation/DCSCoalitionObject.html @@ -73,6 +73,12 @@ CoalitionObject + + + + coalition + + @@ -88,6 +94,38 @@ CoalitionObject:getCountry()

Returns object country.

+ + + + +

Type coalition

+ + + + + +
coalition.side + +
+ +

Type coalition.side

+ + + + + + + + + + + +
coalition.side.BLUE + +
coalition.side.NEUTRAL + +
coalition.side.RED +
@@ -105,6 +143,20 @@ + + +
+
+ + #coalition + +coalition + +
+
+ + +

Type DCSCoalitionObject

@@ -124,7 +176,7 @@

Return value

-

#coalition.side:

+

DCSTypes#coalition.side:

@@ -145,11 +197,68 @@

#country.id:

+ + + +

Type coalition

+

Field(s)

+
+
+ + #coalition.side + +coalition.side + +
+
+ + +

Type coalition.side

- +

Field(s)

+
+
+ + +coalition.side.BLUE + +
+
+ + + +
+
+
+
+ + +coalition.side.NEUTRAL + +
+
+ + + +
+
+
+
+ + +coalition.side.RED + +
+
+ + + +
+
+

Type country.id

diff --git a/Documentation/Database.html b/Documentation/Database.html index 0e988cba7..cb2bdddb7 100644 --- a/Documentation/Database.html +++ b/Documentation/Database.html @@ -68,7 +68,70 @@

Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.

-

Administers the Spawning of new Groups within the DCSRTE and administers these new Groups within the DATABASE object(s).

+

Mission designers can use the DATABASE class to build sets of units belonging to certain:

+ + + +

Note that this is an initial filter set. More to follow, like zones etc.

+ + +

DATABASE construction methods:

+

Create a new DATABASE object with the DATABASE.New method:

+ + + + +

DATABASE filter criteria:

+

You can set filter criteria to define the set of units within the database. +Filter criteria are defined by:

+ + + +

Once the filter criteria have been set for the DATABASE, you can start filtering using:

+ + + +

Planned filter criteria within development are (so these are not yet available):

+ + + + +

DATABASE iterators:

+

Once the filters have been defined and the DATABASE has been built, you can iterate the database with the available iterator methods. +The iterator methods will walk the DATABASE set, and call for each element within the set a function that you provide. +The following iterator methods are currently available within the DATABASE:

+ + + +

Planned iterators methods in development are (so these are not yet available):

+ +

Global(s)

@@ -76,19 +139,13 @@ - - - -
DATABASE -
_Database -

Type DATABASE

- + @@ -109,6 +166,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -132,13 +273,19 @@ + + + + @@ -157,12 +304,42 @@ + + + + + + + + + + + + + + + + + + + + @@ -186,20 +363,6 @@ - - -
-
- - Database#DATABASE - -_Database - -
-
- - -

Type Database

@@ -213,8 +376,8 @@
- -DATABASE.ActivePlayers + +DATABASE.AlivePlayers
@@ -263,6 +426,320 @@ +
+ +
+
+ + + +DATABASE.DCSGroups + +
+
+ + + +
+
+
+
+ + + +DATABASE.DCSGroupsAlive + +
+
+ + + +
+
+
+
+ + + +DATABASE.DCSUnits + +
+
+ + + +
+
+
+
+ + + +DATABASE.DCSUnitsAlive + +
+
+ + + +
+
+
+
+ + + +DATABASE.Filter + +
+
+ + + +
+
+
+
+ + +DATABASE:FilterCategory(Categories) + +
+
+ +

Builds a set of units out of categories.

+ + +

Possible current categories are plane, helicopter, ground, ship.

+ +

Parameter

+
    +
  • + +

    #string Categories : +Can take the following values: "plane", "helicopter", "ground", "ship".

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + +DATABASE:FilterCoalition(Coalitions) + +
+
+ +

Builds a set of units of coalitons.

+ + +

Possible current coalitions are red, blue and neutral.

+ +

Parameter

+
    +
  • + +

    #string Coalitions : +Can take the following values: "red", "blue", "neutral".

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + +DATABASE:FilterCountries(Countries) + +
+
+ +

Builds a set of units of defined countries.

+ + +

Possible current countries are those known within DCS world.

+ +

Parameter

+
    +
  • + +

    #string Countries : +Can take those country strings known within DCS world.

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + +DATABASE:FilterGroupPrefix(Prefixes) + +
+
+ +

Builds a set of units of defined group prefixes.

+ + +

All the units starting with the given group prefixes will be included within the set.

+ +

Parameter

+
    +
  • + +

    #string Prefixes : +The prefix of which the group name where the unit belongs to starts with.

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + + +DATABASE.FilterMeta + +
+
+ + + +
+
+
+
+ + +DATABASE:FilterStart() + +
+
+ +

Starts the filtering.

+ +

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + +DATABASE:FilterType(Types) + +
+
+ +

Builds a set of units of defined unit types.

+ + +

Possible current types are those types known within DCS world.

+ +

Parameter

+
    +
  • + +

    #string Types : +Can take those type strings known within DCS world.

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + +DATABASE:FilterUnitPrefix(Prefixes) + +
+
+ +

Builds a set of units of defined unit prefixes.

+ + +

All the units starting with the given prefixes will be included within the set.

+ +

Parameter

+
    +
  • + +

    #string Prefixes : +The prefix of which the unit name starts with.

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + +DATABASE:ForEachAliveUnit(IteratorFunction, ...) + +
+
+ +

Interate the DATABASE and call an interator function for each alive unit, providing the Unit and optional parameters.

+ +

Parameters

+
    +
  • + +

    #function IteratorFunction : +The function that will be called when there is an alive unit in the database. The function needs to accept a UNIT parameter.

    + +
  • +
  • + +

    ... :

    + +
  • +
+

Return value

+ +

#DATABASE: +self

+
@@ -323,12 +800,12 @@
-

Creates a new DATABASE Object to administer the Groups defined and alive within the DCSRTE.

+

Creates a new DATABASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

Return value

+

#DATABASE:

-

DATABASE

Usage:

-- Define a new DATABASE Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE.
@@ -348,6 +825,19 @@ DBObject = DATABASE:New()
+
+
+
+
+ + +DATABASE:ScanEnvironment() + +
+
+ + +
@@ -414,6 +904,27 @@ This method is used by the SPAWN class.

+ +
+
+
+ + +DATABASE:TraceDatabase() + +
+
+ +

Traces the current database contents in the log ...

+ + +

(for debug reasons).

+ +

Return value

+ +

#DATABASE: +self

+
@@ -428,6 +939,100 @@ This method is used by the SPAWN class.

+ +
+
+
+ + +DATABASE:_EventOnBirth(Event) + +
+
+ +

Handles the OnBirth event for the alive units set.

+ +

Parameter

+ +
+
+
+
+ + +DATABASE:_EventOnDeadOrCrash(Event) + +
+
+ +

Handles the OnDead or OnCrash event for alive units set.

+ +

Parameter

+ +
+
+
+
+ + +DATABASE:_IsAliveDCSUnit(DCSUnit) + +
+
+ + + +

Parameter

+ +

Return value

+ +

#DATABASE: +self

+ +
+
+
+
+ + +DATABASE:_IsIncludeDCSUnit(DCSUnit) + +
+
+ + + +

Parameter

+ +

Return value

+ +

#DATABASE: +self

+
diff --git a/Documentation/Escort.html b/Documentation/Escort.html index a75e3f26f..9855f9944 100644 --- a/Documentation/Escort.html +++ b/Documentation/Escort.html @@ -1835,6 +1835,7 @@ self

+ ESCORT.ReportTargetsScheduler diff --git a/Documentation/Event.html b/Documentation/Event.html index 9e5bd862b..eaa58b863 100644 --- a/Documentation/Event.html +++ b/Documentation/Event.html @@ -73,12 +73,6 @@
- - - -
DATABASE.ActivePlayersDATABASE.AlivePlayers DATABASE.ClientsByName +
DATABASE.DCSGroups + +
DATABASE.DCSGroupsAlive + +
DATABASE.DCSUnits + +
DATABASE.DCSUnitsAlive + +
DATABASE.Filter + +
DATABASE:FilterCategory(Categories) +

Builds a set of units out of categories.

+
DATABASE:FilterCoalition(Coalitions) +

Builds a set of units of coalitons.

+
DATABASE:FilterCountries(Countries) +

Builds a set of units of defined countries.

+
DATABASE:FilterGroupPrefix(Prefixes) +

Builds a set of units of defined group prefixes.

+
DATABASE.FilterMeta + +
DATABASE:FilterStart() +

Starts the filtering.

+
DATABASE:FilterType(Types) +

Builds a set of units of defined unit types.

+
DATABASE:FilterUnitPrefix(Prefixes) +

Builds a set of units of defined unit prefixes.

+
DATABASE:ForEachAliveUnit(IteratorFunction, ...) +

Interate the DATABASE and call an interator function for each alive unit, providing the Unit and optional parameters.

DATABASE:New() -

Creates a new DATABASE Object to administer the Groups defined and alive within the DCSRTE.

+

Creates a new DATABASE object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

DATABASE.Players +
DATABASE:ScanEnvironment() +
DATABASE.Statics +
DATABASE:TraceDatabase() +

Traces the current database contents in the log ...

DATABASE.Units +
DATABASE:_EventOnBirth(Event) +

Handles the OnBirth event for the alive units set.

+
DATABASE:_EventOnDeadOrCrash(Event) +

Handles the OnDead or OnCrash event for alive units set.

+
DATABASE:_IsAliveDCSUnit(DCSUnit) + +
DATABASE:_IsIncludeDCSUnit(DCSUnit) +
EVENT -
_EVENTDISPATCHER -

Declare the event dispatcher based on the EVENT class

@@ -389,20 +383,6 @@ - - -
-
- - #EVENT - -_EVENTDISPATCHER - -
-
- -

Declare the event dispatcher based on the EVENT class

-

Type Event

diff --git a/Documentation/Spawn.html b/Documentation/Spawn.html index 21d159c33..49bc1e57f 100644 --- a/Documentation/Spawn.html +++ b/Documentation/Spawn.html @@ -89,52 +89,58 @@ Groups will follow the following naming structure when spawned at run-time:

Some additional notes that need to be remembered:

+ +

SPAWN construction methods:

+

Create a new SPAWN object with the SPAWN.New or the SPAWN.NewWithAlias methods:

+ +

It is important to understand how the SPAWN class works internally. The SPAWN object created will contain internally a list of groups that will be spawned and that are already spawned. The initialization functions will modify this list of groups so that when a group gets spawned, ALL information is already prepared when spawning. This is done for performance reasons. So in principle, the group list will contain all parameters and configurations after initialization, and when groups get actually spawned, this spawning can be done quickly and efficient.

-
    -
  1. SPAWN object initialization methods:

    -

    A spawn object will behave differently based on the usage of initialization methods:

  2. -
  3. SPAWN.Limit: Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.

  4. -
  5. SPAWN.RandomizeRoute: Randomize the routes of spawned groups.

  6. -
  7. SPAWN.RandomizeTemplate: Randomize the group templates so that when a new group is spawned, a random group template is selected from one of the templates defined.

  8. -
  9. SPAWN.Uncontrolled: Spawn plane groups uncontrolled.

  10. -
  11. SPAWN.Array: Make groups visible before they are actually activated, and order these groups like a batallion in an array.

  12. -
  13. SPAWN.Repeat: Re-spawn groups when they land at the home base. Similar functions are SPAWN.RepeatOnLanding and SPAWN.RepeatOnEngineShutDown.

  14. -
  15. SPAWN object spawning methods:

    -

    Groups can be spawned at different times and methods:

  16. -
  17. SPAWN.Spawn: Spawn one new group based on the last spawned index.

  18. -
  19. SPAWN.ReSpawn: Re-spawn a group based on a given index.

  20. -
  21. SPAWN.SpawnScheduled: Spawn groups at scheduled but randomized intervals. You can use SPAWN.SpawnScheduleStart and SPAWN.SpawnScheduleStop to start and stop the schedule respectively.

  22. -
  23. SPAWN.SpawnFromUnit: Spawn a new group taking the position of a UNIT.

  24. -
  25. SPAWN.SpawnInZone: Spawn a new group in a ZONE.

  26. -
+

SPAWN initialization methods:

+

A spawn object will behave differently based on the usage of initialization methods:

+ + + +

SPAWN spawning methods:

+

Groups can be spawned at different times and methods:

+ +

Note that SPAWN.Spawn and SPAWN.ReSpawn return a GROUP#GROUP.New object, that contains a reference to the DCSGroup object. You can use the GROUP object to do further actions with the DCSGroup.

-
    -
  1. SPAWN object cleaning: -
    - Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damged stop their activities, while remaining alive. - In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't, - and it may occur that no new groups are or can be spawned as limits are reached. - To prevent this, a SPAWN.CleanUp initialization method has been defined that will silently monitor the status of each spawned group. - Once a group has a velocity = 0, and has been waiting for a defined interval, that group will be cleaned or removed from run-time. - There is a catch however :-) If a damaged group has returned to an airbase within the coalition, that group will not be considered as "lost"... - In such a case, when the inactive group is cleaned, a new group will Re-spawned automatically. - This models AI that has succesfully returned to their airbase, to restart their combat activities. - Check the SPAWN.CleanUp for further info.
  2. -
+

SPAWN object cleaning:

+

Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damged stop their activities, while remaining alive. +In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't, +and it may occur that no new groups are or can be spawned as limits are reached. +To prevent this, a SPAWN.CleanUp initialization method has been defined that will silently monitor the status of each spawned group. +Once a group has a velocity = 0, and has been waiting for a defined interval, that group will be cleaned or removed from run-time. +There is a catch however :-) If a damaged group has returned to an airbase within the coalition, that group will not be considered as "lost"... +In such a case, when the inactive group is cleaned, a new group will Re-spawned automatically. +This models AI that has succesfully returned to their airbase, to restart their combat activities. +Check the SPAWN.CleanUp for further info.

Global(s)

@@ -2052,7 +2058,7 @@ Nothing found

-

TODO Need to delete this... _Database does this now ...

+

TODO Need to delete this... _DATABASE does this now ...

Parameter