Fastroping - Remove FRIES on vehicle deletion / adjust Ghosthawk Fries (#6932)

* fastroping_fnc_deequipFRIES, remove FRIES on vehicle deletion

* Prevent FRIES from clipping into Ghost Hawk right door

* UNequipFRIES

* Remove fastroping checkVehicleThread

* Document FRIES equip and unequip functions
This commit is contained in:
Filip Maciejewski 2019-04-25 20:31:36 +02:00 committed by PabstMirror
parent 83cd316b2e
commit cc22e95012
6 changed files with 49 additions and 36 deletions

View File

@ -207,7 +207,7 @@ class CfgVehicles {
GVAR(enabled) = 2;
GVAR(ropeOrigins)[] = {"ropeOriginRight", "ropeOriginLeft"};
GVAR(friesType) = "ACE_friesAnchorBar";
GVAR(friesAttachmentPoint)[] = {0.065, 2.2, -0.15};
GVAR(friesAttachmentPoint)[] = {0.035, 2.2, -0.15};
GVAR(onPrepare) = QFUNC(onPrepareCommon);
GVAR(onCut) = QFUNC(onCutCommon);
EQUIP_FRIES_ATTRIBUTE;

View File

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

View File

@ -1,24 +0,0 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Checks if the given helicopter still exits, and if not, destroys the FRIES.
*
* Arguments:
* 0: The helicopter <OBJECT>
* 1: The helicopter's FRIES <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_vehicle, _fries] call ace_fastroping_fnc_checkVehicleThread
*
* Public: No
*/
params ["_vehicle", "_fries"];
if (isNull _vehicle) then {
deleteVehicle _fries;
} else {
[FUNC(checkVehicleThread), _this, 5] call CBA_fnc_waitAndExecute;
};

View File

@ -12,7 +12,7 @@
* Example:
* [_vehicle] call ace_fastroping_fnc_equipFRIES
*
* Public: No
* Public: Yes
*/
params ["_vehicle"];
@ -24,15 +24,8 @@ if !(isNumber (_config >> QGVAR(enabled))) then {
private _fries = (getText (_config >> QGVAR(friesType))) createVehicle [0, 0, 0];
_fries attachTo [_vehicle, (getArray (_config >> QGVAR(friesAttachmentPoint)))];
_vehicle setVariable [QGVAR(FRIES), _fries, true];
_vehicle addEventHandler ["Killed", {
params ["_vehicle"];
deleteVehicle (_vehicle getVariable [QGVAR(FRIES), objNull]);
_vehicle setVariable [QGVAR(FRIES), nil, true];
if !((_vehicle getVariable [QGVAR(deployedRopes), []] isEqualTo [])) then {
[_vehicle] call FUNC(cutRopes);
};
}];
[FUNC(checkVehicleThread), [_vehicle, _fries], 5] call CBA_fnc_waitAndExecute;
_vehicle addEventHandler ["Killed", FUNC(unequipFRIES)];
_vehicle addEventHandler ["Deleted", FUNC(unequipFRIES)];
};
};

View File

@ -0,0 +1,24 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Removes FRIES from helicopter.
*
* Arguments:
* 0: The helicopter <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_vehicle] call ace_fastroping_fnc_unequipFRIES
*
* Public: Yes
*/
params ["_vehicle"];
deleteVehicle (_vehicle getVariable [QGVAR(FRIES), objNull]);
_vehicle setVariable [QGVAR(FRIES), nil, true];
if !((_vehicle getVariable [QGVAR(deployedRopes), []] isEqualTo [])) then {
[_vehicle] call FUNC(cutRopes);
};

View File

@ -80,3 +80,23 @@ To create a custom FRIES you will need to look out for a few things:
The `onCut` and `onPrepare` functions are responsible for opening/closing the helicopter doors and animating the FRIES (if equipped) when the FRIES gets prepared and the ropes get cut.
ACE3 provides two functions that are compatible with most helicopters and all ACE3 FRIES. It is recommended to use the naming scheme for doors that is present in the base game so you can use the already existing functions `ace_fastroping_fnc_onCutCommon` and `ace_fastroping_fnc_onPrepareCommon`. You can however define your own functions if you so desire. Note that these functions run in the unscheduled environment, so commands like `sleep` and `waitUntil` will not work unless you use `spawn`. It is recommended to use `ace_common_fnc_waitAndExecute` and `ace_common_fnc_waitUntilAndExecute` instead though.
## 4. Scripting
### 4.1. Add FRIES to helicopter
`ace_fastroping_fnc_equipFRIES`
| | Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Helicopter | Object | Required
**R** | None | None | Return value
### 4.2. Remove FRIES from helicopter
`ace_fastroping_fnc_unequipFRIES`
| | Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Helicopter | Object | Required
**R** | None | None | Return value