2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-05-30 16:37:03 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
|
|
|
* Handles synced events being received. Server will log them, and server/client will execute them.
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Arguments: [Client]
|
2016-05-30 16:37:03 +00:00
|
|
|
* 0: eventName <STRING>
|
|
|
|
* 1: arguments <ARRAY>
|
|
|
|
* 2: ttl <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Boolean of success <BOOL>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob] call ace_common_fnc__handleSyncedEvent
|
|
|
|
*
|
2016-05-30 16:37:03 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_name", "_args", "_ttl"];
|
|
|
|
|
2021-10-10 16:55:14 +00:00
|
|
|
if !(_name in GVAR(syncedEvents)) exitWith {
|
2024-02-05 17:04:24 +00:00
|
|
|
ERROR_1("Synced event key [%1] not found (_handleSyncedEvent).",_name);
|
2016-05-30 16:37:03 +00:00
|
|
|
false
|
|
|
|
};
|
|
|
|
|
2021-10-10 16:55:14 +00:00
|
|
|
private _internalData = GVAR(syncedEvents) get _name;
|
2016-07-30 10:28:06 +00:00
|
|
|
_internalData params ["_eventCode", "_eventLog"];
|
2016-05-30 16:37:03 +00:00
|
|
|
|
|
|
|
if (isServer) then {
|
|
|
|
// Server needs to internally log it for synchronization
|
|
|
|
if (_ttl > -1) then {
|
2016-06-02 15:02:09 +00:00
|
|
|
_eventLog pushBack [diag_tickTime, _args, _ttl];
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_args call _eventCode;
|