From 4eb2ecb0b617befd762c49ca1e4f32190a3d6025 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Sat, 7 May 2016 22:35:18 +0200 Subject: [PATCH] Fixed getting stuck on rope whilst fastroping (#3734) --- addons/fastroping/functions/fnc_fastRope.sqf | 2 +- .../fastroping/functions/fnc_fastRopeServerPFH.sqf | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/fastroping/functions/fnc_fastRope.sqf b/addons/fastroping/functions/fnc_fastRope.sqf index bf2730efc7..adeb536362 100644 --- a/addons/fastroping/functions/fnc_fastRope.sqf +++ b/addons/fastroping/functions/fnc_fastRope.sqf @@ -35,6 +35,6 @@ _deployedRopes set [_usableRopeIndex, _usableRope]; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; //Start server PFH asap -[QGVAR(startFastRope), [_unit, _vehicle, _usableRope, _usableRopeIndex]] call EFUNC(common,serverEvent); +[QGVAR(startFastRope), [_unit, _vehicle, _usableRope, _usableRopeIndex, false]] call EFUNC(common,serverEvent); moveOut _unit; [FUNC(fastRopeLocalPFH), 0, [_unit, _vehicle, _usableRope, _usableRopeIndex]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf b/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf index ed78d43592..2ebffe680e 100644 --- a/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf +++ b/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" params ["_arguments", "_pfhHandle"]; -_arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex"]; +_arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex", "_hasBeenAttached"]; _rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_hook", "_occupied"]; private ["_vectorUp", "_vectorDir", "_origin"]; @@ -37,10 +37,15 @@ if (getMass _dummy != 80) exitWith { ropeUnwind [_ropeBottom, 6, 0.5]; }; -//Check if rope broke and unit is falling +//Check if the player has been attached to the rope yet +if (!_hasBeenAttached && {!(isNull attachedTo _unit)}) then { + _hasBeenAttached = true; + _arguments set [4, true]; +}; + +//Exit when the unit has been detached and is falling (rope broke, heli flew too fast, etc.) //Make sure this isn't executed before the unit is actually fastroping -//Note: Stretching ropes does not change ropeLength -if ((isNull attachedTo _unit) && {ropeLength _ropeTop > 0.5}) exitWith { +if (_hasBeenAttached && {isNull attachedTo _unit}) exitWith { [_pfhHandle] call CBA_fnc_removePerFrameHandler; };