ACE3/addons/towing/functions/fnc_detachChild.sqf
Dystopian b54992b8fc
Towing - Fix some issues (#9007)
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
2024-02-05 15:54:51 -03:00

34 lines
751 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Dystopian
* Detaches child.
* Run globally.
*
* Arguments:
* 0: Child <OBJECT>
*
* Return Value:
* None
*
* Example:
* cursorObject call ace_towing_fnc_detachChild
*
* Public: No
*/
params ["_child"];
TRACE_1("detachChild",_child);
_child setTowParent objNull;
if (!isServer) exitWith {};
_child setVariable [QGVAR(parent), objNull, true];
GVAR(allChildren) = GVAR(allChildren) - [_child];
private _childChildHooks = _child getVariable [QGVAR(childHooks), []];
if (_childChildHooks isEqualTo []) then {
TRACE_1("remove Deleted EH",_child);
_child removeEventHandler ["Deleted", _child getVariable [QGVAR(DeletedEHID), -1]];
_child setVariable [QGVAR(DeletedEHID), -1];
};