mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 21:33:29 +00:00
added previous OpenTAKServer defined functions
This commit is contained in:
3
addons/main/functions/api/fn_deleteMarkers.sqf
Normal file
3
addons/main/functions/api/fn_deleteMarkers.sqf
Normal file
@@ -0,0 +1,3 @@
|
||||
params["_marker"];
|
||||
|
||||
"armatak" callExtension ["ots_api:delete", _marker call armatak_fnc_extract_info];
|
||||
3
addons/main/functions/api/fn_postMarkers.sqf
Normal file
3
addons/main/functions/api/fn_postMarkers.sqf
Normal file
@@ -0,0 +1,3 @@
|
||||
params["_markers"];
|
||||
|
||||
"armatak" callExtension ["ots_api:post", [_markers]];
|
||||
3
addons/main/functions/api/fn_postMarkersDebug.sqf
Normal file
3
addons/main/functions/api/fn_postMarkersDebug.sqf
Normal file
@@ -0,0 +1,3 @@
|
||||
params["_markers"];
|
||||
|
||||
"armatak" callExtension ["ots_api:post_debug", [markers]];
|
||||
18
addons/main/functions/extract_data/fn_extract_auth_token.sqf
Normal file
18
addons/main/functions/extract_data/fn_extract_auth_token.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
private _atak_server_instance = missionNamespace getVariable "_atak_server_instance";
|
||||
private _atak_server_instance_username = missionNamespace getVariable "_atak_server_instance_username";
|
||||
private _atak_server_instance_password = missionNamespace getVariable "_atak_server_instance_password";
|
||||
private _authentication = [_atak_server_instance, _atak_server_instance_username, _atak_server_instance_password];
|
||||
|
||||
_atak_server_instance_token = ("armatak" callExtension ["ots_api:get_auth_token", [_authentication]]) select 0;
|
||||
|
||||
if ((_atak_server_instance_token != "") and !(["ERROR", _atak_server_instance_token, false] call BIS_fnc_inString)) then {
|
||||
missionNamespace setVariable ["_atak_server_instance_token", _atak_server_instance_token];
|
||||
private _warning = format ["<t color='#2B7319'>ARMATAK</t><br/> %1", "Authorized"];
|
||||
[[_warning, 1.5]] call CBA_fnc_notify;
|
||||
} else {
|
||||
missionNamespace setVariable ["_atak_server_instance_token", _atak_server_instance_token];
|
||||
private _warning = format ["<t color='#FF0000'>ARMATAK</t><br/> %1", "Failed to get Auth Token " + _atak_server_instance_token];
|
||||
[[_warning, 1]] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
_atak_server_instance_token
|
||||
@@ -0,0 +1,8 @@
|
||||
params["_unit"];
|
||||
private _callsign = "";
|
||||
if (roleDescription _unit != "") then {
|
||||
_callsign = name _unit + " | " + roleDescription _unit;
|
||||
} else {
|
||||
_callsign = name _unit;
|
||||
};
|
||||
_callsign
|
||||
32
addons/main/functions/extract_data/fn_extract_drone_info.sqf
Normal file
32
addons/main/functions/extract_data/fn_extract_drone_info.sqf
Normal file
@@ -0,0 +1,32 @@
|
||||
params["_drone"];
|
||||
private _location = (getPos _drone) call armatak_fnc_convert_location;
|
||||
private _atak_uid = _drone call armatak_fnc_extract_uuid;
|
||||
private _atak_latitude = _location select 0;
|
||||
private _atak_longitude = _location select 1;
|
||||
private _atak_speed = speed _drone;
|
||||
private _atak_bearing = parseNumber ((getDir _drone) toFixed 0);
|
||||
private _atak_role = "a-f-A";
|
||||
private _atak_callsign = _drone getVariable "_atak_uav_callsign";
|
||||
private _atak_server_instance = missionNamespace getVariable "_atak_server_instance";
|
||||
private _atak_server_instance_token = missionNamespace getVariable "_atak_server_instance_token";
|
||||
private _atak_altitude = _location select 2;
|
||||
switch (side _drone) do {
|
||||
case "WEST": {
|
||||
_atak_role = "a-f-A-M-F-Q"
|
||||
};
|
||||
case "EAST": {
|
||||
_atak_role = "a-h-A-M-F-Q"
|
||||
};
|
||||
case "INDEPENDENT": {
|
||||
_atak_role = "a-n-A-M-F-Q"
|
||||
};
|
||||
case "CIVILIAN": {
|
||||
_atak_role = "a-f-A-C"
|
||||
};
|
||||
default {
|
||||
_atak_role = "a-f-A-M-F-Q"
|
||||
};
|
||||
};
|
||||
_drone_info = [_atak_uid, _atak_latitude, _atak_longitude, _atak_speed, _atak_bearing, _atak_role, _atak_callsign, _atak_altitude, _atak_server_instance, _atak_server_instance_token];
|
||||
|
||||
_drone_info
|
||||
@@ -5,11 +5,22 @@
|
||||
params["_unit"];
|
||||
private _location = (getPos _unit) call armatak_fnc_convert_location;
|
||||
|
||||
private _atak_uid = [_unit] call armatak_fnc_extract_uuid;
|
||||
private _atak_latitude = _location select 0;
|
||||
private _atak_longitude = _location select 1;
|
||||
private _atak_altitude = _location select 2;
|
||||
private _atak_speed = speed _unit;
|
||||
private _atak_bearing = parseNumber ((getDir _unit) toFixed 0);
|
||||
private _atak_role = [_unit] call armatak_fnc_extract_role;
|
||||
private _atak_callsign = [_unit] call armatak_fnc_extract_callsign;
|
||||
private _atak_altitude = _location select 2;
|
||||
private _atak_server_instance = missionNamespace getVariable "_atak_server_instance";
|
||||
private _atak_server_instance_token = missionNamespace getVariable "_atak_server_instance_token";
|
||||
_drone = vehicle (getConnectedUAVUnit _unit);
|
||||
if (!isNull _drone) then {
|
||||
_drone setVariable ["_atak_uav_connected", true];
|
||||
_drone setVariable ["_atak_uav_callsign", "[UAV]" + name _unit];
|
||||
};
|
||||
|
||||
_unit_info = [_atak_latitude,_atak_longitude,_atak_altitude,_atak_bearing];
|
||||
_unit_info = [_atak_uid, _atak_latitude, _atak_longitude, _atak_speed, _atak_bearing, _atak_role, _atak_callsign, _atak_altitude, _atak_server_instance, _atak_server_instance_token];
|
||||
|
||||
_unit_info
|
||||
100
addons/main/functions/extract_data/fn_extract_role.sqf
Normal file
100
addons/main/functions/extract_data/fn_extract_role.sqf
Normal file
@@ -0,0 +1,100 @@
|
||||
params["_unit"];
|
||||
private _affiliation = "f";
|
||||
private _type = "G";
|
||||
private _role = "a-f-G-U-C-I";
|
||||
switch (side _unit) do {
|
||||
case "WEST": {
|
||||
_affiliation = "f";
|
||||
};
|
||||
case "EAST": {
|
||||
_affiliation = "h";
|
||||
};
|
||||
case "INDEPENDENT": {
|
||||
_affiliation = "n";
|
||||
};
|
||||
case "CIVILIAN": {
|
||||
_affiliation = "u";
|
||||
};
|
||||
default {
|
||||
_affiliation = "f";
|
||||
};
|
||||
};
|
||||
_unit_type = _unit call BIS_fnc_objectType select 1;
|
||||
switch (_unit_type) do {
|
||||
case "AT": {
|
||||
_type = "G-U-C-F-R";
|
||||
};
|
||||
case "Civilian": {
|
||||
_type = "G-E-V-C";
|
||||
};
|
||||
case "Diver": {
|
||||
_type = "U-S";
|
||||
};
|
||||
case "Infantry": {
|
||||
_type = "G-U-C-I";
|
||||
};
|
||||
case "Medic": {
|
||||
_type = "a-f-G-U-C";
|
||||
};
|
||||
case "MG": {
|
||||
_type = "G-U-C-I";
|
||||
};
|
||||
case "Officer": {
|
||||
_type = "G-U-C-I";
|
||||
};
|
||||
case "Pilot": {
|
||||
_type = "G-U-C-V";
|
||||
};
|
||||
case "Sniper": {
|
||||
_type = "G-U-C-R-X";
|
||||
};
|
||||
case "SpecialForces": {
|
||||
_type = "G-U-C-R-X";
|
||||
};
|
||||
case "UAVPilot": {
|
||||
_type = "G-U-C-V-U";
|
||||
};
|
||||
default {
|
||||
_type = "G-U-C-I";
|
||||
};
|
||||
};
|
||||
if (!isNull vehicle _unit) then {
|
||||
_vehicle_type = (vehicle _unit) call BIS_fnc_objectType select 1;
|
||||
switch (_vehicle_type) do {
|
||||
case "Car": {
|
||||
_type = "G-U-C-I-M";
|
||||
};
|
||||
case "Helicopter": {
|
||||
_type = "A-M-H";
|
||||
};
|
||||
case "Motorcycle": {
|
||||
_type = "G-U-C-I-M";
|
||||
};
|
||||
case "Plane": {
|
||||
_type = "A-M-F";
|
||||
};
|
||||
case "Ship": {
|
||||
_type = "S";
|
||||
};
|
||||
case "StaticWeapon": {
|
||||
_type = "G-U-C-F-M";
|
||||
};
|
||||
case "Submarine": {
|
||||
_type = "U-S";
|
||||
};
|
||||
case "TrackedAPC": {
|
||||
_type = "G-U-C-I-I";
|
||||
};
|
||||
case "Tank": {
|
||||
_type = "G-U-C-A-T";
|
||||
};
|
||||
case "WheeledAPC": {
|
||||
_type = "G-U-C-I-Z";
|
||||
};
|
||||
default {};
|
||||
};
|
||||
};
|
||||
|
||||
_role = "a-" + _affiliation + "-" + _type;
|
||||
|
||||
_role
|
||||
20
addons/main/functions/extract_data/fn_extract_side.sqf
Normal file
20
addons/main/functions/extract_data/fn_extract_side.sqf
Normal file
@@ -0,0 +1,20 @@
|
||||
params["_unit"];
|
||||
_side = "friendly";
|
||||
switch (side _unit) do {
|
||||
case "WEST": {
|
||||
_side = "friendly";
|
||||
};
|
||||
case "EAST": {
|
||||
_side = "hostile";
|
||||
};
|
||||
case "INDEPENDENT": {
|
||||
_side = "neutral";
|
||||
};
|
||||
case "CIVILIAN": {
|
||||
_side = "unknown";
|
||||
};
|
||||
default {
|
||||
_side = "friendly";
|
||||
};
|
||||
};
|
||||
_side
|
||||
Reference in New Issue
Block a user