CMF3 Engine: script component

From cluster wiki
Jump to navigation Jump to search

The CMF3 Engine: script_component.hpp file contains meta information and MACROs for the component it is located inside. This file is absolutely vital for the functionality of a CMF3 framework component and without it the component would not work. It's job is to define the component name, required addons and required CMF3 components and MACROs for the component.

They all follow the following format:

#define MODULE /* component name */
#define REQUIRED_ADDONS /* array of required addons from CfgPatches */
#define REQUIRED_MODULES /* array of required components from CMF3 */

#include "..\main\script_component.hpp" // True for every component except the main component

/* component specific macros */

As stated in the comment #include "..\main\script_component.hpp" should be omitted from the main component or else it would be a circular reference.

A complete file can look like the following (taken from the CMF3 player component):

#define MODULE player
#define REQUIRED_ADDONS ["ace_hearing"]
#define REQUIRED_MODULES ["common"]

#include "..\main\script_component.hpp"

#define IDD_SPEC_DISPLAY 60000