From 4d62865ea2d06411771fb4c2f6326c08e6bd897a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 27 Mar 2015 11:53:04 -0500 Subject: [PATCH] Stop placement on interact_menu open --- addons/attach/CfgEventHandlers.hpp | 6 +++++- addons/attach/XEH_clientInit.sqf | 6 ++++++ addons/attach/functions/fnc_attach.sqf | 6 +++--- addons/attach/functions/fnc_detach.sqf | 6 +++--- 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 addons/attach/XEH_clientInit.sqf diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp index f0a9f14d91..3daad1425a 100644 --- a/addons/attach/CfgEventHandlers.hpp +++ b/addons/attach/CfgEventHandlers.hpp @@ -1,6 +1,10 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); + }; +}; diff --git a/addons/attach/XEH_clientInit.sqf b/addons/attach/XEH_clientInit.sqf new file mode 100644 index 0000000000..f7e663c2ae --- /dev/null +++ b/addons/attach/XEH_clientInit.sqf @@ -0,0 +1,6 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +//If attach placing, stop when opening menu: +["interactMenuOpened", {GVAR(placeAction) = 0;}] call EFUNC(common,addEventHandler); diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 6b7de1e72f..2a79a28699 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -1,5 +1,5 @@ /* - * Author: eRazeri and esteldunedain + * Author: eRazeri, esteldunedain, PabstMirror * Attach an item to the unit * * Arguments: @@ -77,7 +77,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment // _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {true}, {GVAR(placeAction) = 0;}] call EFUNC(common,AddActionEventHandler)]; _actionID = _unit addAction [format ["%1", localize "STR_ACE_Attach_CancelAction"], {GVAR(placeAction) = 0}]; - + [{ PARAMS_2(_args,_pfID); EXPLODE_7_PVT(_args,_unit,_attachToVehicle,_itemClassname,_itemVehClass,_tempObject,_onAtachText,_actionID); @@ -93,7 +93,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); //[_unit, "MenuBack", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler); _unit removeAction _actionID; - + if (GVAR(placeAction) == 1) then { _startingPosition = _tempObject modelToWorld [0,0,0]; [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _startingPosition] call FUNC(placeApprove); diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 0386f5452a..124e5910d6 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -74,13 +74,13 @@ _attachToVehicle setVariable [QGVAR(ItemNames), _attachedItems, true]; // Display message switch (true) do { - case (_itemName == "ACE_IR_Strobe_Item") : { +case (_itemName == "ACE_IR_Strobe_Item") : { [localize "STR_ACE_Attach_IrStrobe_Detached"] call EFUNC(common,displayTextStructured); }; - case (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) : { +case (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) : { [localize "STR_ACE_Attach_IrGrenade_Detached"] call EFUNC(common,displayTextStructured); }; - case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]) : { +case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]) : { [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); }; };