From 991ecdfe010ffd366839c5d088e668c2a8ef30ae Mon Sep 17 00:00:00 2001 From: jaynus Date: Mon, 11 May 2015 13:37:50 -0700 Subject: [PATCH] Removed: Debug sidechat in laser seeker code. --- .../functions/fnc_seekerFindLaserSpot.sqf | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/addons/laser/functions/fnc_seekerFindLaserSpot.sqf b/addons/laser/functions/fnc_seekerFindLaserSpot.sqf index 77713eb591..346aec837e 100644 --- a/addons/laser/functions/fnc_seekerFindLaserSpot.sqf +++ b/addons/laser/functions/fnc_seekerFindLaserSpot.sqf @@ -1,32 +1,32 @@ -/* - * Author: Nou - * Turn a laser designator on. - * - * Arguments: - * 0: Position of seeker (ASL) - * 1: Direction vector (will be normalized) - * 2: Seeker FOV in degrees - * 3: Seeker wavelength sensitivity range, [1550,1550] is common eye safe. - * 4: Seeker laser code. - * - * Return value: - * Array, [Strongest compatible laser spot ASL pos, owner object] Nil array values if nothing found. - */ - -#include "script_component.hpp" - -private ["_pos", "_seekerWavelengths", "_seekerCode", "_spots", "_buckets", "_excludes", "_bucketIndex", "_finalPos", "_owner", "_obj", "_x", "_method"]; -private ["_emitterWavelength", "_laserCode", "_divergence", "_laser", "_laserPos", "_laserDir", "_res", "_bucketPos", "_bucketList", "_c", "_forEachIndex", "_index"]; -private ["_testPos", "_finalBuckets", "_largest", "_largestIndex", "_finalBucket", "_owners", "_avgX", "_avgY", "_avgZ", "_count", "_maxOwner", "_maxOwnerIndex", "_finalOwner"]; -private["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"]; - -_pos = _this select 0; -_dir = vectorNormalized (_this select 1); +/* + * Author: Nou + * Turn a laser designator on. + * + * Arguments: + * 0: Position of seeker (ASL) + * 1: Direction vector (will be normalized) + * 2: Seeker FOV in degrees + * 3: Seeker wavelength sensitivity range, [1550,1550] is common eye safe. + * 4: Seeker laser code. + * + * Return value: + * Array, [Strongest compatible laser spot ASL pos, owner object] Nil array values if nothing found. + */ + +#include "script_component.hpp" + +private ["_pos", "_seekerWavelengths", "_seekerCode", "_spots", "_buckets", "_excludes", "_bucketIndex", "_finalPos", "_owner", "_obj", "_x", "_method"]; +private ["_emitterWavelength", "_laserCode", "_divergence", "_laser", "_laserPos", "_laserDir", "_res", "_bucketPos", "_bucketList", "_c", "_forEachIndex", "_index"]; +private ["_testPos", "_finalBuckets", "_largest", "_largestIndex", "_finalBucket", "_owners", "_avgX", "_avgY", "_avgZ", "_count", "_maxOwner", "_maxOwnerIndex", "_finalOwner"]; +private["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"]; + +_pos = _this select 0; +_dir = vectorNormalized (_this select 1); _seekerFov = _this select 2; _seekerWavelengths = _this select 3; -_seekerCode = _this select 4; - - +_seekerCode = _this select 4; + + _seekerCos = cos _seekerFov; _spots = []; @@ -47,9 +47,9 @@ _finalOwner = nil; _laser = []; if(IS_CODE(_method)) then { _laser = _x call _method; - } else { - if(IS_STRING(_method)) then { - _laser = _x call (missionNamespace getVariable [_method, {}]); + } else { + if(IS_STRING(_method)) then { + _laser = _x call (missionNamespace getVariable [_method, {}]); } else { if(IS_ARRAY(_method)) then { if(count _method == 2) then { @@ -59,18 +59,18 @@ _finalOwner = nil; _laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), (ATLtoASL (_obj modelToWorldVisual (_method select 1))) vectorFromTo (ATLtoASL (_obj modelToWorldVisual (_method select 2)))]; }; }; - }; + }; }; }; _laserPos = _laser select 0; _laserDir = _laser select 1; _res = [_laserPos, _laserDir, _divergence] call FUNC(shootCone); - { - _testPoint = _x select 0; - _testPointVector = vectorNormalized (_testPoint vectorDiff _pos); - _testDotProduct = _dir vectorDotProduct _testPointVector; + { + _testPoint = _x select 0; + _testPointVector = vectorNormalized (_testPoint vectorDiff _pos); + _testDotProduct = _dir vectorDotProduct _testPointVector; if(_testDotProduct > _seekerCos) then { - _spots pushBack [_testPoint, _owner]; + _spots pushBack [_testPoint, _owner]; }; } forEach (_res select 2); }; @@ -128,7 +128,7 @@ if((count _spots) > 0) then { _avgY = 0; _avgZ = 0; { - player sideChat format["x: %1", _x]; + //player sideChat format["x: %1", _x]; _avgX = _avgX + ((_x select 0) select 0); _avgY = _avgY + ((_x select 0) select 1); _avgZ = _avgZ + ((_x select 0) select 2);