Module CleanUp

Functional -- The CLEANUP class keeps an area clean of crashing or colliding airplanes.

It also prevents airplanes from firing within this area.


Author: Sven Van de Velde (FlightControl)

Contributions:


Global(s)

CLEANUP

CLEANUP, extends Base#BASE

Banner Image

The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.

Type CLEANUP

CLEANUP.<

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

CLEANUP:AddAirbase(AirbaseName)

Adds an airbase to the airbase validation list.

CLEANUP.CleanUpScheduler
CLEANUP:New(<, AirbaseNames)

Creates the main object which is handling the cleaning of the debris within the given Zone Names.

CLEANUP:RemoveAirbase(AirbaseName)

Removes an airbase from the airbase validation list.

CLEANUP.__

Type CLEANUP.__

CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName)

Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.

CLEANUP.__:CleanUpScheduler()

At the defined time interval, CleanUp the Groups within the CleanUpList.

CLEANUP.__:DestroyMissile(MissileObject)

Destroys a missile from the simulator, but checks first if it is still existing!

CLEANUP.__:DestroyUnit(CleanUpUnit)

Destroys a Unit from the simulator, but checks first if it is still existing!

CLEANUP.__:EventAddForCleanUp(Event)

Detects if the Unit has an SEVENTENGINESHUTDOWN or an SEVENT_HIT within the given AirbaseNames.

CLEANUP.__:IsInAirbase(Vec2)
CLEANUP.__:OnEventBirth(EventData)
CLEANUP.__:OnEventCrash(Event)

Detects if a crash event occurs.

CLEANUP.__:OnEventHit(Event)

Detects if the Unit has an SEVENTHIT within the given AirbaseNames.

CLEANUP.__:OnEventShot(Event)

Detects if a unit shoots a missile.

Global(s)

#CLEANUP CLEANUP

CLEANUP, extends Base#BASE

Banner Image

The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.

Specific airbases need to be provided that need to be guarded. Each airbase registered, will be guarded within a zone of 8 km around the airbase. Any unit that fires a missile, or shoots within the zone of an airbase, will be monitored by CLEANUP. Within the 8km zone, units cannot fire any missile, which prevents the airbase runway to receive missile or bomb hits. Any airborne or ground unit that is on the runway below 30 meters (default value) will be automatically removed if it is damaged.

This is not a full 100% secure implementation. It is still possible that CLEANUP cannot prevent (in-time) to keep the airbase clean. The following situations may happen that will still stop the runway of an airbase:

  • A damaged unit is not removed on time when above the runway, and crashes on the runway.
  • A bomb or missile is still able to dropped on the runway.
  • Units collide on the airbase, and could not be removed on time.

When a unit is within the airbase zone and needs to be monitored, its status will be checked every 0.25 seconds! This is required to ensure that the airbase is kept clean. But as a result, there is more CPU overload.

So as an advise, I suggest you use the CLEANUP class with care:

  • Only monitor airbases that really need to be monitored!
  • Try not to monitor airbases that are likely to be invaded by enemy troops. For these airbases, there is little use to keep them clean, as they will be invaded anyway...

By following the above guidelines, you can add airbase cleanup with acceptable CPU overhead.

1. CLEANUP Constructor

Creates the main object which is preventing the airbase to get polluted with debris on the runway, which halts the airbase.

 -- Clean these Zones.
 CleanUpAirports = CLEANUP:New( { AIRBASE.Caucasus.Tbilisi, AIRBASE.Caucasus.Kutaisi )

 -- or
 CleanUpTbilisi = CLEANUP:New( AIRBASE.Caucasus.Tbilisi )
 CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )

2. Add or Remove airbases

The method CLEANUP.AddAirbase to add an airbase to the cleanup validation process. The method CLEANUP.RemoveAirbase removes an airbase from the cleanup validation process.

Type CleanUp

Type CLEANUP

Field(s)

#map CLEANUP.<

string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.

CLEANUP:AddAirbase(AirbaseName)

Adds an airbase to the airbase validation list.

Parameter

  • #string AirbaseName :

Return value

#CLEANUP:

CLEANUP.CleanUpScheduler
CLEANUP:New(<, AirbaseNames)

Creates the main object which is handling the cleaning of the debris within the given Zone Names.

Parameters

  • #list < : string> AirbaseNames Is a table of airbase names where the debris should be cleaned. Also a single string can be passed with one airbase name.

  • AirbaseNames :

Return value

#CLEANUP:

Usage:

 -- Clean these Zones.
CleanUpAirports = CLEANUP:New( { AIRBASE.Caucasus.Tbilisi, AIRBASE.Caucasus.Kutaisi )
or
CleanUpTbilisi = CLEANUP:New( AIRBASE.Caucasus.Tbilisi )
CleanUpKutaisi = CLEANUP:New( AIRBASE.Caucasus.Kutaisi )
CLEANUP:RemoveAirbase(AirbaseName)

Removes an airbase from the airbase validation list.

Parameter

  • #string AirbaseName :

Return value

#CLEANUP:

#CLEANUP.__ CLEANUP.__

Type CLEANUP.__

Field(s)

CLEANUP.__:AddForCleanUp(CleanUpUnit, CleanUpUnitName)

Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.

Parameters

CLEANUP.__:CleanUpScheduler()

At the defined time interval, CleanUp the Groups within the CleanUpList.

CLEANUP.__:DestroyMissile(MissileObject)

Destroys a missile from the simulator, but checks first if it is still existing!

Parameter

CLEANUP.__:DestroyUnit(CleanUpUnit)

Destroys a Unit from the simulator, but checks first if it is still existing!

Parameter

CLEANUP.__:EventAddForCleanUp(Event)

Detects if the Unit has an SEVENTENGINESHUTDOWN or an SEVENT_HIT within the given AirbaseNames.

If this is the case, add the Group to the CLEANUP List.

Parameter

CLEANUP.__:IsInAirbase(Vec2)

Parameter

  • Vec2 :

CLEANUP.__:OnEventBirth(EventData)

Parameter

CLEANUP.__:OnEventCrash(Event)

Detects if a crash event occurs.

Crashed units go into a CleanUpList for removal.

Parameter

CLEANUP.__:OnEventHit(Event)

Detects if the Unit has an SEVENTHIT within the given AirbaseNames.

If this is the case, destroy the unit.

Parameter

CLEANUP.__:OnEventShot(Event)

Detects if a unit shoots a missile.

If this occurs within one of the airbases, then the weapon used must be destroyed.

Parameter

Type list

Type map