Removed: Debug sidechat in laser seeker code.

This commit is contained in:
jaynus 2015-05-11 13:37:50 -07:00
parent 0bb158bd14
commit 991ecdfe01

View File

@ -1,32 +1,32 @@
/*
* Author: Nou
* Turn a laser designator on.
*
* Arguments:
* 0: Position of seeker (ASL) <position>
* 1: Direction vector (will be normalized) <vector>
* 2: Seeker FOV in degrees <number>
* 3: Seeker wavelength sensitivity range, [1550,1550] is common eye safe. <array>
* 4: Seeker laser code. <number>
*
* 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) <position>
* 1: Direction vector (will be normalized) <vector>
* 2: Seeker FOV in degrees <number>
* 3: Seeker wavelength sensitivity range, [1550,1550] is common eye safe. <array>
* 4: Seeker laser code. <number>
*
* 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);