
All checks were successful
Build / Build (push) Successful in 30s
Enhanced debugging capabilities by adding conditional logging statements to all DragonflyDB functions. These logs include input parameters and return values, providing detailed insights into function execution. The logging is enabled only when the `__A3__DEBUG__` preprocessor directive is defined, ensuring minimal performance impact in production environments. This change improves the ability to diagnose issues and understand the flow of data within the DragonflyDB system.
55 lines
1.8 KiB
Plaintext
55 lines
1.8 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Function: dragonfly_db_fnc_pubSubHandler
|
|
* Author: Creedcoder, J.Schmidt
|
|
* Edit: 07.15.2024
|
|
* Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved
|
|
*
|
|
* Do not edit without permission!
|
|
*
|
|
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
|
* To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons,
|
|
* PO Box 1866, Mountain View, CA 94042
|
|
*
|
|
* [Description]
|
|
* Handles pub/sub messages and routes them through the CBA event system based on event type.
|
|
*
|
|
* Arguments:
|
|
* 0: UniqueID for message tracking <STRING> (default: "")
|
|
* 1: Event type (global, local, server, remote) <STRING> (default: "")
|
|
* 2: Event name for CBA event system <STRING> (default: "")
|
|
* 3: Message data [<ARRAY|STRING|NUMBER|BOOL>] (default: [])
|
|
* 4: Target NetID for remote events <STRING> (default: "")
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Examples:
|
|
* ["123", "global", "myEvent", ["Hello"], ""] call dragonfly_db_fnc_pubSubHandler
|
|
* ["456", "remote", "playerEvent", ["Update"], "2:3"] call dragonfly_db_fnc_pubSubHandler
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params [["_uniqueID", "", [""]], ["_eventType", "", [""]], ["_eventName", "", [""]], ["_data", [], [[]]], ["_target", "", [""]]];
|
|
|
|
#ifdef __A3__DEBUG__
|
|
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubHandler' Data: %1", _this];
|
|
#endif
|
|
|
|
switch (_eventType) do {
|
|
case "global": {
|
|
[_eventName, _data] call CFUNC(globalEvent);
|
|
};
|
|
case "local": {
|
|
[_eventName, _data] call CFUNC(localEvent);
|
|
};
|
|
case "server": {
|
|
[_eventName, _data] call CFUNC(serverEvent);
|
|
};
|
|
case "remote": {
|
|
private _targetObj = objectFromNetId _target;
|
|
[_eventName, _data, _targetObj] call CFUNC(remoteEvent);
|
|
};
|
|
}; |