mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 15:33:29 +00:00
linted OTS/FTS handling, fixed module init function getVars
This commit is contained in:
@@ -3,7 +3,6 @@ class CfgFunctions {
|
||||
class functions {
|
||||
class init {
|
||||
file = "\armatak\armatak\armatak_main\functions\fn_init.sqf";
|
||||
postInit = 1;
|
||||
};
|
||||
class extract_callsign {
|
||||
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_callsign.sqf";
|
||||
@@ -26,8 +25,8 @@ class CfgFunctions {
|
||||
class extract_uuid {
|
||||
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_uuid.sqf";
|
||||
};
|
||||
class extract_auth_token {
|
||||
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_auth_token.sqf";
|
||||
class extract_ots_auth_token {
|
||||
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_ots_extract_auth_token.sqf";
|
||||
};
|
||||
class convert_location {
|
||||
file = "\armatak\armatak\armatak_main\functions\map\fn_convert_location.sqf";
|
||||
@@ -44,14 +43,14 @@ class CfgFunctions {
|
||||
class convert_to_vr {
|
||||
file = "\armatak\armatak\armatak_main\functions\map\fn_convert_to_vr.sqf";
|
||||
};
|
||||
class postMarkers {
|
||||
file = "\armatak\armatak\armatak_main\functions\api\fn_postMarkers.sqf";
|
||||
class ots_postMarkers {
|
||||
file = "\armatak\armatak\armatak_main\functions\api\fn_ots_postMarkers.sqf";
|
||||
};
|
||||
class postMarkersDebug {
|
||||
file = "\armatak\armatak\armatak_main\functions\api\fn_postMarkersDebug.sqf";
|
||||
class ots_postMarkersDebug {
|
||||
file = "\armatak\armatak\armatak_main\functions\api\fn_ots_postMarkersDebug.sqf";
|
||||
};
|
||||
class deleteMarkers {
|
||||
file = "\armatak\armatak\armatak_main\functions\api\fn_deleteMarkers.sqf";
|
||||
class ots_deleteMarkers {
|
||||
file = "\armatak\armatak\armatak_main\functions\api\fn_ots_deleteMarkers.sqf";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ class CfgVehicles {
|
||||
category = "armatak_module_category";
|
||||
function = "armatak_fnc_init";
|
||||
functionPriority = 1;
|
||||
isGlobal = 2;
|
||||
isGlobal = 0;
|
||||
isTriggerActivated = 0;
|
||||
isDisposable = 1;
|
||||
is3den = 0;
|
||||
@@ -50,10 +50,10 @@ class CfgVehicles {
|
||||
|
||||
class Attributes: AttributesBase {
|
||||
class Units: Units {
|
||||
property = "armatak_module_property_attached_units";
|
||||
property = "armatak_module_attached_units";
|
||||
};
|
||||
class armatak_module_api_instance: Combo {
|
||||
property = "armatak_module_property_api_instance";
|
||||
property = "armatak_module_api_instance";
|
||||
displayname = "TAK API Instance";
|
||||
tooltip = "Used TAK Server Instance";
|
||||
typeName = "STRING";
|
||||
@@ -65,7 +65,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
class armatak_module_api_instance_protocol: Combo {
|
||||
property = "armatak_module_property_api_instance_protocol";
|
||||
property = "armatak_module_api_instance_protocol";
|
||||
displayname = "OTS Protocol";
|
||||
tooltip = "OpenTAKServer instance protocol";
|
||||
typeName = "STRING";
|
||||
@@ -77,28 +77,28 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
class armatak_module_api_instance_address: Edit {
|
||||
property = "armatak_module_property_api_instance_address";
|
||||
property = "armatak_module_api_instance_address";
|
||||
displayname = "OTS Address";
|
||||
tooltip = "OpenTAKServer Instance Address";
|
||||
typeName = "STRING";
|
||||
defaultValue = "localhost";
|
||||
};
|
||||
class armatak_module_api_instance_port: Edit {
|
||||
property = "armatak_module_property_api_instance_port";
|
||||
property = "armatak_module_api_instance_port";
|
||||
displayname = "OTS Port";
|
||||
tooltip = "OpenTAKServer Instance Port";
|
||||
typeName = "NUMBER";
|
||||
defaultValue = "8080";
|
||||
};
|
||||
class armatak_module_api_instance_username: Edit {
|
||||
property = "armatak_module_property_api_instance_username";
|
||||
property = "armatak_module_api_instance_username";
|
||||
displayname = "API Username";
|
||||
tooltip = "API Username for authorization";
|
||||
typeName = "STRING";
|
||||
defaultValue = "administrator";
|
||||
};
|
||||
class armatak_module_api_instance_password: Edit {
|
||||
property = "armatak_module_property_api_instance_password";
|
||||
property = "armatak_module_api_instance_password";
|
||||
displayname = "API Password";
|
||||
tooltip = "API Password for authorization";
|
||||
typeName = "STRING";
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user