2018-11-19 04:33:50 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
|
|
|
* Author: Dystopian
|
|
|
|
* Checks if Free Seats menu can be shown.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Vehicle <OBJECT>
|
|
|
|
* 1: Unit <OBJECT>
|
2019-03-22 02:29:51 +00:00
|
|
|
* 2: Args <ARRAY>
|
2018-11-19 04:33:50 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can show menu <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [cursorObject, player] call ace_quickmount_fnc_canShowFreeSeats
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2019-03-22 02:29:51 +00:00
|
|
|
params ["_vehicle", "_unit", "_args"];
|
2018-11-19 04:33:50 +00:00
|
|
|
|
|
|
|
private _isInVehicle = _unit in _vehicle;
|
|
|
|
|
|
|
|
GVAR(enabled)
|
|
|
|
&& {
|
|
|
|
GVAR(enableMenu) == 3
|
|
|
|
|| {_isInVehicle && {GVAR(enableMenu) == 2}}
|
|
|
|
|| {!_isInVehicle && {GVAR(enableMenu) == 1}}
|
|
|
|
}
|
|
|
|
&& {alive _vehicle}
|
|
|
|
&& {2 > locked _vehicle}
|
2020-09-03 15:56:49 +00:00
|
|
|
&& {simulationEnabled _vehicle}
|
2018-11-19 04:33:50 +00:00
|
|
|
&& {
|
|
|
|
-1 == crew _vehicle findIf {alive _x}
|
|
|
|
|| {0.6 <= side group _unit getFriend side group _vehicle}
|
|
|
|
}
|
|
|
|
&& {
|
|
|
|
0.3 < vectorUp _vehicle select 2 // moveIn* and GetIn* don't work for flipped vehicles
|
|
|
|
|| {_vehicle isKindOf "Air"} // except Air
|
|
|
|
}
|
2019-03-22 02:29:51 +00:00
|
|
|
&& {
|
2021-02-04 17:01:35 +00:00
|
|
|
_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];
|
2021-02-27 17:05:05 +00:00
|
|
|
[] isNotEqualTo _subActions
|
2021-02-04 17:01:35 +00:00
|
|
|
}
|
2019-03-22 02:29:51 +00:00
|
|
|
}
|