Contributing: Building a Component - PiZZAD0X/MMFW GitHub Wiki
Structure of Components
The MMFW divides components into separate addons according to the ace addon structure which allows for a level of modular and additive component maintenance and contribution to the framework.
The most basic structure of a MMFW component is the addon's config.cpp
, $PBOPREFIX$
, CfgEventHandlers.hpp
, script_component.hpp
, and neccessary XEH handler files, ie XEH_PREP.hpp
, XEH_preInit.sqf
, etc.
Functions introduced by a component are added through the PREP
macro in XEH_PREP.hpp
and stored in component\functions. Functions can be divided and differentiated from their component with the PREPE
macro, which will assign the function to a separate component prefix and is stored in a separate folder. ie: PREPE(Olsen,canLinkItem)
will assign the function as MMFW_Olsen_fnc_canLinkItem
and look for it in component\functions\olsen\fnc_canLinkItem.sqf
. Functions for 3den attributes are added with PREPATTR
which will look for them in component\functions\attributes\
Adding Module Settings
The MMFW has a module menu meant for modules with only a few settings. Module attribute categories are added to the module menu with the inclusion of a component\Cfg3DEN.hpp file that defines the component categories to add to the module settings menu. The component settings are created in component\cfg3den\modules\MenuName.hpp.
Adding Entity Settings
Adding entity settings is done through the component\Cfg3DEN.hpp file with the class Object
entries. Entity attribute categories are created in the same way as module setting attributes and are stored in component\cfgAttributeCategories\Object.hpp
.
Creating Modules
Modules are added with cfgVehicles.hpp and their attributes are created directly inside the cfgVehicles entries. Their module function must point to a component function that can handle 3den and init eventhandler modes.
Creating New Attributes/Controls
Please refer to the BI documentation. Attributes in MMFW are added through Cfg3DEN
, stored in component\cfgAttributes
, and their functions are defined in XEH_PREP.hpp
using the PREPATTR
macro. Attribute EH and functions should always pass their parameters immediately to a separate function, ie: attributeLoad = QUOTE([ARR_3(_this,_value,_config)] call FUNC(AOModeAttribute_attr_load));
instead of handling the EH within the config entry as a string.