Skip to content

Commit

Permalink
Fastroping - Remove FRIES on vehicle deletion / adjust Ghosthawk Fries (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
veteran29 authored and PabstMirror committed Apr 25, 2019
1 parent 83cd316 commit cc22e95
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 36 deletions.
2 changes: 1 addition & 1 deletion addons/fastroping/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion addons/fastroping/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ PREP(canDeployRopes);
PREP(canFastRope);
PREP(canPrepareFRIES);
PREP(canStowFRIES);
PREP(checkVehicleThread);
PREP(cutRopes);
PREP(deployAI);
PREP(deployRopes);
Expand All @@ -18,3 +17,4 @@ PREP(onPrepareCommon);
PREP(onRopeBreak);
PREP(prepareFRIES);
PREP(stowFRIES);
PREP(unequipFRIES);
24 changes: 0 additions & 24 deletions addons/fastroping/functions/fnc_checkVehicleThread.sqf

This file was deleted.

13 changes: 3 additions & 10 deletions addons/fastroping/functions/fnc_equipFRIES.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Example:
* [_vehicle] call ace_fastroping_fnc_equipFRIES
*
* Public: No
* Public: Yes
*/
params ["_vehicle"];

Expand All @@ -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)];
};
};
24 changes: 24 additions & 0 deletions addons/fastroping/functions/fnc_unequipFRIES.sqf
Original file line number Diff line number Diff line change
@@ -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);
};
20 changes: 20 additions & 0 deletions docs/wiki/framework/fastroping-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cc22e95

Please sign in to comment.