mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
b489750d5b
* Optimizations with private, params, and isEqualType * Fixed tab being used instead of space * Fixed tabs inserted by notepad++ * More usage of new private syntax and params - changed a few checks for an array being empty to `_arr isEqualTo []` rather than `count _arr == 0` - added more uses of `private` on the same line as the variable is declared - added more uses of params to assign variables passed as parameters - removed unnecessary parentheses - removed several unnecessary variable declarations with private array syntax * clean up and formatting
56 lines
1.8 KiB
Plaintext
56 lines
1.8 KiB
Plaintext
/*
|
|
* Author: BaerMitUmlaut
|
|
* Deploy ropes from the helicopter.
|
|
*
|
|
* Arguments:
|
|
* 0: The helicopter itself <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [_vehicle] call ace_fastroping_fnc_deployRopes
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
params ["_vehicle"];
|
|
|
|
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
|
|
|
private _ropeOrigins = getArray (_config >> QGVAR(ropeOrigins));
|
|
private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
|
private _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
|
|
{
|
|
private _ropeOrigin = _x;
|
|
private _hook = QGVAR(helper) createVehicle [0, 0, 0];
|
|
_hook allowDamage false;
|
|
if (_ropeOrigin isEqualType []) then {
|
|
_hook attachTo [_hookAttachment, _ropeOrigin];
|
|
} else {
|
|
_hook attachTo [_hookAttachment, [0, 0, 0], _ropeOrigin];
|
|
};
|
|
|
|
private _origin = getPosATL _hook;
|
|
|
|
private _dummy = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -1], [], 0, "CAN_COLLIDE"];
|
|
_dummy allowDamage false;
|
|
_dummy disableCollisionWith _vehicle;
|
|
|
|
private _ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
|
|
private _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, occupied
|
|
_deployedRopes pushBack [_ropeOrigin, _ropeTop, _ropeBottom, _dummy, _hook, false];
|
|
|
|
false
|
|
} count _ropeOrigins;
|
|
|
|
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
|
_vehicle setVariable [QGVAR(deploymentStage), 3, true];
|