mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
more common cleanup
This commit is contained in:
parent
fc82018c49
commit
e833c3fc42
@ -1,33 +1,34 @@
|
||||
/*
|
||||
* Author: Nou
|
||||
* Add an event handler.
|
||||
*
|
||||
* Add a event handler.
|
||||
* Arguments:
|
||||
* 0: Event name <STRING>
|
||||
* 1: Event code <CODE>
|
||||
*
|
||||
* Argument:
|
||||
* 0: Event name (string)
|
||||
* 1: Event code (code)
|
||||
* Return Value:
|
||||
* Event handler ID number (for use with fnc_removeEventHandler) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Event handler ID number (for use with fnc_removeEventHandler)
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_eventNames", "_eventFunctions", "_eventNameCount", "_eventIndex", "_eventFunctionCount"];
|
||||
params ["_eventName", "_eventCode"];
|
||||
|
||||
PARAMS_2(_eventName,_eventCode);
|
||||
private ["_eventNames", "_eventFunctions", "_eventIndex"];
|
||||
|
||||
_eventNames = GVAR(events) select 0;
|
||||
_eventFunctions = [];
|
||||
_eventIndex = _eventNames find _eventName;
|
||||
|
||||
if (_eventIndex != -1) then {
|
||||
_eventFunctions = (GVAR(events) select 1) select _eventIndex;
|
||||
} else {
|
||||
private "_eventNameCount";
|
||||
_eventNameCount = count _eventNames;
|
||||
_eventNames set[_eventNameCount, _eventName];
|
||||
(GVAR(events) select 1) set[_eventNameCount, _eventFunctions];
|
||||
|
||||
_eventNames set [_eventNameCount, _eventName];
|
||||
(GVAR(events) select 1) set [_eventNameCount, _eventFunctions];
|
||||
};
|
||||
|
||||
_eventFunctionCount = count _eventFunctions;
|
||||
_eventFunctions set [_eventFunctionCount, _eventCode];
|
||||
|
||||
_eventFunctionCount;
|
||||
_eventFunctions pushBack _eventCode // Return event function count
|
||||
|
@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Add line to draw on debug
|
||||
*
|
||||
* Argument:
|
||||
* 0: Start point ASL (Array)
|
||||
* 1: End point ASL (Array)
|
||||
* 2: Color (Array)
|
||||
* Arguments:
|
||||
* 0: Start point ASL <ARRAY>
|
||||
* 1: End point ASL <ARRAY>
|
||||
* 2: Color <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -45,4 +45,4 @@ if (isNil QGVAR(debugDrawHandler)) then {
|
||||
drawLine3D [_p0, _p1, _x select 2];
|
||||
} forEach GVAR(debugLines);
|
||||
}];
|
||||
};
|
||||
};
|
||||
|
@ -1,29 +1,29 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Add a map marker creation event handler.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Code to execute (Code or String)
|
||||
* Arguments:
|
||||
* 0: Code to execute <CODE, STRING>
|
||||
*
|
||||
* Return value:
|
||||
* ID of the event script (used to remove it later).
|
||||
* Return Value:
|
||||
* ID of the event script (used to remove it later). <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_actionsVar", "_id", "_actionIDs", "_actions"];
|
||||
|
||||
PARAMS_1(_statement);
|
||||
params ["_statement"];
|
||||
|
||||
if (typeName _statement == "STRING") then {
|
||||
_statement = compile _statement;
|
||||
};
|
||||
|
||||
private "_actionsVar";
|
||||
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
|
||||
|
||||
_id = (_actionsVar select 0) + 1;
|
||||
_actionIDs = _actionsVar select 1;
|
||||
_actions = _actionsVar select 2;
|
||||
_actionsVar params ["_id", "_actionIDs", "_actions"];
|
||||
|
||||
_id = _id + 1;
|
||||
|
||||
if (_id == 0) then {
|
||||
uiNamespace setVariable ["ACE_EventHandler_MapMarker", count allMapMarkers];
|
||||
|
@ -1,29 +1,30 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games.
|
||||
* _this will be [Interval] where 'Interval' is a number.
|
||||
*
|
||||
* Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games. Argument will be [Interval] where 'Interval' is a number.
|
||||
* Arguments:
|
||||
* 0: Code to execute <CODE, STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: Code to execute (Code or String)
|
||||
* Return Value:
|
||||
* ID of the event script (used to remove it later). <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* ID of the event script (used to remove it later).
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_actionsVar", "_id", "_actionIDs", "_actions"];
|
||||
|
||||
PARAMS_1(_statement);
|
||||
params ["_statement"];
|
||||
|
||||
if (typeName _statement == "STRING") then {
|
||||
_statement = compile _statement;
|
||||
_statement = compile _statement;
|
||||
};
|
||||
|
||||
private "_actionsVar";
|
||||
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
|
||||
|
||||
_id = (_actionsVar select 0) + 1;
|
||||
_actionIDs = _actionsVar select 1;
|
||||
_actions = _actionsVar select 2;
|
||||
_actionsVar params ["_id", "_actionIDs", "_actions"];
|
||||
|
||||
_id = _id + 1;
|
||||
|
||||
_actionIDs pushBack _id;
|
||||
_actions pushBack _statement;
|
||||
|
Loading…
Reference in New Issue
Block a user