linted OTS/FTS handling, fixed module init function getVars

This commit is contained in:
Valmo Trindade
2024-12-30 04:23:42 -03:00
parent c0c8932bbc
commit 763c71e748
7 changed files with 54 additions and 52 deletions

View File

@@ -5,53 +5,56 @@ params [
];
if (isServer && _activated) exitWith {
private _warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Connecting to OTS Server..."];
_warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Connecting to API Provider..."];
[[_warning, 1.5]] call CBA_fnc_notify;
private _atak_instance_protocol = _logic getVariable "armatak_module_api_instance_protocol";
private _atak_instance_address = _logic getVariable "armatak_module_api_instance_address";
private _atak_instance_port = _logic getVariable "armatak_module_api_instance_port";
_atak_instance = _logic getVariable "armatak_module_api_instance";
_atak_instance_protocol = _logic getVariable "armatak_module_api_instance_protocol";
_atak_instance_address = _logic getVariable "armatak_module_api_instance_address";
_atak_instance_port = _logic getVariable "armatak_module_api_instance_port";
private _atak_fulladdress = _atak_instance_protocol + ":" + "/" + "/" + _atak_instance_address + ":" + (str _atak_instance_port);
private _atak_api_username = _logic getVariable "armatak_module_api_instance_username";
private _atak_api_password = _logic getVariable "armatak_module_api_instance_password";
_atak_fulladdress = _atak_instance_protocol + ":" + "/" + "/" + _atak_instance_address + ":" + (str _atak_instance_port);
_atak_api_username = _logic getVariable "armatak_module_api_instance_username";
_atak_api_password = _logic getVariable "armatak_module_api_instance_password";
missionNamespace setVariable ["_atak_server_instance", _atak_fulladdress];
missionNamespace setVariable ["_atak_server_instance_username", _atak_api_username];
missionNamespace setVariable ["_atak_server_instance_password", _atak_api_password];
if (_atak_instance == "ots") then {
missionNamespace setVariable ["_atak_server_instance", _atak_fulladdress];
missionNamespace setVariable ["_atak_server_instance_username", _atak_api_username];
missionNamespace setVariable ["_atak_server_instance_password", _atak_api_password];
_atak_server_instance_token = call armatak_fnc_extract_auth_token;
_atak_server_instance_token = call armatak_fnc_extract_auth_token;
if ((_atak_server_instance_token == "") and !(["ERROR", _atak_server_instance_token, false] call BIS_fnc_inString)) then {
private _warning = format ["<t color='#FF0000'>ARMATAK</t><br/> %1", "Connection Failed"];
[[_warning, 2]] call CBA_fnc_notify;
} else {
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Connected"];
[[_warning, 2]] call CBA_fnc_notify;
};
if ((_atak_server_instance_token == "") and !(["ERROR", _atak_server_instance_token, false] call BIS_fnc_inString)) then {
private _warning = format ["<t color='#FF0000'>ARMATAK</t><br/> %1", "Connection Failed"];
[[_warning, 2]] call CBA_fnc_notify;
} else {
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Connected"];
[[_warning, 2]] call CBA_fnc_notify;
};
_syncUnits = synchronizedObjects _logic;
_syncUnits = synchronizedObjects _logic;
missionNamespace setVariable ["_armatak_marked_units", _syncUnits];
missionNamespace setVariable ["_armatak_marked_units", _syncUnits];
[{
[{
_syncedUnits = missionNamespace getVariable "_armatak_marked_units";
_markers = [];
[{
_syncedUnits = missionNamespace getVariable "_armatak_marked_units";
_markers = [];
{
if (unitIsUAV _x) then {
_marker = _x call armatak_fnc_extract_drone_info;
_markers append [_marker];
} else {
_marker = _x call armatak_fnc_extract_info;
_markers append [_marker];
};
} forEach _syncedUnits;
{
if (unitIsUAV _x) then {
_marker = _x call armatak_fnc_extract_drone_info;
_markers append [_marker];
} else {
_marker = _x call armatak_fnc_extract_info;
_markers append [_marker];
};
} forEach _syncedUnits;
_request = "armatak" callExtension ["ots_api:post", [_markers]];
}, 1, []] call CBA_fnc_addPerFrameHandler;
}, [], 1] call CBA_fnc_waitAndExecute;
_request = "armatak" callExtension ["ots_api:post", [_markers]];
}, 1, []] call CBA_fnc_addPerFrameHandler;
}, [], 1] call CBA_fnc_waitAndExecute;
};
};
true;