Skip to content

Instantly share code, notes, and snippets.

@headswe
Created February 23, 2020 18:03
Show Gist options
  • Save headswe/d30a6f817a06e29393a84882e93642cd to your computer and use it in GitHub Desktop.
Save headswe/d30a6f817a06e29393a84882e93642cd to your computer and use it in GitHub Desktop.
private _allVehs = ("true" configClasses (configFile >> "CfgVehicles"));
dsm_factions = [true] call CBA_fnc_createNamespace;
{
private _configName = configName _x;
private _isVehicle = _x isKindOf 'AllVehicles';
private _isNotMan = !(configName isKindOf 'Man');
if(_isVehicle && _isNotMan) then {
private _factionStr = (getText (_x >> 'faction'));
if(_factionStr != '') then {
private _faction = dsm_factions getVariable [_factionStr, []];
if(count _faction <= 0) then {
_faction = [(configfile >> "CfgFactionClasses" >> _factionStr),getText (configfile >> "CfgFactionClasses" >> _factionStr >> "displayName"), [_x]];
} else {
(_faction#2) pushBackUnique _x;
};
dsm_factions setVariable [_factionStr, _faction];
}
}
} forEach _allVehs;
publicVariable "dsm_factions";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment