From 2452884acbee25d2cd0967d4cc38904217e9dc80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 11 Jan 2015 16:16:08 -0300 Subject: [PATCH] Further macros for attach (EFUNC, EQGVAR). Minor fixes --- addons/Attach/config.cpp | 2 +- addons/Attach/functions/fn_attach.sqf | 6 ++--- addons/Attach/functions/fn_detach.sqf | 8 +++---- addons/Attach/functions/fn_openAttachUI.sqf | 26 ++++++++++----------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/addons/Attach/config.cpp b/addons/Attach/config.cpp index b3c27dd628..c5054ebd6e 100644 --- a/addons/Attach/config.cpp +++ b/addons/Attach/config.cpp @@ -41,7 +41,7 @@ class CfgVehicles { class CAManBase: Man { class AGM_SelfActions { class AGM_Equipment { - class ADDON { + class GVAR(Attach) { displayName = "$STR_AGM_Attach_AttachDetach"; condition = QUOTE( [_player, ''] call FUNC(canAttach) ); statement = QUOTE( [_player] call FUNC(openAttachUI); ); diff --git a/addons/Attach/functions/fn_attach.sqf b/addons/Attach/functions/fn_attach.sqf index 704dc2c9f0..23b9b86ee9 100644 --- a/addons/Attach/functions/fn_attach.sqf +++ b/addons/Attach/functions/fn_attach.sqf @@ -29,12 +29,12 @@ switch true do { case (_itemName == "AGM_IR_Strobe_Item") : { _attachedItem = "AGM_IR_Strobe_Effect" createVehicle [0,0,0]; _attachedItem attachTo [_unit,[0,-0.11,0.16],"pilot"];//makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri - [localize "STR_AGM_Attach_IrStrobe_Attached"] call AGM_Core_fnc_displayTextStructured; + [localize "STR_AGM_Attach_IrStrobe_Attached"] call EFUNC(core,displayTextStructured); }; case (_itemName == "B_IR_Grenade") : { _attachedItem = "B_IRStrobe" createVehicle [0,0,0]; _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_AGM_Attach_IrGrenade_Attached"] call AGM_Core_fnc_displayTextStructured; + [localize "STR_AGM_Attach_IrGrenade_Attached"] call EFUNC(core,displayTextStructured); }; case (_itemName == "O_IR_Grenade") : { _attachedItem = "O_IRStrobe" createVehicle [0,0,0]; @@ -59,4 +59,4 @@ switch true do { // Remove item _unit removeItem _itemName; _unit setVariable [QGVAR(ItemName), _itemName, true]; -_unit setVariable ["AGM_AttachedItem", _attachedItem, true]; +_unit setVariable [QGVAR(Item), _attachedItem, true]; diff --git a/addons/Attach/functions/fn_detach.sqf b/addons/Attach/functions/fn_detach.sqf index caf2eff400..415429440b 100644 --- a/addons/Attach/functions/fn_detach.sqf +++ b/addons/Attach/functions/fn_detach.sqf @@ -24,7 +24,7 @@ if (_itemName == "") exitWith {}; _count = (count items _unit) + (count magazines _unit); _unit addItem _itemName; if ((count items _unit) + (count magazines _unit) <= _count) exitWith { - [localize "STR_AGM_Attach_Inventory_Full"] call AGM_Core_fnc_displayTextStructured; + [localize "STR_AGM_Attach_Inventory_Full"] call EFUNC(core,displayTextStructured); }; if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then { @@ -51,13 +51,13 @@ _unit setVariable [QGVAR(Item),nil, true]; // Display message switch true do { case (_itemName == "AGM_IR_Strobe_Item") : { - [localize "STR_AGM_Attach_IrStrobe_Detached"] call AGM_Core_fnc_displayTextStructured; + [localize "STR_AGM_Attach_IrStrobe_Detached"] call EFUNC(core,displayTextStructured); }; case (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") : { - [localize "STR_AGM_Attach_IrGrenade_Detached"] call AGM_Core_fnc_displayTextStructured; + [localize "STR_AGM_Attach_IrGrenade_Detached"] call EFUNC(core,displayTextStructured); }; case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { - [localize "STR_AGM_Attach_Chemlight_Detached"] call AGM_Core_fnc_displayTextStructured; + [localize "STR_AGM_Attach_Chemlight_Detached"] call EFUNC(core,displayTextStructured); }; default { if (true) exitWith {}; diff --git a/addons/Attach/functions/fn_openAttachUI.sqf b/addons/Attach/functions/fn_openAttachUI.sqf index f16832bf00..5af80d2c9e 100644 --- a/addons/Attach/functions/fn_openAttachUI.sqf +++ b/addons/Attach/functions/fn_openAttachUI.sqf @@ -2,18 +2,18 @@ /* Name: AGM_Attach_fnc_openAttachUI - + Author: Garth de Wet (LH) - + Description: Opens the UI for attaching objects. - - Parameters: + + Parameters: 0: OBJECT - unit - + Returns: Nothing - + Example: [player] call AGM_Attach_fnc_openAttachUI; */ @@ -21,7 +21,7 @@ private ["_unit", "_actions", "_attachables", "_item"]; _unit = _this select 0; _listed = []; _attachables = magazines _unit; -_actions = [localize "STR_AGM_Attach_AttachDetach", localize "STR_AGM_Attach_Attach"] call AGM_Interaction_fnc_prepareSelectMenu; +_actions = [localize "STR_AGM_Attach_AttachDetach", localize "STR_AGM_Attach_Attach"] call EFUNC(interaction,prepareSelectMenu); { if !(_x in _listed) then { _item = ConfigFile >> "CfgMagazines" >> _x; @@ -31,7 +31,7 @@ _actions = [localize "STR_AGM_Attach_AttachDetach", localize "STR_AGM_Attach_Att getText(_item >> "displayName"), getText(_item >> "picture"), _x - ] call AGM_Interaction_fnc_AddSelectableItem; + ] call EFUNC(interaction,addSelectableItem); }; _listed pushBack _x; }; @@ -46,7 +46,7 @@ _attachables = items _unit; getText(_item >> "displayName"), getText(_item >> "picture"), _x - ] call AGM_Interaction_fnc_AddSelectableItem; + ] call EFUNC(interaction,addSelectableItem); }; _listed pushBack _x; }; @@ -56,10 +56,10 @@ _attachables = items _unit; _actions, { [AGM_player, _this] call FUNC(attach); - call AGM_Interaction_fnc_hideMenu; + call EFUNC(interaction,hideMenu); }, { - call AGM_Interaction_fnc_hideMenu; - if !(profileNamespace getVariable ["AGM_Interaction_AutoCloseMenu", false]) then {"Default" call AGM_Interaction_fnc_openMenuSelf}; + call EFUNC(interaction,hideMenu); + if !(profileNamespace getVariable [EQGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; } -] call AGM_Interaction_fnc_openSelectMenu; +] call EFUNC(interaction,openSelectMenu);