ACE3/addons/common/functions/fnc_localEvent.sqf

40 lines
923 B
Plaintext
Raw Normal View History

/*
* Author: Nou
* Execute a local event on this client only.
*
2015-09-18 16:28:19 +00:00
* Arguments:
* 0: Event name (string)
* 1: Event args (any)
*
2015-09-18 16:28:19 +00:00
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
2015-09-18 16:28:19 +00:00
params ["_eventName", "_eventArgs"];
2015-09-18 16:28:19 +00:00
GVAR(events) params ["_eventNames", "_eventArray"];
2015-05-14 22:12:40 +00:00
private _eventIndex = _eventNames find _eventName;
2015-09-18 16:28:19 +00:00
if (_eventIndex != -1) then {
private _events = _eventArray select _eventIndex;
2015-09-18 16:28:19 +00:00
#ifdef DEBUG_EVENTS
2015-08-26 15:39:44 +00:00
ACE_LOGINFO_1("* Local Event: %1",_eventName);
ACE_LOGINFO_1(" args=%1",_eventArgs);
#endif
{
2015-09-18 16:28:19 +00:00
if (!isNil "_x") then {
_eventArgs call CALLSTACK_NAMED(_x,FORMAT_2("Local Event %1 ID: %2",_eventName,_forEachIndex));
#ifdef DEBUG_EVENTS_CALLSTACK
2015-08-26 15:39:44 +00:00
ACE_LOGINFO_1(" ID: %1",_forEachIndex);
#endif
};
} forEach _events;
};