mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 15:33:29 +00:00
Added functions for adding and removing entities into the marked entitis gvar for the CoT Router
This commit is contained in:
39
addons/server/functions/fnc_routerEntityAdd.sqf
Normal file
39
addons/server/functions/fnc_routerEntityAdd.sqf
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Valmo
|
||||
* Adds a unit into the global marked units array.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [LOGIC] call armatak_server_fnc_routerEntityAdd;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_logic"];
|
||||
|
||||
if (!local _logic) exitWith {};
|
||||
|
||||
private _unit = attachedTo _logic;
|
||||
deleteVehicle _logic;
|
||||
|
||||
switch (false) do {
|
||||
case (!isNull _unit): {
|
||||
deleteVehicle _logic;
|
||||
["Nothing selected", "error", "TCP Socket"] call EFUNC(main,notify);
|
||||
};
|
||||
default {
|
||||
GVAR(syncedUnits) = missionNamespace getVariable "armatak_marked_units";
|
||||
|
||||
GVAR(syncedUnits) pushBack _unit;
|
||||
|
||||
missionNamespace setVariable ["armatak_marked_units", GVAR(syncedUnits)];
|
||||
|
||||
deleteVehicle _logic;
|
||||
};
|
||||
};
|
||||
41
addons/server/functions/fnc_routerEntityRemove.sqf
Normal file
41
addons/server/functions/fnc_routerEntityRemove.sqf
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Valmo
|
||||
* Removes a unit from the global marked units array.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [LOGIC] call armatak_server_fnc_routerEntityRemove;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_logic"];
|
||||
|
||||
if (!local _logic) exitWith {};
|
||||
|
||||
private _unit = attachedTo _logic;
|
||||
deleteVehicle _logic;
|
||||
|
||||
switch (false) do {
|
||||
case (!isNull _unit): {
|
||||
deleteVehicle _logic;
|
||||
["Nothing selected", "error", "TCP Socket"] call EFUNC(main,notify);
|
||||
};
|
||||
default {
|
||||
{
|
||||
if (_x isEqualTo _unit) then {
|
||||
GVAR(syncedUnits) deleteAt _forEachIndex;
|
||||
};
|
||||
} forEach GVAR(syncedUnits);
|
||||
|
||||
missionNmaespace setVariable ["armatak_marked_units", GVAR(syncedUnits)];
|
||||
|
||||
deleteVehicle _logic;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user