ACE3/addons/dragging/functions/fnc_handleUnconscious.sqf

49 lines
1.1 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
2015-08-09 12:53:13 +00:00
/*
* Author: commy2
* 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:
* [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
// Handle falling unconscious
2015-03-25 12:32:59 +00:00
if (_unit == _player) then {
[_unit, _draggedObject] call FUNC(dropObject);
};
// Handle waking up dragged unit
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
// Handle falling unconscious
2015-03-25 12:32:59 +00:00
if (_unit == _player) then {
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
// Handle waking up dragged unit
if (_unit == _carriedObject) then {
[_player, _carriedObject] call FUNC(dropObject_carry);
};
2015-03-24 18:07:39 +00:00
};