Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- get_good_val_to_add = {
- _mag_array_and_max = _this select 0;
- _max_multiplier = _this select 1;
- _mag_type = _this select 2;
- _result_to_add = 0;
- {
- if ((_x select 0) == _mag_type) exitWith {
- _mag_max_count = _x select 1;
- _result_to_add = _mag_max_count * _max_multiplier
- };
- }forEach _mag_array_and_max;
- _result_to_add;
- };
- get_munitions_level = {
- _vehicle = _this select 0;
- _munition_level = 0;
- _false_munition_level = 0;
- _max_munition_level = 0;
- _all_magazines_one_time = [];
- _magazines_one_time_count = [];
- _magazines_type_and_max_count = [];
- _all_infos_turrets = magazinesAllTurrets _vehicle;
- {
- _magazine_type = _x select 0;
- _magazine_count = _x select 2;
- if !(_magazine_type in _all_magazines_one_time) then {
- _all_magazines_one_time pushBack _magazine_type;
- };
- if (count _magazines_one_time_count > 0) then {
- _can_add = true;
- for "_arr_index" from 0 to ((count _magazines_one_time_count) - 1) do {
- _mag_array = _magazines_one_time_count select _arr_index;
- _mag_type = _mag_array select 0;
- if (_mag_type == _magazine_type) then {
- _mag_array pushBack _magazine_type;
- _can_add = false;
- };
- };
- if (_can_add) then {
- _magazines_one_time_count pushBack [_magazine_type];
- };
- }
- else {
- _magazines_one_time_count pushBack [_magazine_type];
- };
- _false_munition_level = _false_munition_level + _magazine_count;
- }forEach _all_infos_turrets;
- {
- _magazines_type_and_max_count pushBack [_x, getNumber (configfile >> "CfgMagazines" >> _x >> "count")];
- }forEach _all_magazines_one_time;
- {
- _max_munition_level = _max_munition_level + ([_magazines_type_and_max_count, (count _x), (_x select 0)] call get_good_val_to_add);
- }forEach _magazines_one_time_count;
- _munition_level = (_false_munition_level / _max_munition_level);
- _munition_level;
- };
Add Comment
Please, Sign In to add comment