Module cleanup

CLEANUP will keep (a) CleanUp Zone(s) clean.

This class can be used to KEEP airbases or farps clean (note the word keep here, it cannot destroy units that are already dead). The CleanUp class works with 2 validation logic compontents: * EVENT validation: An event detection to intercept HIT events, upon which a validation of units CLEANUP CONDITIONS are applied. Once a unit is HIT, it is registered in a TIMED validation logic. * TIMED validation: Units registered in a TIMED validation, are repeatedly validated of certain CLEANUP CONDITIONS. If the CLEANUP CONDITIONS apply, the unit will be destroyed, and the group will be destroyed. * It does not clean the zone, it tries to keep it clean by destroying units or groups before they explode or crash into the ground. * For airplanes or helicopters, when in the CleanUpZone: ** When the unit is airborne, and it is HIT ( by a weapon or a crash of another unit ), CLEANUP will destroy the unit or group when the health of the unit reaches an AIRBORNE HEALTH LIMIT.

When the unit is HIT, it will register the unit for further repeated health monitoring, until:

* the unit's health is beyond the an AIRBORNE HEALTH LIMIT * until the height of the unit is below the safety zone to prevent it from crashing. * When the unit is not airborne, and it is HIT, it will be registered * When the unit is

Functions

CLEANUP:New (ZoneNames, TimeInterval) Creates the main object which is handling the cleaning of the debris within the given Zone Names.
CLEANUP:_ExecuteDeadEvents (CleanUpUnit) This function is required, and used a non-documented feature.
CLEANUP:_CheckLife (the) Measures the life of a Unit using the LifeLimit treshold.
CLEANUP:_CleanUnit (CleanUpUnit) Cleans a Group from the DCSRTE.
CLEANUP:_EventAddForCleanUp (event) Detects if the Unit has an SEVENTENGINESHUTDOWN or an SEVENT_HIT within the given ZoneNames.
CLEANUP:_Scheduler () At the defined time interval, CleanUp the Groups within the CleanUpList.


Functions

CLEANUP:New (ZoneNames, TimeInterval)
Creates the main object which is handling the cleaning of the debris within the given Zone Names.

Parameters:

  • ZoneNames table{string,...} or string which is a table of zone names where the debris should be cleaned. Also a single string can be passed with one zone name.
  • TimeInterval optional number is the interval in seconds when the clean activity takes place. The default is 300 seconds, thus every 5 minutes.

Returns:

    CLEANUP

Usage:

     -- Clean these Zones.
     CleanUpAirports = CLEANUP:New( { 'CLEAN Tbilisi', 'CLEAN Kutaisi' }, 150 )
     or
     CleanUpTbilisi = CLEANUP:New( 'CLEAN Tbilisi', 150 )
     CleanUpKutaisi = CLEANUP:New( 'CLEAN Kutaisi', 600 )
CLEANUP:_ExecuteDeadEvents (CleanUpUnit)
This function is required, and used a non-documented feature. The function world.onEvent will loop through all registered event handlers with the event structure given. This is required to be done because the method Group.destroy(Group) does not generate the SEVENTDEAD through all the registered event handlers. As such, the other classes using the SEVENTDEAD will get confused if this event is not catched properly...

Parameters:

  • CleanUpUnit
CLEANUP:_CheckLife (the)
Measures the life of a Unit using the LifeLimit treshold. Returns true if Group has a life lower than the treshold, false if the life is still okay.

Parameters:

  • the Group Group to be cleaned.

Returns:

    bool
CLEANUP:_CleanUnit (CleanUpUnit)
Cleans a Group from the DCSRTE.

Parameters:

  • CleanUpUnit
CLEANUP:_EventAddForCleanUp (event)
Detects if the Unit has an SEVENTENGINESHUTDOWN or an SEVENT_HIT within the given ZoneNames. If this is the case, add the Group to the CLEANUP List.

Parameters:

  • event
CLEANUP:_Scheduler ()
At the defined time interval, CleanUp the Groups within the CleanUpList.
generated by LDoc 1.4.3 Last updated 2015-02-11 11:12:10