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 functions {
|
||||||
class init {
|
class init {
|
||||||
file = "\armatak\armatak\armatak_main\functions\fn_init.sqf";
|
file = "\armatak\armatak\armatak_main\functions\fn_init.sqf";
|
||||||
postInit = 1;
|
|
||||||
};
|
};
|
||||||
class extract_callsign {
|
class extract_callsign {
|
||||||
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_callsign.sqf";
|
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_callsign.sqf";
|
||||||
@@ -26,8 +25,8 @@ class CfgFunctions {
|
|||||||
class extract_uuid {
|
class extract_uuid {
|
||||||
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_uuid.sqf";
|
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_uuid.sqf";
|
||||||
};
|
};
|
||||||
class extract_auth_token {
|
class extract_ots_auth_token {
|
||||||
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_extract_auth_token.sqf";
|
file = "\armatak\armatak\armatak_main\functions\extract_data\fn_ots_extract_auth_token.sqf";
|
||||||
};
|
};
|
||||||
class convert_location {
|
class convert_location {
|
||||||
file = "\armatak\armatak\armatak_main\functions\map\fn_convert_location.sqf";
|
file = "\armatak\armatak\armatak_main\functions\map\fn_convert_location.sqf";
|
||||||
@@ -44,14 +43,14 @@ class CfgFunctions {
|
|||||||
class convert_to_vr {
|
class convert_to_vr {
|
||||||
file = "\armatak\armatak\armatak_main\functions\map\fn_convert_to_vr.sqf";
|
file = "\armatak\armatak\armatak_main\functions\map\fn_convert_to_vr.sqf";
|
||||||
};
|
};
|
||||||
class postMarkers {
|
class ots_postMarkers {
|
||||||
file = "\armatak\armatak\armatak_main\functions\api\fn_postMarkers.sqf";
|
file = "\armatak\armatak\armatak_main\functions\api\fn_ots_postMarkers.sqf";
|
||||||
};
|
};
|
||||||
class postMarkersDebug {
|
class ots_postMarkersDebug {
|
||||||
file = "\armatak\armatak\armatak_main\functions\api\fn_postMarkersDebug.sqf";
|
file = "\armatak\armatak\armatak_main\functions\api\fn_ots_postMarkersDebug.sqf";
|
||||||
};
|
};
|
||||||
class deleteMarkers {
|
class ots_deleteMarkers {
|
||||||
file = "\armatak\armatak\armatak_main\functions\api\fn_deleteMarkers.sqf";
|
file = "\armatak\armatak\armatak_main\functions\api\fn_ots_deleteMarkers.sqf";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class CfgVehicles {
|
|||||||
category = "armatak_module_category";
|
category = "armatak_module_category";
|
||||||
function = "armatak_fnc_init";
|
function = "armatak_fnc_init";
|
||||||
functionPriority = 1;
|
functionPriority = 1;
|
||||||
isGlobal = 2;
|
isGlobal = 0;
|
||||||
isTriggerActivated = 0;
|
isTriggerActivated = 0;
|
||||||
isDisposable = 1;
|
isDisposable = 1;
|
||||||
is3den = 0;
|
is3den = 0;
|
||||||
@@ -50,10 +50,10 @@ class CfgVehicles {
|
|||||||
|
|
||||||
class Attributes: AttributesBase {
|
class Attributes: AttributesBase {
|
||||||
class Units: Units {
|
class Units: Units {
|
||||||
property = "armatak_module_property_attached_units";
|
property = "armatak_module_attached_units";
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance: Combo {
|
class armatak_module_api_instance: Combo {
|
||||||
property = "armatak_module_property_api_instance";
|
property = "armatak_module_api_instance";
|
||||||
displayname = "TAK API Instance";
|
displayname = "TAK API Instance";
|
||||||
tooltip = "Used TAK Server Instance";
|
tooltip = "Used TAK Server Instance";
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
@@ -65,7 +65,7 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance_protocol: Combo {
|
class armatak_module_api_instance_protocol: Combo {
|
||||||
property = "armatak_module_property_api_instance_protocol";
|
property = "armatak_module_api_instance_protocol";
|
||||||
displayname = "OTS Protocol";
|
displayname = "OTS Protocol";
|
||||||
tooltip = "OpenTAKServer instance protocol";
|
tooltip = "OpenTAKServer instance protocol";
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
@@ -77,28 +77,28 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance_address: Edit {
|
class armatak_module_api_instance_address: Edit {
|
||||||
property = "armatak_module_property_api_instance_address";
|
property = "armatak_module_api_instance_address";
|
||||||
displayname = "OTS Address";
|
displayname = "OTS Address";
|
||||||
tooltip = "OpenTAKServer Instance Address";
|
tooltip = "OpenTAKServer Instance Address";
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
defaultValue = "localhost";
|
defaultValue = "localhost";
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance_port: Edit {
|
class armatak_module_api_instance_port: Edit {
|
||||||
property = "armatak_module_property_api_instance_port";
|
property = "armatak_module_api_instance_port";
|
||||||
displayname = "OTS Port";
|
displayname = "OTS Port";
|
||||||
tooltip = "OpenTAKServer Instance Port";
|
tooltip = "OpenTAKServer Instance Port";
|
||||||
typeName = "NUMBER";
|
typeName = "NUMBER";
|
||||||
defaultValue = "8080";
|
defaultValue = "8080";
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance_username: Edit {
|
class armatak_module_api_instance_username: Edit {
|
||||||
property = "armatak_module_property_api_instance_username";
|
property = "armatak_module_api_instance_username";
|
||||||
displayname = "API Username";
|
displayname = "API Username";
|
||||||
tooltip = "API Username for authorization";
|
tooltip = "API Username for authorization";
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
defaultValue = "administrator";
|
defaultValue = "administrator";
|
||||||
};
|
};
|
||||||
class armatak_module_api_instance_password: Edit {
|
class armatak_module_api_instance_password: Edit {
|
||||||
property = "armatak_module_property_api_instance_password";
|
property = "armatak_module_api_instance_password";
|
||||||
displayname = "API Password";
|
displayname = "API Password";
|
||||||
tooltip = "API Password for authorization";
|
tooltip = "API Password for authorization";
|
||||||
typeName = "STRING";
|
typeName = "STRING";
|
||||||
|
|||||||
@@ -5,53 +5,56 @@ params [
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (isServer && _activated) exitWith {
|
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;
|
[[_warning, 1.5]] call CBA_fnc_notify;
|
||||||
|
|
||||||
private _atak_instance_protocol = _logic getVariable "armatak_module_api_instance_protocol";
|
_atak_instance = _logic getVariable "armatak_module_api_instance";
|
||||||
private _atak_instance_address = _logic getVariable "armatak_module_api_instance_address";
|
_atak_instance_protocol = _logic getVariable "armatak_module_api_instance_protocol";
|
||||||
private _atak_instance_port = _logic getVariable "armatak_module_api_instance_port";
|
_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);
|
_atak_fulladdress = _atak_instance_protocol + ":" + "/" + "/" + _atak_instance_address + ":" + (str _atak_instance_port);
|
||||||
private _atak_api_username = _logic getVariable "armatak_module_api_instance_username";
|
_atak_api_username = _logic getVariable "armatak_module_api_instance_username";
|
||||||
private _atak_api_password = _logic getVariable "armatak_module_api_instance_password";
|
_atak_api_password = _logic getVariable "armatak_module_api_instance_password";
|
||||||
|
|
||||||
missionNamespace setVariable ["_atak_server_instance", _atak_fulladdress];
|
if (_atak_instance == "ots") then {
|
||||||
missionNamespace setVariable ["_atak_server_instance_username", _atak_api_username];
|
missionNamespace setVariable ["_atak_server_instance", _atak_fulladdress];
|
||||||
missionNamespace setVariable ["_atak_server_instance_password", _atak_api_password];
|
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 {
|
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"];
|
private _warning = format ["<t color='#FF0000'>ARMATAK</t><br/> %1", "Connection Failed"];
|
||||||
[[_warning, 2]] call CBA_fnc_notify;
|
[[_warning, 2]] call CBA_fnc_notify;
|
||||||
} else {
|
} else {
|
||||||
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Connected"];
|
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Connected"];
|
||||||
[[_warning, 2]] call CBA_fnc_notify;
|
[[_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 {
|
if (unitIsUAV _x) then {
|
||||||
_marker = _x call armatak_fnc_extract_drone_info;
|
_marker = _x call armatak_fnc_extract_drone_info;
|
||||||
_markers append [_marker];
|
_markers append [_marker];
|
||||||
} else {
|
} else {
|
||||||
_marker = _x call armatak_fnc_extract_info;
|
_marker = _x call armatak_fnc_extract_info;
|
||||||
_markers append [_marker];
|
_markers append [_marker];
|
||||||
};
|
};
|
||||||
} forEach _syncedUnits;
|
} forEach _syncedUnits;
|
||||||
|
|
||||||
_request = "armatak" callExtension ["ots_api:post", [_markers]];
|
_request = "armatak" callExtension ["ots_api:post", [_markers]];
|
||||||
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||||
}, [], 1] call CBA_fnc_waitAndExecute;
|
}, [], 1] call CBA_fnc_waitAndExecute;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
Reference in New Issue
Block a user