2023-09-12 18:58:10 +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
|
|
|
|
|
2021-10-10 16:55:14 +00:00
|
|
|
{
|
|
|
|
_y 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;
|
|
|
|
};
|
2021-10-10 16:55:14 +00:00
|
|
|
} forEach _eventLog;
|
|
|
|
_y set [1, _newEventLog];
|
|
|
|
} forEach GVAR(syncedEvents);
|
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
|