From c70ab0b332c7eacbc2fac11e6d58a06973ae028f Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Thu, 17 Sep 2015 01:26:07 +0200 Subject: [PATCH] Buggy ropes workaround --- addons/fastroping/functions/fnc_canCutRopes.sqf | 2 +- addons/fastroping/functions/fnc_canDeployRopes.sqf | 3 ++- addons/fastroping/functions/fnc_canFastRope.sqf | 2 +- addons/fastroping/functions/fnc_cutRopes.sqf | 4 ++-- addons/fastroping/functions/fnc_deployRopes.sqf | 14 +++++++++----- addons/fastroping/functions/fnc_fastRope.sqf | 4 ++-- addons/fastroping/functions/fnc_fastRopePFH.sqf | 10 ++++------ 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/addons/fastroping/functions/fnc_canCutRopes.sqf b/addons/fastroping/functions/fnc_canCutRopes.sqf index 2fa33dec93..7abc1f8be0 100644 --- a/addons/fastroping/functions/fnc_canCutRopes.sqf +++ b/addons/fastroping/functions/fnc_canCutRopes.sqf @@ -22,5 +22,5 @@ private ["_deployedRopes"]; _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; if ((driver _vehicle != _unit) && {!(_deployedRopes isEqualTo [])} && - {{_x select 5} count (_deployedRopes) == 0}) exitWith {true}; + {{_x select 6} count (_deployedRopes) == 0}) exitWith {true}; false diff --git a/addons/fastroping/functions/fnc_canDeployRopes.sqf b/addons/fastroping/functions/fnc_canDeployRopes.sqf index 4db45cff24..7197020aa3 100644 --- a/addons/fastroping/functions/fnc_canDeployRopes.sqf +++ b/addons/fastroping/functions/fnc_canDeployRopes.sqf @@ -22,5 +22,6 @@ private ["_deployedRopes"]; _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; if (isNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) && {getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) == 1} && - {_deployedRopes isEqualTo []}) exitWith {true}; + {_deployedRopes isEqualTo []} && + {getPos _vehicle select 2 > 5}) exitWith {true}; false diff --git a/addons/fastroping/functions/fnc_canFastRope.sqf b/addons/fastroping/functions/fnc_canFastRope.sqf index 910d3cccc9..573a36f1a1 100644 --- a/addons/fastroping/functions/fnc_canFastRope.sqf +++ b/addons/fastroping/functions/fnc_canFastRope.sqf @@ -22,5 +22,5 @@ private ["_deployedRopes"]; _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; if ((driver _vehicle != _unit) && {!(_deployedRopes isEqualTo [])} && - {{!(_x select 5)} count (_deployedRopes) > 0}) exitWith {true}; + {{!(_x select 6)} count (_deployedRopes) > 0}) exitWith {true}; false diff --git a/addons/fastroping/functions/fnc_cutRopes.sqf b/addons/fastroping/functions/fnc_cutRopes.sqf index 9ec88da7c0..48b0b0480b 100644 --- a/addons/fastroping/functions/fnc_cutRopes.sqf +++ b/addons/fastroping/functions/fnc_cutRopes.sqf @@ -20,10 +20,10 @@ private ["_deployedRopes"]; _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; { - _x params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_occupied"]; + _x params ["", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook"]; deleteVehicle _ropeTop; - [{{deleteVehicle _x} count _this}, [_dummy, _anchor, _ropeBottom], 60] call EFUNC(common,waitAndExecute); + [{{deleteVehicle _x} count _this}, [_dummy, _anchor, _ropeBottom, _hook], 60] call EFUNC(common,waitAndExecute); } count _deployedRopes; _vehicle setVariable [QGVAR(deployedRopes), [], true]; diff --git a/addons/fastroping/functions/fnc_deployRopes.sqf b/addons/fastroping/functions/fnc_deployRopes.sqf index 6cdf71c868..f47b5873b7 100644 --- a/addons/fastroping/functions/fnc_deployRopes.sqf +++ b/addons/fastroping/functions/fnc_deployRopes.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" params ["_unit", "_vehicle"]; -private ["_ropeOrigins", "_deployedRopes", "_origin", "_dummy", "_anchor", "_ropeTop", "_ropeBottom"]; +private ["_ropeOrigins", "_deployedRopes", "_origin", "_dummy", "_anchor", "_hook", "_ropeTop", "_ropeBottom"]; _ropeOrigins = getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(ropeOrigins)); _deployedRopes = []; @@ -26,18 +26,22 @@ _deployedRopes = []; _dummy = QGVAR(helper) createVehicle [0, 0, 0]; _dummy allowDamage false; - _dummy setPosASL (_origin vectorAdd [0, 0, -2]); + _dummy setPosASL (_origin vectorAdd [0, 0, -1]); _anchor = QGVAR(helper) createVehicle [0, 0, 0]; _anchor allowDamage false; _anchor setPosASL (_origin vectorAdd [0, 0, -2.5]); - _ropeTop = ropeCreate [_vehicle, _x, _dummy, [0, 0, 0], 2]; + _hook = QGVAR(helper) createVehicle [0, 0, 0]; + _hook allowDamage false; + _hook attachTo [_vehicle, _x]; + + _ropeTop = ropeCreate [_hook, [0, 0, 0], _dummy, [0, 0, 0], 2]; _ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 33]; //deployedRopes format: attachment point, top part of the rope, bottom part of the rope, attachTo helper object, anchor helper object, occupied - _deployedRopes pushBack [_x, _ropeTop, _ropeBottom, _dummy, _anchor, false]; - false + _deployedRopes pushBack [_x, _ropeTop, _ropeBottom, _dummy, _anchor, _hook, false]; + true } count _ropeOrigins; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; diff --git a/addons/fastroping/functions/fnc_fastRope.sqf b/addons/fastroping/functions/fnc_fastRope.sqf index 69043b3cf8..6ea6a2c7f1 100644 --- a/addons/fastroping/functions/fnc_fastRope.sqf +++ b/addons/fastroping/functions/fnc_fastRope.sqf @@ -24,13 +24,13 @@ _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; _usableRope = _deployedRopes select 0; _usableRopeIndex = 0; { - if !(_x select 5) exitWith { + if !(_x select 6) exitWith { _usableRope = _x; _usableRopeIndex = _forEachIndex; }; } forEach _deployedRopes; -_usableRope set [5, true]; +_usableRope set [6, true]; _deployedRopes set [_usableRopeIndex, _usableRope]; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; diff --git a/addons/fastroping/functions/fnc_fastRopePFH.sqf b/addons/fastroping/functions/fnc_fastRopePFH.sqf index 9afd7568a0..706d570343 100644 --- a/addons/fastroping/functions/fnc_fastRopePFH.sqf +++ b/addons/fastroping/functions/fnc_fastRopePFH.sqf @@ -18,7 +18,7 @@ #include "script_component.hpp" params ["_arguments", "_pfhHandle"]; _arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex"]; -_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_occupied"]; +_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook", "_occupied"]; private ["_origin"]; //Wait until the unit is actually outside of the helicopter @@ -29,14 +29,12 @@ if (isNull attachedTo _unit) exitWith { _dummy setVectorUp [0, 0, 1]; _unit attachTo [_dummy, [0, 0, -1.2]]; [_unit, "ACE_FastRoping", 2] call EFUNC(common,doAnimation); - systemChat str _ropeTop; - systemChat str _ropeBottom; ropeUnwind [_ropeTop, 6, 35]; ropeUnwind [_ropeBottom, 6, 0]; }; //Check if fast rope is finished -if (((getPos _unit select 2) < 0.5) || {ropeUnwound _ropeTop} || {vectorMagnitude (velocity _vehicle) > 5}) exitWith { +if (((getPos _unit select 2) < 0.2) || {ropeUnwound _ropeTop} || {vectorMagnitude (velocity _vehicle) > 5}) exitWith { detach _unit; [_unit, "", 2] call EFUNC(common,doAnimation); @@ -47,12 +45,12 @@ if (((getPos _unit select 2) < 0.5) || {ropeUnwound _ropeTop} || {vectorMagnitud _origin = AGLtoASL (_vehicle modelToWorld _attachmentPoint); _dummy setPosASL (_origin vectorAdd [0, 0, -2]); - _ropeTop = ropeCreate [_vehicle, _attachmentPoint, _dummy, [0, 0, 0], 2]; + _ropeTop = ropeCreate [_hook, [0, 0, 0], _dummy, [0, 0, 0], 2]; _ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 33]; //Update deployedRopes array _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; - _deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _anchor, false]]; + _deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _anchor, _hook, false]]; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; [_pfhHandle] call CBA_fnc_removePerFrameHandler;