Modules

Modules are high level structures in the AI. Their defining property is that they are AI-wide, and don’t represent a specific unit.

There is only a single instance of a module. If you need to create more than one of a module, then you should create a new type of entity based on AIBase, and create a module to manage them as a collection. UnitHandler is an example of this.

The decision of which modules are loaded and instantiated is made in modules.lua

Created modules are available as properties of the main AI Object, with an all lowercase name. For example, this is how you would access the AttackHandler modules AddRecruit method:

ai.attackhandler:AddRecruit(self)