-
Notifications
You must be signed in to change notification settings - Fork 749
Expand file tree
/
Copy pathfnc_detach.sqf
More file actions
48 lines (37 loc) · 1.3 KB
/
fnc_detach.sqf
File metadata and controls
48 lines (37 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "..\script_component.hpp"
/*
* Author: tcvm
* Detaches child from parent, and gives rope item back
*
* Arguments:
* 0: Parent <OBJECT>
* 1: Child <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject] call ace_towing_fnc_detach
*
* Public: No
*/
params ["_unit", "_parent", "_child"];
TRACE_3("detach",_unit,_parent,_child);
private _hook = _child getVariable [QGVAR(hook), objNull];
_parent removeEventHandler ["Deleted", _hook getVariable QGVAR(parentDeleteEventHandler)];
_hook setVariable [QGVAR(parentDeleteEventHandler), -1];
_child removeEventHandler ["Deleted", _hook getVariable QGVAR(childDeleteEventHandler)];
_hook setVariable [QGVAR(childDeleteEventHandler), -1];
_parent removeEventHandler ["RopeBreak", _parent getVariable QGVAR(ropeBreakEventHandler)];
_parent setVariable [QGVAR(ropeBreakEventHandler), -1];
private _rope = _child getVariable [QGVAR(rope), objNull];
ropeDestroy _rope;
private _ropeClass = _hook getVariable [QGVAR(ropeClass), ""];
deleteVehicle _hook;
TRACE_1("rope",_ropeClass);
if (_ropeClass isNotEqualTo "") then {
[_unit, _ropeClass, true] call CBA_fnc_addItem;
};
[QGVAR(setTowParent), [objNull, _child], _child] call CBA_fnc_targetEvent;
_child setVariable [QGVAR(towing), false, true];
_parent setVariable [QGVAR(towing), false, true];