mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
0e1f2828a9
* Rename Advanced Throwing component to be in-line with other advanced_ components * Rename wiki page as well * Add redirect from old wiki page
32 lines
723 B
Plaintext
32 lines
723 B
Plaintext
/*
|
|
* Author: Jonpas
|
|
* Checks if a throwable can be thrown.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* Can Throw <BOOL>
|
|
*
|
|
* Example:
|
|
* [unit] call ace_advanced_throwing_fnc_canThrow
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
params ["_unit"];
|
|
|
|
if !(_unit getVariable [QGVAR(inHand), false]) exitWith {false};
|
|
|
|
if (vehicle _unit != _unit) exitWith {
|
|
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
|