2015-04-17 17:21:41 +00:00
|
|
|
/*
|
|
|
|
* 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-17 17:21:41 +00:00
|
|
|
*
|
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-08-26 13:20:11 +00:00
|
|
|
*
|
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-08-26 13:20:11 +00:00
|
|
|
*
|
2015-09-18 05:42:10 +00:00
|
|
|
* Public: No
|
2015-04-17 17:21:41 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
//SEH_s
|
2015-09-18 05:42:10 +00:00
|
|
|
if (isServer) then {
|
2015-04-17 17:21:41 +00:00
|
|
|
// Find the event name, and shovel out the events to the client
|
2015-09-18 05:42:10 +00:00
|
|
|
params ["_eventName", "_client"];
|
2015-08-26 13:20:11 +00:00
|
|
|
|
2015-09-18 05:42:10 +00:00
|
|
|
if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
|
2015-08-26 13:20:11 +00:00
|
|
|
ACE_LOGERROR("Request for synced event - key not found.");
|
2015-04-17 17:21:41 +00:00
|
|
|
false
|
|
|
|
};
|
2015-09-18 05:42:10 +00:00
|
|
|
|
|
|
|
private ["_eventEntry", "_eventLog"];
|
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
|
|
|
|
_eventLog = _eventEntry select 1;
|
2015-08-26 13:20:11 +00:00
|
|
|
|
2015-09-18 05:42:10 +00:00
|
|
|
["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent);
|
2015-04-17 17:21:41 +00:00
|
|
|
} else {
|
2015-09-18 05:42:10 +00:00
|
|
|
params ["_eventName", "_eventLog"];
|
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
// 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);
|
2015-04-17 17:21:41 +00:00
|
|
|
};
|
|
|
|
|
2015-08-26 13:20:11 +00:00
|
|
|
true
|