2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2016-05-30 16:37:03 +00:00
|
|
|
/*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Author: ACE-Team
|
2016-05-30 16:37:03 +00:00
|
|
|
*
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* ?
|
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [?] call ace_common_fnc_syncedEventPFH
|
2016-05-30 16:37:03 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Public: No
|
2016-05-30 16:37:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
if (!isServer) exitWith {false};
|
|
|
|
|
|
|
|
// Walk through the local synced events and clean up anything thats already EOL
|
|
|
|
// @TODO: This should be iteration limited to prevent FPS lag
|
|
|
|
|
2016-07-30 10:28:06 +00:00
|
|
|
[GVAR(syncedEvents), {
|
|
|
|
_value params ["_eventTime", "_eventLog", "_globalEventTTL"];
|
2016-05-30 16:37:03 +00:00
|
|
|
|
|
|
|
private _newEventLog = [];
|
|
|
|
|
|
|
|
// @TODO: This should be iteration limited to prevent FPS lag
|
|
|
|
{
|
|
|
|
private _eventEntry = _x;
|
|
|
|
private _ttlReturn = true;
|
|
|
|
|
|
|
|
if (_globalEventTTL isEqualType {}) then {
|
|
|
|
_ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL;
|
|
|
|
} else {
|
2016-06-02 15:02:09 +00:00
|
|
|
_ttlReturn = call {_globalEventTTL < 1 || {diag_tickTime < (_eventEntry select 0) + _globalEventTTL}};
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_ttlReturn) then {
|
|
|
|
// Do event based TTL check
|
|
|
|
_eventEntry params ["_time", "", "_eventTTL"];
|
|
|
|
|
|
|
|
if (_eventTTL isEqualType {}) then {
|
|
|
|
_ttlReturn = [_eventTime, _eventEntry] call _eventTTL;
|
|
|
|
} else {
|
2016-06-02 15:02:09 +00:00
|
|
|
_ttlReturn = call {_eventTTL < 1 || {diag_tickTime < _time + _eventTTL}};
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// Finally drop it if the TTL check fails
|
|
|
|
if (_ttlReturn) then {
|
|
|
|
_newEventLog pushBack _x;
|
|
|
|
};
|
|
|
|
false
|
|
|
|
} count _eventLog;
|
|
|
|
|
2016-07-30 10:28:06 +00:00
|
|
|
_value set [1, _newEventLog];
|
2016-05-30 16:37:03 +00:00
|
|
|
false
|
2016-07-30 10:28:06 +00:00
|
|
|
}] call CBA_fnc_hashEachPair;
|
2016-05-30 16:37:03 +00:00
|
|
|
|
|
|
|
// @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events
|