ACE3/addons/fastroping/functions/fnc_fastRope.sqf

40 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-09-16 21:01:01 +00:00
/*
* Author: BaerMitUmlaut
* Lets the unit fast rope.
*
* Arguments:
* 0: Unit occupying the helicopter <OBJECT>
* 1: The helicopter itself <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_player, _vehicle] call ace_fastroping_fnc_fastRope
2015-09-16 21:01:01 +00:00
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_vehicle"];
//Select unoccupied rope
private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
private _usableRope = _deployedRopes select 0;
private _usableRopeIndex = 0;
2015-09-16 21:01:01 +00:00
{
if (!(_x select 5) && !(_x select 6)) exitWith {
2015-09-16 21:01:01 +00:00
_usableRope = _x;
_usableRopeIndex = _forEachIndex;
};
} forEach _deployedRopes;
_usableRope set [5, true];
2015-09-16 21:01:01 +00:00
_deployedRopes set [_usableRopeIndex, _usableRope];
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
//Start server PFH asap
[QGVAR(startFastRope), [_unit, _vehicle, _usableRope, _usableRopeIndex, false]] call CBA_fnc_serverEvent;
2015-09-16 21:01:01 +00:00
moveOut _unit;
2016-05-18 09:57:40 +00:00
[FUNC(fastRopeLocalPFH), 0, [_unit, _vehicle, _usableRope, _usableRopeIndex, diag_tickTime]] call CBA_fnc_addPerFrameHandler;