diff --git a/addons/server/XEH_PREP.hpp b/addons/server/XEH_PREP.hpp index eb3e8f8..7dd10b8 100644 --- a/addons/server/XEH_PREP.hpp +++ b/addons/server/XEH_PREP.hpp @@ -1,3 +1,4 @@ PREP(3denCoreModuleConfig); +PREP(routerEntityAdd); +PREP(routerEntityRemove); PREP(ZeusCoreModuleConfig); -PREP(ZeusCoreModuleShow); \ No newline at end of file diff --git a/addons/server/functions/fnc_routerEntityAdd.sqf b/addons/server/functions/fnc_routerEntityAdd.sqf new file mode 100644 index 0000000..f340d34 --- /dev/null +++ b/addons/server/functions/fnc_routerEntityAdd.sqf @@ -0,0 +1,39 @@ +#include "..\script_component.hpp" +/* + * Author: Valmo + * Adds a unit into the global marked units array. + * + * Arguments: + * 0: The module logic + * + * 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; + }; +}; \ No newline at end of file diff --git a/addons/server/functions/fnc_routerEntityRemove.sqf b/addons/server/functions/fnc_routerEntityRemove.sqf new file mode 100644 index 0000000..56b7e02 --- /dev/null +++ b/addons/server/functions/fnc_routerEntityRemove.sqf @@ -0,0 +1,41 @@ +#include "..\script_component.hpp" +/* + * Author: Valmo + * Removes a unit from the global marked units array. + * + * Arguments: + * 0: The module logic + * + * 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; + }; +}; \ No newline at end of file