2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-08-22 13:09:08 +00:00
|
|
|
/*
|
|
|
|
* Author: Jonpas
|
|
|
|
* Checks if a throwable can be prepared.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
2016-09-09 09:00:30 +00:00
|
|
|
* 1: Ignore Last Thrown Time <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
|
|
|
|
*/
|
|
|
|
|
2016-09-09 09:00:30 +00:00
|
|
|
params ["_unit", ["_ignoreLastThrownTime", false]];
|
2016-09-05 18:23:03 +00:00
|
|
|
|
|
|
|
// Don't delay when picking up
|
2016-09-09 09:00:30 +00:00
|
|
|
if (_ignoreLastThrownTime) then {
|
2016-09-05 18:23:03 +00:00
|
|
|
_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
|
|
|
|
|
2018-10-12 12:59:40 +00:00
|
|
|
{(call CBA_fnc_getActiveFeatureCamera) isEqualTo ""} &&
|
2017-08-22 18:30:56 +00:00
|
|
|
{[_unit, objNull, ["isNotInside", "isNotSwimming", "isNotSitting"/*, "isNotOnLadder"*/]] call EFUNC(common,canInteractWith)} && // Ladder needs positioning fixes on throw
|
2017-12-07 17:26:21 +00:00
|
|
|
{_unit call CBA_fnc_canUseWeapon} && // Disable in non-FFV seats due to surface detection issues
|
|
|
|
{"" == currentWeapon _unit || {currentWeapon _unit != secondaryWeapon _unit}} &&
|
2018-01-30 16:54:34 +00:00
|
|
|
{0 >= _unit getVariable [QEGVAR(common,effect_blockThrow), 0]} &&
|
|
|
|
{isNull (ACE_controlledUAV select 0)}
|