mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Refactor the interact_menu so options for multiple objects can coexist inside a single action point
This commit is contained in:
parent
eb4ccd9505
commit
3030b78ea2
@ -69,4 +69,4 @@ if ((count _activeChildren) == 0 && ((_origActionData select 3) isEqualTo {})) e
|
|||||||
[]
|
[]
|
||||||
};
|
};
|
||||||
|
|
||||||
[_origActionData, _activeChildren]
|
[_origActionData, _activeChildren, _object]
|
||||||
|
@ -142,8 +142,8 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
|||||||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"];
|
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"];
|
||||||
_foundTarget = true;
|
_foundTarget = true;
|
||||||
GVAR(actionSelected) = true;
|
GVAR(actionSelected) = true;
|
||||||
GVAR(selectedTarget) = (_closest select 0) select 0;
|
|
||||||
GVAR(selectedAction) = (_closest select 0) select 1;
|
GVAR(selectedAction) = (_closest select 0) select 1;
|
||||||
|
GVAR(selectedTarget) = (GVAR(selectedAction)) select 2;
|
||||||
GVAR(selectedStatement) = ((GVAR(selectedAction)) select 0) select 3;
|
GVAR(selectedStatement) = ((GVAR(selectedAction)) select 0) select 3;
|
||||||
|
|
||||||
_misMatch = false;
|
_misMatch = false;
|
||||||
@ -153,7 +153,7 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
|||||||
_misMatch = true;
|
_misMatch = true;
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
if(_x != (_hoverPath select _forEachIndex)) exitWith {
|
if !(_x isEqualTo (_hoverPath select _forEachIndex)) exitWith {
|
||||||
_misMatch = true;
|
_misMatch = true;
|
||||||
};
|
};
|
||||||
} forEach GVAR(lastPath);
|
} forEach GVAR(lastPath);
|
||||||
|
@ -66,12 +66,11 @@ _activeActionTree = [
|
|||||||
_object, _uid, 0.2
|
_object, _uid, 0.2
|
||||||
] call EFUNC(common,cachedCall);
|
] call EFUNC(common,cachedCall);
|
||||||
|
|
||||||
|
|
||||||
// Check if there's something left for rendering
|
// Check if there's something left for rendering
|
||||||
if (count _activeActionTree == 0) exitWith {false};
|
if (count _activeActionTree == 0) exitWith {false};
|
||||||
|
|
||||||
//EXPLODE_2_PVT(_activeActionTree,_actionData,_actionChildren);
|
//EXPLODE_2_PVT(_activeActionTree,_actionData,_actionChildren);
|
||||||
|
|
||||||
[_object, _activeActionTree, _pos, [180,360]] call FUNC(renderMenu);
|
[[], _activeActionTree, _pos, [180,360]] call FUNC(renderMenu);
|
||||||
|
|
||||||
true
|
true
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Render an interaction menu and it's children recursively
|
* Render an interaction menu and it's children recursively
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* 0: Object <OBJECT>
|
* 0: Parent path <ARRAY>
|
||||||
* 1: Action data <ARRAY>
|
* 1: Action data <ARRAY>
|
||||||
* 2: 3D position <ARRAY>
|
* 2: 3D position <ARRAY>
|
||||||
* 3: Angle range available for rendering <ARRAY>
|
* 3: Angle range available for rendering <ARRAY>
|
||||||
@ -15,16 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_menuInSelectedPath", "_path", "_menuDepth", "_currentRenderDepth", "_x", "_offset", "_newPos", "_forEachIndex"];
|
private ["_menuInSelectedPath", "_localPath", "_path", "_menuDepth", "_currentRenderDepth", "_x", "_offset", "_newPos", "_forEachIndex"];
|
||||||
|
|
||||||
EXPLODE_4_PVT(_this,_object,_action,_pos,_angles);
|
EXPLODE_4_PVT(_this,_parentPath,_action,_pos,_angles);
|
||||||
EXPLODE_2_PVT(_action,_actionData,_activeChildren);
|
EXPLODE_3_PVT(_action,_actionData,_activeChildren,_actionObject);
|
||||||
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
|
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
|
||||||
|
|
||||||
_menuDepth = (count GVAR(menuDepthPath)) - 1;
|
_menuDepth = (count GVAR(menuDepthPath)) - 1;
|
||||||
|
|
||||||
// Store path to action
|
// Store path to action
|
||||||
_path = [_object] + (_actionData select 7);
|
_localPath = _actionData select 7;
|
||||||
|
_path = +_parentPath;
|
||||||
|
_path pushBack [_localPath select ((count _localPath) - 1), _actionObject];
|
||||||
|
|
||||||
// Check if the menu is on the selected path
|
// Check if the menu is on the selected path
|
||||||
_menuInSelectedPath = true;
|
_menuInSelectedPath = true;
|
||||||
@ -32,7 +34,7 @@ _menuInSelectedPath = true;
|
|||||||
if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith {
|
if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith {
|
||||||
_menuInSelectedPath = false;
|
_menuInSelectedPath = false;
|
||||||
};
|
};
|
||||||
if (_x != (GVAR(menuDepthPath) select _forEachIndex)) exitWith {
|
if !(_x isEqualTo (GVAR(menuDepthPath) select _forEachIndex)) exitWith {
|
||||||
_menuInSelectedPath = false;
|
_menuInSelectedPath = false;
|
||||||
};
|
};
|
||||||
} forEach _path;
|
} forEach _path;
|
||||||
@ -63,7 +65,7 @@ if (_angleSpan >= 305) then {
|
|||||||
|
|
||||||
_angle = _centerAngle - _angleSpan / 2;
|
_angle = _centerAngle - _angleSpan / 2;
|
||||||
{
|
{
|
||||||
_target = _object;
|
_target = _actionObject;
|
||||||
_player = ACE_player;
|
_player = ACE_player;
|
||||||
|
|
||||||
_mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
|
_mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
|
||||||
@ -74,7 +76,7 @@ _angle = _centerAngle - _angleSpan / 2;
|
|||||||
|
|
||||||
//drawLine3D [_pos, _newPos, [1,0,0,0.5]];
|
//drawLine3D [_pos, _newPos, [1,0,0,0.5]];
|
||||||
|
|
||||||
[_object, _x, _newPos, [_angle, 140]] call FUNC(renderMenu);
|
[_path, _x, _newPos, [_angle, 140]] call FUNC(renderMenu);
|
||||||
|
|
||||||
if (_angleSpan == 360) then {
|
if (_angleSpan == 360) then {
|
||||||
_angle = _angle + _angleSpan / (count _activeChildren);
|
_angle = _angle + _angleSpan / (count _activeChildren);
|
||||||
|
Loading…
Reference in New Issue
Block a user