2015-01-16 23:21:47 +00:00
|
|
|
/**
|
|
|
|
* fn_loadPersonLocal_f.sqf
|
|
|
|
* @Descr: Load a person, local
|
|
|
|
* @Author: Glowbal
|
|
|
|
*
|
|
|
|
* @Arguments: [unit OBJECT, vehicle OBJECT, caller OBJECT]
|
|
|
|
* @Return: void
|
|
|
|
* @PublicAPI: false
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-07-27 01:20:36 +00:00
|
|
|
private ["_unit","_vehicle","_caller","_handle","_loaded","_slotsOpen"];
|
2015-01-16 23:21:47 +00:00
|
|
|
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
|
|
|
_vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
|
|
|
_caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
2015-07-27 01:20:36 +00:00
|
|
|
_slotsOpen = false;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
if (!alive _unit) then {
|
2015-02-14 19:29:07 +00:00
|
|
|
_unit = [_unit,_caller] call FUNC(makeCopyOfBody);
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-07-27 01:20:36 +00:00
|
|
|
|
|
|
|
if (_vehicle emptyPositions "cargo" > 0) then {
|
|
|
|
_unit moveInCargo _vehicle;
|
|
|
|
_slotsOpen = true;
|
2015-01-16 23:21:47 +00:00
|
|
|
} else {
|
2015-07-27 01:20:36 +00:00
|
|
|
if (_vehicle emptyPositions "gunner" > 0) then {
|
|
|
|
_unit moveInGunner _vehicle;
|
|
|
|
_slotsOpen = true;
|
|
|
|
};
|
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-07-27 01:20:36 +00:00
|
|
|
if (_slotsOpen) then {
|
|
|
|
_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]];
|
|
|
|
_loaded pushback _unit;
|
|
|
|
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
|
|
|
if (!([_unit] call FUNC(isAwake))) then {
|
|
|
|
_handle = [_unit,_vehicle] spawn {
|
|
|
|
private ["_unit","_vehicle"];
|
|
|
|
_unit = _this select 0;
|
|
|
|
_vehicle = _this select 1;
|
|
|
|
waituntil {vehicle _unit == _vehicle};
|
|
|
|
sleep 0.5;
|
|
|
|
|
|
|
|
//Save the "awake" animation before applying the death animation
|
|
|
|
if (vehicle _unit == _vehicle) then {
|
|
|
|
_unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, (animationState _unit)]];
|
|
|
|
};
|
|
|
|
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
if ([_unit] call FUNC(isArrested)) then {
|
|
|
|
|
|
|
|
};
|
2015-01-18 19:09:19 +00:00
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|