ACE3/addons/dragging/functions/fnc_handleUnconscious.sqf

47 lines
1.2 KiB
Plaintext
Raw Normal View History

2015-03-24 18:07:39 +00:00
// by commy2
#include "script_component.hpp"
private ["_unit", "_isUnconscious"];
_unit = _this select 0;
_isUnconscious = _this select 1;
private "_player";
_player = ACE_player;
if ((_unit getHitPointDamage "HitLeftLeg") + (_unit getHitPointDamage "HitRightLeg") > 0.4) exitwith {};
2015-03-25 12:32:59 +00:00
if (_player getVariable [QGVAR(isDragging), false]) then {
2015-03-24 18:07:39 +00:00
2015-03-25 12:32:59 +00:00
private "_draggedObject";
_draggedObject = _player getVariable [QGVAR(draggedObject), objNull];
// handle falling unconscious
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 {
private "_carriedObject";
_carriedObject = _player getVariable [QGVAR(carriedObject), objNull];
// handle falling unconscious
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
};