Fixed getting stuck on rope whilst fastroping (#3734)

This commit is contained in:
BaerMitUmlaut 2016-05-07 22:35:18 +02:00 committed by Glowbal
parent 82f8eb758c
commit 4eb2ecb0b6
2 changed files with 10 additions and 5 deletions

View File

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

View File

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