mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Buggy ropes workaround
This commit is contained in:
parent
eb028c0d1b
commit
c70ab0b332
@ -22,5 +22,5 @@ private ["_deployedRopes"];
|
||||
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
||||
if ((driver _vehicle != _unit) &&
|
||||
{!(_deployedRopes isEqualTo [])} &&
|
||||
{{_x select 5} count (_deployedRopes) == 0}) exitWith {true};
|
||||
{{_x select 6} count (_deployedRopes) == 0}) exitWith {true};
|
||||
false
|
||||
|
@ -22,5 +22,6 @@ private ["_deployedRopes"];
|
||||
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
||||
if (isNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) &&
|
||||
{getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) == 1} &&
|
||||
{_deployedRopes isEqualTo []}) exitWith {true};
|
||||
{_deployedRopes isEqualTo []} &&
|
||||
{getPos _vehicle select 2 > 5}) exitWith {true};
|
||||
false
|
||||
|
@ -22,5 +22,5 @@ private ["_deployedRopes"];
|
||||
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
||||
if ((driver _vehicle != _unit) &&
|
||||
{!(_deployedRopes isEqualTo [])} &&
|
||||
{{!(_x select 5)} count (_deployedRopes) > 0}) exitWith {true};
|
||||
{{!(_x select 6)} count (_deployedRopes) > 0}) exitWith {true};
|
||||
false
|
||||
|
@ -20,10 +20,10 @@ private ["_deployedRopes"];
|
||||
|
||||
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
||||
{
|
||||
_x params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_occupied"];
|
||||
_x params ["", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook"];
|
||||
|
||||
deleteVehicle _ropeTop;
|
||||
[{{deleteVehicle _x} count _this}, [_dummy, _anchor, _ropeBottom], 60] call EFUNC(common,waitAndExecute);
|
||||
[{{deleteVehicle _x} count _this}, [_dummy, _anchor, _ropeBottom, _hook], 60] call EFUNC(common,waitAndExecute);
|
||||
} count _deployedRopes;
|
||||
|
||||
_vehicle setVariable [QGVAR(deployedRopes), [], true];
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_unit", "_vehicle"];
|
||||
private ["_ropeOrigins", "_deployedRopes", "_origin", "_dummy", "_anchor", "_ropeTop", "_ropeBottom"];
|
||||
private ["_ropeOrigins", "_deployedRopes", "_origin", "_dummy", "_anchor", "_hook", "_ropeTop", "_ropeBottom"];
|
||||
|
||||
_ropeOrigins = getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(ropeOrigins));
|
||||
_deployedRopes = [];
|
||||
@ -26,18 +26,22 @@ _deployedRopes = [];
|
||||
|
||||
_dummy = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_dummy allowDamage false;
|
||||
_dummy setPosASL (_origin vectorAdd [0, 0, -2]);
|
||||
_dummy setPosASL (_origin vectorAdd [0, 0, -1]);
|
||||
|
||||
_anchor = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_anchor allowDamage false;
|
||||
_anchor setPosASL (_origin vectorAdd [0, 0, -2.5]);
|
||||
|
||||
_ropeTop = ropeCreate [_vehicle, _x, _dummy, [0, 0, 0], 2];
|
||||
_hook = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_hook allowDamage false;
|
||||
_hook attachTo [_vehicle, _x];
|
||||
|
||||
_ropeTop = ropeCreate [_hook, [0, 0, 0], _dummy, [0, 0, 0], 2];
|
||||
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 33];
|
||||
|
||||
//deployedRopes format: attachment point, top part of the rope, bottom part of the rope, attachTo helper object, anchor helper object, occupied
|
||||
_deployedRopes pushBack [_x, _ropeTop, _ropeBottom, _dummy, _anchor, false];
|
||||
false
|
||||
_deployedRopes pushBack [_x, _ropeTop, _ropeBottom, _dummy, _anchor, _hook, false];
|
||||
true
|
||||
} count _ropeOrigins;
|
||||
|
||||
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
||||
|
@ -24,13 +24,13 @@ _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
||||
_usableRope = _deployedRopes select 0;
|
||||
_usableRopeIndex = 0;
|
||||
{
|
||||
if !(_x select 5) exitWith {
|
||||
if !(_x select 6) exitWith {
|
||||
_usableRope = _x;
|
||||
_usableRopeIndex = _forEachIndex;
|
||||
};
|
||||
} forEach _deployedRopes;
|
||||
|
||||
_usableRope set [5, true];
|
||||
_usableRope set [6, true];
|
||||
_deployedRopes set [_usableRopeIndex, _usableRope];
|
||||
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "script_component.hpp"
|
||||
params ["_arguments", "_pfhHandle"];
|
||||
_arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex"];
|
||||
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_occupied"];
|
||||
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook", "_occupied"];
|
||||
private ["_origin"];
|
||||
|
||||
//Wait until the unit is actually outside of the helicopter
|
||||
@ -29,14 +29,12 @@ if (isNull attachedTo _unit) exitWith {
|
||||
_dummy setVectorUp [0, 0, 1];
|
||||
_unit attachTo [_dummy, [0, 0, -1.2]];
|
||||
[_unit, "ACE_FastRoping", 2] call EFUNC(common,doAnimation);
|
||||
systemChat str _ropeTop;
|
||||
systemChat str _ropeBottom;
|
||||
ropeUnwind [_ropeTop, 6, 35];
|
||||
ropeUnwind [_ropeBottom, 6, 0];
|
||||
};
|
||||
|
||||
//Check if fast rope is finished
|
||||
if (((getPos _unit select 2) < 0.5) || {ropeUnwound _ropeTop} || {vectorMagnitude (velocity _vehicle) > 5}) exitWith {
|
||||
if (((getPos _unit select 2) < 0.2) || {ropeUnwound _ropeTop} || {vectorMagnitude (velocity _vehicle) > 5}) exitWith {
|
||||
detach _unit;
|
||||
[_unit, "", 2] call EFUNC(common,doAnimation);
|
||||
|
||||
@ -47,12 +45,12 @@ if (((getPos _unit select 2) < 0.5) || {ropeUnwound _ropeTop} || {vectorMagnitud
|
||||
_origin = AGLtoASL (_vehicle modelToWorld _attachmentPoint);
|
||||
_dummy setPosASL (_origin vectorAdd [0, 0, -2]);
|
||||
|
||||
_ropeTop = ropeCreate [_vehicle, _attachmentPoint, _dummy, [0, 0, 0], 2];
|
||||
_ropeTop = ropeCreate [_hook, [0, 0, 0], _dummy, [0, 0, 0], 2];
|
||||
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 33];
|
||||
|
||||
//Update deployedRopes array
|
||||
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
||||
_deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _anchor, false]];
|
||||
_deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _anchor, _hook, false]];
|
||||
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
||||
|
||||
[_pfhHandle] call CBA_fnc_removePerFrameHandler;
|
||||
|
Loading…
Reference in New Issue
Block a user