mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 16:03:31 +00:00
added functions to handle TCP payloads
This commit is contained in:
30
addons/main/functions/api/fn_send_drone_cot.sqf
Normal file
30
addons/main/functions/api/fn_send_drone_cot.sqf
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// function name: armatak_fnc_extract_drone
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Gets the drone information for the CoT Router
|
||||||
|
|
||||||
|
params["_drone"];
|
||||||
|
|
||||||
|
private _atak_role = "a-f-A";
|
||||||
|
private _atak_callsign = getText(configFile >> "CfgVehicles" >> typeOf _drone >> "displayName");
|
||||||
|
|
||||||
|
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"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_cot = [_drone, _atak_role, _atak_callsign] call armatak_fnc_extract_marker_cot_info;
|
||||||
|
|
||||||
|
"armatak" callExtension ["cot_router:send_marker_cot", [_cot]];
|
||||||
67
addons/main/functions/api/fn_send_group_cots.sqf
Normal file
67
addons/main/functions/api/fn_send_group_cots.sqf
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
// function name: armatak_fnc_send_group_cots
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: handle the cot routing for drones
|
||||||
|
|
||||||
|
params["_group"];
|
||||||
|
|
||||||
|
{
|
||||||
|
_group_colors = missionNamespace getVariable "_group_colors";
|
||||||
|
|
||||||
|
_group_roles = ["Team Member", "Team Lead", "HQ", "Sniper", "Medic", "Forward Observer", "RTO", "K9"];
|
||||||
|
|
||||||
|
_group_role = "Team Member";
|
||||||
|
|
||||||
|
_group_name = "";
|
||||||
|
|
||||||
|
_group_name = _group getVariable "_atak_group_name";
|
||||||
|
|
||||||
|
if (isNil "_group_name") then {
|
||||||
|
_group_colors = missionNamespace getVariable "_group_colors";
|
||||||
|
_group_name = selectRandom _group_colors;
|
||||||
|
|
||||||
|
if (count _group_colors > 0) then {
|
||||||
|
_randomIndex = floor (random (count _group_colors));
|
||||||
|
|
||||||
|
_selectedColor = _group_colors select _randomIndex;
|
||||||
|
|
||||||
|
_group_colors deleteAt _randomIndex;
|
||||||
|
|
||||||
|
_group_name = _selectedColor;
|
||||||
|
_group setVariable ["_atak_group_name", _group_name];
|
||||||
|
missionNamespace setVariable ["_group_colors", _group_colors]
|
||||||
|
} else {
|
||||||
|
_group_name = "Red";
|
||||||
|
_group setVariable ["_atak_group_name", _group_name];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (["SpecialOperative", (configFile >> "CfgVehicles" >> typeOf _x >> "role") call BIS_fnc_getCfgData, false] call BIS_fnc_inString) then {
|
||||||
|
_group_role = _group_roles select 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_x getUnitTrait "medic") then {
|
||||||
|
_group_role = _group_roles select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((["jtac", typeOf _x, false] call BIS_fnc_inString)) then {
|
||||||
|
_group_role = _group_roles select 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (((backpack _x) isKindOf "TFAR_Bag_Base") or (["radio", typeOf _x, false] call BIS_fnc_inString)) then {
|
||||||
|
_group_role = _group_roles select 6;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((["sniper", typeOf _x, false] call BIS_fnc_inString) or (["marksman", (configFile >> "CfgVehicles" >> typeOf _x >> "role") call BIS_fnc_getCfgData, false] call BIS_fnc_inString) or (["sharpshooter", typeOf _x, false] call BIS_fnc_inString)) then {
|
||||||
|
_group_role = _group_roles select 3;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (leader _group == _x) then {
|
||||||
|
_group_role = _group_roles select 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (["officer", typeOf _x, false] call BIS_fnc_inString) then {
|
||||||
|
_group_role = _group_roles select 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
[_x, name _x, _group_name, _group_role] call armatak_fnc_send_human_cot;
|
||||||
|
} forEach (units _group);
|
||||||
12
addons/main/functions/api/fn_send_human_cot.sqf
Normal file
12
addons/main/functions/api/fn_send_human_cot.sqf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// function name: armatak_fnc_extract_human_cot_info
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Gets the information necessary for generating the Human Cursor Over Time
|
||||||
|
|
||||||
|
params ["_unit", "_callsign", "_group_name", "_group_role"];
|
||||||
|
|
||||||
|
_unit_position = _unit call armatak_fnc_extract_position;
|
||||||
|
_uuid = _unit call armatak_fnc_extract_uuid;
|
||||||
|
|
||||||
|
_human_cot = [_uuid, _unit_position select 0, _unit_position select 1, _unit_position select 2, _callsign, _group_name, _group_role, _unit_position select 3, speed player / 3.6];
|
||||||
|
|
||||||
|
"armatak" callExtension ["cot_router:send_human_cot", [_human_cot]];
|
||||||
12
addons/main/functions/api/fn_send_marker_cot.sqf
Normal file
12
addons/main/functions/api/fn_send_marker_cot.sqf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// function name: armatak_fnc_send_marker_cot
|
||||||
|
// function author: Valmo
|
||||||
|
// function description: Gets the information necessary for generating the Marker Cursor Over Time
|
||||||
|
|
||||||
|
params ["_unit", "_type", "_callsign"];
|
||||||
|
|
||||||
|
_unit_position = _unit call armatak_fnc_extract_position;
|
||||||
|
_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];
|
||||||
|
|
||||||
|
"armatak" callExtension ["cot_router:send_marker_cot", [_marker_cot]];
|
||||||
@@ -24,7 +24,9 @@ switch (side _unit) do {
|
|||||||
_affiliation = "f";
|
_affiliation = "f";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_unit_type = _unit call BIS_fnc_objectType select 1;
|
_unit_type = _unit call BIS_fnc_objectType select 1;
|
||||||
|
|
||||||
switch (_unit_type) do {
|
switch (_unit_type) do {
|
||||||
case "AT": {
|
case "AT": {
|
||||||
_type = "G-U-C-F-R";
|
_type = "G-U-C-F-R";
|
||||||
@@ -63,7 +65,8 @@ switch (_unit_type) do {
|
|||||||
_type = "G-U-C-I";
|
_type = "G-U-C-I";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (!isNull vehicle _unit) then {
|
|
||||||
|
if (typeOf (vehicle _unit) != typeOf _unit) then {
|
||||||
_vehicle_type = (vehicle _unit) call BIS_fnc_objectType select 1;
|
_vehicle_type = (vehicle _unit) call BIS_fnc_objectType select 1;
|
||||||
switch (_vehicle_type) do {
|
switch (_vehicle_type) do {
|
||||||
case "Car": {
|
case "Car": {
|
||||||
|
|||||||
Reference in New Issue
Block a user