From 8ceb2aabc1137aec9f9c08394cdcbca91b25e978 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 31 Jan 2015 11:43:58 -0600 Subject: [PATCH] Attach Stuff --- addons/attach/functions/fnc_attach.sqf | 7 ++++--- addons/attach/functions/fnc_openAttachUI.sqf | 2 +- addons/attach/functions/fnc_placeApprove.sqf | 8 +++++--- addons/attach/functions/fnc_placeCancel.sqf | 5 +---- addons/attach/stringtable.xml | 9 ++++++++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 3b99462338..0c6302db71 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -69,7 +69,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment private "_player"; _player = ACE_player; //Stop if player switch or player gets to far from vehicle - if ((GVAR(placer) != _player) || ((_player distance GVAR(SetupAttachVehicle)) > 9)) exitWith { + if ((GVAR(placer) != _player) || {(_player distance GVAR(SetupAttachVehicle)) > 7}) exitWith { call FUNC(placeCancel); }; GVAR(pfeh_running) = true; @@ -77,8 +77,9 @@ if (_unit == _attachToVehicle) then { //Self Attachment GVAR(setupObject) setPosATL _pos; }] call BIS_fnc_addStackedEventHandler; - //had to spawn the mouseHint, not sure why - [localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] spawn EFUNC(interaction,showMouseHint); + //had to delay the mouseHint, not sure why + [{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute); + _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 573e0ad27f..db1a5d1513 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -8,7 +8,7 @@ Parameters: 0: OBJECT - unit - 0: OBJECT - target + 1: OBJECT - target Returns: Nothing diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index 630158caa6..687ce472c5 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -56,7 +56,7 @@ _closeInDistance = 0; while {_keepGoingCloser} do { if (_closeInDistance >= _distanceFromCenter) exitWith {}; - _closeInDistance = _closeInDistance + 0.01; //10mm + _closeInDistance = _closeInDistance + 0.01; //10mm each step _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset set [2, (_startingOffset select 2)]; _endPosTest = _attachToVehicle modelToWorld _endPosTestOffset; @@ -80,8 +80,10 @@ while {_keepGoingCloser} do { deleteVehicle _setupObject; //Checks -if (_closeInDistance >= _distanceFromCenter) exitWith {ERROR("no valid spot found")}; -if (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach))) exitWith {ERROR("canAttach failed")}; +if ((_closeInDistance >= _distanceFromCenter) || (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach)))) exitWith { + TRACE_2("no valid spot found",_closeInDistance,_distanceFromCenter); + [localize "STR_ACE_Attach_Failed"] call EFUNC(common,displayTextStructured); +}; //Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull) _closeInDistance = (_closeInDistance - 0.0085); diff --git a/addons/attach/functions/fnc_placeCancel.sqf b/addons/attach/functions/fnc_placeCancel.sqf index ffa84b9d12..12577512e8 100644 --- a/addons/attach/functions/fnc_placeCancel.sqf +++ b/addons/attach/functions/fnc_placeCancel.sqf @@ -29,10 +29,7 @@ GVAR(SetupPlacmentItem) = ""; GVAR(SetupPlacmentText) = ""; GVAR(setupObject) = objNull; GVAR(SetupAttachVehicle) = objNull; -if (isNil QGVAR(placer)) then { - ERROR("Nil placer?"); - GVAR(placer) = objNull; -}; + [GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); call EFUNC(interaction,hideMouseHint); diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index ef26e0738d..21577c55d3 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -168,5 +168,12 @@ Annulla Mégse + + Attach Failed + Échec du Attacher + Befestigen Fehlgeschlagen + Присоединить Ошибка + Error en Acoplar + \ No newline at end of file