Skip to content

Commit

Permalink
Merge pull request #279 from CBATeam/adddisablexeh2
Browse files Browse the repository at this point in the history
add possibility to disable all xeh on an object
  • Loading branch information
Killswitch00 committed Feb 26, 2016
2 parents bfa1148 + 6121eaf commit d07ff00
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion addons/xeh/fnc_addClassEventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private _config = configFile >> "CfgVehicles" >> _className;

// init fallback loop when executing on incompatible class for the first time
if (!GVAR(fallbackRunning) && {ISINCOMP(_className)}) then {
diag_log text format ["[XEH]: One or more children of class %1 do not support Extended Eventhandlers. Fall back to loop.", configName _config];
diag_log text format ["[XEH]: One or more children of class %1 do not support Extended Event Handlers. Fall back to loop.", configName _config];
call CBA_fnc_startFallbackLoop;
};

Expand Down
6 changes: 5 additions & 1 deletion addons/xeh/fnc_initEvents.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ if !(ISPROCESSED(_unit)) then {
SETPROCESSED(_unit);

private _class = configFile >> "CfgVehicles" >> typeOf _unit;
private _eventClass = _class >> "EventHandlers" >> QUOTE(XEH_CLASS);

// adds ability to disable XEH completely on a unit, by manually clearing the CBA event handler class.
if (isClass _eventClass && {configProperties [_eventClass] isEqualTo []}) exitWith {};

// add events to XEH incompatible units
if (!isClass (_class >> "EventHandlers" >> QUOTE(XEH_CLASS))) then {
if (!isClass _eventClass) then {
{
if (_x isEqualTo "hitpart") then {
_unit addEventHandler ["hitpart", "{_this call _x} forEach ((_this select 0 select 0) getVariable ""cba_xeh_hitpart"")"];
Expand Down
4 changes: 2 additions & 2 deletions addons/xeh/fnc_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ with uiNamespace do {
_x params ["_classname", "_addon"];

if (_addon == "") then {
diag_log text format ["[XEH]: %1 does not support Extended Eventhandlers!", _classname];
diag_log text format ["[XEH]: %1 does not support Extended Event Handlers!", _classname];
} else {
diag_log text format ["[XEH]: %1 does not support Extended Eventhandlers! Addon: %2", _classname, _addon];
diag_log text format ["[XEH]: %1 does not support Extended Event Handlers! Addon: %2", _classname, _addon];
};
} forEach (true call CBA_fnc_supportMonitor);
};
2 changes: 1 addition & 1 deletion addons/xeh/fnc_supportMonitor.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private _notSupportingClasses = [];

{
if (_classFilter == "" || {configName _x isKindOf _classFilter}) then {
if (configProperties [_x >> "EventHandlers" >> QUOTE(XEH_CLASS)] isEqualTo []) then {
if (!isClass (_x >> "EventHandlers" >> QUOTE(XEH_CLASS))) then {
// don't list duplicates
if (!_includeDuplicates && {{configName _x == "EventHandlers"} count configProperties [_x, "isClass _x", false] == 0}) exitWith {};

Expand Down

0 comments on commit d07ff00

Please sign in to comment.