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>
|
2016-01-29 00:19:02 +00:00
|
|
|
* 2: ttl <NUMBER>
|
2015-09-18 05:42:10 +00:00
|
|
|
*
|
|
|
|
* 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-12-14 12:08:19 +00:00
|
|
|
private _internalData = HASH_GET(GVAR(syncedEvents),_name);
|
2015-04-17 17:21:41 +00:00
|
|
|
|
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
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
_internalData params ["", "_eventLog"];
|
2015-11-30 16:21:28 +00:00
|
|
|
_eventLog pushBack [ACE_diagTime, _args, _ttl];
|
2015-04-17 17:21:41 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
_internalData params ["_eventCode"];
|
2015-08-26 13:20:11 +00:00
|
|
|
_args call _eventCode;
|