ACE3/addons/quickmount/functions/fnc_canShowFreeSeats.sqf
johnb432 cf8c847811
Interaction - Add crew status check for some vehicle interactions (#9637)
* Added check for crew status

If a one or more passenger in a vehicle are conscious, not captive and hostile to the interacting unit, the interactions (passenger, cargo) will not appear.

* Update fnc_canInteractWithVehicleCrew.sqf

* Update fnc_canInteractWithVehicleCrew.sqf
2023-11-11 09:03:32 -03:00

51 lines
1.2 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: Dystopian
* Checks if Free Seats menu can be shown.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Unit <OBJECT>
* 2: Args <ARRAY>
*
* Return Value:
* Can show menu <BOOL>
*
* Example:
* [cursorObject, player] call ace_quickmount_fnc_canShowFreeSeats
*
* Public: No
*/
params ["_vehicle", "_unit", "_args"];
private _isInVehicle = _unit in _vehicle;
GVAR(enabled)
&& {
GVAR(enableMenu) == 3
|| {_isInVehicle && {GVAR(enableMenu) == 2}}
|| {!_isInVehicle && {GVAR(enableMenu) == 1}}
}
&& {alive _vehicle}
&& {2 > locked _vehicle}
&& {isNull getConnectedUAVUnit _unit}
&& {simulationEnabled _vehicle}
&& {
[_unit, _vehicle] call EFUNC(interaction,canInteractWithVehicleCrew)
}
&& {
0.3 < vectorUp _vehicle select 2 // moveIn* and GetIn* don't work for flipped vehicles
|| {_vehicle isKindOf "Air"} // except Air
}
&& {
_isInVehicle
|| {
// because Get In action has its own statement
// we have to cache subactions in args and reuse them in insertChildren code
private _subActions = _this call FUNC(addFreeSeatsActions);
_args set [0, _subActions];
[] isNotEqualTo _subActions
}
}