Further macros for attach (EFUNC, EQGVAR). Minor fixes

This commit is contained in:
Nicolás Badano 2015-01-11 16:16:08 -03:00
parent ef2ed3444a
commit 2452884acb
4 changed files with 21 additions and 21 deletions

View File

@ -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); );

View File

@ -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];

View File

@ -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 {};

View File

@ -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);