mirror of
https://github.com/valmojr/armatak.git
synced 2026-08-18 16:02:58 +00:00
Added addRouterEntities and removeRouterEntites instead of manually adding entites to the CoT Router array
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
PREP(3denEnrollModuleConfig);
|
||||
PREP(3denTcpModuleConfig);
|
||||
PREP(addRouterEntities);
|
||||
PREP(removeRouterEntities);
|
||||
PREP(routerEntityAdd);
|
||||
PREP(routerEntityRemove);
|
||||
PREP(setRouterEntities);
|
||||
PREP(startCotRouter);
|
||||
PREP(ZeusEnrollModuleConfig);
|
||||
PREP(ZeusTcpModuleConfig);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Valmo, Codex
|
||||
* Adds entities to the server-side CoT router entity list.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Entity or entities to publish through the CoT router <OBJECT|ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Current routed entities <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_entities", [], [objNull, []]]
|
||||
];
|
||||
|
||||
private _toAdd = if (_entities isEqualType objNull) then {[_entities]} else {_entities};
|
||||
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
|
||||
_routed append _toAdd;
|
||||
_routed = _routed arrayIntersect _routed;
|
||||
_routed = _routed select {!isNull _x && {alive _x}};
|
||||
|
||||
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
|
||||
GVAR(syncedUnits) = _routed;
|
||||
|
||||
_routed
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Valmo, Codex
|
||||
* Removes entities from the server-side CoT router entity list.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Entity or entities to remove from the CoT router <OBJECT|ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Current routed entities <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_entities", [], [objNull, []]]
|
||||
];
|
||||
|
||||
private _toRemove = if (_entities isEqualType objNull) then {[_entities]} else {_entities};
|
||||
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
|
||||
_routed = (_routed - _toRemove) select {!isNull _x && {alive _x}};
|
||||
|
||||
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
|
||||
GVAR(syncedUnits) = _routed;
|
||||
|
||||
_routed
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Valmo, Codex
|
||||
* Replaces the server-side CoT router entity list with a de-duplicated list.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Entities to publish through the CoT router <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Current routed entities <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_entities", [], [[]]]
|
||||
];
|
||||
|
||||
private _routed = _entities arrayIntersect _entities;
|
||||
_routed = _routed select {!isNull _x && {alive _x}};
|
||||
|
||||
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
|
||||
GVAR(syncedUnits) = _routed;
|
||||
|
||||
_routed
|
||||
Reference in New Issue
Block a user