Files
MissionTemplate/functions/client/fn_initVehicleFlags.sqf

197 lines
6.3 KiB
Plaintext

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 _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
{true}, // 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], // 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
{true}, // 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;