-
Notifications
You must be signed in to change notification settings - Fork 7
ITC Air System Development
This document will go over the basics of a system's setup for ITC Air Systems. It will explain common folder structure, naming schemes, and how it ties in to the rest of the mod. It will also quickly go over the options system to allow easy integration to the MFDs.
The idea of "systems" in itc air are functionality sets that can be added to aircraft by including them in the "systems" array in the itc_air config class(see compatibility docs for config classes).
Systems are initialised when a player enters an aircraft, and they are shut down when a player leaves the aircraft or dies.
Every system is a separate folder that packs to a separate pbo. Pictured is the GCAS(Ground Collision Avoidance System) system, which warns players of ground collisions, and when combined with the AGCAS(Automated GCAS) system can initiate the auto-pilot to avoid collisions.
Systems folders are named itc_air_sys_systemname. In the system's root folder the config.cpp file can be found.
config.cpp
The config.cpp is where the CfgPatches is set up with the addon name following the format itc_air_systemname. The config.cpp is also used to #include other files.
This is the folder where config files can be found, in the case of gcas, and many other systems, this will only feature a cfgFunctions.
cfgFunctions.hpp
This is where the system's cfgFunctions can be found, the functions class will be named itc_air_systemName like the cfgPatches.
This is where sqf functions can be found, all named as functionName.sqf
Default functions
ITC Air offers 4 default functions:
- setup: is ran on aircraft start when a player enters an aircraft with this system, is also run when system is started manually on the STAT>SYS MFD page.
- shutDown: is ran when the player leaves the aircraft or dies, is also run when system is stopped manually on the STAT>SYS MFD page.
- perframe: is ran on every frame, and is automatically stopped when the game is paused, or the system is stopped manually on the STAT>SYS MFD page.
- perSecond: is ran once per second, and is automatically stopped when the game is paused, or the system is stopped manually on the STAT>SYS MFD page.
Additionally, it is recommended to use an init function to set any variables that other systems might expect from this system, to still function when the aircraft is not active. Example: The F-22 features the HMD, but not the TGP, the TGP init function is used to set variables that lets the HMD know there is no TGP active.
Ideally other systems using a system should isNil check variables, but using init functions to set negative values will add an extra level of reliability.
Not present in the example: uiConfig is used to house hpp files used for dialogs.
The ITC Air MFDs feature an options page to add a simple script based method of user configuration.
The options page lists some options introduced by systems, and allows users to change the values of these options.
New options can be registered anywhere, but is generally done in a system's setup function, an option is registered by calling:
[
_vehicle, //vehicle to which the option is applied
[
missionNameSpace, //option variable namespace
"itc_air_gcas_on", //option variable name
true, //default value
"GCAS ON", //options page label
{}, //onChange code
"cycle", //option data type, can be "cycle" for a rotary input or "UFC" for a numeric input
[false, true], //data type option: when "cycle":it's an array of values, when "UFC": number validation code
false //optional: when "UFC" is used, this defines whether to parse the number to an int or keep it as string
]
] call itc_air_common_fnc_addOption;