private void getAnomValues() { anomCloseRange = false; anomInRange = false; closestAnom = ""; foreach (DMAnomalyObject anom in DMAnomalyList.anomObjects) { if (anom.Vdistance < 100000) { if (anom.Vhorizontal < (30000 * (1 - anom.Vheight / 15000))) //Determine cutoff distance on sliding scale based on altitude above the anomaly. { DMAnomalyList.bearing(vessel, anom); //Calculate the bearing to the anomaly from the current vessel position. string anomDirection = direction(anom.bearing); //Get cardinal directions based on the bearing. anomInRange = true; DMUtils.Logging("Anomaly: {0} is at bearing: {1:N1} deg at a distance of {2:N1}m.", anom.name, anom.bearing, anom.Vdistance); if (anom.Vdistance < 250) //Scanning range distance for science experiment. { closestAnom = anom.name; anomCloseRange = true; } else if (anom.Vheight > 10000) //Use alternate message when more than 10km above the anomaly. { ScreenMessages.PostScreenMessage(string.Format("Anomalous signal detected approximately {0:N1} km below current position, get closer for a better signal", anom.Vdistance / 1000 + RandomDouble((2 * (anom.Vdistance / 1000) / 30), (4 * (anom.Vdistance / 1000) / 30))), 6f, ScreenMessageStyle.UPPER_CENTER); } else { ScreenMessages.PostScreenMessage(string.Format("Anomalous signal detected approximately {0:N1} km away to the {1}, get closer for a better signal.", anom.Vdistance / 1000 + RandomDouble((2 * (anom.Vdistance / 1000) / 30), (4 * (anom.Vdistance / 1000) / 30)), anomDirection), 6f, ScreenMessageStyle.UPPER_CENTER); } } } } }
private bool checkAnomalyForScience(DMAnomalyObject a) { if (a == null) { return(false); } DMAnomalyList.updateAnomaly(vessel, a); //DMUtils.Logging("Checking Anomaly For Science: [{0}]\nDistance: {1:F4}m\nHeight: {2:F4}m\nHorizontal: {3:F4}m", a.Name, a.VDistance, a.VHeight, a.VHorizontal); if (a.VDistance >= 50000) { return(false); } //Determine cutoff distance on sliding scale based on altitude above the anomaly. if (a.VHorizontal >= (30000 * (1 - a.VHeight / 15000))) { return(false); } //Calculate the bearing to the anomaly from the current vessel position. DMAnomalyList.bearing(vessel, a); //Get cardinal directions based on the bearing. string anomDirection = direction(a.Bearing); anomScienceInRange = true; DMUtils.Logging("Anomaly: {0} is at bearing: {1:N1} deg at a distance of {2:N1}m.", a.Name, a.Bearing, a.VDistance); //Scanning range distance for science experiment. if (a.VDistance < 250) { closestAnom = a.Name; anomCloseRange = true; return(true); } //Use alternate message when more than 10km above the anomaly. else if (a.VHeight > 10000) { ScreenMessages.PostScreenMessage(string.Format("Anomalous signal detected approximately {0:N1} km below current position, get closer for a better signal.", a.VDistance / 1000 + RandomDouble((2 * (a.VDistance / 1000) / 30), (4 * (a.VDistance / 1000) / 30))), 6f, ScreenMessageStyle.UPPER_CENTER); } else { ScreenMessages.PostScreenMessage(string.Format("Anomalous signal detected approximately {0:N1} km away to the {1}, get closer for a better signal.", a.VDistance / 1000 + RandomDouble((2 * (a.VDistance / 1000) / 30), (4 * (a.VDistance / 1000) / 30)), anomDirection), 6f, ScreenMessageStyle.UPPER_CENTER); } return(false); }