mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Interact Menu - Combine parent menu with single child (#8060)
* Combine parent menu with single child * Adapt fastroping Cut ropes action for the setting * Change setting name and description * Fix action object when child action has different object Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Adapt quickmount Change Seat actions Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
091d0d2449
commit
08472f6343
@ -9,11 +9,8 @@ class CfgVehicles {
|
|||||||
class ACE_Chemlights {
|
class ACE_Chemlights {
|
||||||
displayName = CSTRING(Action_Chemlights);
|
displayName = CSTRING(Action_Chemlights);
|
||||||
icon = "\a3\ui_f\data\gui\cfg\Hints\chemlights_ca.paa";
|
icon = "\a3\ui_f\data\gui\cfg\Hints\chemlights_ca.paa";
|
||||||
condition = QUOTE(count ([ACE_player] call FUNC(getShieldComponents)) > 0);
|
|
||||||
statement = "true";
|
|
||||||
exceptions[] = {"isNotDragging", "isNotSwimming", "notOnMap", "isNotInside", "isNotSitting"};
|
exceptions[] = {"isNotDragging", "isNotSwimming", "notOnMap", "isNotInside", "isNotSitting"};
|
||||||
insertChildren = QUOTE(_this call DFUNC(compileChemlightMenu));
|
insertChildren = QUOTE(call DFUNC(compileChemlightMenu));
|
||||||
showDisabled = 0;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -75,8 +75,9 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
class ACE_cutRopes {
|
class ACE_cutRopes {
|
||||||
displayName = CSTRING(Interaction_cutRopes);
|
displayName = CSTRING(Interaction_cutRopes);
|
||||||
condition = QUOTE(true);
|
condition = QUOTE([_target] call FUNC(canCutRopes));
|
||||||
statement = "";
|
// should not be empty to work with EGVAR(interact_menu,consolidateSingleChild) setting
|
||||||
|
statement = QUOTE(true);
|
||||||
class confirmCutRopes {
|
class confirmCutRopes {
|
||||||
displayName = ECSTRING(common,confirm);
|
displayName = ECSTRING(common,confirm);
|
||||||
condition = QUOTE([_target] call FUNC(canCutRopes));
|
condition = QUOTE([_target] call FUNC(canCutRopes));
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* Active children <ARRAY>
|
* Active children <ARRAY>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [bob, [array], [array], 5] call ACE_interact_menu_fnc_collectActoveActionTree
|
* [bob, [array], [array], 5] call ACE_interact_menu_fnc_collectActiveActionTree
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -31,7 +31,17 @@ if !((_origActionData select 10) isEqualTo {}) then {
|
|||||||
[_target, ACE_player, _origActionData select 6, _origActionData] call (_origActionData select 10);
|
[_target, ACE_player, _origActionData select 6, _origActionData] call (_origActionData select 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
_origActionData params ["_actionName", "", "", "_statementCode", "_conditionCode", "_insertChildrenCode", "_customParams", "", "_distance"];
|
_origActionData params [
|
||||||
|
"_actionName",
|
||||||
|
"_displayName",
|
||||||
|
"",
|
||||||
|
"_statementCode",
|
||||||
|
"_conditionCode",
|
||||||
|
"_insertChildrenCode",
|
||||||
|
"_customParams",
|
||||||
|
"_position",
|
||||||
|
"_distance"
|
||||||
|
];
|
||||||
|
|
||||||
// Return nothing if the action itself is not active
|
// Return nothing if the action itself is not active
|
||||||
if !([_target, ACE_player, _customParams] call _conditionCode) exitWith {
|
if !([_target, ACE_player, _customParams] call _conditionCode) exitWith {
|
||||||
@ -91,5 +101,23 @@ if ((_activeChildren isEqualTo []) && {_statementCode isEqualTo {}}) exitWith {
|
|||||||
[]
|
[]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (GVAR(consolidateSingleChild) && {count _activeChildren == 1} && {_statementCode isEqualTo {}}) then {
|
||||||
|
_activeChildren select 0 params ["_childActionData", "_childChildren", "_childObject"];
|
||||||
|
_childActionData params ["", "_displayNameChild", "_iconChild", "_statementChild", "", "", "_customParamsChild", "", "", "_paramsChild"];
|
||||||
|
_origActionData = [
|
||||||
|
_actionName,
|
||||||
|
format ["%1 > %2", _displayName, _displayNameChild],
|
||||||
|
_iconChild,
|
||||||
|
_statementChild,
|
||||||
|
_conditionCode,
|
||||||
|
_insertChildrenCode,
|
||||||
|
_customParamsChild,
|
||||||
|
_position,
|
||||||
|
_distance,
|
||||||
|
_paramsChild
|
||||||
|
];
|
||||||
|
_activeChildren = _childChildren;
|
||||||
|
_object = _childObject;
|
||||||
|
};
|
||||||
|
|
||||||
[_origActionData, _activeChildren, _object]
|
[_origActionData, _activeChildren, _object]
|
||||||
|
@ -8,6 +8,14 @@
|
|||||||
{GVAR(selectorColorHex) = _this call BIS_fnc_colorRGBtoHTML} // Stored in Hex to avoid constant conversion
|
{GVAR(selectorColorHex) = _this call BIS_fnc_colorRGBtoHTML} // Stored in Hex to avoid constant conversion
|
||||||
] call CBA_settings_fnc_init;
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(consolidateSingleChild),
|
||||||
|
"CHECKBOX",
|
||||||
|
[LSTRING(consolidateSingleChild), LSTRING(consolidateSingleChild_Description)],
|
||||||
|
format ["ACE %1", LLSTRING(Category_InteractionMenu)],
|
||||||
|
false
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
[
|
[
|
||||||
QGVAR(alwaysUseCursorInteraction),
|
QGVAR(alwaysUseCursorInteraction),
|
||||||
"CHECKBOX",
|
"CHECKBOX",
|
||||||
|
@ -489,5 +489,13 @@
|
|||||||
<Spanish>Selector de color</Spanish>
|
<Spanish>Selector de color</Spanish>
|
||||||
<Turkish>Seçici Renk</Turkish>
|
<Turkish>Seçici Renk</Turkish>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interact_Menu_consolidateSingleChild">
|
||||||
|
<English>Consolidate single child actions</English>
|
||||||
|
<Russian>Объединять с единственным дочерним действием</Russian>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interact_Menu_consolidateSingleChild_Description">
|
||||||
|
<English>Combines parent action with only one child action together.</English>
|
||||||
|
<Russian>Объединять родительское действие с единственным дочерним действием в одно.</Russian>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -5,11 +5,9 @@ class CfgVehicles {
|
|||||||
class ACE_MapFlashlight {
|
class ACE_MapFlashlight {
|
||||||
displayName = CSTRING(Action_Flashlights);
|
displayName = CSTRING(Action_Flashlights);
|
||||||
icon = QUOTE(\a3\ui_f\data\IGUI\Cfg\VehicleToggles\lightsiconon_ca.paa);
|
icon = QUOTE(\a3\ui_f\data\IGUI\Cfg\VehicleToggles\lightsiconon_ca.paa);
|
||||||
condition = QUOTE(GVAR(mapIllumination) && visibleMap && {!([] isEqualTo (_player call FUNC(getUnitFlashlights)))});
|
condition = QUOTE(GVAR(mapIllumination) && visibleMap);
|
||||||
statement = "true";
|
|
||||||
exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"};
|
exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"};
|
||||||
insertChildren = QUOTE(_this call DFUNC(compileFlashlightMenu));
|
insertChildren = QUOTE(call DFUNC(compileFlashlightMenu));
|
||||||
showDisabled = 0;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -51,8 +51,7 @@ class CfgVehicles {
|
|||||||
class GVAR(ChangeSeat) { \
|
class GVAR(ChangeSeat) { \
|
||||||
displayName = CSTRING(ChangeSeat); \
|
displayName = CSTRING(ChangeSeat); \
|
||||||
condition = QUOTE(call DFUNC(canShowFreeSeats)); \
|
condition = QUOTE(call DFUNC(canShowFreeSeats)); \
|
||||||
statement = ""; \
|
insertChildren = QUOTE(call DFUNC(addFreeSeatsActions)); \
|
||||||
insertChildren = QUOTE((_this select 2) param [ARR_2(0, [])]); \
|
|
||||||
}; \
|
}; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
params ["_vehicle", "_unit", "_args"];
|
params ["_vehicle", "_unit", "_args"];
|
||||||
|
|
||||||
_args set [0, []];
|
|
||||||
private _isInVehicle = _unit in _vehicle;
|
private _isInVehicle = _unit in _vehicle;
|
||||||
|
|
||||||
GVAR(enabled)
|
GVAR(enabled)
|
||||||
@ -40,7 +39,12 @@ GVAR(enabled)
|
|||||||
|| {_vehicle isKindOf "Air"} // except Air
|
|| {_vehicle isKindOf "Air"} // except Air
|
||||||
}
|
}
|
||||||
&& {
|
&& {
|
||||||
private _subActions = _this call FUNC(addFreeSeatsActions);
|
_isInVehicle
|
||||||
_args set [0, _subActions];
|
|| {
|
||||||
!([] isEqualTo _subActions)
|
// because Get In action has its own statement
|
||||||
|
// we have to cache subactions in args and reuse them in insertChildren code
|
||||||
|
private _subActions = _this call FUNC(addFreeSeatsActions);
|
||||||
|
_args set [0, _subActions];
|
||||||
|
!([] isEqualTo _subActions)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user