ACE3/addons/fastroping/functions/fnc_fastRope.sqf
SilentSpike 108ff4f644 Replace ACE event system calls with CBA counterparts
Regex used:

\[(.+?),(.+?),(.+?)\]\s+call\s+E?FUNC\((common,)?(target|object)Event\)
[$1,$3,$2] call CBA_fnc_targetEvent

E?FUNC\((common,)?(server|global|local)Event\)
CBA_fnc_$2Event

E?FUNC\((common,)?(add|remove)EventHandler\)
CBA_fnc_$2EventHandler
2016-05-22 16:47:39 +01:00

41 lines
1.1 KiB
Plaintext

/*
* 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
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_vehicle"];
private ["_deployedRopes", "_usableRope", "_usableRopeIndex"];
//Select unoccupied rope
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
_usableRope = _deployedRopes select 0;
_usableRopeIndex = 0;
{
if !(_x select 5) exitWith {
_usableRope = _x;
_usableRopeIndex = _forEachIndex;
};
} forEach _deployedRopes;
_usableRope set [5, true];
_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;
moveOut _unit;
[FUNC(fastRopeLocalPFH), 0, [_unit, _vehicle, _usableRope, _usableRopeIndex, ACE_diagTime]] call CBA_fnc_addPerFrameHandler;