ACE3/addons/common/functions/fnc_localEvent.sqf
2015-08-26 15:32:54 +02:00

37 lines
956 B
Plaintext

/*
* Author: Nou
*
* Execute a local event on this client only.
*
* Argument:
* 0: Event name (string)
* 1: Event args (any)
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
PARAMS_2(_eventName,_eventArgs);
private["_eventIndex", "_eventNames", "_events"];
_eventNames = GVAR(events) select 0;
_eventIndex = _eventNames find _eventName;
if(_eventIndex != -1) then {
_events = (GVAR(events) select 1) select _eventIndex;
#ifdef DEBUG_EVENTS
ACE_LOGINFO(format ["* Local Event: %1", _eventName]);
ACE_LOGINFO(format [" args=%1", _eventArgs]);
#endif
{
if(!isNil "_x") then {
_eventArgs call CALLSTACK_NAMED(_x, format ["Local Event %1 ID: %2", _eventName, _forEachIndex]);
#ifdef DEBUG_EVENTS_CALLSTACK
ACE_LOGINFO(format [" ID: %1", _forEachIndex]);
#endif
};
} forEach _events;
};