Add a flag that allows the simulator to force "radar" computations even if
AI aircraft are out of range or the piloted aircraft has no radar system. These computation include range, bearing, and angular offset relative to the piloted aircraft. This gives some external script the control the behavior of the AI aircraft relative to the piloted aircraft without requiring a radar system, and without requiring the AI aircraft to be within radar range.
This commit is contained in:
parent
943b7b22a7
commit
4fade5839e
1 changed files with 2 additions and 1 deletions
|
@ -266,6 +266,7 @@ void FGAIBase::unbind() {
|
|||
double FGAIBase::UpdateRadar(FGAIManager* manager)
|
||||
{
|
||||
double radar_range_ft2 = fgGetDouble("/instrumentation/radar/range");
|
||||
bool force_on = fgGetBool("/instrumentation/radar/debug-mode", false);
|
||||
radar_range_ft2 *= SG_NM_TO_METER * SG_METER_TO_FEET * 1.1; // + 10%
|
||||
radar_range_ft2 *= radar_range_ft2;
|
||||
|
||||
|
@ -279,7 +280,7 @@ double FGAIBase::UpdateRadar(FGAIManager* manager)
|
|||
// Test whether the target is within radar range.
|
||||
//
|
||||
in_range = (range_ft2 && (range_ft2 <= radar_range_ft2));
|
||||
if ( in_range )
|
||||
if ( in_range || force_on )
|
||||
{
|
||||
props->setBoolValue("radar/in-range", true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue