From f2c7b23dc86419f2d63be20c4819812e1d036623 Mon Sep 17 00:00:00 2001 From: Valmo Trindade Date: Fri, 31 Jan 2025 05:04:23 -0300 Subject: [PATCH] linted group_cots function to use extract functions --- .../main/functions/api/fn_send_group_cots.sqf | 62 ++----------------- 1 file changed, 4 insertions(+), 58 deletions(-) diff --git a/addons/main/functions/api/fn_send_group_cots.sqf b/addons/main/functions/api/fn_send_group_cots.sqf index 7e6f316..8d98b19 100644 --- a/addons/main/functions/api/fn_send_group_cots.sqf +++ b/addons/main/functions/api/fn_send_group_cots.sqf @@ -5,63 +5,9 @@ params["_group"]; { - _group_colors = missionNamespace getVariable "_group_colors"; + _callsign = [_x] call armatak_fnc_extract_callsign; + _group_name = [_group] call armatak_fnc_extract_group_color; + _group_role = [_x] call armatak_fnc_extract_group_role; - _group_roles = ["Team Member", "Team Lead", "HQ", "Sniper", "Medic", "Forward Observer", "RTO", "K9"]; - - _group_role = "Team Member"; - - _group_name = ""; - - _group_name = _group getVariable "_atak_group_name"; - - if (isNil "_group_name") then { - _group_colors = missionNamespace getVariable "_group_colors"; - _group_name = selectRandom _group_colors; - - if (count _group_colors > 0) then { - _randomIndex = floor (random (count _group_colors)); - - _selectedColor = _group_colors select _randomIndex; - - _group_colors deleteAt _randomIndex; - - _group_name = _selectedColor; - _group setVariable ["_atak_group_name", _group_name]; - missionNamespace setVariable ["_group_colors", _group_colors] - } else { - _group_name = "Red"; - _group setVariable ["_atak_group_name", _group_name]; - }; - }; - - if (["SpecialOperative", (configFile >> "CfgVehicles" >> typeOf _x >> "role") call BIS_fnc_getCfgData, false] call BIS_fnc_inString) then { - _group_role = _group_roles select 5; - }; - - if (_x getUnitTrait "medic") then { - _group_role = _group_roles select 4; - }; - - if ((["jtac", typeOf _x, false] call BIS_fnc_inString)) then { - _group_role = _group_roles select 5; - }; - - if (((backpack _x) isKindOf "TFAR_Bag_Base") or (["radio", typeOf _x, false] call BIS_fnc_inString)) then { - _group_role = _group_roles select 6; - }; - - if ((["sniper", typeOf _x, false] call BIS_fnc_inString) or (["marksman", (configFile >> "CfgVehicles" >> typeOf _x >> "role") call BIS_fnc_getCfgData, false] call BIS_fnc_inString) or (["sharpshooter", typeOf _x, false] call BIS_fnc_inString)) then { - _group_role = _group_roles select 3; - }; - - if (leader _group == _x) then { - _group_role = _group_roles select 1; - }; - - if (["officer", typeOf _x, false] call BIS_fnc_inString) then { - _group_role = _group_roles select 2; - }; - - [_x, name _x, _group_name, _group_role] call armatak_fnc_send_human_cot; + [_x, _callsign, _group_name, _group_role] call armatak_fnc_send_human_cot; } forEach (units _group); \ No newline at end of file