2020-10-04 20:39:52 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
2023-07-20 17:42:35 +00:00
|
|
|
* Author: BaerMitUmlaut, johnb43
|
2020-10-04 20:39:52 +00:00
|
|
|
* Drops a draggable / carryable clone of a dead unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2023-07-20 17:42:35 +00:00
|
|
|
* 0: Unit dragging / carrying <OBJECT>
|
|
|
|
* 1: Clone <OBJECT>
|
|
|
|
* 2: If unit is in building <BOOL>
|
2020-10-04 20:39:52 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2023-07-20 17:42:35 +00:00
|
|
|
* Original unit <OBJECT>
|
2020-10-04 20:39:52 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2023-07-20 17:42:35 +00:00
|
|
|
* [player, cursorObject, false] call ace_dragging_fnc_dropClone;
|
2020-10-04 20:39:52 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2023-07-20 17:42:35 +00:00
|
|
|
params ["_unit", "_clone", "_inBuilding"];
|
2020-10-04 20:39:52 +00:00
|
|
|
|
2023-07-20 17:42:35 +00:00
|
|
|
private _target = _clone getVariable [QGVAR(original), objNull];
|
|
|
|
|
|
|
|
if (isNull _target) exitWith {objNull};
|
|
|
|
|
|
|
|
// Turn on PhysX so that unit is not desync when moving
|
|
|
|
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
|
|
|
|
|
|
|
|
private _posASL = getPosASL _clone;
|
|
|
|
|
|
|
|
if (_inBuilding) then {
|
|
|
|
_posASL = _posASL vectorAdd [0, 0, 0.05];
|
|
|
|
};
|
|
|
|
|
|
|
|
// Set the unit's direction
|
|
|
|
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
|
|
|
|
|
|
|
// Bring unit back to clone's position
|
|
|
|
_target setPosASL _posASL;
|
|
|
|
|
|
|
|
// Turn off PhysX
|
|
|
|
[QEGVAR(common,awake), [_target, false]] call CBA_fnc_globalEvent;
|
2020-10-04 20:39:52 +00:00
|
|
|
|
2020-10-11 18:37:59 +00:00
|
|
|
// Detach first to prevent objNull in attachedObjects
|
2020-10-04 20:39:52 +00:00
|
|
|
detach _clone;
|
|
|
|
deleteVehicle _clone;
|
|
|
|
|
2023-07-20 17:42:35 +00:00
|
|
|
_target
|