Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interaction - Simplify pulling out bodies #10092

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 2 additions & 44 deletions addons/interaction/functions/fnc_pullOutBody.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Arguments:
* 0: Body <OBJECT>
* 1: Unit <OBJECT>
* 1: Unit (not used) <OBJECT>
*
* Return Value:
* None
Expand All @@ -18,46 +18,4 @@

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 isNotEqualTo []) 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;
moveOut _body;
Loading