2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2017-11-17 22:47:58 +00:00
|
|
|
/*
|
|
|
|
* Author: Dystopian
|
|
|
|
* Checks if unit can pull target body out of vehicle.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 1: Body <OBJECT>
|
|
|
|
* 2: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Able to pull out target body <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [crew cursorObject select 0, player] call ace_interaction_fnc_canPullOutBody
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_body", "_unit"];
|
|
|
|
|
2023-07-22 06:41:20 +00:00
|
|
|
// Defer to ACE Medical's unload patient if present
|
|
|
|
if (["ace_medical"] call EFUNC(common,isModLoaded)) exitWith {false};
|
|
|
|
|
2017-11-17 22:47:58 +00:00
|
|
|
private _vehicle = objectParent _body;
|
|
|
|
|
|
|
|
if (
|
|
|
|
!isNull objectParent _unit
|
|
|
|
|| {alive _body}
|
|
|
|
|| {isNull _vehicle}
|
|
|
|
|| {1 < locked _vehicle}
|
|
|
|
|| {
|
|
|
|
0 < {alive _x} count crew _vehicle // alive is in vehicle
|
|
|
|
// group is used here for situations when side player == ENEMY
|
|
|
|
&& {0.6 > side group _unit getFriend side group _vehicle} // player is enemy
|
|
|
|
}
|
|
|
|
) exitWith {false};
|
|
|
|
|
|
|
|
((fullCrew [_vehicle, ""] select {_body == _x select 0}) select 0) params ["", "", "_cargoIndex", "_turretPath"];
|
|
|
|
|
2021-02-27 17:05:05 +00:00
|
|
|
private _locked = if (_turretPath isNotEqualTo []) then {
|
2017-11-17 22:47:58 +00:00
|
|
|
_vehicle lockedTurret _turretPath;
|
|
|
|
} else {
|
|
|
|
if (_cargoIndex > -1) then {
|
|
|
|
_vehicle lockedCargo _cargoIndex;
|
|
|
|
} else {
|
|
|
|
lockedDriver _vehicle;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
!_locked
|