Added functions for adding and removing entities into the marked entitis gvar for the CoT Router

This commit is contained in:
Valmo Trindade
2025-05-21 20:03:59 -03:00
parent 2d207965db
commit aa7b27ac2e
3 changed files with 82 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
PREP(3denCoreModuleConfig); PREP(3denCoreModuleConfig);
PREP(routerEntityAdd);
PREP(routerEntityRemove);
PREP(ZeusCoreModuleConfig); PREP(ZeusCoreModuleConfig);
PREP(ZeusCoreModuleShow);

View 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;
};
};

View 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;
};
};