ACE3/addons/common/functions/fnc__handleRequestSyncedEvent.sqf

49 lines
1.2 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 {
ACE_LOGERROR("Request for synced event - key not found.");
false
};
2015-09-18 05:42:10 +00:00
private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
_eventEntry params ["", "_eventLog"];
2015-09-18 05:42:10 +00:00
["SEH_s", _client, [_eventName, _eventLog]] call FUNC(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