2015-04-17 17:21:41 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
2015-04-18 02:26:27 +00:00
|
|
|
*
|
|
|
|
* Handles synced events being received. Server will log them, and server/client will execute them.
|
2015-04-17 17:21:41 +00:00
|
|
|
*
|
2015-04-18 02:26:27 +00:00
|
|
|
* Arguments [Client] :
|
|
|
|
* 0: eventName (String)
|
|
|
|
* 1: arguments (Array)
|
|
|
|
* 2: ttl (Scalar)
|
2015-04-17 17:21:41 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Boolean of success
|
|
|
|
*/
|
2015-04-18 02:26:27 +00:00
|
|
|
//#define DEBUG_MODE_FULL
|
2015-04-17 17:21:41 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
PARAMS_3(_name,_args,_ttl);
|
|
|
|
private["_internalData", "_eventLog", "_eventCode"];
|
|
|
|
|
|
|
|
if(!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
|
|
|
diag_log text format["[ACE] Error, synced event key not found."];
|
|
|
|
false
|
|
|
|
};
|
|
|
|
|
|
|
|
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
|
|
|
|
|
|
|
if(isServer) then {
|
|
|
|
// Server needs to internally log it for synchronization
|
|
|
|
if(_ttl > -1) then {
|
|
|
|
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
|
|
|
_eventLog = _internalData select 1;
|
2015-05-21 16:42:44 +00:00
|
|
|
_eventLog pushback [ACE_diagTime, _args, _ttl];
|
2015-04-17 17:21:41 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_eventCode = _internalData select 0;
|
|
|
|
_args call _eventCode;
|