mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 23:13:28 +00:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13cd08c655 | ||
|
|
8fe14dc18d | ||
|
|
1bec26df8a | ||
|
|
c5d5da636f | ||
|
|
c2e137e67c | ||
|
|
de5ac9dbb5 | ||
|
|
ef3be1e768 | ||
|
|
9bda92d389 | ||
|
|
9763cb6697 | ||
|
|
5ac49e12f8 | ||
|
|
2108d20b01 | ||
|
|
524e7a0b3e | ||
|
|
7e4379ada4 | ||
|
|
572b2a360f | ||
|
|
083ccd2906 | ||
|
|
35a45d2cd4 | ||
|
|
2b241fbeaf | ||
|
|
ad9ba834cc | ||
|
|
469403d9b5 |
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -75,7 +75,6 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"log4rs",
|
"log4rs",
|
||||||
"once_cell",
|
|
||||||
"serde",
|
"serde",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ chrono = "0.4.39"
|
|||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
log = "0.4.22"
|
log = "0.4.22"
|
||||||
log4rs = "1.3.0"
|
log4rs = "1.3.0"
|
||||||
once_cell = "1.19.0"
|
|
||||||
serde = { version = "1.0.210", features = ["derive"] }
|
serde = { version = "1.0.210", features = ["derive"] }
|
||||||
|
|
||||||
[dependencies.uuid]
|
[dependencies.uuid]
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ switch (toLower worldName) do {
|
|||||||
case "vr": {
|
case "vr": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_vr;
|
_realLocation = _position call armatak_fnc_convert_to_vr;
|
||||||
};
|
};
|
||||||
|
case "lawn": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_lawn;
|
||||||
|
};
|
||||||
case "cucui": {
|
case "cucui": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_cucui;
|
_realLocation = _position call armatak_fnc_convert_to_cucui;
|
||||||
};
|
};
|
||||||
@@ -74,9 +77,36 @@ switch (toLower worldName) do {
|
|||||||
case "kunduz_valley": {
|
case "kunduz_valley": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_kunduz_valley;
|
_realLocation = _position call armatak_fnc_convert_to_kunduz_valley;
|
||||||
};
|
};
|
||||||
|
case "malvinasfalkands": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_malvinasfalkands;
|
||||||
|
};
|
||||||
|
case "pebble_island_airfield": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_pebble_island_airfield;
|
||||||
|
};
|
||||||
|
case "p_argentino_stanley": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_p_argentino_stanley;
|
||||||
|
};
|
||||||
|
case "top_malo_house": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_top_malo_house;
|
||||||
|
};
|
||||||
|
case "pradera_ganso": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_malvinas_pradera_ganso;
|
||||||
|
};
|
||||||
case "tanoa": {
|
case "tanoa": {
|
||||||
_realLocation = _position call armatak_fnc_convert_to_tanoa;
|
_realLocation = _position call armatak_fnc_convert_to_tanoa;
|
||||||
};
|
};
|
||||||
|
case "zagor_zagorsk_reserved_forest": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_zagor_zagorsk_reserved_forest;
|
||||||
|
};
|
||||||
|
case "umb_colombia": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_colombia;
|
||||||
|
};
|
||||||
|
case "clafghan": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_clafghan;
|
||||||
|
};
|
||||||
|
case "rut_mandol": {
|
||||||
|
_realLocation = _position call armatak_fnc_convert_to_rut_mandol;
|
||||||
|
};
|
||||||
default {
|
default {
|
||||||
_warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Unsupported Map"];
|
_warning = format ["<t color='#FF8021'>ARMATAK</t><br/> %1", "Unsupported Map"];
|
||||||
[[_warning, 1.5]] call CBA_fnc_notify;
|
[[_warning, 1.5]] call CBA_fnc_notify;
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ class CfgFunctions {
|
|||||||
class send_group_cots {
|
class send_group_cots {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_send_group_cots.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_group_cots.sqf";
|
||||||
};
|
};
|
||||||
|
class send_enemy_cot {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_enemy_cot.sqf";
|
||||||
|
};
|
||||||
class send_eud_cot {
|
class send_eud_cot {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_send_eud_cot.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_send_eud_cot.sqf";
|
||||||
};
|
};
|
||||||
@@ -31,6 +34,9 @@ class CfgFunctions {
|
|||||||
class extract_role {
|
class extract_role {
|
||||||
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_role.sqf";
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_role.sqf";
|
||||||
};
|
};
|
||||||
|
class extract_sensor_data {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_sensor_data.sqf";
|
||||||
|
};
|
||||||
class extract_unit_callsign {
|
class extract_unit_callsign {
|
||||||
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_unit_callsign.sqf";
|
file = "\armatak\armatak\addons\main\functions\extract_data\fn_extract_unit_callsign.sqf";
|
||||||
};
|
};
|
||||||
@@ -62,12 +68,30 @@ class CfgFunctions {
|
|||||||
class convert_to_kunduz_valley {
|
class convert_to_kunduz_valley {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_kunduz_valley.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_kunduz_valley.sqf";
|
||||||
};
|
};
|
||||||
|
class convert_to_lawn {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_lawn.sqf";
|
||||||
|
};
|
||||||
class convert_to_livonia {
|
class convert_to_livonia {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_livonia.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_livonia.sqf";
|
||||||
};
|
};
|
||||||
class convert_to_malden {
|
class convert_to_malden {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malden.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malden.sqf";
|
||||||
};
|
};
|
||||||
|
class convert_to_malvinas_malvinasfalkands {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_malvinasfalkands.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_p_argentino_stanley {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_p_argentino_stanley.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_pebble_island_airfield {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_pebble_island_airfield.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_pradera_ganso {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_pradera_ganso.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_malvinas_top_malo_house {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_malvinas_top_malo_house.sqf";
|
||||||
|
};
|
||||||
class convert_to_southen_sahrani {
|
class convert_to_southen_sahrani {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_southen_sahrani.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_southen_sahrani.sqf";
|
||||||
};
|
};
|
||||||
@@ -86,6 +110,18 @@ class CfgFunctions {
|
|||||||
class convert_to_vr {
|
class convert_to_vr {
|
||||||
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_vr.sqf";
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_vr.sqf";
|
||||||
};
|
};
|
||||||
|
class convert_to_zagor_zagorsk_reserved_forest {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_zagor_zagorsk_reserved_forest.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_colombia {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_colombia.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_clafghan {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_clafghan.sqf";
|
||||||
|
};
|
||||||
|
class convert_to_rut_mandol {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_rut_mandol.sqf";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ if (!isNull _digitalPointer) then {
|
|||||||
_link_uid = [_unit] call armatak_fnc_extract_uuid;
|
_link_uid = [_unit] call armatak_fnc_extract_uuid;
|
||||||
_contact_callsign = ([player] call armatak_fnc_extract_unit_callsign) + ".DP1";
|
_contact_callsign = ([player] call armatak_fnc_extract_unit_callsign) + ".DP1";
|
||||||
|
|
||||||
_dpCot = [_link_uid, _contact_callsign, _digitalPointerPosition select 0, _digitalPointerPosition select 1, _digitalPointerPosition select 2];
|
_dpCot = [_link_uid, _contact_callsign, _digitalPointerPosition select 1, _digitalPointerPosition select 2, _digitalPointerPosition select 3];
|
||||||
|
|
||||||
"armatak" callExtension ["tcp_socket:send_digital_pointer_cot", [_dpCot]];
|
"armatak" callExtension ["tcp_socket:cot:digital_pointer", [_dpCot]];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
// function name: armatak_fnc_extract_drone
|
// function name: armatak_fnc_send_drone_cot
|
||||||
// function author: Valmo
|
// function author: Valmo
|
||||||
// function description: Gets the drone information for the CoT Router
|
// function description: Gets the drone information for the CoT Router
|
||||||
|
|
||||||
params["_drone"];
|
params["_drone"];
|
||||||
|
|
||||||
private _atak_role = "a-f-A";
|
private _atak_role = "a-f-A";
|
||||||
private _atak_callsign = [_drone] call armatak_fnc_extract_unit_callsign;
|
private _atak_callsign = [_drone] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
switch (side _drone) do {
|
switch (side _drone) do {
|
||||||
case "WEST": {
|
case "WEST": {
|
||||||
@@ -25,4 +25,10 @@ switch (side _drone) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_pre_defined_role = _drone getVariable "_atak_group_role";
|
||||||
|
|
||||||
|
if (!isNil "_pre_defined_role") then {
|
||||||
|
_callsign = _pre_defined_role;
|
||||||
|
};
|
||||||
|
|
||||||
_cot = [_drone, _atak_role, _atak_callsign] call armatak_fnc_send_marker_cot;
|
_cot = [_drone, _atak_role, _atak_callsign] call armatak_fnc_send_marker_cot;
|
||||||
|
|||||||
15
addons/main/functions/api/fn_send_enemy_cot.sqf
Normal file
15
addons/main/functions/api/fn_send_enemy_cot.sqf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// function name: armatak_fnc_send_eud_cot
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Gets the information necessary for generating the EUD Cursor Over Time
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
_unit_position = _unit call armatak_client_fnc_extractClientPosition;
|
||||||
|
|
||||||
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
|
_type = _unit call armatak_fnc_extract_role;
|
||||||
|
_callsign = _unit call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// function name: armatak_fnc_extract_eud_cot_info
|
// function name: armatak_fnc_send_eud_cot
|
||||||
// function author: Valmo
|
// function author: Valmo
|
||||||
// function description: Gets the information necessary for generating the EUD Cursor Over Time
|
// function description: Gets the information necessary for generating the EUD Cursor Over Time
|
||||||
|
|
||||||
@@ -8,6 +8,5 @@ _position = _unit call armatak_client_fnc_extractClientPosition;
|
|||||||
|
|
||||||
_uuid = _unit call armatak_fnc_extract_uuid;
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
|
|
||||||
_eud_cot = [_uuid, _position select 0, _position select 1, _position select 2, _callsign, _group_name, _group_role, _position select 3, speed player / 3.6];
|
_eud_cot = [_uuid, _position select 1, _position select 2, _position select 3, _callsign, _group_name, _group_role, _position select 5, _position select 6];
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:eud", [_eud_cot]];
|
||||||
"armatak" callExtension ["tcp_socket:send_eud_cot", [_eud_cot]];
|
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ _unit_position = _unit call armatak_client_fnc_extractClientPosition;
|
|||||||
|
|
||||||
_uuid = _unit call armatak_fnc_extract_uuid;
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
|
|
||||||
_marker_cot = [_uuid, _type, _unit_position select 0, _unit_position select 1, _unit_position select 2, _callsign, _unit_position select 3, speed _unit / 3.6];
|
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
|
||||||
|
|
||||||
"armatak" callExtension ["tcp_socket:send_marker_cot", [_marker_cot]];
|
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
|
||||||
|
|||||||
@@ -7,8 +7,15 @@ params["_unit"];
|
|||||||
private _affiliation = "f";
|
private _affiliation = "f";
|
||||||
private _type = "G";
|
private _type = "G";
|
||||||
private _role = "a-f-G-U-C-I";
|
private _role = "a-f-G-U-C-I";
|
||||||
|
private _side = side _unit;
|
||||||
|
|
||||||
switch (str side _unit) do {
|
if (isNil {
|
||||||
|
_unit getVariable "armatak_current_side"
|
||||||
|
}) then {
|
||||||
|
_side = _unit getVariable "armatak_current_side";
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (str _side) do {
|
||||||
case "WEST": {
|
case "WEST": {
|
||||||
_affiliation = "f";
|
_affiliation = "f";
|
||||||
};
|
};
|
||||||
@@ -22,7 +29,7 @@ switch (str side _unit) do {
|
|||||||
_affiliation = "u";
|
_affiliation = "u";
|
||||||
};
|
};
|
||||||
default {
|
default {
|
||||||
_affiliation = "f";
|
_affiliation = "u";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -110,7 +117,6 @@ if ((typeOf (vehicle _unit) != typeOf _unit) or ((_unit_type select 0) == "Vehic
|
|||||||
|
|
||||||
_role = "a-" + _affiliation + "-" + _type;
|
_role = "a-" + _affiliation + "-" + _type;
|
||||||
|
|
||||||
|
|
||||||
armatak_attribute_marker_type = _unit getVariable "armatak_attribute_marker_type";
|
armatak_attribute_marker_type = _unit getVariable "armatak_attribute_marker_type";
|
||||||
|
|
||||||
if (!isNil "armatak_attribute_marker_type" or armatak_attribute_marker_type != '') then {
|
if (!isNil "armatak_attribute_marker_type" or armatak_attribute_marker_type != '') then {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
params["_unit"];
|
||||||
|
|
||||||
|
_target = getSensorTargets (_unit);
|
||||||
|
|
||||||
|
{
|
||||||
|
_unit = _x select 0;
|
||||||
|
_position = _x select 1;
|
||||||
|
_status = _x select 2;
|
||||||
|
|
||||||
|
if (isNil {
|
||||||
|
_unit getVariable "armatak_current_side"
|
||||||
|
}) then {
|
||||||
|
_unit setVariable ["armatak_current_side", side _unit];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_status != "destroyed" && !(_unit in armatak_server_syncedUnits)) then {
|
||||||
|
_unit_position = _unit call armatak_client_fnc_extractClientPosition;
|
||||||
|
|
||||||
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
|
_type = _unit call armatak_fnc_extract_role;
|
||||||
|
_callsign = getText (configOf _unit >> "displayName");
|
||||||
|
|
||||||
|
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
|
||||||
|
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
|
||||||
|
};
|
||||||
|
} forEach _target;
|
||||||
@@ -16,6 +16,10 @@ if (roleDescription _unit != "") then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (side _unit == east) then {
|
||||||
|
_callsign = getText (configOf _unit >> "displayName");
|
||||||
|
};
|
||||||
|
|
||||||
armatak_attribute_unit_callsign = _unit getVariable "armatak_attribute_unit_callsign";
|
armatak_attribute_unit_callsign = _unit getVariable "armatak_attribute_unit_callsign";
|
||||||
|
|
||||||
if (!isNil "armatak_attribute_unit_callsign" or armatak_attribute_unit_callsign != '') then {
|
if (!isNil "armatak_attribute_unit_callsign" or armatak_attribute_unit_callsign != '') then {
|
||||||
|
|||||||
23
addons/main/functions/map/fn_convert_to_clafghan.sqf
Normal file
23
addons/main/functions/map/fn_convert_to_clafghan.sqf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLatitude = 20480;
|
||||||
|
_playerMaxLongitude = 20480;
|
||||||
|
|
||||||
|
_MapMaxLongitude = 33.728772;
|
||||||
|
_MapMinLongitude = 33.542815;
|
||||||
|
|
||||||
|
_MapMaxLatitude = 63.169746;
|
||||||
|
_MapMinLatitude = 62.938820;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
23
addons/main/functions/map/fn_convert_to_colombia.sqf
Normal file
23
addons/main/functions/map/fn_convert_to_colombia.sqf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLatitude = 20480;
|
||||||
|
_playerMaxLongitude = 20480;
|
||||||
|
|
||||||
|
_MapMaxLatitude = -67.765153;
|
||||||
|
_MapMinLatitude = -68.223664;
|
||||||
|
|
||||||
|
_MapMaxLongitude = 10.593815;
|
||||||
|
_MapMinLongitude = 10.137466;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
23
addons/main/functions/map/fn_convert_to_lawn.sqf
Normal file
23
addons/main/functions/map/fn_convert_to_lawn.sqf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLongitude = 4992;
|
||||||
|
_playerMaxLatitude = 4992;
|
||||||
|
|
||||||
|
_MapMaxLongitude = -99.722665;
|
||||||
|
_MapMinLongitude = -99.775505;
|
||||||
|
|
||||||
|
_MapMaxLatitude = 32.159272;
|
||||||
|
_MapMinLatitude = 32.114011;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
|
private _mapWidth = 11264;
|
||||||
|
private _mapHeight = 11264;
|
||||||
|
|
||||||
|
// SW corner (used as origin)
|
||||||
|
private _SW_lat = -51.736078;
|
||||||
|
private _SW_lon = -57.915032;
|
||||||
|
|
||||||
|
// SE corner
|
||||||
|
private _SE_lat = -51.736078;
|
||||||
|
private _SE_lon = -58.077879;
|
||||||
|
|
||||||
|
// NW corner
|
||||||
|
private _NW_lat = -51.634750;
|
||||||
|
private _NW_lon = -58.077879;
|
||||||
|
|
||||||
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
|
private _mapWidth = 16384;
|
||||||
|
private _mapHeight = 16384;
|
||||||
|
|
||||||
|
// SW corner (used as origin)
|
||||||
|
private _SW_lat = -51.806546;
|
||||||
|
private _SW_lon = -57.939747;
|
||||||
|
|
||||||
|
// SE corner
|
||||||
|
private _SE_lat = -51.806546;
|
||||||
|
private _SE_lon = -57.701978;
|
||||||
|
|
||||||
|
// NW corner
|
||||||
|
private _NW_lat = -51.658913;
|
||||||
|
private _NW_lon = -57.939747;
|
||||||
|
|
||||||
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
|
private _mapWidth = 10240;
|
||||||
|
private _mapHeight = 10240;
|
||||||
|
|
||||||
|
// SW corner (used as origin)
|
||||||
|
private _SW_lat = -51.863358;
|
||||||
|
private _SW_lon = -59.054585;
|
||||||
|
|
||||||
|
// SE corner
|
||||||
|
private _SE_lat = -51.863358;
|
||||||
|
private _SE_lon = -58.906155;
|
||||||
|
|
||||||
|
// NW corner
|
||||||
|
private _NW_lat = -51.771493;
|
||||||
|
private _NW_lon = -59.054585;
|
||||||
|
|
||||||
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLongitude = 5120;
|
||||||
|
_playerMaxLatitude = 5120;
|
||||||
|
|
||||||
|
_MapMaxLatitude = -51.619725;
|
||||||
|
_MapMinLatitude = -51.664223;
|
||||||
|
|
||||||
|
_MapMaxLongitude = -58.394630;
|
||||||
|
_MapMinLongitude = -58.469580;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
23
addons/main/functions/map/fn_convert_to_rut_mandol.sqf
Normal file
23
addons/main/functions/map/fn_convert_to_rut_mandol.sqf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLatitude = 32768;
|
||||||
|
_playerMaxLongitude = 32768;
|
||||||
|
|
||||||
|
_MapMaxLongitude = 35.285485;
|
||||||
|
_MapMinLongitude = 34.927617;
|
||||||
|
|
||||||
|
_MapMaxLatitude = 70.445404;
|
||||||
|
_MapMinLatitude = 70.016783;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -12,7 +12,7 @@ private _SE_lat = 39.458019;
|
|||||||
private _SE_lon = 25.081992;
|
private _SE_lon = 25.081992;
|
||||||
|
|
||||||
// NW corner
|
// NW corner
|
||||||
private _NW_lat = 39.458019;
|
private _NW_lat = 39.568847;
|
||||||
private _NW_lon = 24.939314;
|
private _NW_lon = 24.939314;
|
||||||
|
|
||||||
private _edgeSE_lat = _SE_lat - _SW_lat;
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
params["_latitude", "_longitude", "_altitude"];
|
||||||
|
|
||||||
|
_playerPosition = [_latitude, _longitude, _altitude];
|
||||||
|
|
||||||
|
_playerLatitude = _playerPosition select 0;
|
||||||
|
_playerLongitude = _playerPosition select 1;
|
||||||
|
|
||||||
|
_playerMaxLongitude = 20480;
|
||||||
|
_playerMaxLatitude = 20480;
|
||||||
|
|
||||||
|
_MapMaxLongitude = 48.351216;
|
||||||
|
_MapMinLongitude = 48.097496;
|
||||||
|
|
||||||
|
_MapMaxLatitude = 38.345389;
|
||||||
|
_MapMinLatitude = 37.956754;
|
||||||
|
|
||||||
|
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
||||||
|
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
||||||
|
|
||||||
|
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
||||||
|
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
||||||
|
|
||||||
|
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
||||||
@@ -4,19 +4,11 @@ class CfgVehicles {
|
|||||||
{
|
{
|
||||||
class AttributesBase
|
class AttributesBase
|
||||||
{
|
{
|
||||||
class Default;
|
|
||||||
class Edit;
|
class Edit;
|
||||||
class Combo;
|
|
||||||
class Checkbox;
|
|
||||||
class CheckboxNumber;
|
|
||||||
class ModuleDescription;
|
class ModuleDescription;
|
||||||
class Units;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModuleDescription
|
class ModuleDescription;
|
||||||
{
|
|
||||||
class AnyBrain;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GVAR(moduleBase): Module_F {
|
class GVAR(moduleBase): Module_F {
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ if (isServer) exitWith {
|
|||||||
|
|
||||||
_syncUnits = synchronizedObjects _logic;
|
_syncUnits = synchronizedObjects _logic;
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_marked_units", _syncUnits];
|
missionNamespace setVariable ["armatak_server_syncedUnits", _syncUnits];
|
||||||
|
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_marked_units";
|
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
||||||
|
|
||||||
[{
|
[{
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_marked_units";
|
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
||||||
|
|
||||||
{
|
{
|
||||||
_objectType = _x call BIS_fnc_objectType;
|
_objectType = _x call BIS_fnc_objectType;
|
||||||
@@ -44,14 +44,21 @@ if (isServer) exitWith {
|
|||||||
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
|
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
|
||||||
|
|
||||||
|
_x call armatak_fnc_extract_sensor_data;
|
||||||
};
|
};
|
||||||
};
|
case ((_objectType select 0) == "VehicleAutonomous"): {
|
||||||
if (unitIsUAV _x) then {
|
_atak_type = [_x] call armatak_fnc_extract_role;
|
||||||
[_x] call armatak_fnc_send_drone_cot;
|
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
|
||||||
[_x] call armatak_fnc_send_digital_pointer_cot;
|
[_x] call armatak_fnc_send_digital_pointer_cot;
|
||||||
|
|
||||||
|
_x call armatak_fnc_extract_sensor_data;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} forEach GVAR(syncedUnits);
|
} forEach GVAR(syncedUnits);
|
||||||
}, 2, []] call CBA_fnc_addPerFrameHandler;
|
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ missionNamespace setVariable ["armatak_tcp_socket_is_running", true];
|
|||||||
|
|
||||||
_syncUnits = [];
|
_syncUnits = [];
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_marked_units", _syncUnits];
|
missionNamespace setVariable ["armatak_server_syncedUnits", _syncUnits];
|
||||||
|
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_marked_units";
|
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
||||||
|
|
||||||
[{
|
[{
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_marked_units";
|
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
||||||
|
|
||||||
{
|
{
|
||||||
_objectType = _x call BIS_fnc_objectType;
|
_objectType = _x call BIS_fnc_objectType;
|
||||||
@@ -48,13 +48,20 @@ GVAR(syncedUnits) = missionNamespace getVariable "armatak_marked_units";
|
|||||||
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
|
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
|
||||||
|
|
||||||
|
_x call armatak_fnc_extract_sensor_data;
|
||||||
};
|
};
|
||||||
};
|
case ((_objectType select 0) == "VehicleAutonomous"): {
|
||||||
if (unitIsUAV _x) then {
|
_atak_type = [_x] call armatak_fnc_extract_role;
|
||||||
[_x] call armatak_fnc_send_drone_cot;
|
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
|
||||||
|
|
||||||
|
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
|
||||||
[_x] call armatak_fnc_send_digital_pointer_cot;
|
[_x] call armatak_fnc_send_digital_pointer_cot;
|
||||||
|
|
||||||
|
_x call armatak_fnc_extract_sensor_data;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} forEach GVAR(syncedUnits);
|
} forEach GVAR(syncedUnits);
|
||||||
}, 2, []] call CBA_fnc_addPerFrameHandler;
|
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
closeDialog 1;
|
closeDialog 1;
|
||||||
|
|||||||
@@ -27,16 +27,16 @@ switch (false) do {
|
|||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
};
|
};
|
||||||
default {
|
default {
|
||||||
if (_unit in (missionNamespace getVariable ["armatak_marked_units", []])) exitWith {
|
if (_unit in (missionNamespace getVariable ["armatak_server_syncedUnits", []])) exitWith {
|
||||||
["Unit already marked", "warning", "TCP Socket"] call EFUNC(main,notify);
|
["Unit already marked", "warning", "TCP Socket"] call EFUNC(main,notify);
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_marked_units";
|
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
|
||||||
|
|
||||||
GVAR(syncedUnits) pushBack _unit;
|
GVAR(syncedUnits) pushBack _unit;
|
||||||
|
|
||||||
missionNamespace setVariable ["armatak_marked_units", GVAR(syncedUnits)];
|
missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits)];
|
||||||
SETVAR(_unit,GVAR(isRouting),true);
|
SETVAR(_unit,GVAR(isRouting),true);
|
||||||
|
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ switch (false) do {
|
|||||||
};
|
};
|
||||||
} forEach GVAR(syncedUnits);
|
} forEach GVAR(syncedUnits);
|
||||||
|
|
||||||
missionNmaespace setVariable ["armatak_marked_units", GVAR(syncedUnits)];
|
missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits)];
|
||||||
SETVAR(_unit,GVAR(isRouting),false);
|
SETVAR(_unit,GVAR(isRouting),false);
|
||||||
|
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
|
|||||||
126
src/cot/draws/circle.rs
Normal file
126
src/cot/draws/circle.rs
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
|
||||||
|
pub struct CircleCoTPayload {
|
||||||
|
pub uuid: String,
|
||||||
|
pub center_lat: f64,
|
||||||
|
pub center_lon: f64,
|
||||||
|
pub center_hae: f32,
|
||||||
|
pub major: f64,
|
||||||
|
pub minor: f64,
|
||||||
|
pub angle: f32,
|
||||||
|
pub callsign: String,
|
||||||
|
pub creator_uid: String,
|
||||||
|
pub creator_callsign: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for CircleCoTPayload {
|
||||||
|
fn from_arma(data: String) -> Result<Self, FromArmaError> {
|
||||||
|
let (
|
||||||
|
uuid,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
angle,
|
||||||
|
callsign,
|
||||||
|
creator_uid,
|
||||||
|
creator_callsign,
|
||||||
|
) = <(String, f64, f64, f32, f64, f64, f32, String, String, String)>::from_arma(data)?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
uuid,
|
||||||
|
center_lat,
|
||||||
|
center_lon,
|
||||||
|
center_hae,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
angle,
|
||||||
|
callsign,
|
||||||
|
creator_uid,
|
||||||
|
creator_callsign,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ShapeCircleCoT {
|
||||||
|
pub uid: String,
|
||||||
|
pub lat: f64,
|
||||||
|
pub lon: f64,
|
||||||
|
pub hae: f32,
|
||||||
|
pub major: f64,
|
||||||
|
pub minor: f64,
|
||||||
|
pub angle: f32,
|
||||||
|
pub callsign: String,
|
||||||
|
pub creator_uid: String,
|
||||||
|
pub creator_callsign: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CircleCoTPayload {
|
||||||
|
pub fn to_cot(&self) -> ShapeCircleCoT {
|
||||||
|
ShapeCircleCoT {
|
||||||
|
uid: self.uuid.clone(),
|
||||||
|
lat: self.center_lat,
|
||||||
|
lon: self.center_lon,
|
||||||
|
hae: self.center_hae,
|
||||||
|
major: self.major,
|
||||||
|
minor: self.minor,
|
||||||
|
angle: self.angle,
|
||||||
|
callsign: self.callsign.clone(),
|
||||||
|
creator_uid: self.creator_uid.clone(),
|
||||||
|
creator_callsign: self.creator_callsign.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ShapeCircleCoT {
|
||||||
|
pub fn to_xml(&self, now: &str, stale: &str) -> String {
|
||||||
|
format!(
|
||||||
|
r#"<event version="2.0" uid="{uid}" type="u-d-c-c"
|
||||||
|
time="{t}" start="{t}" stale="{stale}"
|
||||||
|
how="h-e" access="Undefined">
|
||||||
|
<point lat="{lat}" lon="{lon}" hae="{hae}" ce="10.9" le="9999999.0" />
|
||||||
|
<detail>
|
||||||
|
<shape>
|
||||||
|
<ellipse major="{major}" minor="{minor}" angle="{angle}" />
|
||||||
|
<link uid="{uid}.Style" type="b-x-KmlStyle" relation="p-c">
|
||||||
|
<Style>
|
||||||
|
<LineStyle>
|
||||||
|
<color>ffffffff</color>
|
||||||
|
<width>3.0</width>
|
||||||
|
</LineStyle>
|
||||||
|
<PolyStyle>
|
||||||
|
<color>96ffffff</color>
|
||||||
|
</PolyStyle>
|
||||||
|
</Style>
|
||||||
|
</link>
|
||||||
|
<link uid="{creator_uid}" type="self" relation="p-p-CenterAnchor" />
|
||||||
|
</shape>
|
||||||
|
<__shapeExtras cpvis="true" editable="true" />
|
||||||
|
<remarks />
|
||||||
|
<contact callsign="{callsign}" />
|
||||||
|
<creator uid="{creator_uid}" callsign="{creator_callsign}" time="{t}" type="a-f-G-U-C" />
|
||||||
|
<archive />
|
||||||
|
<labels_on value="true" />
|
||||||
|
<strokeColor value="-1" />
|
||||||
|
<strokeWeight value="3.0" />
|
||||||
|
<strokeStyle value="solid" />
|
||||||
|
<fillColor value="-1761607681" />
|
||||||
|
<precisionlocation altsrc="GPS" geopointsrc="GPS" />
|
||||||
|
</detail>
|
||||||
|
</event>"#,
|
||||||
|
uid = self.uid,
|
||||||
|
t = now,
|
||||||
|
stale = stale,
|
||||||
|
lat = self.lat,
|
||||||
|
lon = self.lon,
|
||||||
|
hae = self.hae,
|
||||||
|
major = self.major,
|
||||||
|
minor = self.minor,
|
||||||
|
angle = self.angle,
|
||||||
|
callsign = self.callsign,
|
||||||
|
creator_uid = self.creator_uid,
|
||||||
|
creator_callsign = self.creator_callsign
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/cot/draws/mod.rs
Normal file
1
src/cot/draws/mod.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pub mod circle;
|
||||||
153
src/cot/message.rs
Normal file
153
src/cot/message.rs
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
use arma_rs::{FromArma, FromArmaError};
|
||||||
|
use chrono::{Utc, Duration, SecondsFormat};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
pub struct MessagePayload {
|
||||||
|
pub sender_callsign: String,
|
||||||
|
pub chatroom: String,
|
||||||
|
pub message_text: String,
|
||||||
|
pub point_lat: f64,
|
||||||
|
pub point_lon: f64,
|
||||||
|
pub point_hae: f32,
|
||||||
|
pub sender_uid: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromArma for MessagePayload {
|
||||||
|
fn from_arma(data: String) -> Result<Self, FromArmaError> {
|
||||||
|
let (sender_callsign, chatroom, message_text,
|
||||||
|
point_lat, point_lon, point_hae, sender_uid) =
|
||||||
|
<(String, String, String, f64, f64, f32, String)>::from_arma(data)?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
sender_callsign,
|
||||||
|
chatroom,
|
||||||
|
message_text,
|
||||||
|
point_lat,
|
||||||
|
point_lon,
|
||||||
|
point_hae,
|
||||||
|
sender_uid,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MessageCot {
|
||||||
|
pub sender_callsign: String,
|
||||||
|
pub chatroom: String,
|
||||||
|
pub message_text: String,
|
||||||
|
pub point_lat: f64,
|
||||||
|
pub point_lon: f64,
|
||||||
|
pub point_hae: f32,
|
||||||
|
pub sender_uid: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MessageCot {
|
||||||
|
pub fn from_payload(p: MessagePayload) -> Self {
|
||||||
|
Self {
|
||||||
|
sender_callsign: p.sender_callsign,
|
||||||
|
chatroom: p.chatroom,
|
||||||
|
message_text: p.message_text,
|
||||||
|
point_lat: p.point_lat,
|
||||||
|
point_lon: p.point_lon,
|
||||||
|
point_hae: p.point_hae,
|
||||||
|
sender_uid: p.sender_uid,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn to_xml(&self) -> String {
|
||||||
|
let created_time = Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
let stale_time = (Utc::now() + Duration::days(1))
|
||||||
|
.to_rfc3339_opts(SecondsFormat::Millis, true);
|
||||||
|
|
||||||
|
// MESSAGE ID (random UUID)
|
||||||
|
let message_uuid = Uuid::new_v4().to_string();
|
||||||
|
|
||||||
|
// FULL EVENT UID
|
||||||
|
// format: GeoChat.{sender}.{chatroom}.{uuid}
|
||||||
|
let event_uid = format!(
|
||||||
|
"GeoChat.{}.{}.{}",
|
||||||
|
self.sender_uid,
|
||||||
|
self.chatroom.replace(" ", "_"),
|
||||||
|
message_uuid,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut xml = String::new();
|
||||||
|
|
||||||
|
xml.push_str("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<event version=\"2.0\" uid=\"{}\" type=\"b-t-f\" time=\"{}\" start=\"{}\" stale=\"{}\" how=\"h-g-i-g-o\" access=\"Undefined\">",
|
||||||
|
event_uid, created_time, created_time, stale_time
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<point lat=\"{}\" lon=\"{}\" hae=\"{}\" ce=\"10.3\" le=\"9999999.0\"/>",
|
||||||
|
self.point_lat, self.point_lon, self.point_hae
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str("<detail>");
|
||||||
|
|
||||||
|
// ========== CHAT OBJECT ==========
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<__chat parent=\"RootContactGroup\" groupOwner=\"false\" \
|
||||||
|
messageId=\"{}\" chatroom=\"{}\" id=\"{}\" senderCallsign=\"{}\">",
|
||||||
|
message_uuid,
|
||||||
|
self.chatroom,
|
||||||
|
self.chatroom,
|
||||||
|
self.sender_callsign,
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<chatgrp uid0=\"{}\" uid1=\"{}\" id=\"{}\" />",
|
||||||
|
self.sender_uid,
|
||||||
|
self.chatroom,
|
||||||
|
self.chatroom
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str("</__chat>");
|
||||||
|
|
||||||
|
// ========== LINK ELEMENT ==========
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<link uid=\"{}\" type=\"a-f-G-U-C\" relation=\"p-p\" />",
|
||||||
|
self.sender_uid
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// ========== SERVER DEST ==========
|
||||||
|
// This is optional — you may remove or customize it
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<__serverdestination destinations=\"0.0.0.0:0:tcp:{}\" />",
|
||||||
|
self.sender_uid
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// ========== MESSAGE REMARKS ==========
|
||||||
|
xml.push_str(
|
||||||
|
format!(
|
||||||
|
"<remarks source=\"ARMATAK.{}\" to=\"{}\" time=\"{}\">{}</remarks>",
|
||||||
|
self.sender_uid, self.chatroom, created_time, self.message_text
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
|
|
||||||
|
xml.push_str("</detail></event>");
|
||||||
|
|
||||||
|
xml
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
|
pub mod draws;
|
||||||
pub mod cot;
|
pub mod cot;
|
||||||
pub mod digital_pointer;
|
pub mod digital_pointer;
|
||||||
pub mod eud;
|
pub mod eud;
|
||||||
pub mod gps;
|
pub mod gps;
|
||||||
|
pub mod message;
|
||||||
pub mod nato;
|
pub mod nato;
|
||||||
35
src/lib.rs
35
src/lib.rs
@@ -1,8 +1,8 @@
|
|||||||
use arma_rs::{arma, Extension, Group};
|
use arma_rs::{arma, Extension, Group};
|
||||||
mod structs;
|
mod structs;
|
||||||
|
mod tcp;
|
||||||
mod tests;
|
mod tests;
|
||||||
mod udp_socket;
|
mod udp_socket;
|
||||||
mod tcp_socket;
|
|
||||||
mod video_stream;
|
mod video_stream;
|
||||||
|
|
||||||
mod cot;
|
mod cot;
|
||||||
@@ -35,28 +35,43 @@ pub fn init() -> Extension {
|
|||||||
.command("local_ip", utils::address::get_local_address)
|
.command("local_ip", utils::address::get_local_address)
|
||||||
.command("uuid", utils::uuid::get_uuid)
|
.command("uuid", utils::uuid::get_uuid)
|
||||||
.command("log", utils::log::log_info)
|
.command("log", utils::log::log_info)
|
||||||
.group("udp_socket",
|
.group(
|
||||||
|
"udp_socket",
|
||||||
Group::new()
|
Group::new()
|
||||||
.command("start", udp_socket::start)
|
.command("start", udp_socket::start)
|
||||||
.command("send_payload", udp_socket::send_payload)
|
.command("send_payload", udp_socket::send_payload)
|
||||||
.command("send_gps_cot", udp_socket::send_gps_cot)
|
.command("send_gps_cot", udp_socket::send_gps_cot)
|
||||||
.command("stop", udp_socket::stop)
|
.command("stop", udp_socket::stop),
|
||||||
)
|
)
|
||||||
.group(
|
.group(
|
||||||
"tcp_socket",
|
"tcp_socket",
|
||||||
Group::new()
|
Group::new()
|
||||||
.command("start", tcp_socket::start)
|
.command("start", tcp::start)
|
||||||
.command("send_payload", tcp_socket::send_payload)
|
.command("stop", tcp::stop)
|
||||||
.command("send_eud_cot", tcp_socket::send_eud_cot)
|
.command("send_payload", tcp::send_payload)
|
||||||
.command("send_marker_cot", tcp_socket::send_marker_cot)
|
.group(
|
||||||
.command("send_digital_pointer_cot", tcp_socket::send_digital_pointer_cot)
|
"cot",
|
||||||
.command("stop", tcp_socket::stop)
|
Group::new()
|
||||||
|
.command("eud", tcp::cot::send_eud_cot)
|
||||||
|
.command("marker", tcp::cot::send_marker_cot)
|
||||||
|
.command("digital_pointer", tcp::cot::send_digital_pointer_cot)
|
||||||
|
.command("chat", tcp::cot::send_message_cot),
|
||||||
|
)
|
||||||
|
.group(
|
||||||
|
"draw",
|
||||||
|
Group::new()
|
||||||
|
.command("circle", tcp::draw::send_circle_cot)
|
||||||
|
.command("ellipse", tcp::draw::send_ellipse_cot)
|
||||||
|
.command("rectangle", tcp::draw::send_rectangle_cot)
|
||||||
|
.command("free", tcp::draw::send_freedraw_cot)
|
||||||
|
.command("vector", tcp::draw::send_vectordraw_cot),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.group(
|
.group(
|
||||||
"video_stream",
|
"video_stream",
|
||||||
Group::new()
|
Group::new()
|
||||||
.command("start", video_stream::start_stream)
|
.command("start", video_stream::start_stream)
|
||||||
.command("stop", video_stream::stop_stream)
|
.command("stop", video_stream::stop_stream),
|
||||||
)
|
)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
|
|||||||
32
src/tcp/cot.rs
Normal file
32
src/tcp/cot.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
use arma_rs::Context;
|
||||||
|
|
||||||
|
use crate::{cot, tcp::send_payload};
|
||||||
|
|
||||||
|
pub fn send_eud_cot(ctx: Context, cursor_over_time: cot::eud::EudCoTPayload) -> &'static str {
|
||||||
|
let payload = cursor_over_time.to_cot().convert_to_xml();
|
||||||
|
send_payload(ctx, payload);
|
||||||
|
|
||||||
|
"Sending End User Device Cursor Over Time to TCP server"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn send_marker_cot(ctx: Context, cursor_over_time: cot::nato::MarkerCoTPayload) -> &'static str {
|
||||||
|
let payload = cursor_over_time.to_cot().convert_to_xml();
|
||||||
|
send_payload(ctx, payload);
|
||||||
|
|
||||||
|
"Sending Marker Cursor Over Time to TCP server"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn send_digital_pointer_cot(ctx: Context, cursor_over_time: cot::digital_pointer::DigitalPointerPayload) -> &'static str {
|
||||||
|
let payload = cursor_over_time.to_cot().convert_to_xml();
|
||||||
|
send_payload(ctx, payload);
|
||||||
|
|
||||||
|
"Sending Digital Pointer Cursor Over Time to TCP server"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn send_message_cot(ctx: Context, message_payload: cot::message::MessagePayload) -> &'static str {
|
||||||
|
let message_cot = cot::message::MessageCot::from_payload(message_payload);
|
||||||
|
let payload = message_cot.to_xml();
|
||||||
|
send_payload(ctx, payload);
|
||||||
|
|
||||||
|
"Sending Message CoT to TCP server"
|
||||||
|
}
|
||||||
34
src/tcp/draw.rs
Normal file
34
src/tcp/draw.rs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
use arma_rs::Context;
|
||||||
|
|
||||||
|
use crate::{cot, tcp::send_payload};
|
||||||
|
|
||||||
|
pub fn send_circle_cot(ctx: Context, circle_payload: cot::draws::circle::CircleCoTPayload) -> &'static str {
|
||||||
|
let shape_circle_cot = circle_payload.to_cot();
|
||||||
|
let now = chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Millis, true);
|
||||||
|
let stale = (chrono::Utc::now() + chrono::Duration::days(1))
|
||||||
|
.to_rfc3339_opts(chrono::SecondsFormat::Millis, true);
|
||||||
|
let payload = shape_circle_cot.to_xml(&now, &stale);
|
||||||
|
send_payload(ctx, payload);
|
||||||
|
|
||||||
|
"Sending Circle CoT to TCP server"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn send_ellipse_cot(ctx: Context) -> &'static str {
|
||||||
|
let _ = ctx;
|
||||||
|
"Not implemented: send_ellipse_cot"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn send_rectangle_cot(ctx: Context) -> &'static str {
|
||||||
|
let _ = ctx;
|
||||||
|
"Not implemented: send_ellipse_cot"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn send_freedraw_cot(ctx: Context) -> &'static str {
|
||||||
|
let _ = ctx;
|
||||||
|
"Not implemented: send_ellipse_cot"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn send_vectordraw_cot(ctx: Context) -> &'static str {
|
||||||
|
let _ = ctx;
|
||||||
|
"Not implemented: send_ellipse_cot"
|
||||||
|
}
|
||||||
@@ -7,7 +7,8 @@ use std::sync::mpsc::{self, Receiver, Sender};
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use crate::cot;
|
pub mod cot;
|
||||||
|
pub mod draw;
|
||||||
|
|
||||||
pub enum TcpCommand {
|
pub enum TcpCommand {
|
||||||
SendMessage(String, Context),
|
SendMessage(String, Context),
|
||||||
@@ -123,27 +124,6 @@ pub fn send_payload(ctx: Context, payload: String) -> &'static str {
|
|||||||
"Sending payload to TCP server"
|
"Sending payload to TCP server"
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_eud_cot(ctx: Context, cursor_over_time: cot::eud::EudCoTPayload) -> &'static str {
|
|
||||||
let payload = cursor_over_time.to_cot().convert_to_xml();
|
|
||||||
send_payload(ctx, payload);
|
|
||||||
|
|
||||||
"Sending End User Device Cursor Over Time to TCP server"
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn send_marker_cot(ctx: Context, cursor_over_time: cot::nato::MarkerCoTPayload) -> &'static str {
|
|
||||||
let payload = cursor_over_time.to_cot().convert_to_xml();
|
|
||||||
send_payload(ctx, payload);
|
|
||||||
|
|
||||||
"Sending Marker Cursor Over Time to TCP server"
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn send_digital_pointer_cot(ctx: Context, cursor_over_time: cot::digital_pointer::DigitalPointerPayload) -> &'static str {
|
|
||||||
let payload = cursor_over_time.to_cot().convert_to_xml();
|
|
||||||
send_payload(ctx, payload);
|
|
||||||
|
|
||||||
"Sending Digital Pointer Cursor Over Time to TCP server"
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn stop(ctx: Context) -> &'static str {
|
pub fn stop(ctx: Context) -> &'static str {
|
||||||
if let Some(ref client) = *TCP_CLIENT.lock().unwrap() {
|
if let Some(ref client) = *TCP_CLIENT.lock().unwrap() {
|
||||||
client.stop();
|
client.stop();
|
||||||
Reference in New Issue
Block a user