var vs_gearup = 300; var ias_gearup = 90; var agl_geardown = 1000; var ias_geardown = 100; var VNE = 240; # hash table which contains informations needed to display warning messages and alerts messages # alerts and warnings keys should be 'alert|warning.message', the keys priority and msg_id are # placed here for convenience. # each key is associated with a 2 elements array: # 0: the text to be displayed # 1: priority of the message should be <= 20, also used for display duration # cooked_duration = 21 - priority var alerts_table = { 'warning.gears_up': ['GEARS UP', 10], 'warning.gears_down': ['GEARS DOWN', 0 ], 'warning.traffic': ['TRAFFIC', 20], 'warning.overspeed': ['OVER SPEED', 15], 'warning.stall': ['STALL', 18], 'warning.push_down': ['PUSH DOWN', 17], 'warning.pull_up': ['PULL UP', 15], 'warning.ground': ['GROUND', 15], 'alert.traffic': ['TRAFFIC', 20], 'alert.overspeed': ['OVER SPEED', 20], 'priority': 0, 'msg_id': '', }; var getAircraftDefaultSpecs = func () { var d = props.globals.getNode('/instrumentation/zkv1000/defaults'); d != nil or return; if (d.getNode('vs-gearup') != nil) vs_gearup = d.getNode('vs-gearup').getValue(); if (d.getNode('ias-gearup') != nil) ias_gearup = d.getNode('ias-gearup').getValue(); if (d.getNode('agl-geardown') != nil) agl_geardown = d.getNode('agl-geardown').getValue(); if (d.getNode('ias-geardown') != nil) ias_geardown = d.getNode('ias-geardown').getValue(); if (d.getNode('VNE') != nil) VNE = d.getNode('VNE').getValue(); } var inAirCheckings = func { if (getprop('/gear/gear/wow')) { alerts.getNode('traffic-proximity').setIntValue(0); checkTrafficProximity = void; checkAlerts = void; GND(); # set XPDR mode } else { if (props.globals.getNode('/sim/multiplay/online').getBoolValue()) checkTrafficProximity = _checkTrafficProximity; checkAlerts = _checkAlerts; ALT(); # set XPDR mode } init_main_loop(); } var _checkTrafficProximity = func { var ttc = 0; # Time To Conflict var self = geo.aircraft_position(); foreach (var mp; multiplayer.model.list) { var n = mp.node; var x = n.getNode('position/global-x').getValue(); var y = n.getNode('position/global-y').getValue(); var z = n.getNode('position/global-z').getValue(); var ac = geo.Coord.new().set_xyz(x, y, z); if (ac == nil) continue; ttc = self.direct_distance_to(ac) * 0.5144 / ias; # ias in kt, distance in m, ttc in seconds if (ttc < 20) { set_alert('alert.traffic'); return; } else if (ttc < 60) { set_alert('warning.traffic'); } } } var checkAlerts = void; var _checkAlerts = func { if (stall) set_alert('warning.stall'); if (pitch > 50) set_alert('warning.push_down'); if (pitch < -30) set_alert('warning.pull_up'); if (agl < 1500 and vs < -800) set_alert('warning.ground'); if (vs < -3000) set_alert('warning.pull_up'); if (gear and ias > ias_gearup and agl > agl_geardown) set_alert('warning.gears_down'); elsif (agl < agl_geardown and ias < ias_geardown) set_alert('warning.gears_up'); }