Macros for the rest of interaction

This commit is contained in:
Nicolás Badano 2015-01-11 20:13:47 -03:00
parent 8d1bdd88ff
commit 6025fc5c57
47 changed files with 299 additions and 252 deletions

View File

@ -1,12 +1,13 @@
// by commy2 and CAA-Picard // by commy2 and CAA-Picard
#include "script_component.hpp"
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
AGM_Interaction_isOpeningDoor = false; GVAR(isOpeningDoor) = false;
AGM_Dancing = false;
// restore global fire teams for JIP // restore global fire teams for JIP
{ {
_team = _x getVariable ["AGM_assignedFireTeam", ""]; _team = _x getVariable [QGVAR(assignedFireTeam), ""];
if (_team != "") then {_x assignTeam _team}; if (_team != "") then {_x assignTeam _team};
} forEach allUnits; } forEach allUnits;

View File

@ -17,6 +17,9 @@
Example: Example:
*/ */
#include "script_component.hpp"
private ["_container", "_displayName", "_picture", "_data", "_index"]; private ["_container", "_displayName", "_picture", "_data", "_index"];
_container = _this select 0; _container = _this select 0;
@ -25,10 +28,10 @@ _picture = _this select 2;
_data = _this select 3; _data = _this select 3;
if (_picture == "" || _picture == "PictureThing") then { if (_picture == "" || _picture == "PictureThing") then {
_picture = "AGM_Interaction\UI\dot_ca.paa"; _picture = PATHTOF(UI\dot_ca.paa);
}; };
if ((profileNamespace getVariable ["AGM_Interaction_FlowMenu", false])) then { if ((profileNamespace getVariable [QGVAR(FlowMenu), false])) then {
//[_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey] //[_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]
_container pushBack [_displayName, nil, {true},0,[], _picture, "", {true}, [], 4, "", _data]; _container pushBack [_displayName, nil, {true},0,[], _picture, "", {true}, [], 4, "", _data];
}else{ }else{

View File

@ -1,12 +1,12 @@
/* /*
Name: AGM_Interaction_fnc_GetActions Name: AGM_Interaction_fnc_GetActions
Author: Author:
commy2 commy2
Garth de Wet (LH) Garth de Wet (LH)
Description: Description:
Parameters: Parameters:
0: OBJECT - target 0: OBJECT - target
1: ARRAY - Parents of the target object 1: ARRAY - Parents of the target object
@ -16,16 +16,18 @@
5: BOOL - Is mission config file? 5: BOOL - Is mission config file?
6: STRING - Classname ("AGM_Actions"/"AGM_SelfActions") 6: STRING - Classname ("AGM_Actions"/"AGM_SelfActions")
7: STRING - Sub-class 7: STRING - Sub-class
Returns: Returns:
Nothing Nothing
Example: Example:
[player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "AGM_Actions"] call AGM_Interaction_fnc_GetActions; [player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "AGM_Actions"] call AGM_Interaction_fnc_GetActions;
[player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "AGM_SelfActions"] call AGM_Interaction_fnc_GetActions; [player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "AGM_SelfActions"] call AGM_Interaction_fnc_GetActions;
*/ */
#define DEFAULT_ICON "\AGM_Interaction\UI\dot_ca.paa" #include "script_component.hpp"
#define DEFAULT_ICON PATHTOF(UI\dot_ca.paa)
private ["_target", "_parents", "_actions", "_patches", "_baseConfig", "_actionType", "_i","_index", "_missionConfig", "_stdConfig"]; private ["_target", "_parents", "_actions", "_patches", "_baseConfig", "_actionType", "_i","_index", "_missionConfig", "_stdConfig"];
_target = _this select 0; _target = _this select 0;
_parents = _this select 1; _parents = _this select 1;
@ -54,7 +56,7 @@ for "_i" from 0 to (_count - 1) do {
private ["_action", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority", "_tooltip", "_hotkey", private ["_action", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority", "_tooltip", "_hotkey",
"_subMenu", "_conditionShow", "_exceptions", "_icon", "_actionToCache", "_cacheActions", "_cache", "_indexCache", "_configName"]; "_subMenu", "_conditionShow", "_exceptions", "_icon", "_actionToCache", "_cacheActions", "_cache", "_indexCache", "_configName"];
_action = if (_missionConfig) then {_config select _index} else {_stdConfig >> configName (_config select _index)}; _action = if (_missionConfig) then {_config select _index} else {_stdConfig >> configName (_config select _index)};
_cache = missionNamespace getVariable ["AGM_Interaction_MenuCache", [[], [], []]]; _cache = missionNamespace getVariable [QGVAR(MenuCache), [[], [], []]];
if (count _action > 0) then { if (count _action > 0) then {
_configName = configName _action; _configName = configName _action;
@ -77,7 +79,7 @@ for "_i" from 0 to (_count - 1) do {
_condition = getText (_action >> "condition"); _condition = getText (_action >> "condition");
if (_condition == "") then {_condition = "true"}; if (_condition == "") then {_condition = "true"};
_condition = _condition + format [" && {%1 call AGM_Core_canInteract} && {[AGM_player, AGM_Interaction_Target] call AGM_Core_fnc_canInteractWith}", getArray (_action >> "exceptions")]; _condition = _condition + format [QUOTE( && {%1 call EGVAR(core,canInteract)} && {[AGM_player, GVAR(Target)] call EFUNC(core,canInteractWith)} ), getArray (_action >> "exceptions")];
if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"}; if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"};
_condition = compile _condition; _condition = compile _condition;
@ -98,11 +100,11 @@ for "_i" from 0 to (_count - 1) do {
_statement = getText (_action >> "statement"); _statement = getText (_action >> "statement");
_statement = compile _statement; _statement = compile _statement;
if (profileNamespace getVariable ["AGM_Interaction_FlowMenu", false]) then { if (profileNamespace getVariable [QGVAR(FlowMenu), false]) then {
_statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then {
compile format ["call AGM_Interaction_fnc_hideMenu;if(%2 == 1)then{['%1'] call AGM_Interaction_fnc_openSubMenuSelf;}else{['%1'] call AGM_Interaction_fnc_openSubMenu;};", _subMenu select 0, _subMenu select 1]; 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 { } else {
compile ("call AGM_Interaction_fnc_hideMenu;" + getText (_action >> "statement")); compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement"));
}; };
}; };
@ -114,7 +116,7 @@ for "_i" from 0 to (_count - 1) do {
_actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]; _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 AGM_Interaction_fnc_isInRange}}) then { if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call _condition}} && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then {
_actions pushBack _actionToCache; _actions pushBack _actionToCache;
_patches pushBack _configName; _patches pushBack _configName;
}; };
@ -129,9 +131,9 @@ for "_i" from 0 to (_count - 1) do {
_cacheIndices pushBack _indexCache; _cacheIndices pushBack _indexCache;
_cache = [_cacheConfigs, _cacheActions, _cacheIndices]; _cache = [_cacheConfigs, _cacheActions, _cacheIndices];
["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call AGM_Debug_fnc_log; ["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(debug, log);
} else { } else {
["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call AGM_Debug_fnc_log; ["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(debug, log);
_cachedAction = _cacheActions select (_cacheIndices select _indexCache); _cachedAction = _cacheActions select (_cacheIndices select _indexCache);
@ -140,14 +142,14 @@ for "_i" from 0 to (_count - 1) do {
_showDisabled = [_object, _player] call (_cachedAction select 7); _showDisabled = [_object, _player] call (_cachedAction select 7);
}; };
if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call (_cachedAction select 2)}} && {[_object, (_cachedAction select 9)] call AGM_Interaction_fnc_isInRange || {(_cachedAction select 9) == 0}}) then { 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; _actions pushBack _cachedAction;
_patches pushBack _configName; _patches pushBack _configName;
}; };
}; };
}; };
AGM_Interaction_MenuCache = _cache; GVAR(MenuCache) = _cache;
}; };
}; };
}; };

View File

@ -1,40 +1,42 @@
/* /*
Name: AGM_Interaction_fnc_MoveDown Name: AGM_Interaction_fnc_MoveDown
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
Description: Description:
Depending on the passed value, either scrolls down through the list or up. Depending on the passed value, either scrolls down through the list or up.
Parameters: Parameters:
NUMBER - Amount to increase current interaction target NUMBER - Amount to increase current interaction target
Returns: Returns:
Nothing Nothing
Example: Example:
1 call AGM_Interaction_fnc_MoveDown; 1 call AGM_Interaction_fnc_MoveDown;
-1 call AGM_Interaction_fnc_MoveDown; -1 call AGM_Interaction_fnc_MoveDown;
*/ */
#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}}) #include "script_component.hpp"
if (isNil "AGM_Interaction_MainButton") exitWith{};
if (isNil "AGM_Interaction_Buttons") exitWith{};
_count = (count AGM_Interaction_Buttons)- 1;
AGM_Interaction_SelectedButton = CLAMP(AGM_Interaction_SelectedButton + _this, 0, _count);
_target = AGM_Interaction_Target; #define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}})
if (isNil QGVAR(MainButton)) exitWith{};
if (isNil QGVAR(Buttons)) exitWith{};
_count = (count GVAR(Buttons))- 1;
GVAR(SelectedButton) = CLAMP(GVAR(SelectedButton) + _this, 0, _count);
_target = GVAR(Target);
_player = AGM_player; _player = AGM_player;
_vehicle = vehicle _player; _vehicle = vehicle _player;
disableSerialization; disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable "AGM_Flow_Display"; _dlgInteractionDialog = uiNamespace getVariable QGVAR(Flow_Display);
_top = AGM_Interaction_SelectedButton - 2; _top = GVAR(SelectedButton) - 2;
_i = 0; _i = 0;
while {_i <= 4} do { while {_i <= 4} do {
_index =_i + _top; _index =_i + _top;
_ctrl = _dlgInteractionDialog displayCtrl (1200 + _i); _ctrl = _dlgInteractionDialog displayCtrl (1200 + _i);
if (_index >= 0 && {_index <= _count}) then { if (_index >= 0 && {_index <= _count}) then {
_action = AGM_Interaction_Buttons select _index; _action = GVAR(Buttons) select _index;
_ctrl ctrlShow true; _ctrl ctrlShow true;
_ctrl ctrlSetText (_action select 5); _ctrl ctrlSetText (_action select 5);
_color = [1,1,1,1]; _color = [1,1,1,1];
@ -55,9 +57,9 @@ while {_i <= 4} do {
}; };
_ctrl = _dlgInteractionDialog displayCtrl 1000; _ctrl = _dlgInteractionDialog displayCtrl 1000;
_ctrl ctrlSetText ((AGM_Interaction_Buttons select AGM_Interaction_SelectedButton) select 0); _ctrl ctrlSetText ((GVAR(Buttons) select GVAR(SelectedButton)) select 0);
_ctrl = _dlgInteractionDialog displayCtrl 1100; _ctrl = _dlgInteractionDialog displayCtrl 1100;
_current = (AGM_Interaction_Buttons select AGM_Interaction_SelectedButton); _current = (GVAR(Buttons) select GVAR(SelectedButton));
_infoText = ""; _infoText = "";
if !([_target, _player] call (_current select 2)) then { if !([_target, _player] call (_current select 2)) then {
_infoText = "Unavailable"; _infoText = "Unavailable";

View File

@ -2,7 +2,7 @@
* Author: commy2 * Author: commy2
* *
* Add an AGM action to an object. Note: This function is global. * Add an AGM action to an object. Note: This function is global.
* *
* Argument: * Argument:
* 0: Object the action should be assigned to (Object) * 0: Object the action should be assigned to (Object)
* 1: Name of the action shown in the menu (String) * 1: Name of the action shown in the menu (String)
@ -11,11 +11,13 @@
* 4: Statement (Code or String) * 4: Statement (Code or String)
* 5: Show the action even if the conditon is not met (Bool or Number) * 5: Show the action even if the conditon is not met (Bool or Number)
* 6: Priority (Number, optional default: 0) * 6: Priority (Number, optional default: 0)
* *
* Return value: * Return value:
* ID of the action (used to remove it later). * 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"]; private ["_object", "_displayName", "_distance", "_condition", "_statement", "_showDisabled", "_priority", "_actionsVar", "_id", "_actionIDs", "_actions"];
_object = _this select 0; _object = _this select 0;
@ -42,7 +44,7 @@ if (isNil "_priority") then {
_priority = 0; _priority = 0;
}; };
_actionsVar = _object getVariable ["AGM_Interactions", [-1, [], []]]; _actionsVar = _object getVariable [QGVAR(Interactions), [-1, [], []]];
_id = (_actionsVar select 0) + 1; _id = (_actionsVar select 0) + 1;
_actionIDs = _actionsVar select 1; _actionIDs = _actionsVar select 1;
@ -51,5 +53,5 @@ _actions = _actionsVar select 2;
_actionIDs pushBack _id; _actionIDs pushBack _id;
_actions pushBack [_displayName, _distance, _condition, _statement, _showDisabled, _priority]; _actions pushBack [_displayName, _distance, _condition, _statement, _showDisabled, _priority];
_object setVariable ["AGM_Interactions", [_id, _actionIDs, _actions], true]; _object setVariable [QGVAR(Interactions), [_id, _actionIDs, _actions], true];
_id _id

View File

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

View File

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

View File

@ -1,17 +1,19 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_object", "_actions", "_dlgInteractionDialog", "_ctrlInteractionDialog", "_index", "_ctrlInteractionDialogIcon"]; private ["_object", "_actions", "_dlgInteractionDialog", "_ctrlInteractionDialog", "_index", "_ctrlInteractionDialogIcon"];
_object = AGM_Interaction_Target; _object = GVAR(Target);
_actions = AGM_Interaction_Buttons; _actions = GVAR(Buttons);
disableSerialization; disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable "AGM_Interaction_Dialog"; _dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog);
/* /*
for "_a" from 0 to (_count - 1) do { for "_a" from 0 to (_count - 1) do {
_action = AGM_Interaction_Buttons select _a; _action = GVAR(Buttons) select _a;
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _a); _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _a);
_ctrlInteractionDialog ctrlShow true; _ctrlInteractionDialog ctrlShow true;
@ -22,7 +24,7 @@ for "_a" from 0 to (_count - 1) do {
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3; _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3;
AGM_Interaction_MainButton = "(findDisplay 1713999) closeDisplay 1;"; GVAR(MainButton) = "(findDisplay 1713999) closeDisplay 1;";
if (_object isKindOf "Man") then { if (_object isKindOf "Man") then {
_ctrlInteractionDialog ctrlSetText (if (alive _object) then {name _object} else {_object getVariable ["AGM_Name", "Unknown"]}); _ctrlInteractionDialog ctrlSetText (if (alive _object) then {name _object} else {_object getVariable ["AGM_Name", "Unknown"]});
@ -37,7 +39,7 @@ for "_index" from 0 to 9 do {
_ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _index); _ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _index);
if (_index < _count) then { if (_index < _count) then {
_action = AGM_Interaction_Buttons select _index; _action = GVAR(Buttons) select _index;
_ctrlInteractionDialog ctrlSetText (_action select 0); _ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable (call (_action select 2)); _ctrlInteractionDialog ctrlEnable (call (_action select 2));

View File

@ -1,5 +1,7 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_unit", "_isCivilian"]; private ["_unit", "_isCivilian"];
_unit = _this select 0; _unit = _this select 0;

View File

@ -1,5 +1,7 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_unit", "_target"]; private ["_unit", "_target"];
_unit = _this select 0; _unit = _this select 0;

View File

@ -1,4 +1,5 @@
// commy2 // commy2
#include "script_component.hpp"
private ["_object", "_config", "_type", "_actions", "_configs"]; private ["_object", "_config", "_type", "_actions", "_configs"];
@ -12,7 +13,7 @@ _configs = "_object isKindOf configName _x" configClasses (_config >> _type);
// cache // cache
private ["_cache", "_cacheConfigs", "_cacheActions", "_cacheIndices"]; private ["_cache", "_cacheConfigs", "_cacheActions", "_cacheIndices"];
_cache = uiNamespace getVariable ["AGM_Interaction_MenuCache", [[], [], []]]; _cache = uiNamespace getVariable [QGVAR(MenuCache), [[], [], []]];
_cacheConfigs = _cache select 0; _cacheConfigs = _cache select 0;
_cacheActions = _cache select 1; _cacheActions = _cache select 1;
_cacheIndices = _cache select 2; _cacheIndices = _cache select 2;
@ -44,7 +45,7 @@ _cacheIndices = _cache select 2;
_condition = getText (_action >> "condition"); _condition = getText (_action >> "condition");
if (_condition == "") then {_condition = "true"}; if (_condition == "") then {_condition = "true"};
_condition = _condition + format [" && {%1 call AGM_Core_canInteract} && {[AGM_player, AGM_Interaction_Target] call AGM_Core_fnc_canInteractWith}", getArray (_action >> "exceptions")]; _condition = _condition + format [QUOTE( && {%1 call EFUNC(core,canInteract)} && {[AGM_player, GVAR(Target)] call FUNC(canInteractWith)} ), getArray (_action >> "exceptions")];
if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"}; if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"};
_condition = compile _condition; _condition = compile _condition;
@ -67,9 +68,9 @@ _cacheIndices = _cache select 2;
if (profileNamespace getVariable ["AGM_Interaction_FlowMenu", false]) then { if (profileNamespace getVariable ["AGM_Interaction_FlowMenu", false]) then {
_statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then {
compile format ["call AGM_Interaction_fnc_hideMenu;if(%2 == 1)then{['%1'] call AGM_Interaction_fnc_openSubMenuSelf;}else{['%1'] call AGM_Interaction_fnc_openSubMenu;};", _subMenu select 0, _subMenu select 1]; 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 { } else {
compile ("call AGM_Interaction_fnc_hideMenu;" + getText (_action >> "statement")); compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement"));
}; };
}; };
@ -82,7 +83,7 @@ _cacheIndices = _cache select 2;
private "_actionToCache"; private "_actionToCache";
_actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]; _actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey];
if ((_showDisabled || {[_object, _player] call _condition}) && {_distance == 0 || {[_object, _distance] call AGM_Interaction_fnc_isInRange}}) then { if ((_showDisabled || {[_object, _player] call _condition}) && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then {
_actions pushBack _actionToCache; _actions pushBack _actionToCache;
}; };
@ -96,9 +97,9 @@ _cacheIndices = _cache select 2;
_cacheIndices pushBack _indexCache; _cacheIndices pushBack _indexCache;
_cache = [_cacheConfigs, _cacheActions, _cacheIndices]; _cache = [_cacheConfigs, _cacheActions, _cacheIndices];
["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call AGM_Debug_fnc_log; ["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(debug, log);
} else { } else {
["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call AGM_Debug_fnc_log; ["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(debug, log);
private ["_cachedAction", "_showDisabled"]; private ["_cachedAction", "_showDisabled"];
_cachedAction = _cacheActions select (_cacheIndices select _indexCache); _cachedAction = _cacheActions select (_cacheIndices select _indexCache);
@ -108,13 +109,13 @@ _cacheIndices = _cache select 2;
_showDisabled = [_object, _player] call (_cachedAction select 7); _showDisabled = [_object, _player] call (_cachedAction select 7);
}; };
if ((_showDisabled || {[_object, _player] call (_cachedAction select 2)}) && {[_object, (_cachedAction select 9)] call AGM_Interaction_fnc_isInRange || {(_cachedAction select 9) == 0}}) then { if ((_showDisabled || {[_object, _player] call (_cachedAction select 2)}) && {[_object, (_cachedAction select 9)] call FUNC(isInRange) || {(_cachedAction select 9) == 0}}) then {
_actions pushBack _cachedAction; _actions pushBack _cachedAction;
}; };
}; };
} forEach _configActions; //Actions of this CfgVehicles class } forEach _configActions; //Actions of this CfgVehicles class
} forEach _configs; //CfgVehicles class } forEach _configs; //CfgVehicles class
uiNamespace setVariable ["AGM_Interaction_MenuCache", _cache]; uiNamespace setVariable [QGVAR(MenuCache), _cache];
_actions _actions

View File

@ -1,3 +1,4 @@
// by commy2 // by commy2
#include "script_component.hpp"
_this call AGM_Core_fnc_getCaptivityStatus; _this call EFUNC(core,getCaptivityStatus);

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_distance", "_position0", "_position1", "_intersections", "_count", "_house", "_door", "_index", "_id"]; private ["_distance", "_position0", "_position1", "_intersections", "_count", "_house", "_door", "_index", "_id"];

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_house", "_door", "_animations", "_lockedVariable"]; private ["_house", "_door", "_animations", "_lockedVariable"];

View File

@ -1,14 +1,15 @@
/* /*
* Author: KoffeinFlummi * Author: KoffeinFlummi
* *
* Forces a civilian to the ground. (chance of failure). * Forces a civilian to the ground. (chance of failure).
* *
* Arguments: * Arguments:
* 0: Unit to be sent away (Object) * 0: Unit to be sent away (Object)
* *
* Return value: * Return value:
* none * none
*/ */
#include "script_component.hpp"
#define RADIUS 10 #define RADIUS 10

View File

@ -1,10 +1,11 @@
// by commy2 // by commy2
#include "script_component.hpp"
#define MIN_DISTANCE 0.0065 #define MIN_DISTANCE 0.0065
private ["_position", "_distance", "_angle"]; private ["_position", "_distance", "_angle"];
_position = uiNamespace getVariable ['AGM_Interaction_CursorPosition', [0.5, 0.5, 0]]; _position = uiNamespace getVariable [QGVAR(CursorPosition), [0.5, 0.5, 0]];
_position = [((_position select 1) - 0.5) / safezoneH, ((_position select 2) - 0.5) / safezoneW, 0]; _position = [((_position select 1) - 0.5) / safezoneH, ((_position select 2) - 0.5) / safezoneW, 0];

View File

@ -1,22 +1,24 @@
/* /*
Name: AGM_Interaction_fnc_hideMenu Name: AGM_Interaction_fnc_hideMenu
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
Description: Description:
Closes the Interaction menu Closes the Interaction menu
Parameters: Parameters:
Nothing Nothing
Returns: Returns:
Nothing Nothing
Example: Example:
call AGM_Interaction_fnc_hideMenu; call AGM_Interaction_fnc_hideMenu;
*/ */
#include "script_component.hpp"
closeDialog 0; closeDialog 0;
(findDisplay 1713999) closeDisplay 1; (findDisplay 1713999) closeDisplay 1;
(uiNameSpace getVariable "AGM_Flow_Display") closeDisplay 0; (uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0;
AGM_Interaction_MainButton = nil; GVAR(MainButton) = nil;
call AGM_Interaction_fnc_hideMouseHint; call FUNC(hideMouseHint);

View File

@ -1,21 +1,23 @@
/* /*
Name: AGM_Interaction_fnc_hideMouseHint Name: AGM_Interaction_fnc_hideMouseHint
Author(s): Author(s):
Garth de Wet (LH) Garth de Wet (LH)
Description: Description:
Hides the interaction helper text with the mouse buttons at the bottom middle of the screen Hides the interaction helper text with the mouse buttons at the bottom middle of the screen
Parameters: Parameters:
Nothing Nothing
Returns: Returns:
Nothing Nothing
Example: Example:
call AGM_Interaction_fnc_hideMouseHint; call AGM_Interaction_fnc_hideMouseHint;
*/ */
#include "script_component.hpp"
if (isNull (uiNamespace getVariable ["AGM_Helper_Display", objNull])) exitWith{}; if (isNull (uiNamespace getVariable ["AGM_Helper_Display", objNull])) exitWith{};
("AGM_InteractionHelper" call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; ("AGM_InteractionHelper" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];

View File

@ -19,62 +19,64 @@
Nothing Nothing
Example: Example:
[{"Default" call AGM_Interaction_fnc_openMenu;}, true, (profileNamespace getVariable ["AGM_Interaction_FlowMenu", false]), AGM_Interaction_Target] call AGM_Interaction_fnc_initialiseInteraction; [{"Default" call AGM_Interaction_fnc_openMenu;}, true, (profileNamespace getVariable [QGVAR(FlowMenu), false]), GVAR(Target)] call AGM_Interaction_fnc_initialiseInteraction;
*/ */
#include "script_component.hpp"
private ["_subMenu", "_selfMenu", "_target"]; private ["_subMenu", "_selfMenu", "_target"];
AGM_Interaction_MainButton = _this select 0; GVAR(MainButton) = _this select 0;
_subMenu = _this select 1; _subMenu = _this select 1;
_selfMenu = _this select 3; _selfMenu = _this select 3;
_target = _this select 4; _target = _this select 4;
_player = AGM_player; _player = AGM_player;
_vehicle = vehicle _player; _vehicle = vehicle _player;
//_object = [AGM_Interaction_Target, _player] select (AGM_Interaction_MenuType % 2 == 1); //_object = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
if !([_target, 5] call AGM_Interaction_fnc_isInRange) exitWith {}; if !([_target, 5] call GVAR(isInRange)) exitWith {};
AGM_Interaction_Shortcuts = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; GVAR(Shortcuts) = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
// Flow menu // Flow menu
if (_this select 2) then { if (_this select 2) then {
("AGM_FlowMenu" call BIS_fnc_rscLayer) cutRsc ["AGM_FlowMenu", "PLAIN",0.5, false]; (QGVAR(FlowMenu) call BIS_fnc_rscLayer) cutRsc [QGVAR(FlowMenu), "PLAIN",0.5, false];
AGM_Interaction_SelectedButton = 0; AGM_Interaction_SelectedButton = 0;
(findDisplay 1713999) closeDisplay 1; (findDisplay 1713999) closeDisplay 1;
if (_player getVariable ["AGM_AcceptAction", -1] == -1) then { if (_player getVariable ["AGM_AcceptAction", -1] == -1) then {
[{if(isNil {AGM_Interaction_MainButton} || {!(profileNamespace getVariable ['AGM_Interaction_FlowMenu', false])})exitWith{false};(-(_this select 0) / 1.2) call AGM_Interaction_fnc_MoveDown;true}] call AGM_Core_fnc_addScrollWheelEventHandler; [{if(isNil {GVAR(MainButton)} || {!(profileNamespace getVariable [QGVAR(FlowMenu), false])})exitWith{false};(-(_this select 0) / 1.2) call FUNC(MoveDown);true}] call EFUNC(core,addScrollWheelEventHandler);
_player setVariable ["AGM_AcceptAction", [_player, "DefaultAction", {(!isNil {AGM_Interaction_MainButton}) && {(profileNamespace getVariable ['AGM_Interaction_FlowMenu', false])}}, {_action = AGM_Interaction_Buttons select AGM_Interaction_SelectedButton;_target = AGM_Interaction_Target;_player = AGM_player;_vehicle = vehicle _player;if ([_target, _player] call (_action select 2)) then {call AGM_Interaction_fnc_hideMenu;if(count _action == 12) then{(_action select 11) call (_action select 1);}else{[_target, _player] call (_action select 1);};};}] call AGM_core_fnc_addActionEventHandler]; _player setVariable ["AGM_AcceptAction", [_player, "DefaultAction", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {_action = GVAR(Buttons) select AGM_Interaction_SelectedButton;_target = GVAR(Target);_player = AGM_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(core,addActionEventHandler)];
_player setVariable ["AGM_AcceptAction", [_player, "menuBack", {(!isNil {AGM_Interaction_MainButton}) && {(profileNamespace getVariable ['AGM_Interaction_FlowMenu', false])}}, {call AGM_Interaction_MainButton;}] call AGM_core_fnc_addActionEventHandler]; _player setVariable ["AGM_AcceptAction", [_player, "menuBack", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {call GVAR(MainButton);}] call EFUNC(core,addActionEventHandler)];
}; };
0 call AGM_Interaction_fnc_moveDown; 0 call FUNC(moveDown);
[localize "STR_AGM_Interaction_MakeSelection", if (_subMenu)then{localize "STR_AGM_Interaction_Back"}else{""}, localize "STR_AGM_Interaction_ScrollHint"] call AGM_Interaction_fnc_showMouseHint; [localize "STR_AGM_Interaction_MakeSelection", if (_subMenu)then{localize "STR_AGM_Interaction_Back"}else{""}, localize "STR_AGM_Interaction_ScrollHint"] call FUNC(showMouseHint);
((uiNamespace getVariable "AGM_Flow_Display") displayCtrl (1210)) ctrlShow _subMenu; ((uiNamespace getVariable QGVAR(Flow_Display)) displayCtrl (1210)) ctrlShow _subMenu;
}else{ // Rose }else{ // Rose
if (!isNull(uiNamespace getVariable "AGM_Flow_Display")) then { if (!isNull(uiNamespace getVariable QGVAR(Flow_Display))) then {
(uiNameSpace getVariable "AGM_Flow_Display") closeDisplay 0; (uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0;
call AGM_Interaction_fnc_hideMouseHint; call FUNC(hideMouseHint);
}; };
if (!_subMenu || {isNull (findDisplay 1713999)}) then { if (!_subMenu || {isNull (findDisplay 1713999)}) then {
(findDisplay 1713999) closeDisplay 1; (findDisplay 1713999) closeDisplay 1;
(findDisplay 46) createDisplay "AGM_Interaction_Dialog"; (findDisplay 46) createDisplay QGVAR(Dialog);
// Add eventhandlers // Add eventhandlers
(findDisplay 1713999) displayAddEventHandler ["KeyDown", "_this call AGM_Core_onKeyDown"]; (findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE( _this call EFUNC(core,onKeyDown) )];
(findDisplay 1713999) displayAddEventHandler ["KeyUp", "_this call AGM_Core_onKeyUp"]; (findDisplay 1713999) displayAddEventHandler ["KeyUp", QUOTE( _this call EFUNC(core,onKeyUp) )];
(findDisplay 1713999) displayAddEventHandler ["KeyDown", "_this call AGM_Interaction_fnc_menuKeyInput"]; (findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE( _this call FUNC(menuKeyInput) )];
}; };
disableSerialization; disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable "AGM_Interaction_Dialog"; _dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog);
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3; _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3;
if (profileNamespace getVariable ["AGM_Interaction_AutoCenterCursor", true]) then {setMousePosition [0.5, 0.5]}; if (profileNamespace getVariable [QGVAR(AutoCenterCursor), true]) then {setMousePosition [0.5, 0.5]};
if !(_subMenu) then { if !(_subMenu) then {
_ctrlInteractionDialog ctrlSetText ([_target] call AGM_Core_fnc_getName); _ctrlInteractionDialog ctrlSetText ([_target] call EFUNC(core,getName));
} else { } else {
_ctrlInteractionDialog ctrlSetText localize "STR_AGM_Interaction_Back"; _ctrlInteractionDialog ctrlSetText localize "STR_AGM_Interaction_Back";
}; };
_buttons = AGM_Interaction_Buttons; _buttons = GVAR(Buttons);
_count = count _buttons; _count = count _buttons;
for "_i" from 0 to 9 do { for "_i" from 0 to 9 do {
@ -94,7 +96,7 @@ if (_this select 2) then {
_ctrlInteractionDialogShortcut ctrlSetText (_action select 10); _ctrlInteractionDialogShortcut ctrlSetText (_action select 10);
//_ctrlInteractionDialogBackground ctrlShow true; //_ctrlInteractionDialogBackground ctrlShow true;
AGM_Interaction_Shortcuts set [_i, [_action select 10] call AGM_Core_fnc_letterToCode]; GVAR(Shortcuts) set [_i, [_action select 10] call EFUNC(core,letterToCode)];
} else { } else {
_ctrlInteractionDialog ctrlSetText ""; _ctrlInteractionDialog ctrlSetText "";
_ctrlInteractionDialog ctrlEnable false; _ctrlInteractionDialog ctrlEnable false;
@ -107,23 +109,23 @@ if (_this select 2) then {
}; };
// Update Buttons // Update Buttons
terminate (missionNamespace getVariable ["AGM_Interaction_updateMenuHandle", scriptNull]); terminate (missionNamespace getVariable [QGVAR(updateMenuHandle), scriptNull]);
AGM_Interaction_updateMenuHandle = 0 spawn { GVAR(updateMenuHandle) = 0 spawn {
disableSerialization; disableSerialization;
_dlgMenu = uiNamespace getVariable ["AGM_Interaction_Dialog", displayNull]; _dlgMenu = uiNamespace getVariable [QGVAR(Dialog), displayNull];
_ctrlTooltip = _dlgMenu displayCtrl 40; _ctrlTooltip = _dlgMenu displayCtrl 40;
_player = AGM_player; _player = AGM_player;
_vehicle = vehicle _player; _vehicle = vehicle _player;
_target = [AGM_Interaction_Target, _player] select (AGM_Interaction_MenuType % 2 == 1); _target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
waitUntil { waitUntil {
if !([_target, 5] call AGM_Interaction_fnc_isInRange) exitWith { if !([_target, 5] call GVAR(isInRange)) exitWith {
(findDisplay 1713999) closeDisplay 1 (findDisplay 1713999) closeDisplay 1
}; };
AGM_Interaction_Tooltips = [[], [], [], [], [], [], [], [], [], []]; GVAR(Tooltips) = [[], [], [], [], [], [], [], [], [], []];
{ {
_ctrlText = _dlgMenu displayCtrl (10 + _forEachIndex); _ctrlText = _dlgMenu displayCtrl (10 + _forEachIndex);
_ctrlIcon = _dlgMenu displayCtrl (20 + _forEachIndex); _ctrlIcon = _dlgMenu displayCtrl (20 + _forEachIndex);
@ -132,12 +134,12 @@ if (_this select 2) then {
_conditionShow = _x select 7; _conditionShow = _x select 7;
_distance = _x select 9; _distance = _x select 9;
AGM_Interaction_CurrentTooltip = []; GVAR(CurrentTooltip) = [];
_enable = (_distance == 0 || {[_target, _distance] call AGM_Interaction_fnc_isInRange}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}; _enable = (_distance == 0 || {[_target, _distance] call GVAR(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow};
if (isNil "_enable") then {_enable = false}; if (isNil "_enable") then {_enable = false};
AGM_Interaction_Tooltips set [_forEachIndex, AGM_Interaction_CurrentTooltip]; GVAR(Tooltips) set [_forEachIndex, GVAR(CurrentTooltip)];
// apply conditional tooltips // apply conditional tooltips
/*if (_forEachIndex == call AGM_Interaction_fnc_getSelectedButton) then { /*if (_forEachIndex == call AGM_Interaction_fnc_getSelectedButton) then {
@ -150,7 +152,7 @@ if (_this select 2) then {
{ {
_showTooltip = true; _showTooltip = true;
_tooltip = composeText [_tooltip, lineBreak, _x]; _tooltip = composeText [_tooltip, lineBreak, _x];
} forEach (AGM_Interaction_Tooltips select _forEachIndex); } forEach (GVAR(Tooltips) select _forEachIndex);
_ctrlTooltip ctrlSetStructuredText _tooltip; _ctrlTooltip ctrlSetStructuredText _tooltip;
_ctrlTooltip ctrlShow _showTooltip; _ctrlTooltip ctrlShow _showTooltip;
@ -158,7 +160,7 @@ if (_this select 2) then {
_ctrlText ctrlEnable _enable; _ctrlText ctrlEnable _enable;
_ctrlIcon ctrlEnable _enable; _ctrlIcon ctrlEnable _enable;
} forEach AGM_Interaction_Buttons; } forEach GVAR(Buttons);
sleep 0.5; sleep 0.5;
isNull (findDisplay 1713999) isNull (findDisplay 1713999)

View File

@ -2,14 +2,15 @@
* Author: commy2 * Author: commy2
* *
* Check if the vehicle is in range of the player. * Check if the vehicle is in range of the player.
* *
* Argument: * Argument:
* 0: Vehicke (Object) * 0: Vehicke (Object)
* 1: Distance in meters (Number) * 1: Distance in meters (Number)
* *
* Return value: * Return value:
* (Bool) * (Bool)
*/ */
#include "script_component.hpp"
private ["_vehicle", "_distance", "_player"]; private ["_vehicle", "_distance", "_player"];
@ -44,6 +45,6 @@ _position1 set [2, (_position1 select 2) - (getTerrainHeightASL _position1 min 0
if (_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance}) then { if (_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance}) then {
true true
} else { } else {
["Not in Range"] call AGM_Interaction_fnc_addToTooltip; ["Not in Range"] call FUNC(addToTooltip);
false false
} }

View File

@ -1,12 +1,13 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_unit", "_team", "_message"]; private ["_unit", "_team", "_message"];
_unit = _this select 0; _unit = _this select 0;
_team = _this select 1; _team = _this select 1;
_unit setVariable ["AGM_assignedFireTeam", _team, true]; _unit setVariable [QGVAR(assignedFireTeam), _team, true];
[_unit, format ["{_this assignTeam '%1'}", _team]] call AGM_Core_fnc_execRemoteFnc; [_unit, format ["{_this assignTeam '%1'}", _team]] call EFUNC(core,execRemoteFnc);
if (_unit == AGM_player) then { if (_unit == AGM_player) then {
_message = if (_team == "MAIN") then { _message = if (_team == "MAIN") then {
@ -16,5 +17,5 @@ if (_unit == AGM_player) then {
format [localize "STR_AGM_Interaction_JoinedTeam", _team]; format [localize "STR_AGM_Interaction_JoinedTeam", _team];
}; };
[_message] call AGM_Core_fnc_displayTextStructured; [_message] call EFUNC(core,displayTextStructured);
}; };

View File

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

View File

@ -9,12 +9,13 @@
* Return Value: * Return Value:
* None * None
*/ */
#include "script_component.hpp"
_logic = _this select 0; _logic = _this select 0;
_activated = _this select 2; _activated = _this select 2;
if !(_activated) exitWith {}; if !(_activated) exitWith {};
[_logic, "AGM_Interaction_EnableTeamManagement", "EnableTeamManagement"] call AGM_Core_fnc_readBooleanParameterFromModule; [_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(core,readBooleanParameterFromModule);
diag_log text "[AGM]: Interaction Module Initialized."; diag_log text "[AGM]: Interaction Module Initialized.";

View File

@ -1,14 +1,15 @@
// by commy2 // by commy2
#include "script_component.hpp"
if (dialog) exitWith { if (dialog) exitWith {
closeDialog 0; closeDialog 0;
}; };
if (isNull (findDisplay 1713999)) then { if (isNull (findDisplay 1713999)) then {
if (AGM_player == vehicle AGM_player) then {"" call AGM_Interaction_fnc_openMenu} else {[AGM_player, vehicle AGM_player] call AGM_Interaction_fnc_openMenuSelectUI}; if (AGM_player == vehicle AGM_player) then {"" call FUNC(openMenu)} else {[AGM_player, vehicle AGM_player] call FUNC(openMenuSelectUI)};
setMousePosition [0.5, 0.5]; setMousePosition [0.5, 0.5];
} else { } else {
(findDisplay 1713999) closeDisplay 1; (findDisplay 1713999) closeDisplay 1;
}; };
[_player, "interactionMenuOpened", [_player, AGM_Interaction_Target, 0]] call AGM_Core_fnc_callCustomEventHandlers; [_player, "interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(core,callCustomEventHandlers);

View File

@ -1,14 +1,15 @@
// by commy2 // by commy2
#include "script_component.hpp"
if (dialog) exitWith { if (dialog) exitWith {
closeDialog 0; closeDialog 0;
}; };
if (isNull (findDisplay 1713999)) then { if (isNull (findDisplay 1713999)) then {
"" call AGM_Interaction_fnc_openMenuSelf; "" call FUNC(openMenuSelf);
setMousePosition [0.5, 0.5]; setMousePosition [0.5, 0.5];
} else { } else {
(findDisplay 1713999) closeDisplay 1; (findDisplay 1713999) closeDisplay 1;
}; };
[_player, "interactionMenuOpened", [_player, AGM_Interaction_Target, 1]] call AGM_Core_fnc_callCustomEventHandlers; [_player, "interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(core,callCustomEventHandlers);

View File

@ -1,16 +1,17 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_statement", "_condition", "_conditionShow", "_exceptions", "_distance"]; private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_statement", "_condition", "_conditionShow", "_exceptions", "_distance"];
_player = AGM_player; _player = AGM_player;
_vehicle = vehicle _player; _vehicle = vehicle _player;
_target = [AGM_Interaction_Target, _player] select (AGM_Interaction_MenuType % 2 == 1); _target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
_count = count AGM_Interaction_Buttons; _count = count GVAR(Buttons);
_index = call AGM_Interaction_fnc_getSelectedButton; _index = call FUNC(getSelectedButton);
_action = if (_index != -1 && {_index < _count}) then { _action = if (_index != -1 && {_index < _count}) then {
AGM_Interaction_Buttons select _index GVAR(Buttons) select _index
} else { } else {
["", {}, {false}, 0, [], "", "", {false}, [], 0] ["", {}, {false}, 0, [], "", "", {false}, [], 0]
}; };
@ -20,25 +21,12 @@ closeDialog 0;
_statement = _action select 1; _statement = _action select 1;
_condition = _action select 2; _condition = _action select 2;
_conditionShow = _action select 7; _conditionShow = _action select 7;
_exceptions = _action select 8;// _exceptions = _action select 8;//
_distance = _action select 9; _distance = _action select 9;
if ((_distance == 0 || {[AGM_Interaction_Target, _distance] call AGM_Interaction_fnc_isInRange}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then { if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {
[_target, _player] call _statement; [_target, _player] call _statement;
}; };

View File

@ -1,16 +1,16 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_subMenu", "_statement", "_condition", "_conditionShow", "_exceptions", "_distance"]; private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_subMenu", "_statement", "_condition", "_conditionShow", "_exceptions", "_distance"];
_player = AGM_player; _player = AGM_player;
_vehicle = vehicle _player; _vehicle = vehicle _player;
_target = [AGM_Interaction_Target, _player] select (AGM_Interaction_MenuType % 2 == 1); _target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
_count = count AGM_Interaction_Buttons; _count = count GVAR(Buttons);
_index = _this; //call AGM_Interaction_fnc_getSelectedButton; _index = _this;
_action = if (_index != -1 && {_index < _count}) then { _action = if (_index != -1 && {_index < _count}) then {
AGM_Interaction_Buttons select _index GVAR(Buttons) select _index
} else { } else {
["", {}, {false}, 0, [], "", "", {false}, [], 0] ["", {}, {false}, 0, [], "", "", {false}, [], 0]
}; };
@ -19,7 +19,7 @@ _subMenu = _action select 4;
// back // back
if (_index == -1) exitWith { if (_index == -1) exitWith {
call AGM_Interaction_MainButton; call FUNC(MainButton);
}; };
if (count _subMenu < 2) then { if (count _subMenu < 2) then {
@ -32,13 +32,13 @@ if (count _subMenu < 2) then {
_exceptions = _action select 8;// _exceptions = _action select 8;//
_distance = _action select 9; _distance = _action select 9;
if ((_distance == 0 || {[AGM_Interaction_Target, _distance] call AGM_Interaction_fnc_isInRange}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then { if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {
[_target, _player] call _statement; [_target, _player] call _statement;
}; };
} else { } else {
if (_subMenu select 1 < 1) then { if (_subMenu select 1 < 1) then {
[_subMenu select 0] call AGM_Interaction_fnc_openSubMenu; [_subMenu select 0] call FUNC(openSubMenu);
} else { } else {
[_subMenu select 0] call AGM_Interaction_fnc_openSubMenuSelf; [_subMenu select 0] call FUNC(openSubMenuSelf);
}; };
}; };

View File

@ -1,3 +1,4 @@
// by CorruptedHeart, commy2 // by CorruptedHeart, commy2
#include "script_component.hpp"
call compile (lbData [8866, lbCurSel 8866]) call AGM_Interaction_SelectAccept; call compile (lbData [8866, lbCurSel 8866]) call GVAR(SelectAccept);

View File

@ -1,15 +1,16 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_info", "_house", "_door", "_animations", "_lockedVariable"]; private ["_info", "_house", "_door", "_animations", "_lockedVariable"];
_info = [2] call AGM_Interaction_fnc_getDoor; _info = [2] call FUNC(getDoor);
_house = _info select 0; _house = _info select 0;
_door = _info select 1; _door = _info select 1;
if (isNull _house) exitWith {}; if (isNull _house) exitWith {};
_animations = [_house, _door] call AGM_Interaction_fnc_getDoorAnimations; _animations = [_house, _door] call FUNC(getDoorAnimations);
_lockedVariable = _animations select 1; _lockedVariable = _animations select 1;
_animations = _animations select 0; _animations = _animations select 0;
@ -21,7 +22,7 @@ if (_house animationPhase (_animations select 0) <= 0 && {_house getVariable [_l
_lockedVariable spawn compile preprocessFileLineNumbers "\A3\Structures_F\scripts\LockedDoor_open.sqf"; _lockedVariable spawn compile preprocessFileLineNumbers "\A3\Structures_F\scripts\LockedDoor_open.sqf";
}; };
AGM_Interaction_isOpeningDoor = true; GVAR(isOpeningDoor) = true;
playSound "AGM_Sound_Click"; playSound "AGM_Sound_Click";
[_house, _animations] spawn { [_house, _animations] spawn {
@ -43,7 +44,7 @@ playSound "AGM_Sound_Click";
{_house animate [_x, _phase]} forEach _animations; {_house animate [_x, _phase]} forEach _animations;
!AGM_Interaction_isOpeningDoor || {getPosASL AGM_player distance _position > 1} !GVAR(isOpeningDoor) || {getPosASL AGM_player distance _position > 1}
}; };
if (!_usedMouseWheel && {time < _time}) then { if (!_usedMouseWheel && {time < _time}) then {
@ -52,5 +53,5 @@ playSound "AGM_Sound_Click";
{_house animate [_x, _phase]} forEach _animations; {_house animate [_x, _phase]} forEach _animations;
}; };
AGM_Interaction_isOpeningDoor = false; GVAR(isOpeningDoor) = false;
}; };

View File

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

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_unit", "_vehicle", "_cargo"]; private ["_unit", "_vehicle", "_cargo"];
@ -6,26 +7,26 @@ _unit = _this select 0;
_vehicle = _this select 1; _vehicle = _this select 1;
// allow interaction with all cargo slots and all ffv slots // allow interaction with all cargo slots and all ffv slots
_cargo = [_vehicle, ["cargo", "ffv"], true] call AGM_Core_fnc_getVehicleCrew; _cargo = [_vehicle, ["cargo", "ffv"], true] call EFUNC(core,getVehicleCrew);
// you can only interact if you are in cargo or ffv yourself. exit otherwise // you can only interact if you are in cargo or ffv yourself. exit otherwise
if !(_unit in _cargo) exitWith {}; if !(_unit in _cargo) exitWith {};
AGM_InteractionMenu_Crew = _cargo; GVAR(InteractionMenu_Crew) = _cargo;
// prepare: add header and "OK" button to select menu // prepare: add header and "OK" button to select menu
private "_actions"; private "_actions";
_actions = [localize "STR_AGM_Interaction_InteractionMenu", localize "STR_AGM_Interaction_Interact"] call AGM_Interaction_fnc_prepareSelectMenu; _actions = [localize "STR_AGM_Interaction_InteractionMenu", localize "STR_AGM_Interaction_Interact"] call FUNC(prepareSelectMenu);
// prepare: add all cargo units as options to select menu // prepare: add all cargo units as options to select menu
{ {
if (_x != _unit) then { if (_x != _unit) then {
_actions = [ _actions = [
_actions, _actions,
[_x] call AGM_Core_fnc_getName, [_x] call EFUNC(core,getName),
"\AGM_Interaction\UI\dot_ca.paa", PATHOD(UI\dot_ca.paa),
_forEachIndex _forEachIndex
] call AGM_Interaction_fnc_AddSelectableItem; ] call FUNC(AddSelectableItem);
}; };
} forEach _cargo; } forEach _cargo;
@ -33,11 +34,11 @@ _actions = [localize "STR_AGM_Interaction_InteractionMenu", localize "STR_AGM_In
[ [
_actions, _actions,
{ {
call AGM_Interaction_fnc_hideMenu; call FUNC(hideMenu);
[0, AGM_InteractionMenu_Crew select _this, ""] spawn AGM_Interaction_fnc_showMenu; [0, GVAR(InteractionMenu_Crew) select _this, ""] spawn FUNC(showMenu);
AGM_InteractionMenu_Crew = nil; GVAR(InteractionMenu_Crew) = nil;
}, },
{ {
call AGM_Interaction_fnc_hideMenu; call FUNC(hideMenu);
} }
] call AGM_Interaction_fnc_openSelectMenu; ] call FUNC(openSelectMenu);

View File

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

View File

@ -23,21 +23,23 @@
Example: Example:
*/ */
if (!(profileNamespace getVariable ["AGM_Interaction_FlowMenu", false])) then { #include "script_component.hpp"
AGM_Interaction_SelectAccept = _this select 1;
AGM_Interaction_SelectCancel = _this select 2; if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) then {
buttonSetAction [8855, "call AGM_Interaction_SelectCancel;"]; // cancel GVAR(SelectAccept) = _this select 1;
buttonSetAction [8860, "(call compile (lbData [8866, lbCurSel 8866])) call AGM_Interaction_SelectAccept;"]; // accept GVAR(SelectCancel) = _this select 2;
buttonSetAction [8855, QUOTE( call GVAR(SelectCancel); )]; // cancel
buttonSetAction [8860, QUOTE( (call compile (lbData [8866, lbCurSel 8866])) call GVAR(SelectAccept); )]; // accept
lbSetCurSel [8866, 0]; lbSetCurSel [8866, 0];
}else{ }else{
_customActions = _this select 0; _customActions = _this select 0;
_count = count _customActions; _count = count _customActions;
if (_count == 0) exitWith {}; if (_count == 0) exitWith {};
_customActions call AGM_Interaction_fnc_sortOptionsByPriority; _customActions call FUNC(sortOptionsByPriority);
for "_i" from 0 to _count -1 do { for "_i" from 0 to _count -1 do {
_action = _customActions select _i; _action = _customActions select _i;
_action set [1, (_this select 1)]; _action set [1, (_this select 1)];
}; };
AGM_Interaction_Buttons = _customActions; GVAR(Buttons) = _customActions;
[(_this select 2), true, true, false, AGM_player] call AGM_Interaction_fnc_initialiseInteraction; [(_this select 2), true, true, false, AGM_player] call FUNC(initialiseInteraction);
}; };

View File

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

View File

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

View File

@ -1,24 +1,26 @@
/* /*
Name: AGM_Interaction_fnc_prepareSelectMenu Name: AGM_Interaction_fnc_prepareSelectMenu
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
Description: Description:
Prepares the select menu for use. Prepares the select menu for use.
Parameters: Parameters:
0: TEXT - Header text 0: TEXT - Header text
1: TEXT - Approve button text 1: TEXT - Approve button text
Returns: Returns:
ARRAY/NUMBER - container object for use with AddSelectableItem. ARRAY/NUMBER - container object for use with AddSelectableItem.
Example: Example:
["Select Explosive", "Place"] call AGM_Interaction_fnc_prepareSelectMenu; ["Select Explosive", "Place"] call AGM_Interaction_fnc_prepareSelectMenu;
*/ */
#include "script_component.hpp"
private ["_buttonAction", "_header", "_buttonText", "_cancelButton"]; private ["_buttonAction", "_header", "_buttonText", "_cancelButton"];
closeDialog 0; closeDialog 0;
if (!(profileNamespace getVariable ["AGM_Interaction_FlowMenu", false])) exitWith { if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) exitWith {
_header = _this select 0; _header = _this select 0;
_buttonText = _this select 1; _buttonText = _this select 1;
if (isNil "_buttonText" or {_buttonText == ""}) then { if (isNil "_buttonText" or {_buttonText == ""}) then {

View File

@ -10,12 +10,13 @@
* Return Value: * Return Value:
* None * None
*/ */
#include "script_component.hpp"
_boat = _this select 0; _boat = _this select 0;
_velocity = _this select 1; _velocity = _this select 1;
if !(local _boat) exitWith { if !(local _boat) exitWith {
[_this, "AGM_Interaction_fnc_push", _boat] call AGM_Core_fnc_execRemoteFnc; [_this, QUOTE(FUNC(push)), _boat] call EFUNC(core,execRemoteFnc);
}; };
_boat setVelocity _velocity; _boat setVelocity _velocity;

View File

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

View File

@ -2,21 +2,21 @@
* Author: commy2 * Author: commy2
* *
* Remove an AGM self action from the player. * Remove an AGM self action from the player.
* *
* Argument: * Argument:
* 0: ID of the action (Number) * 0: ID of the action (Number)
* *
* Return value: * Return value:
* None. * None.
*/ */
#include "script_component.hpp"
private ["_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"]; private ["_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"];
_id = _this select 0; _id = _this select 0;
_actionsVar = AGM_player getVariable ["AGM_InteractionsSelf", [-1, [], []]]; _actionsVar = AGM_player getVariable [QGVAR(InteractionsSelf), [-1, [], []]];
_currentID = _actionsVar select 0; _currentID = _actionsVar select 0;
_actionIDs = _actionsVar select 1; _actionIDs = _actionsVar select 1;
@ -32,4 +32,4 @@ _actionIDs = _actionIDs - [-1];
_actions set [_id, []]; _actions set [_id, []];
_actions = _actions - [[]]; _actions = _actions - [[]];
AGM_player setVariable ["AGM_InteractionsSelf", [_currentID, _actionIDs, _actions], false]; AGM_player setVariable [QGVAR(InteractionsSelf), [_currentID, _actionIDs, _actions], false];

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
0 spawn { 0 spawn {
waitUntil {player getVariable ["AGM_Name", ""] != ""}; waitUntil {player getVariable ["AGM_Name", ""] != ""};

View File

@ -1,14 +1,15 @@
/* /*
* Author: KoffeinFlummi * Author: KoffeinFlummi
* *
* Sends a civilian crowd away (chance of failure). * Sends a civilian crowd away (chance of failure).
* *
* Arguments: * Arguments:
* 0: Unit to be sent away (Object) * 0: Unit to be sent away (Object)
* *
* Return value: * Return value:
* none * none
*/ */
#include "script_component.hpp"
#define DISTANCE 50 #define DISTANCE 50
#define RADIUS 10 #define RADIUS 10

View File

@ -1,3 +1,4 @@
// by commy2 // by commy2
#include "script_component.hpp"
_this call AGM_Core_fnc_setCaptivityStatus; _this call EFUNC(core,setCaptivityStatus);

View File

@ -1,74 +1,76 @@
/* /*
Name: AGM_Interaction_fnc_showMenu Name: AGM_Interaction_fnc_showMenu
Author: Author:
commy2 commy2
Garth de Wet (LH) Garth de Wet (LH)
aeroson aeroson
Description: Description:
Parameters: Parameters:
0: NUMBER - Menu type (0 - interaction, 1 - self-interaction, 2 - sub-interaction, 3 - sub-self-interaction) 0: NUMBER - Menu type (0 - interaction, 1 - self-interaction, 2 - sub-interaction, 3 - sub-self-interaction)
1: OBJECT - Target object 1: OBJECT - Target object
2: STRING - Sub-Menu ClassName 2: STRING - Sub-Menu ClassName
Returns: Returns:
Nothing Nothing
Example: Example:
[0, AGM_Interaction_Target] call AGM_Interaction_fnc_showMenu; [0, GVAR(Target)] call AGM_Interaction_fnc_showMenu;
[1, player] call AGM_Interaction_fnc_showMenu; [1, player] call AGM_Interaction_fnc_showMenu;
[2, AGM_Interaction_Target, "AGM_Explosives"] call AGM_Interaction_fnc_showMenu; [2, GVAR(Target), "AGM_Explosives"] call AGM_Interaction_fnc_showMenu;
[3, player, "AGM_Explosives"] call AGM_Interaction_fnc_showMenu; [3, player, "AGM_Explosives"] call AGM_Interaction_fnc_showMenu;
*/ */
#include "script_component.hpp"
private ["_player", "_vehicle", "_mainButtonAction", "_object", "_index", "_actions", "_result", "_menuType"]; private ["_player", "_vehicle", "_mainButtonAction", "_object", "_index", "_actions", "_result", "_menuType"];
#define DEFAULT_ICON "\AGM_Interaction\UI\dot_ca.paa" #define DEFAULT_ICON PATHOF(UI\dot_ca.paa)
#define DEFAULT_DISTANCE 4 // seems to be 4 #define DEFAULT_DISTANCE 4 // seems to be 4
_player = AGM_player; _player = AGM_player;
_vehicle = vehicle _player; _vehicle = vehicle _player;
AGM_Interaction_MenuType = _this select 0; // 0 Interaction, 1 Self Interaction GVAR(MenuType) = _this select 0; // 0 Interaction, 1 Self Interaction
_mainButtonAction = [ _mainButtonAction = [
{call AGM_Interaction_fnc_hideMenu}, {call FUNC(hideMenu)},
{call AGM_Interaction_fnc_hideMenu}, {call FUNC(hideMenu)},
{"Default" call AGM_Interaction_fnc_openMenu}, {"Default" call FUNC(openMenu)},
{"Default" call AGM_Interaction_fnc_openMenuSelf} {"Default" call FUNC(openMenuSelf)}
] select AGM_Interaction_MenuType; ] select GVAR(MenuType);
_menuType = AGM_Interaction_MenuType % 2; _menuType = GVAR(MenuType) % 2;
uiNamespace setVariable ["AGM_Interaction_CursorPosition", [controlNull, 0.5, 0.5, -1]]; uiNamespace setVariable [QGVAR(CursorPosition), [controlNull, 0.5, 0.5, -1]];
AGM_Interaction_Target = _this select 1; GVAR(Target) = _this select 1;
_object = AGM_Interaction_Target; _object = GVAR(Target);
if (_menuType == 0 && {(isNull (_object) || {!([_object, 4] call AGM_Interaction_fnc_isInRange)})}) exitWith {};//call ([AGM_Interaction_fnc_onButtonDown, AGM_Interaction_fnc_onButtonDownSelf] select _menuType)}; if (_menuType == 0 && {(isNull (_object) || {!([_object, 4] call FUNC(isInRange))})}) exitWith {};
if !([_player, _object] call AGM_Core_fnc_canInteractWith) exitWith {}; if !([_player, _object] call EFUNC(core,canInteractWith)) exitWith {};
// add actions or self actions of AGM_Interaction_Target // add actions or self actions of GVAR(Target)
_parents = [configFile >> "CfgVehicles" >> typeOf _object, true] call BIS_fnc_returnParents; _parents = [configFile >> "CfgVehicles" >> typeOf _object, true] call BIS_fnc_returnParents;
_result = [_object, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call AGM_Interaction_fnc_GetActions; _result = [_object, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions);
_actions = ([_object, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call AGM_Interaction_fnc_GetActions) select 0; _actions = ([_object, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0);
// add self actions of vehicle _player // add self actions of vehicle _player
if (_menuType == 1 && {_player != _vehicle}) then { if (_menuType == 1 && {_player != _vehicle}) then {
_parents = [configFile >> "CfgVehicles" >> typeOf _vehicle, true] call BIS_fnc_returnParents; _parents = [configFile >> "CfgVehicles" >> typeOf _vehicle, true] call BIS_fnc_returnParents;
_result = [_vehicle, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call AGM_Interaction_fnc_GetActions; _result = [_vehicle, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions);
_actions = _actions + (([_vehicle, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call AGM_Interaction_fnc_GetActions) select 0); _actions = _actions + (([_vehicle, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["AGM_Actions", "AGM_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0));
}; };
// custom defined actions, stored in variable instead of cfg like above // custom defined actions, stored in variable instead of cfg like above
if (AGM_Interaction_MenuType < 2) then { if (GVAR(MenuType) < 2) then {
private ["_customActions", "_customAction", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority"]; private ["_customActions", "_customAction", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority"];
// add interactions or self interactions of AGM_Interaction_Target // add interactions or self interactions of GVAR(Target)
_customActions = (_object getVariable [["AGM_Interactions", "AGM_InteractionsSelf"] select _menuType, [-1, [], []]]) select 2; _customActions = (_object getVariable [[QGVAR(Interactions), QGVAR(AGM_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2;
// add self interactions of vehicle _player // add self interactions of vehicle _player
if (_menuType == 1 && {_player != _vehicle}) then { if (_menuType == 1 && {_player != _vehicle}) then {
_customActions = _customActions + ((_vehicle getVariable [["AGM_Interactions", "AGM_InteractionsSelf"] select _menuType, [-1, [], []]]) select 2); _customActions = _customActions + ((_vehicle getVariable [[QGVAR(Interactions), QGVAR(AGM_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2);
}; };
if(_menuType==0) then { if(_menuType==0) then {
@ -85,7 +87,7 @@ if (AGM_Interaction_MenuType < 2) then {
_showDisabled = _customAction select 4; _showDisabled = _customAction select 4;
_priority = _customAction select 5; _priority = _customAction select 5;
if ((_showDisabled || {[_object, _player] call _condition}) && {[_object, _distance] call AGM_Interaction_fnc_isInRange || {_distance == 0}}) then { if ((_showDisabled || {[_object, _player] call _condition}) && {[_object, _distance] call FUNC(isInRange) || {_distance == 0}}) then {
_actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], _distance, ""]; _actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], _distance, ""];
}; };
}; };
@ -93,7 +95,7 @@ if (AGM_Interaction_MenuType < 2) then {
} else { // self interactions do not have distance } else { // self interactions do not have distance
for "_index" from 0 to (count _customActions - 1) do { for "_index" from 0 to (count _customActions - 1) do {
_customAction = _customActions select _index; _customAction = _customActions select _index;
_displayName = _customAction select 0; _displayName = _customAction select 0;
_condition = _customAction select 1; _condition = _customAction select 1;
@ -111,8 +113,8 @@ if (AGM_Interaction_MenuType < 2) then {
}; };
if (count _actions == 0) exitWith {};//call ([AGM_Interaction_fnc_onButtonDown, AGM_Interaction_fnc_onButtonDownSelf] select _menuType)}; if (count _actions == 0) exitWith {};
_actions call AGM_Interaction_fnc_sortOptionsByPriority; _actions call FUNC(sortOptionsByPriority);
AGM_Interaction_Buttons = _actions; GVAR(Buttons) = _actions;
[_mainButtonAction, (_this select 2) != "", (profileNamespace getVariable ["AGM_Interaction_FlowMenu", false]), _menuType == 1, _object] call AGM_Interaction_fnc_initialiseInteraction; [_mainButtonAction, (_this select 2) != "", (profileNamespace getVariable [QGVAR(FlowMenu), false]), _menuType == 1, _object] call FUNC(initialiseInteraction);

View File

@ -1,23 +1,25 @@
/* /*
Name: AGM_Interaction_fnc_showMouseHint Name: AGM_Interaction_fnc_showMouseHint
Author(s): Author(s):
Garth de Wet (LH) Garth de Wet (LH)
Description: Description:
Shows the interaction helper text with the mouse buttons at the bottom middle of the screen Shows the interaction helper text with the mouse buttons at the bottom middle of the screen
Parameters: Parameters:
0: STRING - Left click text 0: STRING - Left click text
1: STRING - Right click text 1: STRING - Right click text
3: STRING - (Optional) Scroll text 3: STRING - (Optional) Scroll text
Returns: Returns:
Nothing Nothing
Example: Example:
["Place Explosive", "Cancel"] call AGM_Interaction_fnc_showMouseHint; ["Place Explosive", "Cancel"] call AGM_Interaction_fnc_showMouseHint;
*/ */
#include "script_component.hpp"
#define GUI_GRID_W (0.025) #define GUI_GRID_W (0.025)
#define GUI_GRID_H (0.04) #define GUI_GRID_H (0.04)
private ["_leftClick", "_rightClick", "_scroll"]; private ["_leftClick", "_rightClick", "_scroll"];
@ -28,7 +30,7 @@ if (count _this > 2) then {
_scroll = _this select 2; _scroll = _this select 2;
}; };
("AGM_InteractionHelper" call BIS_fnc_rscLayer) cutRsc ["AGM_InteractionHelper", "PLAIN",0.5, false]; (QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN",0.5, false];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable ["AGM_Helper_Display", objNull]; _display = uiNamespace getVariable ["AGM_Helper_Display", objNull];
if (isNull _display) exitWith{}; if (isNull _display) exitWith{};

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_actions", "_count", "_index", "_actionN", "_actionM"]; private ["_actions", "_count", "_index", "_actionN", "_actionM"];

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_unit", "_message"]; private ["_unit", "_message"];
@ -8,13 +9,13 @@ _target = _this select 1;
if (_target != AGM_player) exitWith { if (_target != AGM_player) exitWith {
addCamShake [4, 0.5, 5]; addCamShake [4, 0.5, 5];
if !(local _target) then { if !(local _target) then {
[[_tapper, _target], "AGM_Interaction_fnc_tapShoulder", _target] call AGM_Core_fnc_execRemoteFnc; [[_tapper, _target], QUOTE(FUNC(tapShoulder)), _target] call EFUNC(execRemoteFnc);
}; };
}; };
addCamShake [4, 0.5, 5]; addCamShake [4, 0.5, 5];
//_message = format ["%1 tapped you on your shoulder.", [_unit] call AGM_Core_fnc_getName]; //_message = format ["%1 tapped you on your shoulder.", [_unit] call EFUNC(core,getName)];
_message = localize "STR_AGM_Interaction_YouWereTapped"; _message = localize "STR_AGM_Interaction_YouWereTapped";
[_message] call AGM_Core_fnc_displayTextStructured; [_message] call EFUNC(core,displayTextStructured);

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
disableSerialization; disableSerialization;
_ctrl = ctrlParent (_this select 0) displayCtrl 40; _ctrl = ctrlParent (_this select 0) displayCtrl 40;