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 thrown.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can Throw <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
2016-09-02 23:39:34 +00:00
|
|
|
* [unit] call ace_advanced_throwing_fnc_canThrow
|
2016-08-22 13:09:08 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_unit"];
|
|
|
|
|
|
|
|
if !(_unit getVariable [QGVAR(inHand), false]) exitWith {false};
|
|
|
|
|
2024-03-26 12:54:06 +00:00
|
|
|
if (!isNull objectParent _unit) exitWith {
|
2016-08-22 13:09:08 +00:00
|
|
|
private _startPos = eyePos _unit;
|
|
|
|
private _aimLinePos = AGLToASL (positionCameraToWorld [0, 0, 1]);
|
|
|
|
private _intersections = lineIntersectsSurfaces [_startPos, _aimLinePos, _unit, objNull, false];
|
|
|
|
//TRACE_1("Intersections",_intersections);
|
|
|
|
|
|
|
|
(_intersections select {(vehicle _unit) in (_x select 3)}) isEqualTo []
|
|
|
|
};
|
|
|
|
|
|
|
|
true
|