change vehicle flag actions to use class inheritance instead of object

This commit is contained in:
2024-02-08 12:01:51 -08:00
parent 3217ec487d
commit 7268d8fd50

View File

@@ -15,19 +15,10 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_
{ // forEach _baseClassesToApplyActionsFor { // forEach _baseClassesToApplyActionsFor
private _parentClass = _x; private _parentClass = _x;
////////////////////////////////////////////////////////////////////////
// add CBA class event handler to add actions to vehicles after they are initialized
// all classes that inherit from the base classes will also have this applied
// an exclusion function is present for manually excluding specific classes
////////////////////////////////////////////////////////////////////////
[_parentClass, "InitPost", {
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// create the root action // create the root action
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
private _rootActionID = "SetVehicleFlag"; private _rootActionID = QGVAR(SetVehicleFlagAction);
private _flagRootAction = [ private _flagRootAction = [
_rootActionID, // id _rootActionID, // id
"Set Vehicle Flag", // displayed title "Set Vehicle Flag", // displayed title
@@ -69,11 +60,12 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_
// add root action to add flags // add root action to add flags
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
[ [
(_this select 0), // object _parentClass, // parent classname
0, // action 0 or self-action 1 0, // action 0 or self-action 1
["ACE_MainActions"], // parent ["ACE_MainActions"], // parent
_flagRootAction // action _flagRootAction, // action
] call ace_interact_menu_fnc_addActionToObject; true // apply to child classes
] call ace_interact_menu_fnc_addActionToClass;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// add action to remove flag under the root action // add action to remove flag under the root action
@@ -97,13 +89,13 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_
// add the action to the vehicle // add the action to the vehicle
// in this class event handler, this#0 will be the vehicle // in this class event handler, this#0 will be the vehicle
[ [
(_this select 0), // object _parentClass, // parent classname
0, // action 0 or self-action 1 0, // action 0 or self-action 1
["ACE_MainActions", _rootActionID], // parent ["ACE_MainActions", _rootActionID], // parent
_removeFlagAction // action _removeFlagAction, // action
] call ace_interact_menu_fnc_addActionToObject; true // apply to child classes
] call ace_interact_menu_fnc_addActionToClass;
}, true, [], true] call CBA_fnc_addClassEventHandler;
} forEach _baseClassesToApplyActionsFor; } forEach _baseClassesToApplyActionsFor;
nil; nil;