2015-01-14 20:44:32 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
2015-04-04 17:08:59 +00:00
|
|
|
PARAMS_2(_eventName,_eventArgs);
|
2015-01-14 20:44:32 +00:00
|
|
|
|
|
|
|
_eventNames = GVAR(events) select 0;
|
|
|
|
_eventIndex = _eventNames find _eventName;
|
|
|
|
if(_eventIndex != -1) then {
|
|
|
|
_events = (GVAR(events) select 1) select _eventIndex;
|
2015-04-02 23:05:21 +00:00
|
|
|
#ifdef DEBUG_EVENTS
|
|
|
|
diag_log text format[ARR_2("* Local Event: %1",_eventName)];
|
|
|
|
diag_log text format[ARR_2(" args=%1",_eventArgs)];
|
|
|
|
#endif
|
|
|
|
|
2015-01-14 20:44:32 +00:00
|
|
|
{
|
|
|
|
if(!isNil "_x") then {
|
|
|
|
_eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Local Event %1 ID: %2",_eventName,_forEachIndex)]);
|
2015-04-02 23:05:21 +00:00
|
|
|
#ifdef DEBUG_EVENTS_CALLSTACK
|
|
|
|
diag_log text format[ARR_2(" ID: %1",_forEachIndex)];
|
|
|
|
#endif
|
2015-01-14 20:44:32 +00:00
|
|
|
};
|
|
|
|
} forEach _events;
|
|
|
|
};
|