Add Stow FRIES interaction (#5533)

* Add stow FRIES interaction
Allows stowing FRIES (retracting the hooks, closing doors) without the need to deploy and cut ropes

* Do not automatically stow FRIES anymore

* Cleanup more privates
This commit is contained in:
jonpas 2017-09-21 16:16:04 +02:00 committed by GitHub
parent 8a0bbf655b
commit 40e4ad3f5a
9 changed files with 72 additions and 18 deletions

View File

@ -45,6 +45,13 @@ class CfgVehicles {
showDisabled = 0; showDisabled = 0;
priority = 1; 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 { class ACE_deployRopes {
displayName = CSTRING(Interaction_deployRopes); displayName = CSTRING(Interaction_deployRopes);
condition = QUOTE([ARR_2(_player, vehicle _player)] call FUNC(canDeployRopes)); condition = QUOTE([ARR_2(_player, vehicle _player)] call FUNC(canDeployRopes));

View File

@ -3,6 +3,7 @@ PREP(canCutRopes);
PREP(canDeployRopes); PREP(canDeployRopes);
PREP(canFastRope); PREP(canFastRope);
PREP(canPrepareFRIES); PREP(canPrepareFRIES);
PREP(canStowFRIES);
PREP(checkVehicleThread); PREP(checkVehicleThread);
PREP(cutRopes); PREP(cutRopes);
PREP(deployAI); PREP(deployAI);
@ -16,3 +17,4 @@ PREP(onCutCommon);
PREP(onPrepareCommon); PREP(onPrepareCommon);
PREP(onRopeBreak); PREP(onRopeBreak);
PREP(prepareFRIES); PREP(prepareFRIES);
PREP(stowFRIES);

View File

@ -0,0 +1,23 @@
/*
* Author: BaerMitUmlaut
* Checks if the unit can stow the helicopters FRIES.
*
* Arguments:
* 0: The helicopter itself <OBJECT>
*
* Return Value:
* Able to stow FRIES <BOOL>
*
* 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)) != ""}

View File

@ -39,14 +39,4 @@ private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
} count _deployedRopes; } count _deployedRopes;
_vehicle setVariable [QGVAR(deployedRopes), [], true]; _vehicle setVariable [QGVAR(deployedRopes), [], true];
_vehicle setVariable [QGVAR(deploymentStage), 1, true]; _vehicle setVariable [QGVAR(deploymentStage), 2, 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;

View File

@ -16,7 +16,6 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle"]; params ["_vehicle"];
private ["_config", "_fries"];
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
if !(isNumber (_config >> QGVAR(enabled))) then { if !(isNumber (_config >> QGVAR(enabled))) then {

View File

@ -18,20 +18,19 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_ehArgs", "_part"]; params ["_ehArgs", "_part"];
_ehArgs params ["_rope", "_helper1", "_helper2"]; _ehArgs params ["_rope", "_helper1", "_helper2"];
private ["_vehicle", "_deployedRopes", "_brokenRope", "_unit"];
if (_part == "bottom") then { if (_part == "bottom") then {
_helper2 = (ropeAttachedObjects _helper1) select 0; _helper2 = (ropeAttachedObjects _helper1) select 0;
}; };
_vehicle = attachedTo _helper2; private _vehicle = attachedTo _helper2;
if (isNil "_vehicle") exitWith {}; //Exit when vehicle got destroyed if (isNil "_vehicle") exitWith {}; //Exit when vehicle got destroyed
if (_vehicle isKindOf "ACE_friesBase") then { if (_vehicle isKindOf "ACE_friesBase") then {
_vehicle = attachedTo _vehicle; _vehicle = attachedTo _vehicle;
}; };
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
_brokenRope = []; private _brokenRope = [];
{ {
if ((_x select 1 == _rope) || {(_x select 2 == _rope)}) exitWith { if ((_x select 1 == _rope) || {(_x select 2 == _rope)}) exitWith {
_brokenRope = _x; _brokenRope = _x;
@ -40,7 +39,7 @@ _brokenRope = [];
_brokenRope set [5, true]; _brokenRope set [5, true];
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
_unit = { private _unit = {
if (_x isKindOf "CAManBase") exitWith {_x}; if (_x isKindOf "CAManBase") exitWith {_x};
} forEach (attachedObjects (_brokenRope select 3)); } forEach (attachedObjects (_brokenRope select 3));

View File

@ -17,7 +17,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle"]; 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]; _vehicle setVariable [QGVAR(deploymentStage), 1, true];
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;

View File

@ -0,0 +1,31 @@
/*
* Author: BaerMitUmlaut
* Stows the helicopters FRIES.
*
* Arguments:
* 0: A helicopter with prepared FRIES <OBJECT>
*
* 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;

View File

@ -46,6 +46,9 @@
<Chinesesimp>准备快速绳降系统</Chinesesimp> <Chinesesimp>准备快速绳降系统</Chinesesimp>
<Chinese>準備快速繩降系統</Chinese> <Chinese>準備快速繩降系統</Chinese>
</Key> </Key>
<Key ID="STR_ACE_Fastroping_Interaction_stowFRIES">
<English>Stow fast roping system</English>
</Key>
<Key ID="STR_ACE_Fastroping_Interaction_deployRopes"> <Key ID="STR_ACE_Fastroping_Interaction_deployRopes">
<English>Deploy ropes</English> <English>Deploy ropes</English>
<German>Seile auswerfen</German> <German>Seile auswerfen</German>