2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-09 12:53:13 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
2023-07-23 23:07:37 +00:00
|
|
|
* Handles consciousness change of a unit while dragging / carrying.
|
2015-08-09 12:53:13 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2023-07-23 23:07:37 +00:00
|
|
|
* [player] call ace_dragging_fnc_handleUnconscious;
|
2015-08-09 12:53:13 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-03-24 18:07:39 +00:00
|
|
|
|
2015-08-09 12:53:13 +00:00
|
|
|
params ["_unit"];
|
2015-03-24 18:07:39 +00:00
|
|
|
|
2016-01-28 18:52:53 +00:00
|
|
|
private _player = ACE_player;
|
2015-03-24 18:07:39 +00:00
|
|
|
|
2015-03-25 12:32:59 +00:00
|
|
|
if (_player getVariable [QGVAR(isDragging), false]) then {
|
2016-01-28 18:52:53 +00:00
|
|
|
private _draggedObject = _player getVariable [QGVAR(draggedObject), objNull];
|
2015-03-25 12:32:59 +00:00
|
|
|
|
2023-07-23 23:07:37 +00:00
|
|
|
// Handle falling unconscious
|
2015-03-25 12:32:59 +00:00
|
|
|
if (_unit == _player) then {
|
|
|
|
[_unit, _draggedObject] call FUNC(dropObject);
|
|
|
|
};
|
|
|
|
|
2023-07-23 23:07:37 +00:00
|
|
|
// Handle waking up dragged unit
|
2016-10-05 22:54:57 +00:00
|
|
|
if (_unit == _draggedObject) then {
|
|
|
|
[_player, _draggedObject] call FUNC(dropObject);
|
|
|
|
};
|
2015-03-24 18:07:39 +00:00
|
|
|
};
|
|
|
|
|
2015-03-25 12:32:59 +00:00
|
|
|
if (_player getVariable [QGVAR(isCarrying), false]) then {
|
2016-01-28 18:52:53 +00:00
|
|
|
private _carriedObject = _player getVariable [QGVAR(carriedObject), objNull];
|
2015-03-25 12:32:59 +00:00
|
|
|
|
2023-07-23 23:07:37 +00:00
|
|
|
// Handle falling unconscious
|
2015-03-25 12:32:59 +00:00
|
|
|
if (_unit == _player) then {
|
|
|
|
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
|
|
|
};
|
|
|
|
|
2023-07-23 23:07:37 +00:00
|
|
|
// Handle waking up dragged unit
|
2016-10-05 22:54:57 +00:00
|
|
|
if (_unit == _carriedObject) then {
|
|
|
|
[_player, _carriedObject] call FUNC(dropObject_carry);
|
|
|
|
};
|
2015-03-24 18:07:39 +00:00
|
|
|
};
|