Add event renaming system

Allows us to switch event names such that anyone currently using our old event framework and names won't have their code broken until it is deprecated in version 3.8.0
This commit is contained in:
PabstMirror 2016-05-22 23:13:58 -05:00 committed by SilentSpike
parent 86b9022322
commit 84eca899a9
9 changed files with 70 additions and 5 deletions

View File

@ -12,6 +12,11 @@ class CfgPatches {
};
};
// This class will be deprecated in version 3.8.0
class ACE_newEvents {
playMoveNow = QGVAR(playMoveNow);
};
#include "CfgEventHandlers.hpp"
#include "CfgLocationTypes.hpp"

View File

@ -1,5 +1,14 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
_this call CBA_fnc_addEventHandler;
params ["_eventName", "_eventCode"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
[_eventName, _eventCode] call CBA_fnc_addEventHandler;
ACE_DEPRECATED("ace_common_fnc_addEventHandler","3.8.0","CBA_fnc_addEventHandler");

View File

@ -1,5 +1,14 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
_this call CBA_fnc_globalEvent;
params ["_eventName", "_eventArgs"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
[_eventName, _eventArgs] call CBA_fnc_globalEvent;
ACE_DEPRECATED("ace_common_fnc_globalEvent","3.8.0","CBA_fnc_globalEvent");

View File

@ -1,5 +1,13 @@
#include "script_component.hpp"
_this call CBA_fnc_localEvent;
params ["_eventName", "_eventArgs"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
[_eventName, _eventArgs] call CBA_fnc_localEvent;
ACE_DEPRECATED("ace_common_fnc_localEvent","3.8.0","CBA_fnc_localEvent");

View File

@ -2,6 +2,12 @@
params ["_eventName", "_eventTarget", "_eventArgs"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
[_eventName, _eventArgs, _eventTargets] call CBA_fnc_targetEvent;
ACE_DEPRECATED("ace_common_fnc_objectEvent","3.8.0","CBA_fnc_targetEvent");

View File

@ -2,6 +2,12 @@
params ["_eventName"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
CBA_events_eventNamespace setVariable [_eventName,nil];
CBA_events_eventHashes setVariable [_eventName,nil];

View File

@ -1,5 +1,13 @@
#include "script_component.hpp"
_this call CBA_fnc_removeEventHandler;
params ["_eventName", "_eventCode"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
[_eventName, _eventCode] call CBA_fnc_removeEventHandler;
ACE_DEPRECATED("ace_common_fnc_removeEventHandler","3.8.0","CBA_fnc_removeEventHandler");

View File

@ -1,5 +1,13 @@
#include "script_component.hpp"
_this call CBA_fnc_serverEvent;
params ["_eventName", "_eventArgs"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
[_eventName, _eventArgs] call CBA_fnc_serverEvent;
ACE_DEPRECATED("ace_common_fnc_serverEvent","3.8.0","CBA_fnc_serverEvent");

View File

@ -2,6 +2,12 @@
params ["_eventName", "_eventTargets", "_eventArgs"];
private _newName = getText (configFile >> "ACE_newEvents" >> _eventName);
if (_newName != "") then {
TRACE_2("Switching Names",_eventName,_newName);
_eventName = _newName;
};
[_eventName,_eventArgs,_eventTargets] call CBA_fnc_targetEvent;
ACE_DEPRECATED("ace_common_fnc_targetEvent","3.8.0","CBA_fnc_targetEvent");