public bool HyperWarpToTime(double warpTime) { string logCaller = "TimeController.HyperWarpToTime"; Log.Trace("method start", logCaller); if (!((CanControlWarpType & TimeControllable.Hyper) == TimeControllable.Hyper)) { Log.Warning("Cannot call HyperWarpToTime when we cannot Hyper warp", logCaller); Log.Trace("method end", logCaller); return(false); } if (!(CurrentWarpState == TimeControllable.None || CurrentWarpState == TimeControllable.Hyper)) { Log.Info("Cannot hyper warp while time warp state is " + CurrentWarpState.ToString(), logCaller); return(false); } if (Planetarium.GetUniversalTime() >= warpTime) { return(false); } hyperWarpEndTime = warpTime; CurrentWarpState = TimeControllable.Hyper; Log.Trace("method end", logCaller); return(true); }
public void CancelRailsWarp(bool cancelAuto = true) { string logCaller = "TimeController.CancelRailsWarp"; Log.Trace("method start", logCaller); railsWarpEndTime = Mathf.Infinity; if (!(CurrentWarpState == TimeControllable.Rails || CurrentWarpState == TimeControllable.Physics)) { if (TimeWarp.fetch != null && TimeWarp.fetch.current_rate_index > 0) { Log.Error("Rails warp is running but TimeController thinks we are on warp type " + CurrentWarpState.ToString(), logCaller); // Recover as best we can CancelHyperWarp(); CancelSlowMo(); CurrentWarpState = TimeControllable.Rails; } else { Log.Info("Cannot cancel rails warp as we are not rails warping."); Log.Trace("method end", logCaller); return; } } if (cancelAuto) { Log.Info("Cancelling auto warp if it is running.", logCaller); TimeWarp.fetch.CancelAutoWarp(); } Log.Info("Setting warp rate to 0.", logCaller); TimeWarp.SetRate(0, true, true); CurrentWarpState = TimeControllable.None; Log.Trace("method end", logCaller); }