2015-09-18 16:28:19 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Load a person, local
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-18 16:28:19 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: unit to be loaded <OBJECT>
|
|
|
|
* 1: vehicle that will beloaded <OBJECT>
|
|
|
|
* 2: caller that will load <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: Yes
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-18 16:28:19 +00:00
|
|
|
params ["_unit", "_vehicle", "_caller"];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
if (!alive _unit) then {
|
2015-09-18 16:28:19 +00:00
|
|
|
_unit = [_unit, _caller] call FUNC(makeCopyOfBody);
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-09-18 16:28:19 +00:00
|
|
|
private "_slotsOpen";
|
|
|
|
|
|
|
|
_slotsOpen = false;
|
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 {
|
2015-09-18 16:28:19 +00:00
|
|
|
private "_loaded";
|
|
|
|
_loaded = _vehicle getVariable [QGVAR(loaded_persons),[]];
|
|
|
|
_loaded pushBack _unit;
|
|
|
|
|
|
|
|
_vehicle setVariable [QGVAR(loaded_persons), _loaded, true];
|
|
|
|
|
2015-09-18 17:12:38 +00:00
|
|
|
// @todo never used. Remove?
|
|
|
|
/*if !([_unit] call FUNC(isAwake)) then {
|
2015-09-18 16:28:19 +00:00
|
|
|
[{
|
|
|
|
(_this select 0) params ["_unit", "_vehicle"];
|
|
|
|
|
|
|
|
// wait until the unit is in the vehicle
|
|
|
|
if (vehicle _unit != _vehicle) exitWith {
|
|
|
|
// kill this pfh if either one is deleted
|
|
|
|
if (isNull _unit || isNull _vehicle) then {
|
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
|
|
|
};
|
2015-07-27 01:20:36 +00:00
|
|
|
};
|
|
|
|
|
2015-09-18 16:28:19 +00:00
|
|
|
_unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, animationState _unit]];
|
|
|
|
|
|
|
|
[_unit, [_unit] call FUNC(getDeathAnim), 1, true] call FUNC(doAnimation);
|
|
|
|
|
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
|
|
|
}, 0.5, [_unit, _vehicle]] call CBA_fnc_addPerFrameHandler;
|
2015-09-18 17:12:38 +00:00
|
|
|
};*/
|
2015-09-18 16:28:19 +00:00
|
|
|
};
|