Jump to content

Just wondering if such a method exists in the KSP API


Recommended Posts

I've been searching for the better half of 3 days but can't find it, so I turn to you, fellow modders.

I'm trying to find an event/method that is called when a user starts a new save, or loads an older save. I'm trying to use it to add things to the game if it can't find a .dat file for the plugin.

Also, since I'm making a thread anyways, is there a way to only get planets? I've seen other people use FlightGlobals.Bodies, but that returns all bodies, including moons, but I only want the parent body, ie Jool, Duna etc.

Thanks in advance guys

Link to comment
Share on other sites

For the first part of your request, you might be able to do something with the GameEvents class though it's only a thought.

For the second part, you can take advantage of the fact that each CelestialBody carries a list of all CelestialBodies orbiting it:

Planetarium.fetch.Sun.orbitingBodies

This will give you a list of all bodies orbiting the sun (meaning; all planets)

Link to comment
Share on other sites

For the first part of your request, you might be able to do something with the GameEvents class though it's only a thought.

For the second part, you can take advantage of the fact that each CelestialBody carries a list of all CelestialBodies orbiting it:

Planetarium.fetch.Sun.orbitingBodies

This will give you a list of all bodies orbiting the sun (meaning; all planets)

I was looking at GameEvents but it didn't seem like any of them were delegates.

And thanks on the second part! Didn't see Sun when I was browsing through fetch

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...