ACE3/addons/interaction/functions/fnc_pullOutBody.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.6 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Dystopian
* Makes unit pull target body out of vehicle.
*
* Arguments:
* 0: Body <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [crew cursorObject select 0, player] call ace_interaction_fnc_pullOutBody
*
* Public: No
*/
params ["_body", "_unit"];
private _vehicle = objectParent _body; // vehicle command doesn't work for dead
// get target crew properties
private ["_cargoIndex", "_turretPath"];
private _cargoNumber = -1;
{
if ("cargo" == _x select 1) then {
INC(_cargoNumber);
};
if (_body == _x select 0) exitWith {
_cargoIndex = _x select 2;
_turretPath = _x select 3;
};
} forEach fullCrew [_vehicle, "", true];
TRACE_3("",_cargoIndex,_cargoNumber,_turretPath);
private _preserveEngineOn = false;
// first get in to target seat
if (!(_turretPath isEqualTo [])) then {
_unit action ["GetInTurret", _vehicle, _turretPath];
} else {
if (_cargoIndex > -1) then {
_unit action ["GetInCargo", _vehicle, _cargoNumber];
} else {
_unit action ["GetInDriver", _vehicle];
_preserveEngineOn = isEngineOn _vehicle;
};
};
// then get out
[
{(_this select 0) in (_this select 1)},
{
params ["_unit", "_vehicle", "_preserveEngineOn"];
TRACE_3("",_unit,_vehicle,_preserveEngineOn);
_unit action ["GetOut", _vehicle];
if (_preserveEngineOn) then {
[{isNull driver _this}, {_this engineOn true}, _vehicle] call CBA_fnc_waitUntilAndExecute;
};
},
[_unit, _vehicle, _preserveEngineOn]
] call CBA_fnc_waitUntilAndExecute;