mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
dbe372cb48
* Code cleanup * Moved keybinds to initKeybinds.sqf * Update addons/dragging/initKeybinds.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/dragging/functions/fnc_carryObject.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/dragging/functions/fnc_getWeight.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Rephrasing and adjustments for dragging --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: commy2
|
|
* Handles consciousness change of a unit while dragging / carrying.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player] call ace_dragging_fnc_handleUnconscious;
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_unit"];
|
|
|
|
private _player = ACE_player;
|
|
|
|
if (_player getVariable [QGVAR(isDragging), false]) then {
|
|
private _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);
|
|
};
|
|
};
|
|
|
|
if (_player getVariable [QGVAR(isCarrying), false]) then {
|
|
private _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);
|
|
};
|
|
};
|