Jump to content

Question about the debug menu


Recommended Posts

I would like to know where the debug menu settings are stored. For example, if "gravity hack" is done on a flight, quicksaved, then reloaded, the gravity has returned in full force. This must mean that the "no gravity" setting is not stored in the save file, so is it written somewhere in a file at all or only stored in memory?

If the latter, then is it accessible through the API somehow? (i.e. could a plugin detect that it has been enabled)

The same question goes for the other settings as well, like infinite fuel.

Thanks!

Link to comment
Share on other sites

I would like to know where the debug menu settings are stored. For example, if "gravity hack" is done on a flight, quicksaved, then reloaded, the gravity has returned in full force. This must mean that the "no gravity" setting is not stored in the save file, so is it written somewhere in a file at all or only stored in memory?

If the latter, then is it accessible through the API somehow? (i.e. could a plugin detect that it has been enabled)

The same question goes for the other settings as well, like infinite fuel.

Thanks!

EndlessWaves is right, you can access their state through the CheatOptions class.

public class CheatOptions
{
public static bool AllowPartClipping;
public static bool InfiniteEVAFuel;
public static bool InfiniteFuel;
public static bool InfiniteRCS;
public static bool NoCrashDamage;
public static bool PauseOnVesselUnpack;
public static bool UnbreakableJoints;
}

Link to comment
Share on other sites

What about the gravity hack? I don't see that in the code segment you posted.

It may be modifying the current planetary gravity value directly rather than setting a flag (hence the 'hack'?). Try checking the various gravity parameters (and Mass) in vessel.mainBody and see if they change.

Link to comment
Share on other sites

Physics.gravity changes by a division of 100~ when the button is clicked if that helps. :) At least on Kerbin.

Before: [Log]: Gravity changed: -2.608566, 0.01757533, 9.454472

After: [Log]: Gravity changed: -0.02608566, 0.0001757532, 0.09454471

Keep a variable of the previous gravity value and monitor it at whatever interval you choose, then when the factor decreases spontaneously by roughly 100.0f you most likely will have the event of the button press. :)

This value will of course spontaneously change when the scene changes (doubtful by such a large amount).

The value also changes slowly during normal flight sessions.

Build a plugin to test it out?

Try this (for debug purposes only):

[KSPAddon(KSPAddon.Startup.Flight, false)]
public class GravityCheck : MonoBehaviour
{
private static Vector3 _gravPrev;
public void Update()
{
if (_gravPrev != Physics.gravity)
{
_gravPrev = Physics.gravity;

Debug.Log(string.Format("Gravity changed: {0}, {1}, {2}", _gravPrev.x, _gravPrev.y, _gravPrev.z));
}
}

That should work

Edited by Razchek
typo
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...