Merge pull request #157 from KoffeinFlummi/selfInteractionMenu

Self action menu and Action menu on selections
This commit is contained in:
Nicolás Badano 2015-02-23 14:24:43 -03:00
commit 669568cafe
29 changed files with 898 additions and 620 deletions

View File

@ -1,25 +1,30 @@
#define MACRO_ATTACHTOVEHICLE \
class ACE_Actions { \
class GVAR(AttachVehicle) { \
displayName = "$STR_ACE_Attach_AttachDetach"; \
condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \
statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \
exceptions[] = {"ACE_Drag_isNotDragging"}; \
showDisabled = 0; \
priority = 0; \
icon = PATHTOF(UI\attach_ca.paa); \
distance = 4; \
}; \
class GVAR(DetachVehicle) { \
displayName = "$STR_ACE_Attach_Detach"; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \
statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \
exceptions[] = {"ACE_Drag_isNotDragging"}; \
showDisabled = 0; \
priority = 0; \
icon = PATHTOF(UI\detach_ca.paa); \
distance = 4; \
class ACE_MainActions { \
selection = ""; \
distance = 5; \
condition = "true"; \
class GVAR(AttachVehicle) { \
displayName = "$STR_ACE_Attach_AttachDetach"; \
condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \
statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \
exceptions[] = {"ACE_Drag_isNotDragging"}; \
showDisabled = 0; \
priority = 0; \
icon = PATHTOF(UI\attach_ca.paa); \
distance = 4; \
}; \
class GVAR(DetachVehicle) { \
displayName = "$STR_ACE_Attach_Detach"; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \
statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \
exceptions[] = {"ACE_Drag_isNotDragging"}; \
showDisabled = 0; \
priority = 0; \
icon = PATHTOF(UI\detach_ca.paa); \
distance = 4; \
}; \
}; \
};

View File

@ -2,70 +2,78 @@ class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_Actions {
class ACE_ApplyHandcuffs {
displayName = "$STR_ACE_Captives_SetCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs));
exceptions[] = {};
showDisabled = 0;
priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
hotkey = "C";
class ACE_RightHandActions {
selection = "righthand";
displayName = "Right hand";
distance = 5;
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)) || ([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)));
class ACE_ApplyHandcuffs {
displayName = "$STR_ACE_Captives_SetCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs));
exceptions[] = {};
showDisabled = 0;
priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
hotkey = "C";
};
class ACE_RemoveHandcuffs {
displayName = "$STR_ACE_Captives_ReleaseCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs));
exceptions[] = {};
showDisabled = 0;
priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
hotkey = "R";
};
};
class ACE_RemoveHandcuffs {
displayName = "$STR_ACE_Captives_ReleaseCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs));
exceptions[] = {};
showDisabled = 0;
priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
hotkey = "R";
};
class ACE_EscortCaptive {
displayName = "$STR_ACE_Captives_EscortCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive));
statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive));
exceptions[] = {};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3;
hotkey = "E";
};
class ACE_StopEscorting {
displayName = "$STR_ACE_Captives_StopEscorting";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting));
statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive));
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3;
hotkey = "E";
};
class ACE_LoadCaptive {
displayName = "$STR_ACE_Captives_LoadCaptive";
distance = 4;
condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive));
statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive));
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.2;
hotkey = "L";
};
class ACE_FriskPerson {
displayName = "$STR_ACE_Captives_FriskPerson";
distance = 2;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson));
showDisabled = 0;
//icon = ""; //@todo
priority = 3;
hotkey = "F";
class ACE_MainActions {
class ACE_EscortCaptive {
displayName = "$STR_ACE_Captives_EscortCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive));
statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive));
exceptions[] = {};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3;
hotkey = "E";
};
class ACE_StopEscorting {
displayName = "$STR_ACE_Captives_StopEscorting";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting));
statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive));
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3;
hotkey = "E";
};
class ACE_LoadCaptive {
displayName = "$STR_ACE_Captives_LoadCaptive";
distance = 4;
condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive));
statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive));
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.2;
hotkey = "L";
};
class ACE_FriskPerson {
displayName = "$STR_ACE_Captives_FriskPerson";
distance = 2;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson));
showDisabled = 0;
//icon = ""; //@todo
priority = 3;
hotkey = "F";
};
};
};
@ -100,24 +108,27 @@ class CfgVehicles {
#define MACRO_LOADUNLOADCAPTIVE \
class ACE_Actions { \
class ACE_LoadCaptive { \
displayName = "$STR_ACE_Captives_LoadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \
statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \
exceptions[] = {QGVAR(isNotEscorting)}; \
showDisabled = 0; \
priority = 1.2; \
hotkey = "L"; \
}; \
class ACE_UnloadCaptive { \
displayName = "$STR_ACE_Captives_UnloadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \
showDisabled = 0; \
priority = 1.2; \
hotkey = "C"; \
class ACE_MainActions { \
selection = ""; \
class ACE_LoadCaptive { \
displayName = "$STR_ACE_Captives_LoadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \
statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \
exceptions[] = {QGVAR(isNotEscorting)}; \
showDisabled = 0; \
priority = 1.2; \
hotkey = "L"; \
}; \
class ACE_UnloadCaptive { \
displayName = "$STR_ACE_Captives_UnloadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \
showDisabled = 0; \
priority = 1.2; \
hotkey = "C"; \
}; \
}; \
};

View File

@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers {
class Extended_InitPost_EventHandlers {
class All {
class GVAR(compileMenu) {
init = QUOTE(_this call FUNC(compileMenu));
init = QUOTE(_this call FUNC(compileMenu);_this call FUNC(compileMenuSelfAction));
};
};
};

View File

@ -15,13 +15,27 @@ _fnc = {
["ACE3",
"Interact Key",
{_this call FUNC(keyDown)},
[15, [false, false, false]],
[219, [false, false, false]],
false,
"keydown"] call cba_fnc_registerKeybind;
["ACE3",
"Interact Key",
{_this call FUNC(keyUp)},
[15, [false, false, false]],
[219, [false, false, false]],
false,
"keyUp"] call cba_fnc_registerKeybind;
["ACE3",
"Self Actions Key",
{_this call FUNC(keyDownSelfAction)},
[219, [false, true, false]],
false,
"keydown"] call cba_fnc_registerKeybind;
["ACE3",
"Self Actions Key",
{_this call FUNC(keyUpSelfAction)},
[219, [false, true, false]],
false,
"keyUp"] call cba_fnc_registerKeybind;

View File

@ -2,22 +2,25 @@
ADDON = false;
PREP(setToRender);
PREP(addAction);
PREP(compileMenu);
PREP(compileMenuSelfAction);
PREP(keyDown);
PREP(keyDownSelfAction);
PREP(keyUp);
PREP(keyUpSelfAction);
PREP(probe);
PREP(removeAction);
PREP(render);
PREP(renderIcon);
PREP(renderMenu);
PREP(probe);
PREP(rotateVectLineGetMap);
PREP(rotateVectLine);
PREP(keyDown);
PREP(keyUp);
PREP(compileMenu);
PREP(addAction);
PREP(removeAction);
PREP(rotateVectLineGetMap);
GVAR(toRender) = [];
GVAR(keyDown) = false;
GVAR(keyDownSelfAction) = false;
GVAR(keyDownTime) = 0;
GVAR(lastTime) = diag_tickTime;

View File

@ -6,7 +6,7 @@ class CfgPatches {
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {""};
author[] = {"NouberNou", "CAA-Picard"};
authorUrl = "";
VERSION_CONFIG;
};

View File

@ -1,31 +1,27 @@
/*
* Author: commy2
*
* Add an ACE action to an object. Note: This function is NOT global.
* Author: commy2 and NouberNou
* Add an ACE action to an object or inside a parent action. Note: This function is NOT global.
*
* Argument:
* 0: Object the action should be assigned to (Object)
* 1: Name of the action shown in the menu (String)
* 2: Icon (String)
* 3: Position (Position or Selection Name)
* 4: Statement (Code)
* 5: Condition (Code)
* 6: Distance (Number)
* 0: Object the action should be assigned to or parent action <OBJECT> or <ARRAY>
* 1: Name of the action shown in the menu <STRING>
* 2: Icon <STRING>
* 3: Position (Position or Selection Name) <POSITION> or <STRING>
* 4: Statement <CODE>
* 5: Condition <CODE>
* 6: Distance <NUMBER>
*
* Return value:
* The entry array, which can be used to remove the entry, or add children entries.
* The entry array, which can be used to remove the entry, or add children entries <ARRAY>.
*
* Public: No
*/
#include "script_component.hpp"
private ["_object", "_displayName", "_icon", "_position", "_statement", "_condition", "_distance", "_actions", "_entry"];
_object = _this select 0;
_displayName = _this select 1;
_icon = _this select 2;
_position = _this select 3;
_statement = _this select 4;
_condition = _this select 5;
_distance = _this select 6;
EXPLODE_7_PVT(_this,_object,_displayName,_icon,_position,_statement,_condition,_distance);
private ["_actions","_entry"];
_actions = [];
if(IS_OBJECT(_object)) then {
_actions = _object getVariable [QUOTE(GVAR(actionData)), []];
@ -50,4 +46,4 @@ _entry = [
];
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_actions pushBack _entry;
_entry;
_entry;

View File

@ -1,23 +1,18 @@
//fnc_compileMenu.sqf
#include "script_component.hpp";
// diag_log text format["COMPILE ACTIONS: %1", _this];
_object = _this select 0;
_objectType = typeOf _object;
/*
displayName = "$STR_ACE_Interaction_TeamManagement";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)});
statement = "";
showDisabled = 0;
priority = 3.2;
icon = PATHTOF(UI\team\team_management_ca.paa);
subMenu[] = {"ACE_TeamManagement", 0};
hotkey = "M";
enableInside = 1;
*/
* Author: NouberNou
* Compile the action menu from config for a given object.
*
* Argument:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_object);
/*
[
@ -33,11 +28,13 @@ enableInside = 1;
]
*/
private ["_objectType","_recurseFnc","_actions"];
_objectType = typeOf _object;
_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions";
_recurseFnc = {
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_condition", "_showDisabled",
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
"_enableInside", "_children", "_entry", "_actionsCfg"];
_actions = [];
_actionsCfg = _this select 0;
@ -48,7 +45,10 @@ _recurseFnc = {
_distance = getNumber (_entryCfg >> "distance");
_icon = getText (_entryCfg >> "icon");
_statement = compile (getText (_entryCfg >> "statement"));
_selection = getText (_entryCfg >> "selection");
if (_selection == "") then {
_selection = [0,0,0];
};
_condition = getText (_entryCfg >> "condition");
if (_condition == "") then {_condition = "true"};
@ -59,25 +59,18 @@ _recurseFnc = {
_enableInside = getNumber (_entryCfg >> "enableInside");
_condition = compile _condition;
// diag_log text format["_condition: %1", _condition];
_children = [];
if(isArray (_entryCfg >> "subMenu")) then {
_subMenuDef = getArray (_entryCfg >> "subMenu");
_childMenuName = _subMenuDef select 0;
_childMenuCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions" >> _childMenuName;
_children = [_childMenuCfg] call _recurseFnc;
};
_children = [_entryCfg] call _recurseFnc;
_entry = [
_displayName,
_icon,
[0,0,0],
_selection,
_statement,
_condition,
_distance,
_children,
GVAR(uidCounter)
];
GVAR(uidCounter) = GVAR(uidCounter) + 1;
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_actions pushBack _entry;
};
};
@ -86,17 +79,4 @@ _recurseFnc = {
_actions = [_actionsCfg] call _recurseFnc;
_actions = [[
"TEST!",
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
"Spine3",
{ true },
{ true },
5,
_actions,
GVAR(uidCounter)
]
];
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_object setVariable [QUOTE(GVAR(actionData)), _actions];
_object setVariable [QUOTE(GVAR(actionData)), _actions];

View File

@ -0,0 +1,92 @@
/*
* Author: NouberNou and CAA-Picard
* Compile the self action menu from config for a given object.
*
* Argument:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_object);
/*
[
[
"Launch",
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
[0,0,0],
{ (_this select 0) setVelocity [0,0,10]; },
{ true },
1,
[]
]
]
*/
private ["_objectType","_recurseFnc","_actions"];
_objectType = typeOf _object;
_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions";
_recurseFnc = {
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_condition", "_showDisabled",
"_enableInside", "_children", "_entry", "_actionsCfg"];
_actions = [];
_actionsCfg = _this select 0;
for "_i" from 0 to (count _actionsCfg)-1 do {
_entryCfg = _actionsCfg select _i;
if(isClass _entryCfg) then {
_displayName = getText (_entryCfg >> "displayName");
_icon = getText (_entryCfg >> "icon");
_statement = compile (getText (_entryCfg >> "statement"));
_condition = getText (_entryCfg >> "condition");
if (_condition == "") then {_condition = "true"};
// Add canInteract (including exceptions) and canInteractWith to condition
_condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
_showDisabled = getNumber (_entryCfg >> "showDisabled");
_enableInside = getNumber (_entryCfg >> "enableInside");
_condition = compile _condition;
_children = [_entryCfg] call _recurseFnc;
_entry = [
_displayName,
_icon,
[0,0,0],
_statement,
_condition,
10, //distace
_children,
GVAR(uidCounter)
];
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_actions pushBack _entry;
};
};
_actions
};
_actions = [_actionsCfg] call _recurseFnc;
// Create a master action to base on self action
_actions = [[
"Self Actions",
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
"Spine3",
{ true },
{ true },
10,
_actions,
GVAR(uidCounter)
]
];
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_object setVariable [QUOTE(GVAR(selfActionData)), _actions];

View File

@ -1,8 +1,19 @@
//fnc_keyDown.sqf
/*
* Author: NouberNou
* Handle interaction key down
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
if(!GVAR(keyDown)) then {
GVAR(keyDown) = true;
GVAR(keyDownTime) = diag_tickTime;
GVAR(keyDown) = true;
GVAR(keyDownTime) = diag_tickTime;
};
true

View File

@ -0,0 +1,22 @@
/*
* Author: NouberNou
* Handle self action key down
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
if(!GVAR(keyDownSelfAction)) then {
GVAR(keyDownSelfAction) = true;
GVAR(keyDown) = false;
GVAR(keyDownTime) = diag_tickTime;
GVAR(selfMenuOffset) = [sin getDir ACE_player, cos getDir ACE_player, 0] vectorMultiply 2;
};
true

View File

@ -1,12 +1,23 @@
//fnc_keyUp.sqf
/*
* Author: NouberNou
* Handle interaction key up
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
GVAR(keyDown) = false;
if(GVAR(actionSelected)) then {
this = GVAR(selectedTarget);
this = GVAR(selectedTarget);
_player = ACE_Player;
_target = GVAR(selectedTarget);
[GVAR(selectedTarget), player] call GVAR(selectedAction);
[GVAR(selectedTarget), player] call GVAR(selectedAction);
};
GVAR(expanded) = false;
GVAR(lastPath) = [];

View File

@ -0,0 +1,26 @@
/*
* Author: NouberNou
* Handle self action key up
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
GVAR(keyDownSelfAction) = false;
if(GVAR(actionSelected)) then {
this = GVAR(selectedTarget);
_player = ACE_Player;
_target = GVAR(selectedTarget);
[GVAR(selectedTarget), player] call GVAR(selectedAction);
};
GVAR(expanded) = false;
GVAR(lastPath) = [];
GVAR(menuDepthPath) = [];
GVAR(vecLineMap) = [];
true

View File

@ -1,15 +1,27 @@
//fnc_probe.sqf
/*
* Author: NouberNou
* Scan de vicinity of the player and collect every interaction available around it on
* the GVAR(toRender) array.
*
* Argument:
* None
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_nearestObjects", "_actionObject", "_x", "_actionData", "_renderData", "_actionItem", "_active", "_renderItem", "_object", "_forEachIndex"];
if(!GVAR(keyDown)) then {
_nearestObjects = nearestObjects [(getPos player), ["All"], 100];
_nearestObjects = nearestObjects [(getPos ACE_player), ["All"], 100];
GVAR(toRender) = [];
{
_actionObject = _x;
_actionData = _actionObject getVariable [QUOTE(GVAR(actionData)), []];
if((count _actionData) > 0) then {
_renderData = [];
{
@ -18,6 +30,7 @@ if(!GVAR(keyDown)) then {
_target = _actionObject;
_player = ACE_player;
_active = [_target, ACE_player] call (_actionItem select 4);
systemChat format ["%1 %2 is active %3", _actionObject, _actionItem select 0, _active];
// player sideChat format["_active: %1 %2", _actionItem select 0, _active];
if(_active) then {
_renderItem = +_actionItem;
@ -35,7 +48,7 @@ if(!GVAR(keyDown)) then {
GVAR(filter) = [];
{
_object = _x select 0;
if(_object distance player > 100) then {
if(_object distance ACE_player > 100) then {
GVAR(filter) set[(count GVAR(filter)), _forEachIndex];
};
} forEach GVAR(toRender);

View File

@ -1,24 +1,21 @@
/*
* Author: commy2
*
* Add an ACE action to an object. Note: This function is global.
* Author: commy2 and NouberNou
* Remove an action from an object
*
* Argument:
* 0: Object the action should be assigned to (Object)
* 1: Entry to remove (Array or Number)
* 0: Object the action should be assigned to <OBJECT>
* 1: Entry to remove <ARRAY> or <NUMBER>
*
* Return value:
* ID of the action (used to remove it later).
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_object", "_entry", "_found", "_actions", "_searchFnc"];
_object = _this select 0;
_entry = _this select 1;
EXPLODE_2_PVT(_this,_object,_entry);
private ["_found", "_actions", "_searchFnc"];
if(!IS_OBJECT(_object)) exitWith {false};
@ -50,4 +47,4 @@ _searchFnc = {
_actions = [_actions, _entry] call _searchFnc;
_object setVariable [QUOTE(GVAR(actionData)), _actions];
_found;
_found;

View File

@ -1,4 +1,15 @@
//fnc_render.sqf
/*
* Author: NouberNou and CAA-Picard
* Render all available nearby interactions
*
* Argument:
* None
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_cursorPos1", "_cursorPos2", "_cursorVec", "_p1", "_p2", "_p", "_v", "_cp", "_forEachIndex", "_renderTargets", "_x", "_cursorScreenPos", "_closestDistance", "_closestSelection", "_pos", "_sPos", "_disSq", "_closest", "_cTime", "_delta", "_foundTarget", "_misMatch", "_hoverPath", "_i"];
@ -6,99 +17,108 @@ _foundTarget = false;
_cursorPos1 = positionCameraToWorld [0, 0, 0];
_cursorPos2 = positionCameraToWorld [0, 0, 2];
GVAR(currentOptions) = [];
if((count GVAR(toRender)) > 0 && GVAR(keyDown)) then {
if((count GVAR(vecLineMap)) == 0 || ((count GVAR(menuDepthPath)) > 0 && (getPosASL player) distance GVAR(lastPos) > 0.01)) then {
GVAR(lastPos) = getPosASL player;
_cursorVec = [_cursorPos2, _cursorPos1] call BIS_fnc_vectorFromXtoY;
_p1 = [0,0,0];
_p2 = +_cursorVec;
_p = (_cursorVec call CBA_fnc_vect2polar);
_v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect;
_cp = [_cursorVec, _v] call BIS_fnc_crossProduct;
GVAR(vecLineMap) = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap);
};
{
if(!(_forEachIndex in GVAR(filter))) then {
GVAR(renderDepth) = 0;
_renderTargets = _x;
{
[_renderTargets select 0, _x, 0] call FUNC(renderMenu);
} forEach (_renderTargets select 1);
};
} forEach GVAR(toRender);
// player sideChat format["c: %1", count GVAR(toRender)];
if((count GVAR(toRender)) > 0 && (GVAR(keyDown) || GVAR(keyDownSelfAction))) then {
if((count GVAR(vecLineMap)) == 0 || ((count GVAR(menuDepthPath)) > 0 && (getPosASL player) distance GVAR(lastPos) > 0.01)) then {
GVAR(lastPos) = getPosASL player;
_cursorVec = [_cursorPos2, _cursorPos1] call BIS_fnc_vectorFromXtoY;
_p1 = [0,0,0];
_p2 = +_cursorVec;
_p = (_cursorVec call CBA_fnc_vect2polar);
_v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect;
_cp = [_cursorVec, _v] call BIS_fnc_crossProduct;
GVAR(vecLineMap) = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap);
};
if (GVAR(keyDown)) then {
// Render all nearby interaction menus
{
if(!(_forEachIndex in GVAR(filter))) then {
GVAR(renderDepth) = 0;
_renderTargets = _x;
{
[_renderTargets select 0, _x, 0, [180, 360]] call FUNC(renderMenu);
} forEach (_renderTargets select 1);
};
} forEach GVAR(toRender);
} else {
// Render only the self action menu
_actions = (ACE_player getVariable QGVAR(selfActionData)) select 0;
_pos = (ACE_player modelToWorld (ACE_player selectionPosition "spine3")) vectorAdd GVAR(selfMenuOffset) vectorAdd [0,0,0.25];
[ACE_player, _actions, 0, [180, 360], _pos] call FUNC(renderMenu);
};
// player sideChat format["c: %1", count GVAR(toRender)];
};
if(GVAR(keyDown)) then {
_cursorScreenPos = worldToScreen _cursorPos2;
_closestDistance = 1000000;
_closestSelection = -1;
{
_pos = _x select 1;
_sPos = worldToScreen _pos;
if(count _sPos > 0) then {
_disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2);
if(_disSq < 0.0125 && _disSq < _closestDistance) then {
_closestDistance = _disSq;
_closestSelection = _forEachIndex;
};
};
} forEach GVAR(currentOptions);
if(_closestSelection != -1) then {
_closest = GVAR(currentOptions) select _closestSelection;
_pos = _closest select 1;
_cTime = diag_tickTime;
_delta = _cTime - GVAR(lastTime);
GVAR(lastTime) = _cTime;
GVAR(rotationAngle) = GVAR(rotationAngle) + (180*_delta);
if(GVAR(rotationAngle) > 360) then {
GVAR(rotationAngle) = GVAR(rotationAngle) - 360;
};
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;
GVAR(actionSelected) = true;
GVAR(selectedTarget) = (_closest select 0) select 0;
GVAR(selectedAction) = ((_closest select 0) select 1) select 3;
_misMatch = false;
_hoverPath = (_closest select 2);
if((count GVAR(lastPath)) != (count _hoverPath)) then {
_misMatch = true;
} else {
{
if(_x != (_hoverPath select _forEachIndex)) exitWith {
_misMatch = true;
};
} forEach GVAR(lastPath);
};
if(_misMatch) then {
GVAR(lastPath) = _hoverPath;
GVAR(startHoverTime) = diag_tickTime;
GVAR(expanded) = false;
} else {
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
GVAR(expanded) = true;
GVAR(menuDepthPath) = +GVAR(lastPath);
};
};
};
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"];
if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
_cursorScreenPos = worldToScreen _cursorPos2;
_closestDistance = 1000000;
_closestSelection = -1;
{
_pos = _x select 1;
_sPos = worldToScreen _pos;
if(count _sPos > 0) then {
_disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2);
if(_disSq < 0.0125 && _disSq < _closestDistance) then {
_closestDistance = _disSq;
_closestSelection = _forEachIndex;
};
};
} forEach GVAR(currentOptions);
if(_closestSelection != -1) then {
_closest = GVAR(currentOptions) select _closestSelection;
_pos = _closest select 1;
_cTime = diag_tickTime;
_delta = _cTime - GVAR(lastTime);
GVAR(lastTime) = _cTime;
GVAR(rotationAngle) = GVAR(rotationAngle) + (180*_delta);
if(GVAR(rotationAngle) > 360) then {
GVAR(rotationAngle) = GVAR(rotationAngle) - 360;
};
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;
GVAR(actionSelected) = true;
GVAR(selectedTarget) = (_closest select 0) select 0;
GVAR(selectedAction) = ((_closest select 0) select 1) select 3;
_misMatch = false;
_hoverPath = (_closest select 2);
if((count GVAR(lastPath)) != (count _hoverPath)) then {
_misMatch = true;
} else {
{
if(_x != (_hoverPath select _forEachIndex)) exitWith {
_misMatch = true;
};
} forEach GVAR(lastPath);
};
if(_misMatch) then {
GVAR(lastPath) = _hoverPath;
GVAR(startHoverTime) = diag_tickTime;
GVAR(expanded) = false;
} else {
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
GVAR(expanded) = true;
GVAR(menuDepthPath) = +GVAR(lastPath);
};
};
};
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"];
};
if(!_foundTarget && GVAR(actionSelected)) then {
GVAR(actionSelected) = false;
GVAR(expanded) = false;
GVAR(lastPath) = [];
if(!GVAR(keyDown)) then {
GVAR(vecLineMap) = [];
};
GVAR(actionSelected) = false;
GVAR(expanded) = false;
GVAR(lastPath) = [];
if(!GVAR(keyDown)) then {
GVAR(vecLineMap) = [];
};
};
for "_i" from GVAR(iconCount) to (count GVAR(iconCtrls))-1 do {
ctrlDelete (GVAR(iconCtrls) select _i);
ctrlDelete (GVAR(iconCtrls) select _i);
};
GVAR(iconCtrls) resize GVAR(iconCount);
GVAR(iconCount) = 0;

View File

@ -1,4 +1,21 @@
//fnc_renderIcon.sqf
/*
* Author: NouberNou and CAA-Picard
* Render a single interaction icon
*
* Argument:
* 0: Text <STRING>
* 1: Color <STRING>
* 2: 3d position ASL <ARRAY>
* 3: ?
* 4: ?
* 5: ?
* 6: Icon <STRING>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa)
private ["_color", "_pos", "_sPos", "_ctrl", "_icon"];
@ -6,24 +23,23 @@ _text = _this select 0;
_color = _this select 1;
_pos = _this select 2;
_icon = _this select 6;
_sPos = worldToScreen _pos;
// _sPos = _pos;
if(count _sPos > 0) then {
// player sideChat format["render!"];
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
GVAR(iconCtrls) pushBack ((findDisplay 46) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
};
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
GVAR(iconCount) = GVAR(iconCount) + 1;
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
GVAR(iconCtrls) pushBack ((findDisplay 46) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
};
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
GVAR(iconCount) = GVAR(iconCount) + 1;
if(_icon == "") then {
_icon = DEFAULT_ICON;
};
_text = "<img image='" + _icon + "' />" + _text;
_ctrl ctrlSetStructuredText (parseText _text);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.011*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.025*SafeZoneW];
_ctrl ctrlSetForegroundColor _color;
_opacity = _color select 3;
_control ctrlSetTextColor _color;
// _ctrl ctrlSetBackgroundColor [1,0,0,1];
_ctrl ctrlCommit 0;
_text = format ["<img image='%1' color='%2' align='center'/><br/><t color ='%3' size='0.75' align='center'>%4</t>", _icon, _color, _color, _text];
_ctrl ctrlSetStructuredText (parseText _text);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.2*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.035*SafeZoneW];
//_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1];
// _ctrl ctrlSetBackgroundColor [1,0,0,1];
_ctrl ctrlCommit 0;
};

View File

@ -1,64 +1,105 @@
//fnc_renderMenu.sqf
/*
* Author: NouberNou and CAA-Picard
* Render a interaction menu
*
* Argument:
* 0: Object <OBJECT>
* 1: Action data <ARRAY>
* 2: ?
* 3: Angle range available for rendering <ARRAY>
* 4: 3D position <ARRAY> (Optional)
* 5: Path of UIDs <ARRAY> (Optional)
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_object", "_actionData", "_distance", "_index", "_pos", "_cursorScreenPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"];
private ["_object", "_actionData", "_distance", "_uid", "_pos", "_cursorScreenPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"];
_object = _this select 0;
_actionData = _this select 1;
_distance = _actionData select 5;
_index = _this select 2;
_uid = _actionData select 7;//_this select 2;
_angles = _this select 3;
if((count _this) > 3) then {
_pos = _this select 3;
_distance = _actionData select 5;
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
if((count _this) > 4) then {
_pos = _this select 4;
} else {
if(typeName (_actionData select 2) == "ARRAY") then {
_pos = _object modelToWorld (_actionData select 2);
} else {
_pos = _object modelToWorld (_object selectionPosition (_actionData select 2));
};
if(typeName (_actionData select 2) == "ARRAY") then {
_pos = _object modelToWorld (_actionData select 2);
} else {
_pos = _object modelToWorld (_object selectionPosition (_actionData select 2));
};
};
_cursorScreenPos = (positionCameraToWorld [0, 0, 0]);
if(_cursorScreenPos distance _pos <= _distance) then {
_path = [];
if((count _this) > 4) then {
_path = +(_this select 4);
};
_menuDepth = (count GVAR(menuDepthPath));
_path = [];
if((count _this) > 5) then {
_path = +(_this select 5);
};
_menuDepth = (count GVAR(menuDepthPath));
_opacity = 1;
if(_menuDepth > 0 && _index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then {
_opacity = ((GVAR(renderDepth)/_menuDepth)) max 0.25;
};
_path set[(count _path), _index];
// player sideChat format["r: %1", _actionData select 2];
[_actionData select 0, [1,1,1,_opacity], _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon);
GVAR(currentOptions) set[(count GVAR(currentOptions)), [_this, _pos, _path]];
_currentRenderDepth = -1;
_currentRenderDepth = GVAR(renderDepth);
GVAR(renderDepth) = GVAR(renderDepth) + 1;
if(_index == (GVAR(menuDepthPath) select (GVAR(renderDepth)-1))) then {
_radialOffset = 0;
{
// if(_index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then {
this = _object;
_target = _object;
_player = ACE_player;
_active = [_object, ACE_player] call (_x select 4);
// diag_log text format["_active: %1: %2", (_x select 0), _active];
if(_active) then {
_offset = [GVAR(vecLineMap), (270*(GVAR(renderDepth)%2))-(_radialOffset*45)] call FUNC(rotateVectLine);
_mod = 0.1*_distance;
_newPos = [
(_pos select 0) + ((_offset select 0)*_mod),
(_pos select 1) + ((_offset select 1)*_mod),
(_pos select 2) + ((_offset select 2)*_mod)
];
// drawLine3D [_pos, _newPos, [1,0,0,1]];
[_object, _x, _forEachIndex, _newPos, _path] call FUNC(renderMenu);
_radialOffset = _radialOffset + 1;
// ARGB Color (First Hex Pair is transparancy)
_color = "#FFFFFFFF";
if(_menuDepth > 0 && _uid != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then {
_color = format ["#%1FFFFFF", [255 * (((GVAR(renderDepth)/_menuDepth)) max 0.25)] call EFUNC(common,toHex)];
};
_path set[(count _path), _uid];
[_actionData select 0, _color, _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon);
GVAR(currentOptions) set[(count GVAR(currentOptions)), [_this, _pos, _path]];
_currentRenderDepth = -1;
_currentRenderDepth = GVAR(renderDepth);
GVAR(renderDepth) = GVAR(renderDepth) + 1;
if(_uid == (GVAR(menuDepthPath) select (GVAR(renderDepth)-1))) then {
// Count how many actions are active
private "_numActions";
_numActions = 0;
{
this = _object;
_target = _object;
_player = ACE_player;
_active = [_object, ACE_player] call (_x select 4);
if(_active) then {
_numActions = _numActions + 1;
};
} forEach (_actionData select 6);
systemChat format ["Menu %1, _numActions: %2", _actionData select 0, _numActions];
private "_angleSpan";
_angleSpan = _maxAngleSpan min (55 * (_numActions - 1));
private "_angle";
_angle = _centerAngle - _angleSpan / 2;
{
this = _object;
_target = _object;
_player = ACE_player;
_active = [_object, ACE_player] call (_x select 4);
// diag_log text format["_active: %1: %2", (_x select 0), _active];
if(_active) then {
//systemChat format ["_angle: %1", _angle];
_offset = [GVAR(vecLineMap), _angle] call FUNC(rotateVectLine);
_mod = 0.15 max (0.15 * (_cursorScreenPos distance _pos)); //0.5;//0.1*_distance;
_newPos = [
(_pos select 0) + ((_offset select 0)*_mod),
(_pos select 1) + ((_offset select 1)*_mod),
(_pos select 2) + ((_offset select 2)*_mod)
];
// drawLine3D [_pos, _newPos, [1,0,0,0.5]];
[_object, _x, _forEachIndex, [_angle, 150], _newPos, _path] call FUNC(renderMenu);
if (_angle == 360) then {
_angle = _angle + _angleSpan / _numActions;
} else {
_angle = _angle + _angleSpan / ((_numActions-1) max 1);
};
// };
} forEach (_actionData select 6);
};
GVAR(renderDepth) = GVAR(renderDepth) - 1;
};
} forEach (_actionData select 6);
};
GVAR(renderDepth) = GVAR(renderDepth) - 1;
};

View File

@ -1,4 +1,16 @@
//fnc_rotateVectLine.sqf
/*
* Author: NouberNou
* Rotate a vector line (?)
*
* Argument:
* 0: Map <ARRAY>
* 1: Theta <ARRAY>
*
* Return value:
* 0: ?? <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
private ["_theta", "_p", "_map", "_p1", "_p2", "_q1", "_q2", "_u", "_d"];

View File

@ -1,4 +1,17 @@
//fnc_rotateVectLineGetMap.sqf
/*
* Author: NouberNou
* ?
*
* Argument:
* 0: p0 <ARRAY>
* 1: p1 <ARRAY>
* 2: p2 <ARRAY>
*
* Return value:
* Map <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
private ["_p", "_p1", "_p2", "_q1", "_q2", "_u", "_d"];

View File

@ -1,6 +0,0 @@
//fnc_setToRender.sqf
#include "script_component.hpp"
// No idea what this function was for, it was autogenerated out of my WIP file...
private ["_options"];
_object = _this select 0;
_options = _this select 1;

View File

@ -30,121 +30,142 @@ class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_Actions {
class ACE_TeamManagement {
displayName = "$STR_ACE_Interaction_TeamManagement";
class ACE_MainActions {
displayName = "$STR_ACE_Interaction_MainAction";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)});
condition = QUOTE(true);
statement = "";
showDisabled = 0;
priority = 3.2;
icon = PATHTOF(UI\team\team_management_ca.paa);
subMenu[] = {"ACE_TeamManagement", 0};
hotkey = "M";
enableInside = 1;
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = "spine3";
class ACE_JoinTeamRed {
displayName = "$STR_ACE_Interaction_JoinTeamRed";
class ACE_TeamManagement {
displayName = "$STR_ACE_Interaction_TeamManagement";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_red_ca.paa);
priority = 2.4;
hotkey = "R";
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)});
statement = "";
showDisabled = 0;
priority = 3.2;
icon = PATHTOF(UI\team\team_management_ca.paa);
hotkey = "M";
enableInside = 1;
class ACE_JoinTeamRed {
displayName = "$STR_ACE_Interaction_JoinTeamRed";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_red_ca.paa);
priority = 2.4;
hotkey = "R";
enableInside = 1;
};
class ACE_JoinTeamGreen {
displayName = "$STR_ACE_Interaction_JoinTeamGreen";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_green_ca.paa);
priority = 2.3;
hotkey = "G";
enableInside = 1;
};
class ACE_JoinTeamBlue {
displayName = "$STR_ACE_Interaction_JoinTeamBlue";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_blue_ca.paa);
priority = 2.2;
hotkey = "B";
enableInside = 1;
};
class ACE_JoinTeamYellow {
displayName = "$STR_ACE_Interaction_JoinTeamYellow";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_yellow_ca.paa);
priority = 2.1;
hotkey = "Y";
enableInside = 1;
};
class ACE_LeaveTeam {
displayName = "$STR_ACE_Interaction_LeaveTeam";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {assignedTeam _player != 'MAIN'});
statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_white_ca.paa);
priority = 2.5;
hotkey = "N";
enableInside = 1;
};
};
class ACE_JoinGroup {
displayName = "$STR_ACE_Interaction_JoinGroup";
distance = 4;
condition = QUOTE(side group _player == side group _target && {group _player != group _target});
statement = QUOTE([_player] joinSilent group _target;);
showDisabled = 0;
priority = 2.6;
icon = PATHTOF(UI\team\team_management_ca.paa);
hotkey = "J";
enableInside = 1;
};
class ACE_JoinTeamGreen {
displayName = "$STR_ACE_Interaction_JoinTeamGreen";
class ACE_GetDown {
displayName = "$STR_ACE_Interaction_GetDown";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_green_ca.paa);
priority = 2.3;
hotkey = "G";
enableInside = 1;
};
class ACE_JoinTeamBlue {
displayName = "$STR_ACE_Interaction_JoinTeamBlue";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_blue_ca.paa);
condition = QUOTE([_target] call DFUNC(canInteractWith));
statement = QUOTE([_target] call DFUNC(getDown));
showDisabled = 0;
priority = 2.2;
hotkey = "B";
enableInside = 1;
};
class ACE_JoinTeamYellow {
displayName = "$STR_ACE_Interaction_JoinTeamYellow";
class ACE_SendAway {
displayName = "$STR_ACE_Interaction_SendAway";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player});
statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_yellow_ca.paa);
priority = 2.1;
hotkey = "Y";
enableInside = 1;
condition = QUOTE([_target] call DFUNC(canInteractWith));
statement = QUOTE([_target] call DFUNC(sendAway));
showDisabled = 0;
priority = 2.0;
};
class ACE_LeaveTeam {
displayName = "$STR_ACE_Interaction_LeaveTeam";
class ACE_Pardon {
displayName = "$STR_ACE_Interaction_Pardon";
distance = 4;
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {assignedTeam _player != 'MAIN'});
statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam));
showDisabled = 1;
icon = PATHTOF(UI\team\team_white_ca.paa);
condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target});
statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc));
showDisabled = 0;
priority = 2.5;
hotkey = "N";
enableInside = 1;
};
};
class ACE_TapShoulder {
class ACE_TapShoulderRight {
displayName = "$STR_ACE_Interaction_TapShoulder";
distance = 4;
selection = "rightshoulder";
distance = 2.0;
condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder));
statement = QUOTE([ARR_2(_player, _target)] call DFUNC(tapShoulder));
showDisabled = 1;
statement = QUOTE([ARR_3(_player, _target, 0)] call DFUNC(tapShoulder));
showDisabled = 0;
priority = 2.8;
hotkey = "Q";
enableInside = 1;
};
class ACE_JoinGroup {
displayName = "$STR_ACE_Interaction_JoinGroup";
distance = 4;
condition = QUOTE(side group _player == side group _target && {group _player != group _target});
statement = QUOTE([_player] joinSilent group _target;);
class ACE_TapShoulderLeft {
displayName = "$STR_ACE_Interaction_TapShoulder";
selection = "leftshoulder";
distance = 2.0;
condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder));
statement = QUOTE([ARR_3(_player, _target, 1)] call DFUNC(tapShoulder));
showDisabled = 0;
priority = 2.6;
icon = PATHTOF(UI\team\team_management_ca.paa);
hotkey = "J";
enableInside = 1;
};
class ACE_GetDown {
displayName = "$STR_ACE_Interaction_GetDown";
distance = 4;
condition = QUOTE([_target] call DFUNC(canInteractWith));
statement = QUOTE([_target] call DFUNC(getDown));
showDisabled = 0;
priority = 2.2;
};
class ACE_SendAway {
displayName = "$STR_ACE_Interaction_SendAway";
distance = 4;
condition = QUOTE([_target] call DFUNC(canInteractWith));
statement = QUOTE([_target] call DFUNC(sendAway));
showDisabled = 0;
priority = 2.0;
};
class ACE_Pardon {
displayName = "$STR_ACE_Interaction_Pardon";
distance = 4;
condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target});
statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc));
showDisabled = 0;
priority = 2.5;
priority = 2.8;
hotkey = "Q";
enableInside = 1;
};
};

View File

@ -16,78 +16,6 @@ GVAR(isOpeningDoor) = false;
// Add keybinds
["ACE3",
localize "STR_ACE_Interaction_InteractionMenu",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(isNull (findDisplay 1713999)) exitWith {false};
// Statement
call FUNC(onButtonDown);
true
},
[219, [false, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Interaction_InteractionMenu",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false};
// Statement
if (GVAR(MenuType) mod 2 == 0) then {call FUNC(onButtonUp)};
true
},
[219, [false, false, false]],
false,
"keyup"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Interaction_InteractionMenuSelf",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(isNull (findDisplay 1713999)) exitWith {false};
// Statement
call FUNC(onButtonDownSelf);
true
},
[219, [false, true, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Interaction_InteractionMenuSelf",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false};
// Statement
if (GVAR(MenuType) mod 2 == 1) then {call FUNC(onButtonUp)};
true
},
[219, [false, true, false]],
false,
"keyup"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Interaction_OpenDoor",
{

View File

@ -1,21 +1,22 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_message"];
_tapper = _this select 0;
_target = _this select 1;
EXPLODE_3_PVT(_this,_tapper,_target,_shoulderNum);
if (_target != ACE_player) exitWith {
addCamShake [4, 0.5, 5];
if !(local _target) then {
[[_tapper, _target], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc);
};
addCamShake [4, 0.5, 5];
ACE_player playActionNow 'gestureAdvance';
if !(local _target) then {
[[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc);
};
};
addCamShake [4, 0.5, 5];
//_message = format ["%1 tapped you on your shoulder.", [_unit] call EFUNC(common,getName)];
_message = localize "STR_ACE_Interaction_YouWereTapped";
if (_shoulderNum == 0) then {
_message = localize "STR_ACE_Interaction_YouWereTappedRight";
} else {
_message = localize "STR_ACE_Interaction_YouWereTappedLeft";
};
[_message] call EFUNC(common,displayTextStructured);

View File

@ -2,6 +2,9 @@
<!-- Edited with tabler - 2014-12-20 -->
<Project name="ACE">
<Package name="Interaction">
<Key ID="STR_ACE_Interaction_MainAction">
<English>Interactions &gt;&gt;</English>
</Key>
<Key ID="STR_ACE_Interaction_InteractionMenu">
<English>Interaction Menu</English>
<German>Interaktionsmenü</German>
@ -338,17 +341,29 @@
<Portuguese>Tocar ombro</Portuguese>
<Italian>Dai un colpetto</Italian>
</Key>
<Key ID="STR_ACE_Interaction_YouWereTapped">
<English>You were tapped on the shoulder.</English>
<German>Dir wurde auf die Schulter geklopft</German>
<Spanish>Te tocaron el hombro.</Spanish>
<French>On te tape sur l'épaule.</French>
<Polish>Zostałeś klepnięty po ramieniu</Polish>
<Hungarian>Vállonveregettek</Hungarian>
<Czech>Někdo tě poklepal na rameno.</Czech>
<Russian>Вас похлопали по плечу</Russian>
<Portuguese>Você foi tocado no ombro.</Portuguese>
<Italian>Ti è stato dato un colpetto sulla spalla</Italian>
<Key ID="STR_ACE_Interaction_YouWereTappedRight">
<English>You were tapped on the RIGHT shoulder &gt;</English>
<Spanish>Te tocaron el hombro DERECHO &gt;</Spanish>
<German>Dir wurde auf die Schulter geklopft &gt;</German>
<French>On te tape sur l'épaule &gt;</French>
<Polish>Zostałeś klepnięty po ramieniu &gt;</Polish>
<Hungarian>Vállonveregettek &gt;</Hungarian>
<Czech>Někdo tě poklepal na rameno &gt;</Czech>
<Russian>Вас похлопали по плечу &gt;</Russian>
<Portuguese>Você foi tocado no ombro &gt;</Portuguese>
<Italian>Ti è stato dato un colpetto sulla spalla &gt;</Italian>
</Key>
<Key ID="STR_ACE_Interaction_YouWereTappedLeft">
<English>&lt; You were tapped on the LEFT shoulder.</English>
<Spanish>&lt; Te tocaron el hombro IZQUIERDO.</Spanish>
<German>&lt; Dir wurde auf die Schulter geklopft</German>
<French>&lt; On te tape sur l'épaule.</French>
<Polish>&lt; Zostałeś klepnięty po ramieniu</Polish>
<Hungarian>&lt; Vállonveregettek</Hungarian>
<Czech>&lt; Někdo tě poklepal na rameno.</Czech>
<Russian>&lt; Вас похлопали по плечу</Russian>
<Portuguese>&lt; Você foi tocado no ombro.</Portuguese>
<Italian>&lt; Ti è stato dato un colpetto sulla spalla</Italian>
</Key>
<Key ID="STR_ACE_Interaction_CancelSelection">
<English>Cancel</English>

View File

@ -2,6 +2,7 @@ class CfgVehicles {
class Helicopter_Base_F;
class UAV_01_base_F: Helicopter_Base_F {
class ACE_Actions {
class ACE_MainActions {
class GVAR(RefuelUAV) {
displayName = "$STR_ACE_logistics_uavbattery_Recharge";
distance = 4;
@ -11,9 +12,10 @@ class CfgVehicles {
priority = 1.245; \
icon = QUOTE(PATHTOF(ui\UAV_battery.paa));
};
};
};
};
// Misc box content
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {

View File

@ -85,12 +85,14 @@ class CfgVehicles {
};
class ACE_Actions {
class ACE_CopyMap {
displayName = "$STR_ACE_Map_CopyMap";
condition = QUOTE(([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target}));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart));
showDisabled = 0;
priority = -1;
class ACE_MainActions {
class ACE_CopyMap {
displayName = "$STR_ACE_Map_CopyMap";
condition = QUOTE(([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target}));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart));
showDisabled = 0;
priority = -1;
};
};
};
};

View File

@ -78,13 +78,18 @@ class CfgVehicles {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint));
};
class ACE_Actions : ACE_Actions {
class ACE_Teleport {
displayName = "Teleport to Rallypoint";
distance = 4;
condition = QUOTE(side group _player == west);
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
class ACE_MainActions {
distance = 5;
condition = "true";
selection = "";
class ACE_Teleport {
displayName = "Teleport to Rallypoint";
distance = 4;
condition = QUOTE(side group _player == west);
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
};
};
};
};
@ -98,13 +103,18 @@ class CfgVehicles {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint));
};
class ACE_Actions : ACE_Actions {
class ACE_Teleport {
displayName = "Teleport to Rallypoint";
distance = 4;
condition = QUOTE(side group _player == east);
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
class ACE_MainActions {
distance = 5;
condition = "true";
selection = "";
class ACE_Teleport {
displayName = "Teleport to Rallypoint";
distance = 4;
condition = QUOTE(side group _player == east);
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
};
};
};
};
@ -118,13 +128,18 @@ class CfgVehicles {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint));
};
class ACE_Actions : ACE_Actions {
class ACE_Teleport {
displayName = "Teleport to Rallypoint";
distance = 4;
condition = QUOTE(side group _player == independent);
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
class ACE_MainActions {
distance = 5;
condition = "true";
selection = "";
class ACE_Teleport {
displayName = "Teleport to Rallypoint";
distance = 4;
condition = QUOTE(side group _player == independent);
statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
};
};
};
};
@ -139,13 +154,17 @@ class CfgVehicles {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint));
};
class ACE_Actions : ACE_Actions {
class ACE_Teleport {
displayName = "Teleport to Base";
distance = 4;
condition = QUOTE(side group _player == west);
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
class ACE_MainActions {
distance = 5;
condition = "true";
class ACE_Teleport {
displayName = "Teleport to Base";
distance = 4;
condition = QUOTE(side group _player == west);
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
};
};
};
};
@ -159,13 +178,17 @@ class CfgVehicles {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint));
};
class ACE_Actions : ACE_Actions {
class ACE_Teleport {
displayName = "Teleport to Base";
distance = 4;
condition = QUOTE(side group _player == east);
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
class ACE_MainActions {
distance = 5;
condition = "true";
class ACE_Teleport {
displayName = "Teleport to Base";
distance = 4;
condition = QUOTE(side group _player == east);
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
};
};
};
};
@ -179,13 +202,17 @@ class CfgVehicles {
init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint));
};
class ACE_Actions : ACE_Actions {
class ACE_Teleport {
displayName = "Teleport to Base";
distance = 4;
condition = QUOTE(side group _player == independent);
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
class ACE_MainActions {
distance = 5;
condition = "true";
class ACE_Teleport {
displayName = "Teleport to Base";
distance = 4;
condition = QUOTE(side group _player == independent);
statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint));
showDisabled = 1;
priority = 1;
};
};
};
};

View File

@ -1,29 +1,34 @@
#define MACRO_LOCK_ACTIONS \
class ACE_unlockVehicle { \
displayName = "$STR_ACE_Vehicle_Action_UnLock"; \
distance = 4; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \
statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \
showDisabled = 0; \
priority = 0.3; \
icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
}; \
class ACE_lockVehicle { \
displayName = "$STR_ACE_Vehicle_Action_Lock"; \
distance = 4; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \
statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \
showDisabled = 0; \
priority = 0.2; \
icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
}; \
class ACE_lockpickVehicle { \
displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \
distance = 4; \
condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \
statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \
showDisabled = 0; \
priority = 0.1; \
class ACE_MainActions { \
selection = ""; \
distance = 5; \
condition = "true"; \
class ACE_unlockVehicle { \
displayName = "$STR_ACE_Vehicle_Action_UnLock"; \
distance = 4; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \
statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \
showDisabled = 0; \
priority = 0.3; \
icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
}; \
class ACE_lockVehicle { \
displayName = "$STR_ACE_Vehicle_Action_Lock"; \
distance = 4; \
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \
statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \
showDisabled = 0; \
priority = 0.2; \
icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \
}; \
class ACE_lockpickVehicle { \
displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \
distance = 4; \
condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \
statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \
showDisabled = 0; \
priority = 0.1; \
}; \
};
class CfgVehicles {