2015-09-20 13:52:40 +00:00
|
|
|
/*
|
|
|
|
* Author: ?
|
|
|
|
*
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* Public: ?
|
|
|
|
*/
|
2015-04-17 17:21:41 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-20 13:52:40 +00:00
|
|
|
if (!isServer) exitWith {false};
|
2015-04-17 17:21:41 +00:00
|
|
|
|
|
|
|
// Walk through the local synced events and clean up anything thats already EOL
|
|
|
|
// @TODO: This should be iteration limited to prevent FPS lag
|
2015-09-20 13:52:40 +00:00
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
{
|
2015-09-20 13:52:40 +00:00
|
|
|
private ["_name", "_data", "_newEventLog"];
|
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
_name = _x;
|
|
|
|
|
|
|
|
_data = HASH_GET(GVAR(syncedEvents),_name);
|
2015-09-20 13:52:40 +00:00
|
|
|
_data params ["_eventTime", "_eventLog", "_globalEventTTL"];
|
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
_newEventLog = [];
|
2015-09-20 13:52:40 +00:00
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
// @TODO: This should be iteration limited to prevent FPS lag
|
|
|
|
{
|
2015-09-20 13:52:40 +00:00
|
|
|
private ["_eventEntry", "_ttlReturn"];
|
|
|
|
|
2015-04-17 17:21:41 +00:00
|
|
|
_eventEntry = _x;
|
|
|
|
_ttlReturn = true;
|
2015-09-20 13:52:40 +00:00
|
|
|
|
|
|
|
if (typeName _globalEventTTL == "CODE") then {
|
|
|
|
_ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL;
|
2015-04-17 17:21:41 +00:00
|
|
|
} else {
|
2015-09-20 13:52:40 +00:00
|
|
|
_ttlReturn = call {_globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL}};
|
2015-04-17 17:21:41 +00:00
|
|
|
};
|
|
|
|
|
2015-09-20 13:52:40 +00:00
|
|
|
if (_ttlReturn) then {
|
2015-04-17 17:21:41 +00:00
|
|
|
// Do event based TTL check
|
2015-09-20 13:52:40 +00:00
|
|
|
_eventEntry params ["_time", "", "_eventTTL"];
|
|
|
|
|
|
|
|
if (typeName _eventTTL == "CODE") then {
|
|
|
|
_ttlReturn = [_eventTime, _eventEntry] call _eventTTL;
|
2015-04-17 17:21:41 +00:00
|
|
|
} else {
|
2015-09-20 13:52:40 +00:00
|
|
|
_ttlReturn = call {_eventTTL < 1 || {ACE_diagTime < _time + _eventTTL}};
|
2015-04-17 17:21:41 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// Finally drop it if the TTL check fails
|
2015-09-20 13:52:40 +00:00
|
|
|
if (_ttlReturn) then {
|
2015-04-17 17:21:41 +00:00
|
|
|
_newEventLog pushBack _x;
|
|
|
|
};
|
2015-09-20 13:52:40 +00:00
|
|
|
false
|
|
|
|
} count _eventLog;
|
2015-04-17 17:21:41 +00:00
|
|
|
|
2015-09-20 13:52:40 +00:00
|
|
|
_data set [1, _newEventLog];
|
|
|
|
false
|
|
|
|
} count (GVAR(syncedEvents) select 0);
|
2015-04-17 17:21:41 +00:00
|
|
|
|
|
|
|
// @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events
|