2015-03-01 09:44:08 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Action for unloading an unconscious or dead unit from a vechile
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The medic <OBJECT>
|
|
|
|
* 1: The patient <OBJECT>
|
|
|
|
* 2: Drag after unload <BOOL> <OPTIONAL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* NONE
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-30 06:17:26 +00:00
|
|
|
private ["_caller", "_target", "_drag"];
|
2015-03-01 09:44:08 +00:00
|
|
|
_caller = _this select 0;
|
|
|
|
_target = _this select 1;
|
|
|
|
_drag = if (count _this > 2) then {_this select 2} else {false};
|
|
|
|
|
|
|
|
// cannot unload a unit not in a vehicle.
|
|
|
|
if (vehicle _target == _target) exitwith {};
|
|
|
|
if (([_target] call cse_fnc_isAwake)) exitwith {};
|
|
|
|
|
2015-04-30 18:44:43 +00:00
|
|
|
if ([_target] call EFUNC(common,unloadPerson)) then {
|
2015-03-01 09:44:08 +00:00
|
|
|
if (_drag) then {
|
|
|
|
if ((vehicle _caller) == _caller) then {
|
2015-03-12 20:16:49 +00:00
|
|
|
[[_caller, _target, true], QUOTE(DFUNC(actionDragUnit)), _caller, false] call EFUNC(common,execRemoteFnc); // TODO replace by event
|
2015-03-01 09:44:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|