ACE3/addons/laser/functions/fnc_checkLos.sqf
Glowbal b489750d5b Minor optimizations using private, params, and isEqualType (#4323)
* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
2016-09-04 16:44:22 +02:00

28 lines
847 B
Plaintext

#include "script_component.hpp"
params ["_pos1", "_pos2", "_designator", "_seeker"]
private _spacing = 100;
if((count _this) > 4) then {
_spacing = _this select 4;
};
private _return = true;
private _vectorTo = [_pos2, _pos1] call BIS_fnc_vectorFromXToY;
private _x = (_vectorTo select 0)*0.25;
private _y = (_vectorTo select 1)*0.25;
private _z = (_vectorTo select 2)*0.25;
_pos2 = [(_pos2 select 0) + _x, (_pos2 select 1) + _y, (_pos2 select 2) + _z];
// player sideChat format["new los check"];
if(terrainIntersect [_pos2, _pos1]) then {
_return = false;
} else {
if(lineIntersects [_pos2, _pos1]) then { // should take as arguments and add to this command objects to exclude - target and observer
// player sideChat format["with: %1", lineIntersectsWith [_pos1, _pos2]];
_return = false;
};
};
_return;