Removal of virtual rope anchor, animation fix

This commit is contained in:
BaerMitUmlaut 2016-02-22 00:29:15 +01:00
parent 6b2dc78ea4
commit 05054737ab
7 changed files with 19 additions and 17 deletions

View File

@ -22,5 +22,5 @@ private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
((driver _vehicle != _unit) &&
{!(_deployedRopes isEqualTo [])} &&
{{!(_x select 6)} count (_deployedRopes) > 0} &&
{{!(_x select 5)} count (_deployedRopes) > 0} &&
{getPos _vehicle select 2 > 2})

View File

@ -20,7 +20,7 @@ private ["_deployedRopes", "_config", "_waitTime"];
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
{
_x params ["", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook", "_occupied"];
_x params ["", "_ropeTop", "_ropeBottom", "_dummy", "_hook", "_occupied"];
//Make player fall if rope is occupied
if (_occupied) then {
@ -33,7 +33,7 @@ _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
};
[QGVAR(ropeDetach), [_hook, _ropeTop]] call EFUNC(common,serverEvent);
[{{deleteVehicle _x} count _this}, [_ropeTop, _ropeBottom, _dummy, _anchor, _hook], 60] call EFUNC(common,waitAndExecute);
[{{deleteVehicle _x} count _this}, [_ropeTop, _ropeBottom, _dummy, _hook], 60] call EFUNC(common,waitAndExecute);
} count _deployedRopes;
_vehicle setVariable [QGVAR(deployedRopes), [], true];

View File

@ -16,7 +16,7 @@
#include "script_component.hpp"
params ["_vehicle"];
private ["_config", "_ropeOrigins", "_ropeOrigin", "_deployedRopes", "_hookAttachment", "_origin", "_dummy", "_anchor", "_hook", "_ropeTop", "_ropeBottom"];
private ["_config", "_ropeOrigins", "_ropeOrigin", "_deployedRopes", "_hookAttachment", "_origin", "_dummy", "_hook", "_ropeTop", "_ropeBottom"];
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
@ -39,18 +39,15 @@ _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
_dummy allowDamage false;
_dummy disableCollisionWith _vehicle;
_anchor = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -2], [], 0, "CAN_COLLIDE"];
_anchor allowDamage false;
_anchor disableCollisionWith _vehicle;
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 34.5];
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], 1];
ropeUnwind [_ropeBottom, 30, 34.5, false];
_ropeTop addEventHandler ["RopeBreak", {[_this, "top"] call FUNC(onRopeBreak)}];
_ropeBottom addEventHandler ["RopeBreak", {[_this, "bottom"] call FUNC(onRopeBreak)}];
//deployedRopes format: attachment point, top part of the rope, bottom part of the rope, attachTo helper object, anchor helper object, occupied
_deployedRopes pushBack [_ropeOrigin, _ropeTop, _ropeBottom, _dummy, _anchor, _hook, false];
//deployedRopes format: attachment point, top part of the rope, bottom part of the rope, attachTo helper object, occupied
_deployedRopes pushBack [_ropeOrigin, _ropeTop, _ropeBottom, _dummy, _hook, false];
false
} count _ropeOrigins;

View File

@ -30,7 +30,7 @@ _usableRopeIndex = 0;
};
} forEach _deployedRopes;
_usableRope set [6, true];
_usableRope set [5, true];
_deployedRopes set [_usableRopeIndex, _usableRope];
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];

View File

@ -18,7 +18,7 @@
#include "script_component.hpp"
params ["_arguments", "_pfhHandle"];
_arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex"];
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook", "_occupied"];
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_hook", "_occupied"];
private ["_vectorUp", "_vectorDir", "_origin"];
//Wait until the unit is actually outside of the helicopter
@ -36,6 +36,11 @@ if (isNull attachedTo _unit) exitWith {
if ((getPos _unit) select 2 > 1) then {
[_unit, "ACE_freeFallStart", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_freeFallLoop", 1] call EFUNC(common,doAnimation);
[{
isTouchingGround _this
}, {
[_this, "", 2] call EFUNC(common,doAnimation);
}, _unit] call EFUNC(common,waitUntilAndExecute);
} else {
[_unit, "", 2] call EFUNC(common,doAnimation);
};

View File

@ -18,7 +18,7 @@
#include "script_component.hpp"
params ["_arguments", "_pfhHandle"];
_arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex"];
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook", "_occupied"];
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_hook", "_occupied"];
private ["_vectorUp", "_vectorDir", "_origin"];
//Wait until the unit is actually outside of the helicopter
@ -61,14 +61,14 @@ if (((getPos _unit select 2) < 0.2) || {ropeLength _ropeTop == 34.5} || {vectorM
_dummy setCenterOfMass [0.000143227,0.00105986,-0.246147];
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 34.5];
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], 34.5];
_ropeTop addEventHandler ["RopeBreak", {[_this, "top"] call FUNC(onRopeBreak)}];
_ropeBottom addEventHandler ["RopeBreak", {[_this, "bottom"] call FUNC(onRopeBreak)}];
//Update deployedRopes array
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
_deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _anchor, _hook, false]];
_deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _hook, false]];
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
[_pfhHandle] call CBA_fnc_removePerFrameHandler;

View File

@ -34,7 +34,7 @@ _brokenRope = [];
_brokenRope = _x;
};
} forEach _deployedRopes;
_brokenRope set [6, true];
_brokenRope set [5, true];
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
_unit = {