mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
What am I doing
This commit is contained in:
parent
a596bc91c7
commit
2f74e81ffe
@ -14,12 +14,27 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
params ["_aircraft", "_scanVector", "_scanConeH", "_scanConeV"];
|
params ["_aircraft", "_fromToH", "_fromToV"];
|
||||||
|
_fromToH params ["_fromH", "_toH"];
|
||||||
|
_fromToV params ["_fromV", "_toV"];
|
||||||
|
|
||||||
|
private _scanConeH = _toH - _fromH;
|
||||||
|
private _scanConeV = _toH - _fromH;
|
||||||
|
|
||||||
|
private _scanVectorH = [vectorDirVisual _aircraft, _fromH + (_scanConeH / 2)] call BIS_fnc_rotateVector2D;
|
||||||
|
private _scanVectorV = [vectorDirVisual _aircraft, _fromV + (_scanConeV / 2)] call BIS_fnc_rotateVector2D;
|
||||||
|
|
||||||
private _scanVectorH = _scanVector select [0, 2]; //[x, y]
|
|
||||||
private _scanVectorV = _scanVector select [1, 2]; //[y, z]
|
|
||||||
private _detectedAircraft = [];
|
private _detectedAircraft = [];
|
||||||
|
|
||||||
|
#ifdef DEBUG_MODE_FULL
|
||||||
|
private _scanVector = _scanVectorH + _scanVectorV;
|
||||||
|
drawLine3D [
|
||||||
|
getPosATL _aircraft,
|
||||||
|
(getPosATL _aircraft) vectorAdd (_scanVector vectorMultiply 20),
|
||||||
|
[1, 0, 0, 1]
|
||||||
|
];
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_x != _aircraft && {(getPosATL _x) select 2 > 10}) then {
|
if (_x != _aircraft && {(getPosATL _x) select 2 > 10}) then {
|
||||||
private _dirToTarget = (getPosASL _x) vectorDiff (getPosASL _aircraft);
|
private _dirToTarget = (getPosASL _x) vectorDiff (getPosASL _aircraft);
|
||||||
|
@ -34,8 +34,7 @@ _lastDir params ["_dirH", "_dirV"];
|
|||||||
|
|
||||||
To simulate this we divide the base of the pyramid into
|
To simulate this we divide the base of the pyramid into
|
||||||
rectangular areas that the beam went through between
|
rectangular areas that the beam went through between
|
||||||
now and the last call of the PFH. If we have an L
|
now and the last call of the PFH.
|
||||||
shaped area, we simply complete it to a rectangle.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// First check if the cone was changed and we're outside of the cone
|
// First check if the cone was changed and we're outside of the cone
|
||||||
@ -53,28 +52,42 @@ if (_dirV < (_angleV / -2)) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 24 movement steps per second (60 deg horizontal)
|
// 24 movement steps per second (60 deg horizontal)
|
||||||
private _steps = 1 max round ((CBA_time - _lastTick) * 24);
|
private _steps = round ((CBA_time - _lastTick) * 24);
|
||||||
private _newDirH = _dirH;
|
private _newDirH = _dirH;
|
||||||
private _newDirV = _dirV;
|
private _newDirV = _dirV;
|
||||||
|
|
||||||
|
// If the antenna has not moved yet, scan the last sector again
|
||||||
|
if (_steps == 0) then {
|
||||||
|
_steps == 1;
|
||||||
|
_dirH = [_dirH - 2.5, _dirH + 2.5] select _moveRight;
|
||||||
|
_newDirH = [_newDirH - 2.5, _newDirH + 2.5] select _moveRight;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _detectedAircraft = [];
|
||||||
|
|
||||||
while {_steps > 0} do {
|
while {_steps > 0} do {
|
||||||
|
// Go one line lower when reaching the end of the cone
|
||||||
|
if (_newDirH <= _angleH) then {
|
||||||
|
_moveRight = !_moveRight;
|
||||||
|
_newDirV = _newDirV - 2.5;
|
||||||
|
|
||||||
|
// If bottom of cone is reached go back to the top
|
||||||
|
if (_newDirV < (_angleV / -2)) then {
|
||||||
|
_newDirV = _angleV / 2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
while {_steps > 0 && {_newDirH < _angleH}} do {
|
while {_steps > 0 && {_newDirH < _angleH}} do {
|
||||||
// Beam has an angle of 2.5 deg
|
// Beam has an angle of 2.5 deg
|
||||||
_newDirH = [_newDirH + 2.5, _newDirH - 2.5] select _moveRight;
|
_newDirH = [_newDirH + 2.5, _newDirH - 2.5] select _moveRight;
|
||||||
_steps = _steps - 1;
|
_steps = _steps - 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// If we still have steps to take, switch direction, go one line lower
|
_detectedAircraft append (
|
||||||
if (_steps > 0) then {
|
[_vehicle, [_dirH, _newDirH], [_dirV, _dirV + 2.5]] call FUNC(scan)
|
||||||
_moveRight = !_moveRight;
|
);
|
||||||
_newDirV = _newDirV - 2.5;
|
|
||||||
|
|
||||||
// If bottom of cone is reached, scan and back to the top.
|
|
||||||
if (_newDirV < (_angleV / -2)) then {
|
|
||||||
// scan here
|
|
||||||
_newDirV = _angleV / 2;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// scan here
|
_args set [1, [_newDirH, _newDirV]];
|
||||||
|
_args set [2, CBA_time];
|
||||||
|
_args set [3, _moveRight];
|
||||||
|
Loading…
Reference in New Issue
Block a user