ACE3/addons/quickmount/functions/fnc_canShowFreeSeats.sqf
Dystopian e8c3be8016 Quick Mount - Add Get In and Change seat action menu (#5745)
* Add quickmount GetIn menu

* Add compartment support

* Check engine, check pilot, check static turret driver

* Add doc, condition, translation

* Add hybrid config entries, fix MP issue

* Optimize condition

* Ignore Enabled setting in vehicle

* Work around SQF validator macro issue

* Fix config macro entries

* Add workaround for getting damage when seat changing while moving

* Add setting for Get In menu disabling

* Fix race when 2 players try to get the same seat

* Convert if-else to switch

* Decrease move-back timeout to 0.5s

* Check if vehicle is flipped

* Add getin statement for parent menu

* Improve canShowFreeSeats

* Apply latest trends

* Improve fnc_addFreeSeatsActions

* Change copilot and gunless turret icons

* Fix macro name

* Fix FFV icon

* Optimize turret icon code

* Extend setting to 4 values

* Fix menu is shown when vehicle is full

* Optimize UAV checking code

* Fix bug with disabled FFV turrets

* Remove bugged FFV, Add turret locality check, Add Failed message

* Replace some macros with function

* Fix validator

* Remove global variables, Add debug
2018-11-18 22:33:50 -06:00

40 lines
937 B
Plaintext

#include "script_component.hpp"
/*
* Author: Dystopian
* Checks if Free Seats menu can be shown.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* Can show menu <BOOL>
*
* Example:
* [cursorObject, player] call ace_quickmount_fnc_canShowFreeSeats
*
* Public: No
*/
params ["_vehicle", "_unit"];
private _isInVehicle = _unit in _vehicle;
GVAR(enabled)
&& {
GVAR(enableMenu) == 3
|| {_isInVehicle && {GVAR(enableMenu) == 2}}
|| {!_isInVehicle && {GVAR(enableMenu) == 1}}
}
&& {alive _vehicle}
&& {2 > locked _vehicle}
&& {
-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
}
&& {!([] isEqualTo (_this call FUNC(addFreeSeatsActions)))} // this should be replaced with faster function