2016-05-30 16:37:03 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
|
|
|
* Returns whether the seeker object can see the target position with lineIntersect
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Arguments:
|
2016-05-30 16:37:03 +00:00
|
|
|
* 0: Seeker [Object]
|
|
|
|
* 1: Target [Object]
|
2016-07-22 01:07:54 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2016-05-30 16:37:03 +00:00
|
|
|
* Boolean
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
2016-07-22 01:07:54 +00:00
|
|
|
|
|
|
|
params ["_seeker", "_target"];
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-06-27 18:43:05 +00:00
|
|
|
if ((isNil "_seeker") || {isNil "_target"}) exitWith {false};
|
|
|
|
|
2016-07-22 01:07:54 +00:00
|
|
|
private _targetPos = getPosASL _target;
|
|
|
|
private _targetAimPos = aimPos _target;
|
|
|
|
private _seekerPos = getPosASL _seeker;
|
|
|
|
private _return = true;
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-07-22 01:07:54 +00:00
|
|
|
if (!((terrainIntersectASL [_seekerPos, _targetPos]) && {terrainIntersectASL [_seekerPos, _targetAimPos]})) then {
|
2016-05-30 16:37:03 +00:00
|
|
|
if(lineIntersects [_seekerPos, _targetPos, _seeker, _target]) then {
|
2016-07-22 01:07:54 +00:00
|
|
|
_return = false;
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
} else {
|
|
|
|
_return = false;
|
|
|
|
};
|
|
|
|
|
2015-04-12 20:02:09 +00:00
|
|
|
_return;
|