2016-08-22 13:09:08 +00:00
|
|
|
/*
|
|
|
|
* Author: Jonpas
|
|
|
|
* Checks if a throwable can be prepared.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
2016-09-05 18:23:03 +00:00
|
|
|
* 1: Pick Up <BOOL> (default: false)
|
2016-08-22 13:09:08 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can Prepare <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
2016-09-02 23:39:34 +00:00
|
|
|
* [unit] call ace_advanced_throwing_fnc_canPrepare
|
2016-08-22 13:09:08 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-09-05 18:23:03 +00:00
|
|
|
params ["_unit", ["_pickUp", false]];
|
|
|
|
|
|
|
|
// Don't delay when picking up
|
|
|
|
if (_pickUp) then {
|
|
|
|
_unit setVariable [QGVAR(lastThrownTime), -1];
|
|
|
|
};
|
2016-08-22 13:09:08 +00:00
|
|
|
|
|
|
|
GVAR(enabled) &&
|
|
|
|
|
2016-09-05 18:23:03 +00:00
|
|
|
#ifdef ALLOW_QUICK_THROW
|
2016-08-22 13:09:08 +00:00
|
|
|
{true} &&
|
2016-09-05 18:23:03 +00:00
|
|
|
#else
|
|
|
|
{_unit getVariable [QGVAR(lastThrownTime), CBA_missionTime - 3] < CBA_missionTime - 2} && // Prevent throwing in quick succession
|
2016-08-22 13:09:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
{!(call EFUNC(common,isFeatureCameraActive))} &&
|
|
|
|
{!EGVAR(common,isReloading)} &&
|
|
|
|
{[_unit, objNull, ["isNotInside", "isNotSitting"/*, "isNotOnLadder"*/]] call EFUNC(common,canInteractWith)} && // Ladder needs positioning fixes on throw
|
|
|
|
{_unit call CBA_fnc_canUseWeapon} // Disable in non-FFV seats due to surface detection issues
|