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] :
|
2015-09-18 05:42:10 +00:00
|
|
|
* 0: eventName <STRING>
|
|
|
|
* 1: arguments <ARRAY>
|
|
|
|
* 2: ttl <SCALAR>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Boolean of success <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"
|
|
|
|
|
2015-09-18 05:42:10 +00:00
|
|
|
params ["_name", "_args", "_ttl"];
|
|
|
|
|
|
|
|
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
|
2015-08-26 13:20:11 +00:00
|
|
|
ACE_LOGERROR("Synced event key not found.");
|
2015-04-17 17:21:41 +00:00
|
|
|
false
|
|
|
|
};
|
|
|
|
|
2015-09-18 05:42:10 +00:00
|
|
|
private ["_internalData", "_eventCode"];
|
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
|
|
|
|
2015-09-18 05:42:10 +00:00
|
|
|
if (isServer) then {
|
2015-04-17 17:21:41 +00:00
|
|
|
// Server needs to internally log it for synchronization
|
2015-09-18 05:42:10 +00:00
|
|
|
if (_ttl > -1) then {
|
2015-04-17 17:21:41 +00:00
|
|
|
_internalData = HASH_GET(GVAR(syncedEvents),_name);
|
2015-09-18 05:42:10 +00:00
|
|
|
|
|
|
|
private "_eventLog";
|
2015-04-17 17:21:41 +00:00
|
|
|
_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;
|
2015-08-26 13:20:11 +00:00
|
|
|
_args call _eventCode;
|