diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 08fa9701cd..4266e9f805 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -74,4 +74,38 @@ GVAR(lastTimeSearchedActions) = -1000; // Init zeus menu [] call FUNC(compileMenuZeus); +// Handle addActionToClass with Inheritance flag set (CAManBase actions are seperated for speed) +GVAR(inheritedActionsAll) = []; +GVAR(inheritedClassesAll) = []; +GVAR(inheritedActionsMan) = []; +GVAR(inheritedClassesMan) = []; + +["All", "InitPost", { + BEGIN_COUNTER(InitPost); + params ["_object"]; + private _type = typeOf _object; + + if (GVAR(inheritedClassesAll) pushBackUnique _type == -1) exitWith { END_COUNTER(InitPost); }; + + { + _x params ["_objectType", "_typeNum", "_parentPath", "_action"]; + if (_object isKindOf _objectType) then { + [_type, _typeNum, _parentPath, _action] call FUNC(addActionToClass); + }; + } forEach GVAR(inheritedActionsAll); + END_COUNTER(InitPost); +}] call CBA_fnc_addClassEventHandler; +["CAManBase", "InitPost", { + BEGIN_COUNTER(InitPost); + params ["_object"]; + private _type = typeOf _object; + + if (GVAR(inheritedClassesMan) pushBackUnique _type == -1) exitWith { END_COUNTER(InitPost); }; + { + _x params ["_typeNum", "_parentPath", "_action"]; + [_type, _typeNum, _parentPath, _action] call FUNC(addActionToClass); + } forEach GVAR(inheritedActionsMan); + END_COUNTER(InitPost); +}] call CBA_fnc_addClassEventHandler; + ADDON = true; diff --git a/addons/interact_menu/functions/fnc_addActionToClass.sqf b/addons/interact_menu/functions/fnc_addActionToClass.sqf index 20c229bfc6..69425ea047 100644 --- a/addons/interact_menu/functions/fnc_addActionToClass.sqf +++ b/addons/interact_menu/functions/fnc_addActionToClass.sqf @@ -25,21 +25,24 @@ if (!params [["_objectType", "", [""]], ["_typeNum", 0, [0]], ["_parentPath", [] ERROR("Bad Params"); [] }; -TRACE_4("params",_objectType,_typeNum,_parentPath,_action); +TRACE_4("addActionToClass",_objectType,_typeNum,_parentPath,_action); if (param [4, false, [false]]) exitwith { - if (isNil QGVAR(inheritedActions)) then {GVAR(inheritedActions) = [];}; - private _index = GVAR(inheritedActions) pushBack [[], _typeNum, _parentPath, _action]; - private _initEH = compile format [' - params ["_object"]; - private _typeOf = typeOf _object; - (GVAR(inheritedActions) select %1) params ["_addedClasses", "_typeNum", "_parentPath", "_action"]; - if (_typeOf in _addedClasses) exitWith {}; - _addedClasses pushBack _typeOf; - [_typeOf, _typeNum, _parentPath, _action] call FUNC(addActionToClass); - ', _index]; - TRACE_2("Added inheritable action",_objectType,_index); - [_objectType, "init", _initEH, true, [], true] call CBA_fnc_addClassEventHandler; + BEGIN_COUNTER(addAction); + if (_objectType == "CAManBase") then { + GVAR(inheritedActionsMan) pushBack [_typeNum, _parentPath, _action]; + { + [_x, _typeNum, _parentPath, _action] call FUNC(addActionToClass); + } forEach GVAR(inheritedClassesMan); + } else { + GVAR(inheritedActionsAll) pushBack [_objectType, _typeNum, _parentPath, _action]; + { + if (_x isKindOf _objectType) then { + [_x, _typeNum, _parentPath, _action] call FUNC(addActionToClass); + }; + } forEach GVAR(inheritedClassesAll); + }; + END_COUNTER(addAction); // Return the full path (_parentPath + [_action select 0]) diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 2f68d490b8..bac9d42fff 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -122,7 +122,7 @@ private _actions = [_actionsCfg, 0] call _recurseFnc; // ace_interaction_fnc_addPassengerAction expects ACE_MainActions to be first // Other mods can change the order that configs are added, so we should verify this now and resort if needed -if (_objectType isKindOf "CaManBase") then { +if (_objectType isKindOf "CAManBase") then { if ((((_actions select 0) select 0) select 0) != "ACE_MainActions") then { INFO_1("ACE_MainActions not first for man [%1]",_objectType); private _mainActions = []; diff --git a/addons/laser/functions/fnc_addLaserTarget.sqf b/addons/laser/functions/fnc_addLaserTarget.sqf index 48a98353e9..2cf99a5311 100644 --- a/addons/laser/functions/fnc_addLaserTarget.sqf +++ b/addons/laser/functions/fnc_addLaserTarget.sqf @@ -31,7 +31,7 @@ _vehicle setVariable [QGVAR(targetObject), _targetObject, true]; private _laserMethod = QFUNC(findLaserSource); private _vehicleSourceSelection = ""; -if (_vehicle isKindOf "CaManBase") then { +if (_vehicle isKindOf "CAManBase") then { _vehicleSourceSelection = "pilot"; } else { { // Go through turrets on vehicle and find the laser diff --git a/addons/medical/dev/test_hitpointConfigs.sqf b/addons/medical/dev/test_hitpointConfigs.sqf index fb65b34669..8838b1d744 100644 --- a/addons/medical/dev/test_hitpointConfigs.sqf +++ b/addons/medical/dev/test_hitpointConfigs.sqf @@ -5,7 +5,7 @@ #include "\z\ace\addons\medical\script_component.hpp" // UAV-AI should get filtered by scope check -private _mans = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(getNumber (_x >> 'scope')) == 2} && {configName _x isKindOf 'CaManBase'}", true]; +private _mans = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(getNumber (_x >> 'scope')) == 2} && {configName _x isKindOf 'CAManBase'}", true]; INFO_1("Checking mans for medical hitpoints [%1 mans]",count _mans); private _testPass = true;