2015-09-16 21:01:01 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut
|
|
|
|
* Deploy ropes from the helicopter.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-12-01 19:48:20 +00:00
|
|
|
* 0: The helicopter itself <OBJECT>
|
2015-09-16 21:01:01 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-12-14 20:50:56 +00:00
|
|
|
* [_vehicle] call ace_fastroping_fnc_deployRopes
|
2015-09-16 21:01:01 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
2015-12-01 19:48:20 +00:00
|
|
|
params ["_vehicle"];
|
2015-11-30 17:35:34 +00:00
|
|
|
private ["_config", "_ropeOrigins", "_ropeOrigin", "_deployedRopes", "_hookAttachment", "_origin", "_dummy", "_anchor", "_hook", "_ropeTop", "_ropeBottom"];
|
2015-11-26 13:56:19 +00:00
|
|
|
|
|
|
|
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
|
|
|
|
2015-11-30 17:35:34 +00:00
|
|
|
_ropeOrigins = getArray (_config >> QGVAR(ropeOrigins));
|
|
|
|
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
|
|
|
_hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
|
|
|
|
{
|
|
|
|
_ropeOrigin = _x;
|
2015-12-22 07:53:57 +00:00
|
|
|
_hook = QGVAR(helper) createVehicle [0, 0, 0];
|
|
|
|
_hook allowDamage false;
|
|
|
|
if (typeName _ropeOrigin == "ARRAY") then {
|
|
|
|
_hook attachTo [_hookAttachment, _ropeOrigin];
|
|
|
|
} else {
|
|
|
|
_hook attachTo [_hookAttachment, [0, 0, 0], _ropeOrigin];
|
|
|
|
};
|
2015-11-26 13:56:19 +00:00
|
|
|
|
2015-12-22 07:53:57 +00:00
|
|
|
_origin = getPosATL _hook;
|
2015-11-26 13:56:19 +00:00
|
|
|
|
2015-12-22 07:53:57 +00:00
|
|
|
_dummy = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -1], [], 0, "CAN_COLLIDE"];
|
|
|
|
_dummy allowDamage false;
|
|
|
|
_dummy disableCollisionWith _vehicle;
|
2015-11-26 13:56:19 +00:00
|
|
|
|
2015-12-22 07:53:57 +00:00
|
|
|
_anchor = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -2], [], 0, "CAN_COLLIDE"];
|
|
|
|
_anchor allowDamage false;
|
|
|
|
_anchor disableCollisionWith _vehicle;
|
2015-11-26 13:56:19 +00:00
|
|
|
|
2015-12-22 07:53:57 +00:00
|
|
|
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
|
|
|
|
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 34.5];
|
2015-11-29 23:14:46 +00:00
|
|
|
|
2015-12-22 07:53:57 +00:00
|
|
|
_ropeTop addEventHandler ["RopeBreak", {[_this, "top"] call FUNC(onRopeBreak)}];
|
|
|
|
_ropeBottom addEventHandler ["RopeBreak", {[_this, "bottom"] call FUNC(onRopeBreak)}];
|
2015-11-26 13:56:19 +00:00
|
|
|
|
2015-12-22 07:53:57 +00:00
|
|
|
//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];
|
2015-11-30 17:35:34 +00:00
|
|
|
|
|
|
|
false
|
|
|
|
} count _ropeOrigins;
|
2015-11-26 13:56:19 +00:00
|
|
|
|
2015-11-30 17:35:34 +00:00
|
|
|
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
|
|
|
_vehicle setVariable [QGVAR(deploymentStage), 3, true];
|