mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 15:43:29 +00:00
Added register and delete cot functions to handle CoT delete commands
This commit is contained in:
@@ -22,6 +22,12 @@ class CfgFunctions {
|
|||||||
class report_marker {
|
class report_marker {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_report_marker.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_report_marker.sqf";
|
||||||
};
|
};
|
||||||
|
class register_cot {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_register_cot.sqf";
|
||||||
|
};
|
||||||
|
class delete_registered_cots {
|
||||||
|
file = "\armatak\armatak\addons\main\functions\api\fn_delete_registered_cots.sqf";
|
||||||
|
};
|
||||||
class draw_circle {
|
class draw_circle {
|
||||||
file = "\armatak\armatak\addons\main\functions\api\fn_draw_circle.sqf";
|
file = "\armatak\armatak\addons\main\functions\api\fn_draw_circle.sqf";
|
||||||
};
|
};
|
||||||
|
|||||||
36
addons/main/functions/api/fn_delete_registered_cots.sqf
Normal file
36
addons/main/functions/api/fn_delete_registered_cots.sqf
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// function name: armatak_fnc_delete_registered_cots
|
||||||
|
// function author: Valmo, Codex
|
||||||
|
// function description: Sends forced delete CoTs for all registered CoTs in a scope.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Scope/key used to group CoTs <STRING>
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
// Number of delete CoTs sent <NUMBER>
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_scope", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (_scope isEqualTo "") exitWith {0};
|
||||||
|
|
||||||
|
private _registry = missionNamespace getVariable ["armatak_registered_cots", []];
|
||||||
|
private _remaining = [];
|
||||||
|
private _deleted = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
_x params ["_registeredScope", "_uid", "_type", "_lat", "_lon", "_hae"];
|
||||||
|
|
||||||
|
if (_registeredScope isEqualTo _scope) then {
|
||||||
|
"armatak" callExtension ["tcp_socket:cot:delete", [[_uid, _type, _lat, _lon, _hae]]];
|
||||||
|
_deleted = _deleted + 1;
|
||||||
|
} else {
|
||||||
|
_remaining pushBack _x;
|
||||||
|
};
|
||||||
|
} forEach _registry;
|
||||||
|
|
||||||
|
missionNamespace setVariable ["armatak_registered_cots", _remaining];
|
||||||
|
|
||||||
|
_deleted
|
||||||
30
addons/main/functions/api/fn_register_cot.sqf
Normal file
30
addons/main/functions/api/fn_register_cot.sqf
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// function name: armatak_fnc_register_cot
|
||||||
|
// function author: Valmo, Codex
|
||||||
|
// function description: Registers a CoT object under a scope so it can be deleted later.
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// 0: Scope/key used to group CoTs <STRING>
|
||||||
|
// 1: CoT UID <STRING>
|
||||||
|
// 2: CoT type <STRING>
|
||||||
|
// 3: Latitude <NUMBER>
|
||||||
|
// 4: Longitude <NUMBER>
|
||||||
|
// 5: HAE altitude <NUMBER>
|
||||||
|
//
|
||||||
|
// Public: Yes
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_scope", "", [""]],
|
||||||
|
["_uid", "", [""]],
|
||||||
|
["_type", "", [""]],
|
||||||
|
["_lat", 0, [0]],
|
||||||
|
["_lon", 0, [0]],
|
||||||
|
["_hae", 0, [0]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (_scope isEqualTo "" || {_uid isEqualTo ""} || {_type isEqualTo ""}) exitWith {false};
|
||||||
|
|
||||||
|
private _registry = missionNamespace getVariable ["armatak_registered_cots", []];
|
||||||
|
_registry pushBack [_scope, _uid, _type, _lat, _lon, _hae];
|
||||||
|
missionNamespace setVariable ["armatak_registered_cots", _registry];
|
||||||
|
|
||||||
|
true
|
||||||
Reference in New Issue
Block a user