From 09dcde7471c606c5eca58267d55ad2b463dcc9b9 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Sat, 3 Feb 2024 20:59:51 -0800 Subject: [PATCH 1/2] wip --- defines/VehicleFlags.hpp | 129 ++++++++++ functions/CfgFunctions.hpp | 11 +- functions/client/fn_initVehicleFlags.sqf | 225 ------------------ .../fn_getActionsFlagCategories.sqf | 87 +++++++ .../vehicleFlags/fn_getVehicleFlagsCfg.sqf | 1 + .../vehicleFlags/fn_initVehicleFlags.sqf | 113 +++++++++ functions/vehicleFlags/fn_isClassExcluded.sqf | 26 ++ 7 files changed, 366 insertions(+), 226 deletions(-) create mode 100644 defines/VehicleFlags.hpp delete mode 100644 functions/client/fn_initVehicleFlags.sqf create mode 100644 functions/vehicleFlags/fn_getActionsFlagCategories.sqf create mode 100644 functions/vehicleFlags/fn_getVehicleFlagsCfg.sqf create mode 100644 functions/vehicleFlags/fn_initVehicleFlags.sqf create mode 100644 functions/vehicleFlags/fn_isClassExcluded.sqf diff --git a/defines/VehicleFlags.hpp b/defines/VehicleFlags.hpp new file mode 100644 index 0000000..fce9606 --- /dev/null +++ b/defines/VehicleFlags.hpp @@ -0,0 +1,129 @@ +class VehicleFlags { + + texturePBOName = "textures"; + baseClassesToApplyActionsFor[] = { + "LandVehicle", + "Helicopter" + }; + + class ExcludedVehicles { + classesWithoutFlagProxies[] = { + "TF373_SOAR_MH47G_Base", // MH-47G Chinook + "RHS_MELB_base", // MELB AH-6M/MH-6M/H-6M Little Bird + "USAF_C17", // C17 Globemaster III + "USAF_C130J", // C130J Super Hercules + "USAF_AC130U", // AC130 Spooky II + "ej_UH60M_base", // UH-60M Black Hawk + DAP variants + "rhsusf_fmtv_base" // M1083A1P2 variants + SOV SOCOM variants + }; + }; + + class FlagCategories { + class ChevronNumbers { + actionID = "flag_chevron_numbers"; + actionTitle = "Chevron Numbers"; + + class Chevron1 { + actionID = "flag_chevron_id1"; + actionTitle = "Flag 1"; + texture = "textures\flag_number\flag_id_1_co.paa"; + }; + class Chevron2 { + actionID = "flag_chevron_id2"; + actionTitle = "Flag 2"; + texture = "textures\flag_number\flag_id_2_co.paa"; + }; + class Chevron3 { + actionID = "flag_chevron_id3"; + actionTitle = "Flag 3"; + texture = "textures\flag_number\flag_id_3_co.paa"; + }; + class Chevron4 { + actionID = "flag_chevron_id4"; + actionTitle = "Flag 4"; + texture = "textures\flag_number\flag_id_4_co.paa"; + }; + class Chevron5 { + actionID = "flag_chevron_id5"; + actionTitle = "Flag 5"; + texture = "textures\flag_number\flag_id_5_co.paa"; + }; + class Chevron6 { + actionID = "flag_chevron_id6"; + actionTitle = "Flag 6"; + texture = "textures\flag_number\flag_id_6_co.paa"; + }; + class Chevron7 { + actionID = "flag_chevron_id7"; + actionTitle = "Flag 7"; + texture = "textures\flag_number\flag_id_7_co.paa"; + }; + class Chevron8 { + actionID = "flag_chevron_id8"; + actionTitle = "Flag 8"; + texture = "textures\flag_number\flag_id_8_co.paa"; + }; + class Chevron9 { + actionID = "flag_chevron_id9"; + actionTitle = "Flag 9"; + texture = "textures\flag_number\flag_id_9_co.paa"; + }; + class Chevron10 { + actionID = "flag_chevron_id10"; + actionTitle = "Flag 10"; + texture = "textures\flag_number\flag_id_10_co.paa"; + }; + class ChevronHQ { + actionID = "flag_chevron_hq"; + actionTitle = "Flag HQ"; + texture = "textures\flag_number\flag_id_hq_co.paa"; + }; + }; + + class SimpleShapes { + actionID = "flag_simpleshape"; + actionTitle = "Simple Shapes"; + + class GreenOctagon { + actionID = "flag_simpleshape_greenoctagon"; + actionTitle = "Green Octagon"; + texture = "textures\simple_shape\flag_simpleshape_greenoctagon_co.paa"; + }; + class BlueCircle { + actionID = "flag_simpleshape_bluecircle"; + actionTitle = "Blue Circle"; + texture = "textures\simple_shape\flag_simpleshape_bluecircle_co.paa"; + }; + class OrangeSquare { + actionID = "flag_simpleshape_orangesquare"; + actionTitle = "Orange Square"; + texture = "textures\simple_shape\flag_simpleshape_orangesquare_co.paa"; + }; + class PinkTriangle { + actionID = "flag_simpleshape_pinktriangle"; + actionTitle = "Pink Triangle"; + texture = "textures\simple_shape\flag_simpleshape_pinktriangle_co.paa"; + }; + class RedPentagon { + actionID = "flag_simpleshape_redpentagon"; + actionTitle = "Red Pentagon"; + texture = "textures\simple_shape\flag_simpleshape_redpentagon_co.paa"; + }; + }; + + class Miscellaneous { + actionID = "flag_misc"; + actionTitle = "Miscellaneous"; + class BattalionEmblem { + actionID = "flag_17th_emblem"; + actionTitle = "17th Emblem"; + texture = "textures\flags_misc\flag_17th_emblem_co.paa"; + }; + class RedCross { + actionID = "flag_redcross"; + actionTitle = "Red Cross"; + texture = "textures\flags_misc\flag_redcross_co.paa"; + }; + }; + }; +}; \ No newline at end of file diff --git a/functions/CfgFunctions.hpp b/functions/CfgFunctions.hpp index 68eae3c..3709be3 100644 --- a/functions/CfgFunctions.hpp +++ b/functions/CfgFunctions.hpp @@ -39,7 +39,6 @@ class milsim class addClientStatsPFH {}; class addMedicalOverlayPFH { postInit = 1; }; class calculateClientStats {}; - class initVehicleFlags { postInit = 1; }; class bindEmptyGroupGarbageCleanup { postInit = 1; }; }; @@ -131,4 +130,14 @@ class milsim_reinsert { class addCheckQueueSelfAction {}; class requestShowQueue {}; }; +}; + +class milsim_vehicleFlags { + class functions { + file = "functions\vehicleFlags"; + class initVehicleFlags {postInit = 1}; + class getActionsFlagCategories {}; + class getVehicleFlagsCfg {}; + class isClassExcluded{}; + }; }; \ No newline at end of file diff --git a/functions/client/fn_initVehicleFlags.sqf b/functions/client/fn_initVehicleFlags.sqf deleted file mode 100644 index 20c2e02..0000000 --- a/functions/client/fn_initVehicleFlags.sqf +++ /dev/null @@ -1,225 +0,0 @@ -milsim_vehicleflag_options = [ - ["Chevron IDs", [ - ["flag_chevron_id1", createHashMapFromArray [ - ["Title", "Flag 1"], - ["Texture", "textures\flag_number\flag_id_1_co.paa"] - ]], - ["flag_chevron_id2", createHashMapFromArray [ - ["Title", "Flag 2"], - ["Texture", "textures\flag_number\flag_id_2_co.paa"] - ]], - ["flag_chevron_id3", createHashMapFromArray [ - ["Title", "Flag 3"], - ["Texture", "textures\flag_number\flag_id_3_co.paa"] - ]], - ["flag_chevron_id4", createHashMapFromArray [ - ["Title", "Flag 4"], - ["Texture", "textures\flag_number\flag_id_4_co.paa"] - ]], - ["flag_chevron_id5", createHashMapFromArray [ - ["Title", "Flag 5"], - ["Texture", "textures\flag_number\flag_id_5_co.paa"] - ]], - ["flag_chevron_id6", createHashMapFromArray [ - ["Title", "Flag 6"], - ["Texture", "textures\flag_number\flag_id_6_co.paa"] - ]], - ["flag_chevron_id7", createHashMapFromArray [ - ["Title", "Flag 7"], - ["Texture", "textures\flag_number\flag_id_7_co.paa"] - ]], - ["flag_chevron_id8", createHashMapFromArray [ - ["Title", "Flag 8"], - ["Texture", "textures\flag_number\flag_id_8_co.paa"] - ]], - ["flag_chevron_id9", createHashMapFromArray [ - ["Title", "Flag 9"], - ["Texture", "textures\flag_number\flag_id_9_co.paa"] - ]], - ["flag_chevron_id10", createHashMapFromArray [ - ["Title", "Flag 10"], - ["Texture", "textures\flag_number\flag_id_10_co.paa"] - ]], - ["flag_chevron_hq", createHashMapFromArray [ - ["Title", "Flag HQ"], - ["Texture", "textures\flag_number\flag_id_hq_co.paa"] - ]] - ]], - ["Simple Shapes", [ - ["flag_simpleshape_greenoctagon", createHashMapFromArray [ - ["Title", "Green Octagon"], - ["Texture", "textures\simple_shape\flag_simpleshape_greenoctagon_co.paa"] - ]], - ["flag_simpleshape_bluecircle", createHashMapFromArray [ - ["Title", "Blue Circle"], - ["Texture", "textures\simple_shape\flag_simpleshape_bluecircle_co.paa"] - ]], - ["flag_simpleshape_orangesquare", createHashMapFromArray [ - ["Title", "Orange Square"], - ["Texture", "textures\simple_shape\flag_simpleshape_orangesquare_co.paa"] - ]], - ["flag_simpleshape_pinktriangle", createHashMapFromArray[ - ["Title", "Pink Triangle"], - ["Texture", "textures\simple_shape\flag_simpleshape_pinktriangle_co.paa"] - ]], - ["flag_simpleshape_redpentagon", createHashMapFromArray [ - ["Title", "Red Pentagon"], - ["Texture", "textures\simple_shape\flag_simpleshape_redpentagon_co.paa"] - ]] - ]], - ["Miscellaneous", [ - ["flag_17th_emblem", createHashMapFromArray [ - ["Title", "17th Emblem"], - ["Texture", "textures\flags_misc\flag_17th_emblem_co.paa"] - ]], - ["flag_redcross", createHashMapFromArray [ - ["Title", "Red Cross"], - ["Texture", "textures\flags_misc\flag_redcross_co.paa"] - ]] - ]] -]; - - -private _appliedParentClasses = [ - "LandVehicle", - "Helicopter" -]; - -private _modelsWithoutFlagProxies = [ - "TF373_SOAR_MH47G_Base", // MH-47G Chinook - "RHS_MELB_base", // MELB AH-6M/MH-6M/H-6M Little Bird - "USAF_C17", // C17 Globemaster III - "USAF_C130J", // C130J Super Hercules - "USAF_AC130U", // AC130 Spooky II - "ej_UH60M_base", // UH-60M Black Hawk + DAP variants - "rhsusf_fmtv_base" // M1083A1P2 variants + SOV SOCOM variants -]; - -{ - private _parentClass = _x; - [_parentClass, "InitPost", { - private _flagActionID = "SetVehicleFlag"; - private _flagMasterAction = [ - _flagActionID, // id - "Set Vehicle Flag", // displayed title - "\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon - {true}, // statement - { - params ["_target", "_player", "_params"]; - private _modelsWithoutFlagProxies = _params select 1; - - // check if hierarchy includes any of the models without flag proxies - private _excluded = false; - { - if (_excluded) exitWith {false}; - _excluded = _target isKindOf _x; - } forEach _modelsWithoutFlagProxies; - if (_excluded) exitWith {false}; - - - // check if vehicle is alive - alive _target; - }, // condition - { - params ["_target", "_player", "_params"]; - private _flagActionID = _params#0; - private _actions = []; - { - _x params ["_flagCategory", "_flagOptions"]; - // diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions]; - - private _flagCategoryOption = [ - _flagActionID + "_" + _flagCategory, // id - _flagCategory, // displayed title - (_flagOptions#0#1) get "Texture", // flag icon - {true}, // statement - { - params ["_target", "_player", "_params"]; - alive _target; - // true; - }, // condition - { - params ["_target", "_player", "_params"]; - _params params ["_flagActionID", "_flagCategoryID", "_flagOptions"]; - private _categoryOptions = []; - { - _x params ["_flagOptionID", "_flagOptionData"]; - // diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData]; - private _newFlagOption = [ - _flagActionID + "_" + _flagCategory + "_" + _flagOptionID, // id - _flagOptionData get "Title", // displayed title - _flagOptionData get "Texture", // flag icon - { - params ["_target", "_player", "_params"]; - _target forceFlagTexture (_params select 2); - }, // statement - { - params ["_target", "_player", "_params"]; - alive _target; - // true; - }, // condition - nil, // child code - [_flagActionID, _flagCategoryID, getMissionPath (_flagOptionData get "Texture")], // params - nil, // position - 4, // distance - [false, false, false, false, false] // other params - ] call ace_interact_menu_fnc_createAction; - _categoryOptions pushBack [_newFlagOption, [], _target]; - } forEach _flagOptions; - _categoryOptions; - }, // child code - [_flagActionID, _flagCategoryID, _flagOptions], // params - nil, // position - 4, // distance - [false, false, false, false, false], // other params - nil // modifier function code - ] call ace_interact_menu_fnc_createAction; - - _actions pushBack [_flagCategoryOption, [], _target]; - } forEach milsim_vehicleflag_options; - - _actions; - }, // child code - [_flagActionID, _modelsWithoutFlagProxies], // params - nil, // position - 4, // distance - [false, false, false, false, false], // other params - nil // modifier function code - ] call ace_interact_menu_fnc_createAction; - - // add action to add flag - [ - (_this select 0), // object - 0, // action 0 or self-action 1 - ["ACE_MainActions"], // parent - _flagMasterAction // action - ] call ace_interact_menu_fnc_addActionToObject; - - - // add action to remove flag - private _removeFlagAction = [ - _flagActionID + "_removeflag", // id - "Remove Flag", // displayed title - "\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon - { - params ["_target", "_player", "_params"]; - _target forceFlagTexture ""; - }, // statement - { - params ["_target", "_player", "_params"]; - alive _target && getForcedFlagTexture _target != ""; - }, // condition - nil // child code - ] call ace_interact_menu_fnc_createAction; - - [ - (_this select 0), // object - 0, // action 0 or self-action 1 - ["ACE_MainActions", _flagActionID], // parent - _removeFlagAction // action - ] call ace_interact_menu_fnc_addActionToObject; - - }, true, [], true] call CBA_fnc_addClassEventHandler; -} forEach _appliedParentClasses; - -nil; \ No newline at end of file diff --git a/functions/vehicleFlags/fn_getActionsFlagCategories.sqf b/functions/vehicleFlags/fn_getActionsFlagCategories.sqf new file mode 100644 index 0000000..640235d --- /dev/null +++ b/functions/vehicleFlags/fn_getActionsFlagCategories.sqf @@ -0,0 +1,87 @@ +/* + Used to generate flag category and nested flag child options for the ACE3 interaction menu. + + Parameters: + 0: STRING - Parent action ID + 1: ARRAY - Flag category configs +*/ + +params ["_rootActionID", "_flagCategoryCfgs"]; + +private _allCategoryActions = []; + +{ + // diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions]; + + private _flagCategoryCfg = _x; + private _flagCategoryActionID = getText(_flagCategoryCfg >> "actionID"); + private _flagCategoryTitle = getText(_flagCategoryCfg >> "actionTitle"); + + private _flagSubclassesCfgs = _flagCategoryCfg call BIS_fnc_returnChildren; + + private _flagCategoryAction = [ + _rootActionID + "_" + _flagCategoryActionID, // id + _flagCategoryTitle, // displayed title + getText((_flagSubclassesCfgs#0) >> "texture"), // flag icon for category - use first flag option + {true}, // statement + { + params ["_target", "_player", "_params"]; + alive _target; + // true; + }, // condition + { + // generate child code under category + // this is the level where actual flag options will be displayed + params ["_target", "_player", "_params"]; + _params params ["_rootActionID", "_flagCategoryActionID", "_flagSubclassesCfgs"]; + + private _individualFlagActions = []; + { // forEach _flagSubclassesCfgs; + private _flagOptionCfg = _x; + private _flagOptionID = getText(_flagOptionCfg >> "actionID"); + private _flagOptionTitle = getText(_flagOptionCfg >> "actionTitle"); + private _flagOptionTexture = getText(_flagOptionCfg >> "texture"); + + // diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData]; + + private _newFlagOption = [ + + _rootActionID + "_" + _flagCategoryActionID + "_" + _flagOptionID, // id + _flagOptionTitle, // displayed title + _flagOptionTexture, // flag icon + { + params ["_target", "_player", "_params"]; + _params params ["_flagOptionTexture"]; + _target forceFlagTexture _flagOptionTexture; + }, // statement + { + params ["_target", "_player", "_params"]; + alive _target; + // true; + }, // condition + nil, // child code + [_flagOptionTexture], // params + nil, // position + 4, // distance + [false, false, false, false, false] // other params + ] call ace_interact_menu_fnc_createAction; + + // add flag option to category subactions + _individualFlagActions pushBack [_newFlagOption, [], _target]; + } forEach _flagSubclassesCfgs; + + // return the generated flag options to the category as child actions + _individualFlagActions; + }, // child code + [_rootActionID, _flagCategoryActionID, _flagSubclassesCfgs], // params + nil, // position + 4, // distance + [false, false, false, false, false], // other params + nil // modifier function code + ] call ace_interact_menu_fnc_createAction; + + // add category to all category actions array + _allCategoryActions pushBack [_flagCategoryAction, [], _target]; +} forEach _flagCategoryCfgs; + +_allCategoryActions; \ No newline at end of file diff --git a/functions/vehicleFlags/fn_getVehicleFlagsCfg.sqf b/functions/vehicleFlags/fn_getVehicleFlagsCfg.sqf new file mode 100644 index 0000000..6330cbc --- /dev/null +++ b/functions/vehicleFlags/fn_getVehicleFlagsCfg.sqf @@ -0,0 +1 @@ +(missionConfigFile >> "VehicleFlags"); \ No newline at end of file diff --git a/functions/vehicleFlags/fn_initVehicleFlags.sqf b/functions/vehicleFlags/fn_initVehicleFlags.sqf new file mode 100644 index 0000000..2141de4 --- /dev/null +++ b/functions/vehicleFlags/fn_initVehicleFlags.sqf @@ -0,0 +1,113 @@ +if (!hasInterface) exitWith {}; + +private _vehicleFlagsCfg = call milsim_vehicleFlags_fnc_getVehicleFlagsCfg; + +if (!isClass _vehicleFlagsCfg) exitWith { + ["WARNING: Vehicle Flags: Vehicle Flags config not found. Vehicle Flags will not be available."] call BIS_fnc_error; +}; + +// get texture pbo class +private _texturePboName = getText(_vehicleFlagsCfg >> "texturePBOName"); +if (_texturePboName == "") exitWith { + ["WARNING: Vehicle Flags: Texture PBO definition is missing or a blank string! Vehicle Flags will not be available."] call BIS_fnc_error; +}; +if (!isClass (configFile >> "CfgPatches" >> _texturePboName)) exitWith { + [ + "WARNING: Vehicle Flags: Texture PBO not found (%1). Vehicle Flags will not be available.", + _texturePboName + ] call BIS_fnc_error; +}; + +private _baseClassesToApplyActionsFor = + (_vehicleFlagsCfg >> "baseClassesToApplyActionsFor") call BIS_fnc_getCfgDataArray; +private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_returnChildren; + +{ // forEach _baseClassesToApplyActionsFor + 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 + //////////////////////////////////////////////////////////////////////// + private _rootActionID = "SetVehicleFlag"; + private _flagRootAction = [ + _rootActionID, // id + "Set Vehicle Flag", // displayed title + "\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon + {true}, // statement + { + params ["_target", "_player", "_params"]; + // _params params ["_parentActionID", "_flagCategories"]; + + // check if vehicle is excluded + private _excluded = [typeOf _target] call milsim_vehicleFlags_fnc_isClassExcluded; + if (_excluded || !alive _target) exitWith {false}; + + true; + }, // condition + { + //////////////////////////////////////////////////////////////////////// + // create the flag category actions (with nested flag actions) + //////////////////////////////////////////////////////////////////////// + params ["_target", "_player", "_params"]; + _params params ["_rootActionID", "_flagCategoryCfgs"]; + + // return category child actions with individual flag actions nested as children + [_rootActionID, _flagCategoryCfgs] call milsim_vehicleFlags_fnc_getActionsFlagCategories; + + }, // child code + [_rootActionID, _flagCategoryCfgs], // params + nil, // position + 4, // distance + [false, false, false, false, false], // other params + nil // modifier function code + ] call ace_interact_menu_fnc_createAction; + + //////////////////////////////////////////////////////////////////////// + // add root action to add flags + //////////////////////////////////////////////////////////////////////// + [ + (_this select 0), // object + 0, // action 0 or self-action 1 + ["ACE_MainActions"], // parent + _flagRootAction // action + ] call ace_interact_menu_fnc_addActionToObject; + + //////////////////////////////////////////////////////////////////////// + // add action to remove flag under the root action + //////////////////////////////////////////////////////////////////////// + // create action + private _removeFlagAction = [ + _flagRootAction + "_removeflag", // id + "Remove Flag", // displayed title + "\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon + { + params ["_target", "_player", "_params"]; + _target forceFlagTexture ""; + }, // statement + { + params ["_target", "_player", "_params"]; + alive _target && getForcedFlagTexture _target != ""; + }, // condition + nil // child code + ] call ace_interact_menu_fnc_createAction; + + // add the action to the vehicle + // in this class event handler, this#0 will be the vehicle + [ + (_this select 0), // object + 0, // action 0 or self-action 1 + ["ACE_MainActions", _flagActionID], // parent + _removeFlagAction // action + ] call ace_interact_menu_fnc_addActionToObject; + + }, true, [], true] call CBA_fnc_addClassEventHandler; +} forEach _baseClassesToApplyActionsFor; + +nil; \ No newline at end of file diff --git a/functions/vehicleFlags/fn_isClassExcluded.sqf b/functions/vehicleFlags/fn_isClassExcluded.sqf new file mode 100644 index 0000000..5d1b85d --- /dev/null +++ b/functions/vehicleFlags/fn_isClassExcluded.sqf @@ -0,0 +1,26 @@ +/* + Used to read vehicle flags config and check provided classname against all present exclusion groups. + + Author: IndigoFox + + Parameter(s): + 0: STRING - Classname of the vehicle to check +*/ + + +if (!hasInterface) exitWith {}; + +params ["_className", "", [""]]; +if (_className == "") exitWith {false}; + +private _vehicleFlagsCfg = call milsim_vehicleFlags_fnc_getVehicleFlagsCfg; +private _excludedVehiclesClass = (_vehicleFlagsCfg >> "ExcludedVehicles"); +private _exclusionGroups = configProperties [_vehicleFlagsCfg >> "ExcludedVehicles"]; + +{ + // Check if the class doesn't have a flag proxy + private _excludedClasses = _x call BIS_fnc_getCfgDataArray; + if (_className in _excludedClasses) exitWith {true}; +} forEach _exclusionGroups; + +false; From d7b8e5186e64b7e1c9d57a38d7c6e1b318d37f04 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Sat, 3 Feb 2024 22:55:21 -0800 Subject: [PATCH 2/2] tested local --- description.ext | 1 + .../vehicleFlags/fn_getActionsFlagCategories.sqf | 3 +++ functions/vehicleFlags/fn_initVehicleFlags.sqf | 16 ++-------------- functions/vehicleFlags/fn_isClassExcluded.sqf | 2 +- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/description.ext b/description.ext index 9781ede..3bb5ba0 100644 --- a/description.ext +++ b/description.ext @@ -21,6 +21,7 @@ #include "defines\BattalionInfo.hpp" #include "defines\DisallowedEquipment.hpp" #include "defines\SupplyCrates.hpp" +#include "defines\VehicleFlags.hpp" //-------------------------------------------MISSION INFO-------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/functions/vehicleFlags/fn_getActionsFlagCategories.sqf b/functions/vehicleFlags/fn_getActionsFlagCategories.sqf index 640235d..1c9aabc 100644 --- a/functions/vehicleFlags/fn_getActionsFlagCategories.sqf +++ b/functions/vehicleFlags/fn_getActionsFlagCategories.sqf @@ -42,6 +42,9 @@ private _allCategoryActions = []; private _flagOptionTitle = getText(_flagOptionCfg >> "actionTitle"); private _flagOptionTexture = getText(_flagOptionCfg >> "texture"); + // if the texture doesn't exist at the config path, skip this flag option + if (not (fileExists _flagOptionTexture)) then {continue}; + // diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData]; private _newFlagOption = [ diff --git a/functions/vehicleFlags/fn_initVehicleFlags.sqf b/functions/vehicleFlags/fn_initVehicleFlags.sqf index 2141de4..32f2952 100644 --- a/functions/vehicleFlags/fn_initVehicleFlags.sqf +++ b/functions/vehicleFlags/fn_initVehicleFlags.sqf @@ -6,18 +6,6 @@ if (!isClass _vehicleFlagsCfg) exitWith { ["WARNING: Vehicle Flags: Vehicle Flags config not found. Vehicle Flags will not be available."] call BIS_fnc_error; }; -// get texture pbo class -private _texturePboName = getText(_vehicleFlagsCfg >> "texturePBOName"); -if (_texturePboName == "") exitWith { - ["WARNING: Vehicle Flags: Texture PBO definition is missing or a blank string! Vehicle Flags will not be available."] call BIS_fnc_error; -}; -if (!isClass (configFile >> "CfgPatches" >> _texturePboName)) exitWith { - [ - "WARNING: Vehicle Flags: Texture PBO not found (%1). Vehicle Flags will not be available.", - _texturePboName - ] call BIS_fnc_error; -}; - private _baseClassesToApplyActionsFor = (_vehicleFlagsCfg >> "baseClassesToApplyActionsFor") call BIS_fnc_getCfgDataArray; private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_returnChildren; @@ -84,7 +72,7 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_ //////////////////////////////////////////////////////////////////////// // create action private _removeFlagAction = [ - _flagRootAction + "_removeflag", // id + _rootActionID + "_removeflag", // id "Remove Flag", // displayed title "\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon { @@ -103,7 +91,7 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_ [ (_this select 0), // object 0, // action 0 or self-action 1 - ["ACE_MainActions", _flagActionID], // parent + ["ACE_MainActions", _rootActionID], // parent _removeFlagAction // action ] call ace_interact_menu_fnc_addActionToObject; diff --git a/functions/vehicleFlags/fn_isClassExcluded.sqf b/functions/vehicleFlags/fn_isClassExcluded.sqf index 5d1b85d..223d6ae 100644 --- a/functions/vehicleFlags/fn_isClassExcluded.sqf +++ b/functions/vehicleFlags/fn_isClassExcluded.sqf @@ -10,7 +10,7 @@ if (!hasInterface) exitWith {}; -params ["_className", "", [""]]; +params [["_className", "", [""]]]; if (_className == "") exitWith {false}; private _vehicleFlagsCfg = call milsim_vehicleFlags_fnc_getVehicleFlagsCfg;