Removed obsolote code from ace_interaction (#109)

This commit is contained in:
Nicolás Badano 2015-02-28 23:00:24 -03:00
parent a2a9643627
commit 2b0cfac8e4
27 changed files with 14 additions and 1002 deletions

View File

@ -62,6 +62,5 @@ _attachables = items _unit;
},
{
call EFUNC(interaction,hideMenu);
if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)};
}
] call EFUNC(interaction,openSelectMenu);

View File

@ -51,8 +51,5 @@ _actions = [localize "STR_ACE_Explosives_PlaceMenu", localize "STR_ACE_Explosive
},
{
call EFUNC(interaction,hideMenu);
if !(profileNamespace getVariable [QUOTE(EGVAR(interaction,AutoCloseMenu)), false]) then {
"ACE_Explosives" call EFUNC(interaction,openMenuSelf);
};
}
] call EFUNC(interaction,openSelectMenu);

View File

@ -43,9 +43,6 @@ if (count _detonators == 0) then {
},
{
call EFUNC(interaction,hideMenu);
if !(profileNamespace getVariable [QUOTE(EGVAR(interaction,AutoCloseMenu)), false]) then {
"ACE_Explosives" call EFUNC(interaction,openMenuSelf);
};
}
] call EFUNC(interaction,openSelectMenu);
};

View File

@ -518,75 +518,6 @@ class RscInteractionText: RscText{
h = 1.5 * GUI_GRID_H;
};
class RscTitles {
class ACE_FlowMenu {
idd = 9920;
enableSimulation = 1;
movingEnable = 0;
fadeIn=0.5;
fadeOut=0.5;
duration = 10e10;
onLoad = "uiNamespace setVariable ['ACE_Flow_Display', _this select 0];";
class controls {
class RearIcon: RscInteractionIcon{
idc = 999;
text = PATHTOF(UI\CenterIcon_ca.paa);
x = 17.9 * GUI_GRID_W;
y = 10 * GUI_GRID_H;
w = 3.7 * GUI_GRID_H;
h = 5.75 * GUI_GRID_H;
};
class TopIcon: RscInteractionIcon{
idc = 1200;
h = 1 * GUI_GRID_H;
y = 9 * GUI_GRID_H;
};
class FirstIcon: RscInteractionIcon{
idc = 1201;
y = 10.25 * GUI_GRID_H;
h = 1.5 * GUI_GRID_H;
};
class SelectedItemIcon: RscInteractionIcon{
idc = 1202;
y = 12 * GUI_GRID_H;
};
class ThirdIcon: RscInteractionIcon{
idc = 1203;
y = 14.25 * GUI_GRID_H;
h = 1.5 * GUI_GRID_H;
};
class BottomIcon: TopIcon{
idc = 1204;
y = 16 * GUI_GRID_H;
};
class ItemName: RscText{
idc = 1000;
style = 0x01;
x = 5.25 * GUI_GRID_W;
y = 12.15 * GUI_GRID_H;
w = 13 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H;
colorBackground[] = {0.3, 0.3, 0.3, 0.8};
};
class BackIcon: RscInteractionIcon{
idc = 1210;
text = PATHTOF(UI\backArrow_ca.paa);
x = 18.25 * GUI_GRID_W;
y = 12.69 * GUI_GRID_H;
w = 0.5 * GUI_GRID_W;
h = 0.5 * GUI_GRID_H;
};
class ItemDetails: RscStructuredText{
idc = 1100;
style = 0x0c;
x = 23.5 * GUI_GRID_W;
y = 11 * GUI_GRID_H;
w = 13 * GUI_GRID_W;
h = 3.9 * GUI_GRID_H;
colorBackground[] = {0, 0, 0, 0.4};
};
};
};
class GVAR(InteractionHelper) {
idd = 9930;
enableSimulation = 1;

View File

@ -2,49 +2,29 @@
ADDON = false;
PREP(addInteraction);
PREP(addInteractionSelf);
PREP(addSelectableItem);
PREP(addToTooltip);
PREP(applyButtons);
PREP(canInteractWith);
PREP(canTapShoulder);
PREP(getActions);
PREP(getActions2);
PREP(getDoor);
PREP(getDoorAnimations);
PREP(getDown);
PREP(getSelectedButton);
PREP(hideMenu);
PREP(hideMouseHint);
PREP(initialiseInteraction);
PREP(isInRange);
PREP(joinTeam);
PREP(menuKeyInput);
PREP(moduleInteraction);
PREP(moveDown);
PREP(onButtonDown);
PREP(onButtonDownSelf);
PREP(onButtonUp);
PREP(onClick);
PREP(onSelectMenuDblClick);
PREP(openDoor);
PREP(openMenu);
PREP(openMenuSelectUI);
PREP(openMenuSelf);
PREP(openSelectMenu);
PREP(openSubMenu);
PREP(openSubMenuSelf);
PREP(prepareSelectMenu);
PREP(push);
PREP(removeInteraction);
PREP(removeInteractionSelf);
PREP(removeTag);
PREP(sendAway);
PREP(showMenu);
PREP(showMouseHint);
PREP(sortOptionsByPriority);
PREP(tapShoulder);
PREP(updateTooltipPosition);
ADDON = true;

View File

@ -19,24 +19,6 @@ class CfgPatches {
#include <Menu_Config.hpp>
class ACE_Settings {
class GVAR(FlowMenu) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Interaction_FlowMenu";
};
class GVAR(AutoCloseMenu) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Interaction_AutoCloseMenu";
};
class GVAR(AutoCenterCursor) {
value = 1;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Interaction_AutoCenterCursor";
};
class GVAR(EnableTeamManagement) {
value = 1;
typeName = "BOOL";

View File

@ -29,13 +29,8 @@ if (_picture == "" || _picture == "PictureThing") then {
_picture = QUOTE(PATHTOF(UI\dot_ca.paa));
};
if ((profileNamespace getVariable [QGVAR(FlowMenu), false])) then {
//[_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]
_container pushBack [_displayName, nil, {true},0,[], _picture, "", {true}, [], 4, "", _data];
}else{
_index = lbAdd [_container, _displayName];
lbSetData [_container, _index, str _data];
lbSetPicture [_container, _index, _picture];
};
_index = lbAdd [_container, _displayName];
lbSetData [_container, _index, str _data];
lbSetPicture [_container, _index, _picture];
_container

View File

@ -1,154 +0,0 @@
/*
Author:
commy2
Garth de Wet (LH)
Description:
Parameters:
0: OBJECT - target
1: ARRAY - Parents of the target object
2: ARRAY - Actions
3: ARRAY - Patches
4: CONFIG - Parent config (ConfigFile >> "CfgVehicles"/MissionConfigFile >> "CfgVehicles")
5: BOOL - Is mission config file?
6: STRING - Classname ("ACE_Actions"/"ACE_SelfActions")
7: STRING - Sub-class
Returns:
Nothing
Example:
[player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "ACE_Actions"] call ACE_Interaction_fnc_GetActions;
[player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "ACE_SelfActions"] call ACE_Interaction_fnc_GetActions;
*/
#include "script_component.hpp"
#define DEFAULT_ICON QUOTE(PATHTOF(UI\dot_ca.paa))
private ["_target", "_parents", "_actions", "_patches", "_baseConfig", "_actionType", "_i","_index", "_missionConfig", "_stdConfig"];
_target = _this select 0;
_parents = _this select 1;
_actions = _this select 2;
_patches = _this select 3;
_baseConfig = _this select 4;
_missionConfig = _this select 5;
_actionType = _this select 6;
_subClass = _this select 7;
_stdConfig = (configFile >> "CfgVehicles" >> typeOf _target >> _actionType);
if (_subClass != "") then {
_stdConfig = _stdConfig >> _subClass;
};
_count = count _parents;
for "_i" from 0 to (_count - 1) do {
_config = _baseConfig >> _parents select _i >> _actionType;
if (_subClass != "") then {
_config = _config >> _subClass;
};
_count = count _config;
if (_count > 0) then {
for "_index" from 0 to (_count - 1) do {
private ["_action", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority", "_tooltip", "_hotkey",
"_subMenu", "_conditionShow", "_exceptions", "_icon", "_actionToCache", "_cacheActions", "_cache", "_indexCache", "_configName"];
_action = if (_missionConfig) then {_config select _index} else {_stdConfig >> configName (_config select _index)};
_cache = missionNamespace getVariable [QGVAR(MenuCache), [[], [], []]];
if (count _action > 0) then {
_configName = configName _action;
_cacheConfigs = _cache select 0;
_cacheActions = _cache select 1;
_cacheIndices = _cache select 2;
_indexCache = _cacheConfigs find _action;
if (_indexCache == -1) then {
_displayName = getText (_action >> "displayName");
_distance = getNumber (_action >> "distance");
_priority = getNumber (_action >> "priority");
_subMenu = getArray (_action >> "subMenu");
_tooltip = getText (_action >> "tooltip");
_hotkey = getText (_action >> "hotkey");
_enableInside = getNumber (_action >> "enableInside");
// Condition
_condition = getText (_action >> "condition");
if (_condition == "") then {_condition = "true"};
_condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, GVAR(Target))] call EFUNC(common,canInteractWith)} ), getArray (_action >> "exceptions")];
if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"};
_condition = compile _condition;
// Condition to show the action
_conditionShow = getText (_action >> "conditionShow");
_conditionShow = if (_conditionShow == "") then {{true}} else {compile _conditionShow};
_showDisabled = getNumber (_action >> "showDisabled") == 1;
if (isText (_action >> "conditionShow")) then {
_showDisabled = [_object, _player] call _conditionShow;
};
// Exceptions to the general conditions that have to be true
_exceptions = getArray (_action >> "exceptions");
// statement
_statement = getText (_action >> "statement");
_statement = compile _statement;
if (profileNamespace getVariable [QGVAR(FlowMenu), false]) then {
_statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then {
compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1];
} else {
compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement"));
};
};
// icon
_icon = getText (_action >> "Icon");
if (_icon == "") then {
_icon = DEFAULT_ICON;
};
_actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey];
if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call _condition}} && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then {
_actions pushBack _actionToCache;
_patches pushBack _configName;
};
_indexCache = _cacheActions find _actionToCache;
if (_indexCache == -1) then {
_indexCache = count _cacheActions;
_cacheActions pushBack _actionToCache;
};
_cacheConfigs pushBack _action;
_cacheIndices pushBack _indexCache;
_cache = [_cacheConfigs, _cacheActions, _cacheIndices];
["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(common,log);
} else {
["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(common,log);
_cachedAction = _cacheActions select (_cacheIndices select _indexCache);
_showDisabled = getNumber (_action >> "showDisabled") == 1;
if (isText (_action >> "conditionShow")) then {
_showDisabled = [_object, _player] call (_cachedAction select 7);
};
if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call (_cachedAction select 2)}} && {[_object, (_cachedAction select 9)] call FUNC(isInRange) || {(_cachedAction select 9) == 0}}) then {
_actions pushBack _cachedAction;
_patches pushBack _configName;
};
};
};
GVAR(MenuCache) = _cache;
};
};
};
[_actions, _patches]

View File

@ -1,57 +0,0 @@
/*
* Author: commy2
*
* Add an ACE action to an object. Note: This function is global.
*
* Argument:
* 0: Object the action should be assigned to (Object)
* 1: Name of the action shown in the menu (String)
* 2: Distance the player can be away from the object (Number)
* 3: Condition (Code or String)
* 4: Statement (Code or String)
* 5: Show the action even if the conditon is not met (Bool or Number)
* 6: Priority (Number, optional default: 0)
*
* Return value:
* ID of the action (used to remove it later).
*/
#include "script_component.hpp"
private ["_object", "_displayName", "_distance", "_condition", "_statement", "_showDisabled", "_priority", "_actionsVar", "_id", "_actionIDs", "_actions"];
_object = _this select 0;
_displayName = _this select 1;
_distance = _this select 2;
_condition = _this select 3;
_statement = _this select 4;
_showDisabled = _this select 5;
_priority = _this select 6;
if (typeName _condition == "STRING") then {
_condition = compile _condition;
};
if (typeName _statement == "STRING") then {
_statement = compile _statement;
};
if (typeName _showDisabled == "SCALAR") then {
_showDisabled = _showDisabled > 0;
};
if (isNil "_priority") then {
_priority = 0;
};
_actionsVar = _object getVariable [QGVAR(Interactions), [-1, [], []]];
_id = (_actionsVar select 0) + 1;
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2;
_actionIDs pushBack _id;
_actions pushBack [_displayName, _distance, _condition, _statement, _showDisabled, _priority];
_object setVariable [QGVAR(Interactions), [_id, _actionIDs, _actions], true];
_id

View File

@ -1,55 +0,0 @@
/*
* Author: commy2
*
* Add an ACE self action to the player. Execute this on the local machine of the player.
*
* Argument:
* 0: Name of the action shown in the menu (String)
* 1: Condition (Code or String)
* 2: Statement (Code or String)
* 3: Show the action even if the conditon is not met (Bool or Number)
* 4: Priority (Number, optional default: 0)
*
* Return value:
* ID of the action (used to remove it later).
*/
#include "script_component.hpp"
private ["_displayName", "_condition", "_statement", "_showDisabled", "_priority", "_actionsVar", "_id", "_actionIDs", "_actions"];
_displayName = _this select 0;
_condition = _this select 1;
_statement = _this select 2;
_showDisabled = _this select 3;
_priority = _this select 4;
if (typeName _condition == "STRING") then {
_condition = compile _condition;
};
if (typeName _statement == "STRING") then {
_statement = compile _statement;
};
if (typeName _showDisabled == "SCALAR") then {
_showDisabled = _showDisabled > 0;
};
if (isNil "_priority") then {
_priority = 0;
};
_actionsVar = ACE_player getVariable [QGVAR(InteractionsSelf), [-1, [], []]];
_id = (_actionsVar select 0) + 1;
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2;
_actionIDs pushBack _id;
_actions pushBack [_displayName, _condition, _statement, _showDisabled, _priority];
ACE_player setVariable [QGVAR(InteractionsSelf), [_id, _actionIDs, _actions], false];
_id

View File

@ -1,5 +0,0 @@
// by commy2
#include "script_component.hpp"
GVAR(CurrentTooltip) pushBack (_this select 0);

View File

@ -1,14 +0,0 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_isCivilian"];
_unit = _this select 0;
_isCivilian = _this select 1;
if (isNil "_isCivilian") then {_isCivilian = true};
alive _unit
&& [side _unit != side ACE_player, side group _unit == civilian] select _isCivilian
//&& {count (weapons _unit) == 0}

View File

@ -1,121 +0,0 @@
// commy2
#include "script_component.hpp"
private ["_object", "_config", "_type", "_actions", "_configs"];
_object = _this select 0;
_config = _this select 1; // configFile, missionConfigFile
_type = _this select 2; // "ACE_CfgInteractions", "ACE_CfgInteractionsSelf"
_actions = _this select 3; // [];
_configs = "_object isKindOf configName _x" configClasses (_config >> _type);
// cache
private ["_cache", "_cacheConfigs", "_cacheActions", "_cacheIndices"];
_cache = uiNamespace getVariable [QGVAR(MenuCache), [[], [], []]];
_cacheConfigs = _cache select 0;
_cacheActions = _cache select 1;
_cacheIndices = _cache select 2;
// get interactions
{
private "_configActions";
_configActions = "true" configClasses (_config >> _type >> configName _x);
{
private ["_action", "_configName", "_indexCache"];
_action = _x;
_configName = configName _action;
_indexCache = _cacheConfigs find _action;
if (_indexCache == -1) then {
private ["_displayName", "_distance", "_priority", "_subMenu", "_tooltip", "_hotkey", "_enableInside", "_condition", "_conditionShow", "_showDisabled", "_exceptions", "_statement", "_icon"];
_displayName = getText (_action >> "displayName");
_distance = getNumber (_action >> "distance");
_priority = getNumber (_action >> "priority");
_subMenu = getArray (_action >> "subMenu");
_tooltip = getText (_action >> "tooltip");
_hotkey = getText (_action >> "hotkey");
_enableInside = getNumber (_action >> "enableInside");
// Condition
_condition = getText (_action >> "condition");
if (_condition == "") then {_condition = "true"};
_condition = _condition + format [QUOTE(&& {%1 call EFUNC(common,canInteract)} && {[ARR_2(ACE_player, GVAR(Target))] call FUNC(canInteractWith)}), getArray (_action >> "exceptions")];
if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"};
_condition = compile _condition;
// Condition to show the action
_conditionShow = getText (_action >> "conditionShow");
_conditionShow = if (_conditionShow == "") then {{true}} else {compile _conditionShow};
_showDisabled = getNumber (_action >> "showDisabled") == 1;
if (isText (_action >> "conditionShow")) then {
_showDisabled = [_object, _player] call _conditionShow;
};
// Exceptions to the general conditions that have to be true
_exceptions = getArray (_action >> "exceptions");
// statement
_statement = getText (_action >> "statement");
_statement = compile _statement;
if (GVAR(FlowMenu)) then {
_statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then {
compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1];
} else {
compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement"));
};
};
// icon
_icon = getText (_action >> "Icon");
if (_icon == "") then {
_icon = DEFAULT_ICON;
};
private "_actionToCache";
_actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey];
if ((_showDisabled || {[_object, _player] call _condition}) && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then {
_actions pushBack _actionToCache;
};
_indexCache = _cacheActions find _actionToCache;
if (_indexCache == -1) then {
_indexCache = count _cacheActions;
_cacheActions pushBack _actionToCache;
};
_cacheConfigs pushBack _action;
_cacheIndices pushBack _indexCache;
_cache = [_cacheConfigs, _cacheActions, _cacheIndices];
["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(common,log);
} else {
["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(common,log);
private ["_cachedAction", "_showDisabled"];
_cachedAction = _cacheActions select (_cacheIndices select _indexCache);
_showDisabled = getNumber (_action >> "showDisabled") == 1;
if (isText (_action >> "conditionShow")) then {
_showDisabled = [_object, _player] call (_cachedAction select 7);
};
if ((_showDisabled || {[_object, _player] call (_cachedAction select 2)}) && {[_object, (_cachedAction select 9)] call FUNC(isInRange) || {(_cachedAction select 9) == 0}}) then {
_actions pushBack _cachedAction;
};
};
} forEach _configActions; //Actions of this CfgVehicles class
} forEach _configs; //CfgVehicles class
uiNamespace setVariable [QGVAR(MenuCache), _cache];
_actions

View File

@ -1,167 +0,0 @@
/*
Author:
commy2
Garth de Wet (LH)
Description:
Initialises the interaction click handlers.
Parameters:
0 : CODE - code to call when right clicking/center button
1 : BOOLEAN - Submenu
2 : BOOLEAN - Flow Menu
3 : BOOLEAN - Self interaction
4 : OBJECT - Target
Returns:
Nothing
Example:
[{"Default" call FUNC(openMenu);}, true, (profileNamespace getVariable [QGVAR(FlowMenu), false]), GVAR(Target)] call FUNC(initialiseInteraction);
*/
#include "script_component.hpp"
private ["_subMenu", "_selfMenu", "_target"];
GVAR(MainButton) = _this select 0;
_subMenu = _this select 1;
_selfMenu = _this select 3;
_target = _this select 4;
_player = ACE_player;
_vehicle = vehicle _player;
//_object = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
if !([_target, 5] call FUNC(isInRange)) exitWith {};
GVAR(Shortcuts) = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
// Flow menu
if (_this select 2) then {
(QGVAR(FlowMenu) call BIS_fnc_rscLayer) cutRsc [QGVAR(FlowMenu), "PLAIN",0.5, false];
ACE_Interaction_SelectedButton = 0;
(findDisplay 1713999) closeDisplay 1;
if (_player getVariable ["ACE_AcceptAction", -1] == -1) then {
[{if(isNil {GVAR(MainButton)} || {!(profileNamespace getVariable [QGVAR(FlowMenu), false])})exitWith{false};(-(_this select 0) / 1.2) call FUNC(MoveDown);true}] call EFUNC(common,addScrollWheelEventHandler);
_player setVariable ["ACE_AcceptAction", [_player, "DefaultAction", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {_action = GVAR(Buttons) select ACE_Interaction_SelectedButton;_target = GVAR(Target);_player = ACE_player;_vehicle = vehicle _player;if ([_target, _player] call (_action select 2)) then {call FUNC(hideMenu);if(count _action == 12) then{(_action select 11) call (_action select 1);}else{[_target, _player] call (_action select 1);};};}] call EFUNC(common,addActionEventHandler)];
_player setVariable ["ACE_AcceptAction", [_player, "menuBack", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {call GVAR(MainButton);}] call EFUNC(common,addActionEventHandler)];
};
0 call FUNC(moveDown);
[localize "STR_ACE_Interaction_MakeSelection", if (_subMenu)then{localize "STR_ACE_Interaction_Back"}else{""}, localize "STR_ACE_Interaction_ScrollHint"] call FUNC(showMouseHint);
((uiNamespace getVariable QGVAR(Flow_Display)) displayCtrl (1210)) ctrlShow _subMenu;
}else{ // Rose
if (!isNull(uiNamespace getVariable QGVAR(Flow_Display))) then {
(uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0;
call FUNC(hideMouseHint);
};
if (!_subMenu || {isNull (findDisplay 1713999)}) then {
(findDisplay 1713999) closeDisplay 1;
(findDisplay 46) createDisplay QGVAR(Dialog);
// Add eventhandlers
/*(findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE(_this call EGVAR(common,onKeyDown))];
(findDisplay 1713999) displayAddEventHandler ["KeyUp", QUOTE(_this call EGVAR(common,onKeyUp))];*/
(findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE(_this call FUNC(menuKeyInput))];
};
disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog);
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3;
if (GVAR(AutoCenterCursor)) then {setMousePosition [0.5, 0.5]};
if !(_subMenu) then {
_ctrlInteractionDialog ctrlSetText ([_target] call EFUNC(common,getName));
} else {
_ctrlInteractionDialog ctrlSetText localize "STR_ACE_Interaction_Back";
};
_buttons = GVAR(Buttons);
_count = count _buttons;
for "_i" from 0 to 9 do {
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _i);
_ctrlInteractionDialog ctrlShow true;
_ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _i);
_ctrlInteractionDialogShortcut = _dlgInteractionDialog displayCtrl (30 + _i);
//_ctrlInteractionDialogBackground = _dlgInteractionDialog displayCtrl (40 + _i);
if (_i < _count) then {
_action = _buttons select _i;
_ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable ([_target, _player] call (_action select 2));
_ctrlInteractionDialog ctrlSetTooltip (_action select 6);
_ctrlInteractionDialogIcon ctrlSetText (_action select 5);
_ctrlInteractionDialogShortcut ctrlSetText (_action select 10);
//_ctrlInteractionDialogBackground ctrlShow true;
GVAR(Shortcuts) set [_i, [_action select 10] call EFUNC(common,letterToCode)];
} else {
_ctrlInteractionDialog ctrlSetText "";
_ctrlInteractionDialog ctrlEnable false;
_ctrlInteractionDialog ctrlSetTooltip "";
_ctrlInteractionDialogIcon ctrlSetText "";
_ctrlInteractionDialogShortcut ctrlSetText "";
//_ctrlInteractionDialogBackground ctrlShow false;
};
};
// Update Buttons
terminate (missionNamespace getVariable [QGVAR(updateMenuHandle), scriptNull]);
GVAR(updateMenuHandle) = 0 spawn {
disableSerialization;
_dlgMenu = uiNamespace getVariable [QGVAR(Dialog), displayNull];
_ctrlTooltip = _dlgMenu displayCtrl 40;
_player = ACE_player;
_vehicle = vehicle _player;
_target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
waitUntil {
if !([_target, 5] call FUNC(isInRange)) exitWith {
(findDisplay 1713999) closeDisplay 1
};
GVAR(Tooltips) = [[], [], [], [], [], [], [], [], [], []];
{
_ctrlText = _dlgMenu displayCtrl (10 + _forEachIndex);
_ctrlIcon = _dlgMenu displayCtrl (20 + _forEachIndex);
_condition = _x select 2;
_conditionShow = _x select 7;
_distance = _x select 9;
GVAR(CurrentTooltip) = [];
_enable = (_distance == 0 || {[_target, _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow};
if (isNil "_enable") then {_enable = false};
GVAR(Tooltips) set [_forEachIndex, GVAR(CurrentTooltip)];
// apply conditional tooltips
/*if (_forEachIndex == call ACE_Interaction_fnc_getSelectedButton) then {
_tooltip = _x select 6;
_showTooltip = _tooltip != "";
_tooltip = text _tooltip;
{
_showTooltip = true;
_tooltip = composeText [_tooltip, lineBreak, _x];
} forEach (GVAR(Tooltips) select _forEachIndex);
_ctrlTooltip ctrlSetStructuredText _tooltip;
_ctrlTooltip ctrlShow _showTooltip;
};*/
_ctrlText ctrlEnable _enable;
_ctrlIcon ctrlEnable _enable;
} forEach GVAR(Buttons);
sleep 0.5;
isNull (findDisplay 1713999)
};
};
};

View File

@ -1,17 +0,0 @@
// by commy2
#include "script_component.hpp"
private "_key";
_key = _this select 1;
if (_key in [28, 57, 156, 200, 208, 203, 205, 201, 209]) exitWith {true};
_index = GVAR(Shortcuts) find _key;
if (_index != -1 && {ctrlEnabled (findDisplay 1713999 displayCtrl (_index + 10))}) exitWith {
_index call FUNC(onClick);
true
};
false

View File

@ -1,18 +0,0 @@
// by commy2
#include "script_component.hpp"
if (dialog) exitWith {
closeDialog 0;
};
if (isNull (findDisplay 1713999)) then {
if (ACE_player == vehicle ACE_player) then {"" call FUNC(openMenu)} else {[ACE_player, vehicle ACE_player] call FUNC(openMenuSelectUI)};
setMousePosition [0.5, 0.5];
} else {
(findDisplay 1713999) closeDisplay 1;
};
// Raise custom event. @todo: remove
[_player, "interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,callCustomEventHandlers);
// Raise ACE localEvent
["interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,localEvent);

View File

@ -1,18 +0,0 @@
// by commy2
#include "script_component.hpp"
if (dialog) exitWith {
closeDialog 0;
};
if (isNull (findDisplay 1713999)) then {
"" call FUNC(openMenuSelf);
setMousePosition [0.5, 0.5];
} else {
(findDisplay 1713999) closeDisplay 1;
};
// Raise custom event. @todo: remove
[_player, "interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,callCustomEventHandlers);
// Raise ACE localEvent
["interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,localEvent);

View File

@ -1,7 +0,0 @@
// by commy2
#include "script_component.hpp"
private "_target";
_target = [cursorTarget, GVAR(Target)] select (_this == "Default");
[0, _target, ""] call FUNC(showMenu);

View File

@ -1,4 +0,0 @@
// by commy2
#include "script_component.hpp"
[1, ACE_player, ""] call FUNC(showMenu);

View File

@ -1,4 +0,0 @@
// by commy2
#include "script_component.hpp"
[2, GVAR(Target), _this select 0] call FUNC(showMenu);

View File

@ -1,4 +0,0 @@
// by commy2
#include "script_component.hpp"
[3, ACE_player, _this select 0] call FUNC(showMenu);

View File

@ -18,18 +18,15 @@
private ["_buttonAction", "_header", "_buttonText", "_cancelButton"];
closeDialog 0;
if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) exitWith {
_header = _this select 0;
_buttonText = _this select 1;
if (isNil "_buttonText" or {_buttonText == ""}) then {
_buttonText = localize "STR_ACE_Interaction_MakeSelection";
};
createDialog "RscACE_SelectAnItem";
ctrlSetText [8860, _buttonText];
ctrlSetText [8870, _header];
lbClear 8866;
8866
_header = _this select 0;
_buttonText = _this select 1;
if (isNil "_buttonText" or {_buttonText == ""}) then {
_buttonText = localize "STR_ACE_Interaction_MakeSelection";
};
[]
createDialog "RscACE_SelectAnItem";
ctrlSetText [8860, _buttonText];
ctrlSetText [8870, _header];
lbClear 8866;
8866

View File

@ -1,36 +0,0 @@
/*
* Author: commy2
*
* Remove an ACE action from an object. Note: This function is global.
*
* Argument:
* 0: Object (Object)
* 1: ID of the action (Number)
*
* Return value:
* None.
*/
#include "script_component.hpp"
private ["_object", "_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"];
_object = _this select 0;
_id = _this select 1;
_actionsVar = _object getVariable [QGVAR(Interactions), [-1, [], []]];
_currentID = _actionsVar select 0;
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2;
_id = _actionIDs find _id;
if (_id == -1) exitWith {};
_actionIDs set [_id, -1];
_actionIDs = _actionIDs - [-1];
_actions set [_id, []];
_actions = _actions - [[]];
_object setVariable [QGVAR(Interactions), [_currentID, _actionIDs, _actions], true];

View File

@ -1,35 +0,0 @@
/*
* Author: commy2
*
* Remove an ACE self action from the player.
*
* Argument:
* 0: ID of the action (Number)
*
* Return value:
* None.
*/
#include "script_component.hpp"
private ["_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"];
_id = _this select 0;
_actionsVar = ACE_player getVariable [QGVAR(InteractionsSelf), [-1, [], []]];
_currentID = _actionsVar select 0;
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2;
_id = _actionIDs find _id;
if (_id == -1) exitWith {};
_actionIDs set [_id, -1];
_actionIDs = _actionIDs - [-1];
_actions set [_id, []];
_actions = _actions - [[]];
ACE_player setVariable [QGVAR(InteractionsSelf), [_currentID, _actionIDs, _actions], false];

View File

@ -1,118 +0,0 @@
/*
Author:
commy2
Garth de Wet (LH)
aeroson
Description:
Parameters:
0: NUMBER - Menu type (0 - interaction, 1 - self-interaction, 2 - sub-interaction, 3 - sub-self-interaction)
1: OBJECT - Target object
2: STRING - Sub-Menu ClassName
Returns:
Nothing
Example:
[0, GVAR(Target)] call FUNC(showMenu);
[1, player] call FUNC(showMenu);
[2, GVAR(Target), "ACE_Explosives"] call FUNC(showMenu);
[3, player, "ACE_Explosives"] call FUNC(showMenu);
*/
#include "script_component.hpp"
private ["_player", "_vehicle", "_mainButtonAction", "_object", "_index", "_actions", "_result", "_menuType"];
#define DEFAULT_ICON QUOTE(PATHOF(UI\dot_ca.paa))
#define DEFAULT_DISTANCE 4 // seems to be 4
_player = ACE_player;
_vehicle = vehicle _player;
GVAR(MenuType) = _this select 0; // 0 Interaction, 1 Self Interaction
_mainButtonAction = [
{call FUNC(hideMenu)},
{call FUNC(hideMenu)},
{"Default" call FUNC(openMenu)},
{"Default" call FUNC(openMenuSelf)}
] select GVAR(MenuType);
_menuType = GVAR(MenuType) % 2;
uiNamespace setVariable [QGVAR(CursorPosition), [controlNull, 0.5, 0.5, -1]];
GVAR(Target) = _this select 1;
_object = GVAR(Target);
if (_menuType == 0 && {(isNull (_object) || {!([_object, 4] call FUNC(isInRange))})}) exitWith {};
if !([_player, _object] call EFUNC(common,canInteractWith)) exitWith {};
// add actions or self actions of GVAR(Target)
_parents = [configFile >> "CfgVehicles" >> typeOf _object, true] call BIS_fnc_returnParents;
_result = [_object, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions);
_actions = ([_object, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0);
// add self actions of vehicle _player
if (_menuType == 1 && {_player != _vehicle}) then {
_parents = [configFile >> "CfgVehicles" >> typeOf _vehicle, true] call BIS_fnc_returnParents;
_result = [_vehicle, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions);
_actions = _actions + (([_vehicle, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0));
};
// custom defined actions, stored in variable instead of cfg like above
if (GVAR(MenuType) < 2) then {
private ["_customActions", "_customAction", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority"];
// add interactions or self interactions of GVAR(Target)
_customActions = (_object getVariable [[QGVAR(Interactions), QGVAR(ACE_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2;
// add self interactions of vehicle _player
if (_menuType == 1 && {_player != _vehicle}) then {
_customActions = _customActions + ((_vehicle getVariable [[QGVAR(Interactions), QGVAR(ACE_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2);
};
if(_menuType==0) then {
private ["_distance"];
for "_index" from 0 to (count _customActions - 1) do {
_customAction = _customActions select _index;
_displayName = _customAction select 0;
_distance = _customAction select 1;
_condition = _customAction select 2;
_statement = _customAction select 3;
_showDisabled = _customAction select 4;
_priority = _customAction select 5;
if ((_showDisabled || {[_object, _player] call _condition}) && {[_object, _distance] call FUNC(isInRange) || {_distance == 0}}) then {
_actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], _distance, ""];
};
};
} else { // self interactions do not have distance
for "_index" from 0 to (count _customActions - 1) do {
_customAction = _customActions select _index;
_displayName = _customAction select 0;
_condition = _customAction select 1;
_statement = _customAction select 2;
_showDisabled = _customAction select 3;
_priority = _customAction select 4;
if (_showDisabled || {[_object, _player] call _condition}) then {
_actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], DEFAULT_DISTANCE, ""];
};
};
};
};
if (count _actions == 0) exitWith {};
_actions call FUNC(sortOptionsByPriority);
GVAR(Buttons) = _actions;
[_mainButtonAction, (_this select 2) != "", (profileNamespace getVariable [QGVAR(FlowMenu), false]), _menuType == 1, _object] call FUNC(initialiseInteraction);

View File

@ -569,18 +569,6 @@
<Italian>Perdona</Italian>
<Hungarian>Megbocsátás</Hungarian>
</Key>
<Key ID="STR_ACE_Interaction_FlowMenu">
<English>Flow Menu</English>
<German>Mausradmenü</German>
<Polish>Flow Menu</Polish>
<Spanish>Menú desplegable</Spanish>
<French>Menu Déroulant</French>
<Czech>Flow Menu</Czech>
<Russian>Выпадающее меню</Russian>
<Portuguese>Flow Menu</Portuguese>
<Italian>Menù a Scorrimento</Italian>
<Hungarian>Legördülő menü</Hungarian>
</Key>
<Key ID="STR_ACE_Interaction_ScrollHint">
<English>Scroll</English>
<German>Scrollen</German>
@ -616,25 +604,6 @@
<Polish>Poza zasięgiem</Polish>
<Czech>Mimo dosah</Czech>
</Key>
<Key ID="STR_ACE_Interaction_AutoCloseMenu">
<English>Close Menu on Key Release</English>
<German>Menü nach Loslassen schließen</German>
<Polish>Zamknij menu automatycznie</Polish>
<French>Fermer le menu en relâchant la touche</French>
<Spanish>Cerrar menú al soltar la tecla</Spanish>
<Hungarian>Menü bezárása a billentyű elengedésekor</Hungarian>
<Russian>Закрывать меню при отжатии клавиши</Russian>
<Czech>Menu interakce (Na držení)</Czech>
</Key>
<Key ID="STR_ACE_Interaction_AutoCenterCursor">
<English>Auto Center Cursor</English>
<German>Mauszeiger automatisch zentrieren</German>
<Spanish>Auto-centrar cursor</Spanish>
<Polish>Automatycznie centruj kursor </Polish>
<Czech>Vycentrování kurzoru</Czech>
<Hungarian>Egér auto-centrírozása</Hungarian>
<Russian>Автоцентрирование курсора</Russian>
</Key>
<Key ID="STR_ACE_Interaction_Equipment">
<English>Equipment &gt;&gt;</English>
<German>Ausrüstung &gt;&gt;</German>

View File

@ -54,6 +54,5 @@ _actions,
{ [_this] call FUNC(startRepackingMagazine); },
{
call EFUNC(interaction,hideMenu); //ToDo: Self Interaction Integration
if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)};
}
] call EFUNC(interaction,openSelectMenu);