ACE3/addons/common/functions/fnc_loadPersonLocal.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

64 lines
1.7 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal
* Load a person, local
*
* Arguments:
* 0: unit to be loaded <OBJECT>
* 1: vehicle that will beloaded <OBJECT>
* 2: caller that will load <OBJECT>
*
* Return Value:
* None
*
* Example:
* [bob, car, kevin] call ace_common_fnc_loadPersonLocal
*
* Public: Yes
*/
params ["_unit", "_vehicle", "_caller"];
// if (!alive _unit) then {
// _unit = [_unit, _caller] call makeCopyOfBody; //func does not exist
// };
private _slotsOpen = false;
if (_vehicle emptyPositions "cargo" > 0) then {
_unit moveInCargo _vehicle;
_slotsOpen = true;
} else {
if (_vehicle emptyPositions "gunner" > 0) then {
_unit moveInGunner _vehicle;
_slotsOpen = true;
};
};
if (_slotsOpen) then {
private _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]];
_loaded pushBack _unit;
_vehicle setVariable [QGVAR(loaded_persons), _loaded, true];
if !([_unit] call FUNC(isAwake)) then {
[{
(_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;
};
};
_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;
};
};