ACE3/addons/common/functions/fnc__handleRequestSyncedEvent.sqf

49 lines
1.3 KiB
Plaintext
Raw Normal View History

/*
* Author: jaynus
2015-04-18 02:26:27 +00:00
* Receives either requests for synchronization from clients, or the synchronization data from the server.
*
2015-04-18 02:26:27 +00:00
* Arguments [Client] :
2015-09-18 05:42:10 +00:00
* 0: eventName <STRING>
* 1: eventLog <ARRAY>
*
2015-04-18 02:26:27 +00:00
* Arguments [Server] :
2015-09-18 05:42:10 +00:00
* 0: eventName <STRING>
* 1: client <OBJECT>
*
* Return Value:
* Event is successed <BOOL>
*
2015-09-18 05:42:10 +00:00
* Public: No
*/
#include "script_component.hpp"
//SEH_s
2015-09-18 05:42:10 +00:00
if (isServer) then {
// Find the event name, and shovel out the events to the client
2015-09-18 05:42:10 +00:00
params ["_eventName", "_client"];
2015-09-18 05:42:10 +00:00
if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
2016-04-25 20:48:24 +00:00
ACE_LOGERROR_1("Request for synced event - key [%1] not found.", _eventName);
false
};
2015-09-18 05:42:10 +00:00
private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
_eventEntry params ["", "_eventLog"];
[QGVAR(SEH_s), [_eventName, _eventLog], _client] call CBA_fnc_targetEvent;
} else {
2015-09-18 05:42:10 +00:00
params ["_eventName", "_eventLog"];
// This is the client handling the response from the server
// Start running the events
{
2015-09-18 05:42:10 +00:00
_x params ["", "_eventArgs","_ttl"];
[_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent);
2015-09-20 20:29:38 +00:00
false
} count _eventLog;
2015-09-18 05:42:10 +00:00
2015-08-26 15:39:44 +00:00
ACE_LOGINFO_1("[%1] synchronized",_eventName);
};
true