Jump to content

Pause Game?


Recommended Posts

For a mod i'm working on when you start a new game you need to choose some options before you begin. I'd like to pause the game at this point to make sure at least one option is selected so I don't have to check that condition everywhere else in my code. Is it possible to pause the game and how would I do it?

Link to comment
Share on other sites

I'm not 100% sure, but I'd check the GameEvent class for a pause/unpause event, or the HighLogic class for a pause game status.

Check the TimeWarp class to see if time is passing or not might "work", but it would be pretty hacky.

D.

Link to comment
Share on other sites

If you need to pause in the flight scene, just do this:


FlightDriver.SetPause(true or false);

However, It seems you want to make sure that an option is selected from a GUI before allowing the player to continue, which can be accomplished without pausing.

Simply use an InputLock, like so:


InputLockManager.SetControlLock(ControlTypes.All, "YourUniqueLockName");

Then, when an option is selected, and you want to restore user control, just remove the input lock, like so:


InputLockManager.RemoveControlLock("YourUniqueLockName");

Also, the ControlTypes enum works like a Bitmask, so choosing multiple ControlTypes is possible using the | operator.

I'm assuming that the option-choosing GUI will pop up when the space center loads, correct me if I'm wrong.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...