diff --git a/addons/fastroping/CfgVehicles.hpp b/addons/fastroping/CfgVehicles.hpp index 8ae760773a..6338ce813d 100644 --- a/addons/fastroping/CfgVehicles.hpp +++ b/addons/fastroping/CfgVehicles.hpp @@ -45,6 +45,13 @@ class CfgVehicles { showDisabled = 0; priority = 1; }; + class ACE_stowFRIES { + displayName = CSTRING(Interaction_stowFRIES); + condition = QUOTE([vehicle _player] call FUNC(canStowFRIES)); + statement = QUOTE([vehicle _player] call FUNC(stowFRIES)); + showDisabled = 0; + priority = 1; + }; class ACE_deployRopes { displayName = CSTRING(Interaction_deployRopes); condition = QUOTE([ARR_2(_player, vehicle _player)] call FUNC(canDeployRopes)); diff --git a/addons/fastroping/XEH_PREP.hpp b/addons/fastroping/XEH_PREP.hpp index 99e1c8b817..1ad995c598 100644 --- a/addons/fastroping/XEH_PREP.hpp +++ b/addons/fastroping/XEH_PREP.hpp @@ -3,6 +3,7 @@ PREP(canCutRopes); PREP(canDeployRopes); PREP(canFastRope); PREP(canPrepareFRIES); +PREP(canStowFRIES); PREP(checkVehicleThread); PREP(cutRopes); PREP(deployAI); @@ -16,3 +17,4 @@ PREP(onCutCommon); PREP(onPrepareCommon); PREP(onRopeBreak); PREP(prepareFRIES); +PREP(stowFRIES); diff --git a/addons/fastroping/functions/fnc_canStowFRIES.sqf b/addons/fastroping/functions/fnc_canStowFRIES.sqf new file mode 100644 index 0000000000..655d5776b8 --- /dev/null +++ b/addons/fastroping/functions/fnc_canStowFRIES.sqf @@ -0,0 +1,23 @@ +/* + * Author: BaerMitUmlaut + * Checks if the unit can stow the helicopters FRIES. + * + * Arguments: + * 0: The helicopter itself + * + * Return Value: + * Able to stow FRIES + * + * Example: + * [_vehicle] call ace_fastroping_fnc_canStowFRIES + * + * Public: No + */ + +#include "script_component.hpp" +params ["_vehicle"]; + +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + +(_vehicle getVariable [QGVAR(deploymentStage), 0]) == 2 && +{getText (_config >> QGVAR(onCut)) != ""} diff --git a/addons/fastroping/functions/fnc_cutRopes.sqf b/addons/fastroping/functions/fnc_cutRopes.sqf index 146364d502..2b3aaa8a8d 100644 --- a/addons/fastroping/functions/fnc_cutRopes.sqf +++ b/addons/fastroping/functions/fnc_cutRopes.sqf @@ -39,14 +39,4 @@ private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; } count _deployedRopes; _vehicle setVariable [QGVAR(deployedRopes), [], true]; -_vehicle setVariable [QGVAR(deploymentStage), 1, true]; - -private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; -private _waitTime = 0; -if (isText (_config >> QGVAR(onCut))) then { - _waitTime = [_vehicle] call (missionNamespace getVariable (getText (_config >> QGVAR(onCut)))); -}; - -[{ - _this setVariable [QGVAR(deploymentStage), 0, true]; -}, _vehicle, _waitTime] call CBA_fnc_waitAndExecute; +_vehicle setVariable [QGVAR(deploymentStage), 2, true]; diff --git a/addons/fastroping/functions/fnc_equipFRIES.sqf b/addons/fastroping/functions/fnc_equipFRIES.sqf index 60c15e4e6c..1cc3202619 100644 --- a/addons/fastroping/functions/fnc_equipFRIES.sqf +++ b/addons/fastroping/functions/fnc_equipFRIES.sqf @@ -16,7 +16,6 @@ #include "script_component.hpp" params ["_vehicle"]; -private ["_config", "_fries"]; private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; if !(isNumber (_config >> QGVAR(enabled))) then { diff --git a/addons/fastroping/functions/fnc_onRopeBreak.sqf b/addons/fastroping/functions/fnc_onRopeBreak.sqf index 29da355481..3c83daea30 100644 --- a/addons/fastroping/functions/fnc_onRopeBreak.sqf +++ b/addons/fastroping/functions/fnc_onRopeBreak.sqf @@ -18,20 +18,19 @@ #include "script_component.hpp" params ["_ehArgs", "_part"]; _ehArgs params ["_rope", "_helper1", "_helper2"]; -private ["_vehicle", "_deployedRopes", "_brokenRope", "_unit"]; if (_part == "bottom") then { _helper2 = (ropeAttachedObjects _helper1) select 0; }; -_vehicle = attachedTo _helper2; +private _vehicle = attachedTo _helper2; if (isNil "_vehicle") exitWith {}; //Exit when vehicle got destroyed if (_vehicle isKindOf "ACE_friesBase") then { _vehicle = attachedTo _vehicle; }; -_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; -_brokenRope = []; +private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; +private _brokenRope = []; { if ((_x select 1 == _rope) || {(_x select 2 == _rope)}) exitWith { _brokenRope = _x; @@ -40,7 +39,7 @@ _brokenRope = []; _brokenRope set [5, true]; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; -_unit = { +private _unit = { if (_x isKindOf "CAManBase") exitWith {_x}; } forEach (attachedObjects (_brokenRope select 3)); diff --git a/addons/fastroping/functions/fnc_prepareFRIES.sqf b/addons/fastroping/functions/fnc_prepareFRIES.sqf index 3c3448d03c..7b98b5ff63 100644 --- a/addons/fastroping/functions/fnc_prepareFRIES.sqf +++ b/addons/fastroping/functions/fnc_prepareFRIES.sqf @@ -17,7 +17,7 @@ #include "script_component.hpp" params ["_vehicle"]; -//Stage indicator: 0 - travel mode; 1 - preparing FRIES; 2 - FRIES ready; 3 - ropes deployed +//Stage indicator: 0 - travel mode; 1 - preparing/stowing FRIES; 2 - FRIES ready; 3 - ropes deployed _vehicle setVariable [QGVAR(deploymentStage), 1, true]; private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; diff --git a/addons/fastroping/functions/fnc_stowFRIES.sqf b/addons/fastroping/functions/fnc_stowFRIES.sqf new file mode 100644 index 0000000000..18813295d8 --- /dev/null +++ b/addons/fastroping/functions/fnc_stowFRIES.sqf @@ -0,0 +1,31 @@ +/* + * Author: BaerMitUmlaut + * Stows the helicopters FRIES. + * + * Arguments: + * 0: A helicopter with prepared FRIES + * + * Return Value: + * None + * + * Example: + * [_vehicle] call ace_fastroping_fnc_stowFRIES + * + * Public: No + */ + +#include "script_component.hpp" +params ["_vehicle"]; + +//Stage indicator: 0 - travel mode; 1 - preparing/stowing FRIES; 2 - FRIES ready; 3 - ropes deployed +_vehicle setVariable [QGVAR(deploymentStage), 1, true]; + +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _waitTime = 0; +if (isText (_config >> QGVAR(onCut))) then { + _waitTime = [_vehicle] call (missionNamespace getVariable (getText (_config >> QGVAR(onCut)))); +}; + +[{ + _this setVariable [QGVAR(deploymentStage), 0, true]; +}, _vehicle, _waitTime] call CBA_fnc_waitAndExecute; diff --git a/addons/fastroping/stringtable.xml b/addons/fastroping/stringtable.xml index f3988ee14f..26601b894d 100644 --- a/addons/fastroping/stringtable.xml +++ b/addons/fastroping/stringtable.xml @@ -46,6 +46,9 @@ 准备快速绳降系统 準備快速繩降系統 + + Stow fast roping system + Deploy ropes Seile auswerfen