-
-
Save patroza/1950145 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this script checks if there arent too many magazines or respawns according to available slots | |
_count = count (configFile >> "CfgVehicles"); | |
_prefix = "t1o_"; | |
_vehicleName = ""; | |
_singleError = false; | |
// Remove this | |
_msg = format["_count: %1", _count]; | |
diag_log [diag_frameNo, diag_tickTime, time, _msg]; | |
// | |
_selectedClasses = []; | |
for [{_i=0},{_i < _count},{_i=_i+1}] do | |
{ | |
_vehicleName = configName ((ConfigFile >> "CfgVehicles") select _i); | |
_prefixIndex = [_vehicleName, _prefix] call CBA_fnc_find; | |
_isMan = _vehicleName isKindOf "Man"; | |
_scope = getNumber (ConfigFile >> "CfgVehicles" >> _vehicleName >> "scope"); | |
// Remove this | |
_msg = format["_vehicleName: %1, _prefixIndex: %2, _isMan: %3, _scope: %4, _i: %5", _vehicleName,_prefixIndex,_isMan,_scope,_i]; | |
diag_log [diag_frameNo, diag_tickTime, time, _msg]; | |
// | |
if ( (_prefixIndex != -1) && _isMan && (_scope == 2)) then | |
{ | |
_magazineSlotsFromConfig = [_vehicleName] call t1o_getWeaponSlotsFromConfig; | |
_magazineSlotsTypeArray = _magazineSlotsFromConfig select 0; | |
_magazineSlotsCountArray = _magazineSlotsFromConfig select 1; | |
_magazineCountFromConfig = [_vehicleName] call t1o_getMagazineCountsFromConfig; | |
_magazinesTypeArray = _magazineCountFromConfig select 0; | |
_magazinesCountArray = _magazineCountFromConfig select 1; | |
_respawnMagazinesTypeArray = _magazineCountFromConfig select 2; | |
_respawnMagazinesCountArray = _magazineCountFromConfig select 3; | |
{ | |
_magazineType = _x; | |
_magazineCount = _magazinesCountArray select _forEachIndex; | |
_slotCountIndex = [_magazineSlotsTypeArray, _magazineType] call t1o_findInArray; | |
if (_slotCountIndex == -1) then | |
{ | |
_readableWeaponType = [_magazineType] call t1o_readableWeaponType; | |
_msg = format["Class %1 has magazine of type %2, for which he has no slot", _vehicleName, _readableWeaponType]; | |
diag_log [diag_frameNo, diag_tickTime, time, _msg]; | |
_singleError = true; | |
} | |
else | |
{ | |
_slotCount = _magazineSlotsCountArray select _slotCountIndex; | |
if (_magazineCount > _slotCount) then | |
{ | |
_overflowSize = _magazineCount - _slotCount; | |
_readableWeaponType = [_magazineType] call t1o_readableWeaponType; | |
_msg = format["Class %1 has %2 more magazines of type %3 than there are slots", _vehicleName, _overflowSize, _readableWeaponType]; | |
diag_log [diag_frameNo, diag_tickTime, time, _msg]; | |
_singleError = true; | |
}; | |
}; | |
}forEach _magazinesTypeArray; | |
{ | |
_magazineType = _x; | |
_magazineCount = _respawnMagazinesCountArray select _forEachIndex; | |
_slotCountIndex = [_magazineSlotsTypeArray, _magazineType] call t1o_findInArray; | |
if (_slotCountIndex == -1) then | |
{ | |
_readableWeaponType = [_magazineType] call t1o_readableWeaponType; | |
_msg = format["Class %1 has respawnmagazine of type %2, for which he has no slot", _vehicleName, _readableWeaponType]; | |
diag_log [diag_frameNo, diag_tickTime, time, _msg]; | |
_singleError = true; | |
} | |
else | |
{ | |
_slotCount = _magazineSlotsCountArray select _slotCountIndex; | |
if (_magazineCount > _slotCount) then | |
{ | |
_overflowSize = _magazineCount - _slotCount; | |
_readableWeaponType = [_magazineType] call t1o_readableWeaponType; | |
_msg = format["Class %1 has %2 more respawnmagazines of type %3 than there are slots", _vehicleName, _overflowSize, _readableWeaponType]; | |
diag_log [diag_frameNo, diag_tickTime, time, _msg]; | |
_singleError = true; | |
}; | |
}; | |
}forEach _respawnMagazinesTypeArray; | |
}; | |
}; | |
if (_singleError) then | |
{ | |
error = true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment