private void Jump() { ClearAlignKeys(); StartJump(); last_jump_time = lastChargeTime; // If it took us a long time to align, fix the timer if ((DateTime.UtcNow - last_jump_time).TotalSeconds > 15) { last_jump_time = DateTime.UtcNow.AddSeconds(-15); } keyboard.Tap(keyThrottle100); // full throttle jumps_remaining -= 1; // reset everything Reset(soft: true); if (state.HasFlag(PilotState.SysMap)) { keyboard.Tap(keySystemMap); // open system map Task.Delay(6000).ContinueWith(t => keyboard.Keydown(keySysMapScrollRight)); // scroll right on system map Task.Delay(7000).ContinueWith(t => keyboard.Keyup(keySysMapScrollRight)); Task.Delay(10000).ContinueWith(t => keyboard.Tap(keyScreenshot)); // screenshot the system map } if (jumps_remaining < 1) { Sounds.PlayOneOf("this is the last jump.mp3", "once more with feeling.mp3", "one jump remaining.mp3"); } }
/// <summary> /// This handles cruising behaviour. The main function is already keeping us aligned; /// we just need to drop to 75% speed. /// This function could also do the final part: /// 1. press G when the "SAFE DISENGAGE" graphic is detected /// 2. Wait 5 seconds /// 3. Press Tab, X, 1,E,E,Space,S,Space to boost, cut throttle, and request docking (so the docking computer takes over). /// </summary> private void Cruise() { if (SecondsSinceFaceplant > 20 && OncePerJump(PilotState.cruiseStart)) { Sounds.Play("cruise mode engaged.mp3"); keyboard.Tap(keyThrottle100); // full throttle keyboard.Tap(keyThrottleReduce25); // drop 25% throttle, to 75% } if (!state.HasFlag(PilotState.CruiseEnd) && cruiseSensor.MatchSafDisengag()) { keyboard.Tap(keyHyperspace); // "Safe Disengage" state |= PilotState.DisengageStarted; return; } // disengage can take a while so wait for it to finish before continuing if (!state.HasFlag(PilotState.CruiseEnd) && state.HasFlag(PilotState.DisengageStarted) && !cruiseSensor.MatchSafDisengag()) { state |= PilotState.CruiseEnd; state &= ~PilotState.Enabled; // disable! we've arrived! // these commands will initiate docking if we have a computer Task.Delay(1000).ContinueWith(t => keyboard.Tap(keyBoost)); // boost Task.Delay(5000).ContinueWith(t => keyboard.Tap(keyThrottle0)); // cut throttle Task.Delay(8000).ContinueWith(t => // request docking { if (!state.HasFlag(PilotState.Cruise)) { return; // abort docking request if cruise gets turned off } Sounds.PlayOneOf("time to dock.mp3", "its dock oclock.mp3", "autopilot disengaged.mp3"); keyboard.TapWait(keyNavMenu); // nav menu keyboard.TapWait(keyMenuTabRight); // tab right keyboard.Tap(keyMenuTabRight); // tab right keyboard.Tap(keySelect); // select first contact (the station) keyboard.Tap(keyDown); // down to the second option (request docking) keyboard.Tap(keySelect); // select request docking keyboard.Tap(keyNavMenu); // close nav menu state &= ~PilotState.Cruise; // disable! we've arrived! }); } }