From d9d6d1ed12097aed8a1793fae91456ef5f044a63 Mon Sep 17 00:00:00 2001 From: "Curtis L. Olson" Date: Thu, 13 Jan 2011 16:36:57 -0600 Subject: [PATCH] Add a variant of the tanker request function that produces a tanker with a more random (challenging to intercept) starting point and heading. --- Nasal/tanker.nas | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Nasal/tanker.nas b/Nasal/tanker.nas index 55834ceff..4bca85928 100644 --- a/Nasal/tanker.nas +++ b/Nasal/tanker.nas @@ -283,6 +283,27 @@ var request = func { } +var request_random = func { + var tanker = values(Tanker.active); + if (size(tanker)) + return tanker[0].identify(); + + var type = props.globals.getNode("systems/refuel", 1).getChildren("type"); + if (!size(type)) + return; + type = type[rand() * size(type)].getValue(); + + var (aiid, callsign, tacanid) =_= identity.get(); + var hdg = rand() * 360; + var course = rand() * 360; + var dist = 6000 + rand() * 4000; + var alt = int(10 + rand() * 15) * 1000; # FL100--FL250 + alt = skip_cloud_layer(alt * FT2M); + var coord = geo.aircraft_position().apply_course_distance(course, dist).set_alt(alt); + Tanker.new(aiid, callsign, tacanid, type, 250, hdg, coord); +} + + var report = func { var tanker = values(Tanker.active); if (size(tanker))