Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- span class="re5"> Rimsiakas_fnc_AISpawnerGroupsInitAdapter = {
- params["_emitter"];
- private["_sideStr","_cfgRoot"];
- _emitter = _this select 0;
- _sideStr = _emitter getVariable ["side",""];
- _cfgRoot = [["CfgGroups"]] call bis_fnc_loadClass;
- private["_factions","_maxVehicles","_maxInfantry","_type","_typeRaw","_groups","_groupDataPoolStored","_groupDataPoolVar","_group","_groupDataPool"];
- _factions = (_cfgRoot >> _sideStr) call bis_fnc_getCfgSubClasses;
- _maxVehicles = _emitter getVariable ["VehiclesInGroup",-1];
- _maxInfantry = _emitter getVariable ["InfantryInGroup",-1];
- if (_maxVehicles < 0) then {_maxVehicles = 10e10};
- if (_maxInfantry < 0) then {_maxInfantry = 10e10};
- {
- scopeName "factionLoop";
- _faction = _x;
- private _rawTypes = (_cfgRoot >> _sideStr >> _faction) call bis_fnc_getCfgSubClasses;
- {
- scopeName "typeLoop";
- _typeRaw = _x;
- _groups = (_cfgRoot >> _sideStr >> _faction >> _x) call bis_fnc_getCfgSubClasses;
- _groupDataPool = [];
- private["_groupData","_groupConfig","_groupCost","_groupWeight","_groupUnitCount","_groupComposition","_groupType"];
- {
- scopeName "groupLoop";
- _group = _x;
- _type = switch (_typeRaw) do
- {
- case "SpecOps";
- case "UInfantry";
- case "Taiga";
- case "Taiga2";
- case "Woodland_Hex";
- case "Group_43";
- case "SE_Warbots";
- case "AC_Warbots";
- case "AR_Warbots";
- case "Infantry":
- {
- "Infantry";
- };
- case "Motorized";
- case "Motorized_MTP":
- {
- "Motorized";
- };
- case "Mechanized":
- {
- "Mechanized";
- };
- case "Armored":
- {
- "Armored";
- };
- default
- {
- _aliveCategory = getText (_cfgRoot >> _sideStr >> _faction >> _typeRaw >> "aliveCategory");
- if (_aliveCategory != "") then {
- _aliveCategory;
- };
- };
- };
- if (isNil "_type") then {
- breakOut "groupLoop";
- };
- _groupData = [];
- if ({_x == _group} count (_emitter getVariable ["BlacklistedGroups",[]]) == 0) then
- {
- _groupConfig = (_cfgRoot >> _sideStr >> _faction >> _typeRaw >> _group);
- _groupComposition = [_groupConfig,_maxVehicles,_maxInfantry] call bis_fnc_moduleSpawnAI_getGroupComposition;
- _groupUnitCount = count _groupComposition;
- if (_groupUnitCount > 0) then
- {
- _groupCost = [_groupConfig,_maxVehicles,_maxInfantry] call bis_fnc_moduleSpawnAI_getGroupCost;
- _groupWeight = [_groupCost,_groupUnitCount] call bis_fnc_moduleSpawnAI_getGroupWeight;
- _groupType = _groupComposition call bis_fnc_moduleSpawnAI_getGroupType;
- _groupData = [_groupConfig,_groupCost,_groupWeight,_groupUnitCount,_groupComposition,_groupType];
- _groupDataPool set [count _groupDataPool, _groupData];
- };
- };
- }
- forEach _groups;
- if (isNil "_type") then {
- continue;
- };
- _groupDataPoolVar = format["groups%1_%2",_faction,_type];
- _groupDataPoolStored = _emitter getVariable [_groupDataPoolVar,[]];
- _groupDataPoolStored = _groupDataPoolStored + _groupDataPool;
- _emitter setVariable [_groupDataPoolVar,_groupDataPoolStored];
- }
- forEach _rawTypes;
- if (missionNamespace getVariable ["bis_fnc_moduleSpawnAI_debug",false]) then
- {
- ["[ ][%1]---------------------------------------------------------",_emitter] call bis_fnc_moduleSpawnAI_logFormat;
- {
- _type = _x;
- _groupDataPoolVar = format["groups%1_%2",_faction,_type];
- {
- ["[ ][%4][%1][%2]: %3",_faction,_type,_x,_emitter] call bis_fnc_moduleSpawnAI_logFormat;
- }
- forEach (_emitter getVariable [_groupDataPoolVar,[]]);
- }
- forEach
- [
- "Infantry",
- "Motorized",
- "Mechanized",
- "Armored"
- ];
- };
- }
- forEach _factions;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement