mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 16:03:31 +00:00
added handling on SQF for letting the OTS server handle sync links on entities with core armatak module
This commit is contained in:
@@ -4,5 +4,9 @@ if (roleDescription _unit != "") then {
|
|||||||
_callsign = name _unit + " | " + roleDescription _unit;
|
_callsign = name _unit + " | " + roleDescription _unit;
|
||||||
} else {
|
} else {
|
||||||
_callsign = name _unit;
|
_callsign = name _unit;
|
||||||
|
|
||||||
|
if (_callsign == "Error: No unit") then {
|
||||||
|
_callsign = getText(configFile >> "CfgVehicles" >> typeOf _unit >> "displayName");
|
||||||
|
};
|
||||||
};
|
};
|
||||||
_callsign
|
_callsign
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
params["_drone"];
|
params["_drone"];
|
||||||
|
|
||||||
private _location = (getPos _drone) call armatak_fnc_convert_location;
|
private _location = (getPos _drone) call armatak_fnc_convert_location;
|
||||||
private _atak_uid = _drone call armatak_fnc_extract_uuid;
|
private _atak_uid = _drone call armatak_fnc_extract_uuid;
|
||||||
private _atak_latitude = _location select 0;
|
private _atak_latitude = _location select 0;
|
||||||
@@ -6,10 +7,17 @@ private _atak_longitude = _location select 1;
|
|||||||
private _atak_speed = speed _drone;
|
private _atak_speed = speed _drone;
|
||||||
private _atak_bearing = parseNumber ((getDir _drone) toFixed 0);
|
private _atak_bearing = parseNumber ((getDir _drone) toFixed 0);
|
||||||
private _atak_role = "a-f-A";
|
private _atak_role = "a-f-A";
|
||||||
private _atak_callsign = _drone getVariable "_atak_uav_callsign";
|
private _atak_callsign = "UAV";
|
||||||
private _atak_server_instance = missionNamespace getVariable "_atak_server_instance";
|
private _atak_server_instance = missionNamespace getVariable "_atak_server_instance";
|
||||||
private _atak_server_instance_token = missionNamespace getVariable "_atak_server_instance_token";
|
private _atak_server_instance_token = missionNamespace getVariable "_atak_server_instance_token";
|
||||||
private _atak_altitude = _location select 2;
|
private _atak_altitude = _location select 2;
|
||||||
|
|
||||||
|
if (isUAVConnected _unit) then {
|
||||||
|
_atak_callsign = format ["[UAV]%1", typeOf _unit ];
|
||||||
|
} else {
|
||||||
|
_atak_callsign = getText(configFile >> "CfgVehicles" >> typeOf _unit >> "displayName");
|
||||||
|
};
|
||||||
|
|
||||||
switch (side _drone) do {
|
switch (side _drone) do {
|
||||||
case "WEST": {
|
case "WEST": {
|
||||||
_atak_role = "a-f-A-M-F-Q"
|
_atak_role = "a-f-A-M-F-Q"
|
||||||
@@ -27,6 +35,7 @@ switch (side _drone) do {
|
|||||||
_atak_role = "a-f-A-M-F-Q"
|
_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 = [_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
|
_drone_info
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
// function description: Receives a player's unit as param and return the information array needed to send the HTTP request
|
// function description: Receives a player's unit as param and return the information array needed to send the HTTP request
|
||||||
|
|
||||||
params["_unit"];
|
params["_unit"];
|
||||||
|
|
||||||
private _location = (getPos _unit) call armatak_fnc_convert_location;
|
private _location = (getPos _unit) call armatak_fnc_convert_location;
|
||||||
|
|
||||||
private _atak_uid = [_unit] call armatak_fnc_extract_uuid;
|
private _atak_uid = [_unit] call armatak_fnc_extract_uuid;
|
||||||
@@ -15,11 +16,6 @@ private _atak_callsign = [_unit] call armatak_fnc_extract_callsign;
|
|||||||
private _atak_altitude = _location select 2;
|
private _atak_altitude = _location select 2;
|
||||||
private _atak_server_instance = missionNamespace getVariable "_atak_server_instance";
|
private _atak_server_instance = missionNamespace getVariable "_atak_server_instance";
|
||||||
private _atak_server_instance_token = missionNamespace getVariable "_atak_server_instance_token";
|
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_uid, _atak_latitude, _atak_longitude, _atak_speed, _atak_bearing, _atak_role, _atak_callsign, _atak_altitude, _atak_server_instance, _atak_server_instance_token];
|
_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];
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ if (isServer && _activated) exitWith {
|
|||||||
missionNamespace setVariable ["_atak_server_instance", _atak_fulladdress];
|
missionNamespace setVariable ["_atak_server_instance", _atak_fulladdress];
|
||||||
missionNamespace setVariable ["_atak_server_instance_username", _atak_api_username];
|
missionNamespace setVariable ["_atak_server_instance_username", _atak_api_username];
|
||||||
missionNamespace setVariable ["_atak_server_instance_password", _atak_api_password];
|
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 == "") then {
|
if (_atak_server_instance_token == "") 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;
|
||||||
@@ -29,7 +29,31 @@ if (isServer && _activated) exitWith {
|
|||||||
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;
|
||||||
|
|
||||||
|
missionNamespace setVariable ["_armatak_marked_units", _syncUnits];
|
||||||
|
|
||||||
|
[{
|
||||||
|
[{
|
||||||
|
_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;
|
||||||
|
|
||||||
|
_request = "armatak" callExtension ["ots_api:post", [_markers]];
|
||||||
|
|
||||||
|
systemChat format ["Result: %1, Code: %2", _request select 0, _request select 1];
|
||||||
|
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
}, [], 5] call CBA_fnc_waitAndExecute;
|
||||||
};
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
@@ -62,7 +62,7 @@ pub async fn async_post_markers(data: Vec<Marker>) {
|
|||||||
let parsed_address: String =
|
let parsed_address: String =
|
||||||
data[0].api_address.clone() + "/api/markers?auth_token=" + &authentication_token;
|
data[0].api_address.clone() + "/api/markers?auth_token=" + &authentication_token;
|
||||||
|
|
||||||
let mut status: String = "fetching".to_string();
|
let mut status: String = format!("fetching {} markers", data.len().to_string());
|
||||||
|
|
||||||
info!("{}", status);
|
info!("{}", status);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user