Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastroping - Fix deployAI not unwinding ropes #7536

Merged
merged 2 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions addons/fastroping/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,28 @@ class CfgVehicles {
};
class ACE_deployRopes12 {
displayName = CSTRING(Interaction_deployRopes12);
condition = QUOTE([ARR_3(_target, _player, 'ACE_rope12')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope12'))]] call CBA_fnc_serverEvent);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope12')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope12'))]] call CBA_fnc_serverEvent);
};
class ACE_deployRopes15 {
displayName = CSTRING(Interaction_deployRopes15);
condition = QUOTE([ARR_3(_target, _player, 'ACE_rope15')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope15'))]] call CBA_fnc_serverEvent);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope15')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope15'))]] call CBA_fnc_serverEvent);
};
class ACE_deployRopes18 {
displayName = CSTRING(Interaction_deployRopes18);
condition = QUOTE([ARR_3(_target, _player, 'ACE_rope18')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope18'))]] call CBA_fnc_serverEvent);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope18')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope18'))]] call CBA_fnc_serverEvent);
};
class ACE_deployRopes27 {
displayName = CSTRING(Interaction_deployRopes27);
condition = QUOTE([ARR_3(_target, _player, 'ACE_rope27')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope27'))]] call CBA_fnc_serverEvent);
condition = QUOTE([ARR_3(_target,_player,'ACE_rope27')] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope27'))]] call CBA_fnc_serverEvent);
};
class ACE_deployRopes36 {
displayName = CSTRING(Interaction_deployRopes36);
condition = QUOTE([ARR_4(_target, _player, 'ACE_rope36', true)] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope36'))]] call CBA_fnc_serverEvent);
condition = QUOTE([ARR_4(_target,_player,'ACE_rope36',true)] call FUNC(canDeployRopes));
statement = QUOTE([ARR_2(QQGVAR(deployRopes),[ARR_3(_target,_player,'ACE_rope36'))]] call CBA_fnc_serverEvent);
};
class ACE_cutRopes {
displayName = CSTRING(Interaction_cutRopes);
Expand Down
5 changes: 4 additions & 1 deletion addons/fastroping/functions/fnc_deployAI.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ if (_createDeploymentGroup) then {
};

private _deployTime = 0;

if (getText (_config >> QGVAR(onPrepare)) != "") then {
_deployTime = [_vehicle] call (missionNamespace getVariable (getText (_config >> QGVAR(onPrepare))));
};
[{[_this] call FUNC(deployRopes)}, _vehicle, _deployTime] call CBA_fnc_waitAndExecute;

[FUNC(deployRopes), _vehicle, _deployTime] call CBA_fnc_waitAndExecute;

driver _vehicle disableAI "MOVE";

DFUNC(deployAIRecursive) = {
Expand Down
11 changes: 9 additions & 2 deletions addons/fastroping/functions/fnc_deployRopes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*
* Public: No
*/
params ["_vehicle", "_player", "_ropeClass"];

params ["_vehicle", ["_player", objNull], ["_ropeClass", ""]];
TRACE_3("deployRopes",_vehicle,_player,_ropeClass);

private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
Expand All @@ -26,9 +27,15 @@ private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
private _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];

private _ropeLength = getNumber (configfile >> "CfgWeapons" >> _ropeClass >> QGVAR(ropeLength));

if (_ropeLength <= 0) then {
_ropeLength = DEFAULT_ROPE_LENGTH;
};

TRACE_3("",_ropeClass,_ropeLength,GVAR(requireRopeItems));

if (GVAR(requireRopeItems)) then {
if (_ropeClass in (items _player)) then {
if (_ropeClass in (_player call EFUNC(common,uniqueItems))) then {
_player removeItem _ropeClass;
} else {
_vehicle removeItem _ropeClass;
Expand Down
2 changes: 1 addition & 1 deletion addons/fastroping/functions/fnc_fastRopeServerPFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (isNull _hook) exitWith {
[_pfhHandle] call CBA_fnc_removePerFrameHandler;
};

private _ropeLength = _vehicle getVariable [QGVAR(ropeLength), 34.5];
private _ropeLength = _vehicle getVariable [QGVAR(ropeLength), DEFAULT_ROPE_LENGTH];

//Start fast roping
if (getMass _dummy != 80) exitWith {
Expand Down
1 change: 1 addition & 0 deletions addons/fastroping/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "\z\ace\addons\main\script_macros.hpp"

#define DEFAULT_ROPE_LENGTH 34.5

#define ANIMS_HOOK ["extendHookRight", "extendHookLeft"]
#define ANIMS_ANIMATEDOOR ["door_R", "door_L", "CargoRamp_Open", "Door_rear_source", "Door_6_source", "CargoDoorR", "CargoDoorL"]
Expand Down