diff --git a/addons/main/functions/fn_init.sqf b/addons/main/functions/fn_init.sqf index 1be8409..5656db7 100644 --- a/addons/main/functions/fn_init.sqf +++ b/addons/main/functions/fn_init.sqf @@ -1,21 +1,29 @@ -if ((!isServer) && (player != player)) then { - waitUntil { - player == player - }; -}; +params [ + ["_logic", objNull, [objNull]], + ["_units", [], [[]]], + ["_activated", true, [true]] +]; -if (isDedicated) exitWith {}; +if (_activated) exitWith { + private _warning = format ["ARMATAK
%1", "Connecting..."]; + [[_warning, 1.5]] call CBA_fnc_notify; -if (player != player) then { - waitUntil { - player == player - }; -}; - -{ - [{if (_x getVariable "_atak_uid" == "") then { - [_x] call armatak_fnc_postGeoObject; - } else { - [_x] call armatak_fnc_putGeoObject; - }},0,[]] call CBA_fnc_addPerFrameHandler; -} forEach playableUnits; + _atak_fts_address = _logic getVariable "armatak_module_fts_api_instance_address"; + _atak_fts_protocol = _logic getVariable "armatak_module_fts_api_instance_protocol"; + _atak_fts_port = _logic getVariable "armatak_module_fts_api_instance_port"; + + _atak_fts_fulladdress = _atak_fts_protocol + ":" + "/" + "/" + _atak_fts_address + ":" + (str _atak_fts_port); + _atak_fts_bearer_token = _logic getVariable "armatak_module_fts_api_instance_token"; + + missionNamespace setVariable ["_atak_server_instance",_atak_fts_fulladdress]; + missionNamespace setVariable ["_atak_server_instance_token",_atak_fts_bearer_token]; + + [{ + _uid = _x getVariable "_atak_uid"; + if (isNull _uid) then { + player call armatak_fnc_postGeoObject; + } else { + player call armatak_fnc_putGeoObject; + }; + },2,[]] call CBA_fnc_addPerFrameHandler; +}; \ No newline at end of file