Merge pull request 'Fix flags applying to CAManBase' (#2) from bug/flags-apply-to-men into main

Reviewed-on: https://17th-gs.iceberg-gaming.com:5443/hizumi/MissionTemplate/pulls/2
This commit was merged in pull request #2.
This commit is contained in:
2023-12-29 23:31:28 -06:00

View File

@@ -80,111 +80,118 @@ milsim_vehicleflag_options = [
];
private _appliedParentClasses = [
"LandVehicle",
"Helicopter"
];
["AllVehicles", "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 = [];
{
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
{
_x params ["_flagCategory", "_flagOptions"];
// diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions];
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 = [];
private _flagCategoryOption = [
_flagActionID + "_" + _flagCategory, // id
_flagCategory, // displayed title
(_flagOptions#0#1) get "Texture", // flag icon
{true}, // statement
{
_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;
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 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;
_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;
// 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;
}, true, [], true] call CBA_fnc_addClassEventHandler;
// 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;