Jump to content

Ship landed detection


MLWostal

Recommended Posts

I'm looking for, and not finding, a simple routine to tell if a ship has actually landed on a planetary body. This would be planets or moons.

A routine that would work with the .CFG file.

What I need is a routine that would allow me, or anyone, to do detect if the ship is landed so another routine can be called.

IE:

module

{

shiplanded = true

output_resource

{

make something

}

}

Basically a generator module but one that only works when grounded.

Is this doable?

Link to comment
Share on other sites

Needs plugin code, but it's only a few lines per module you want to apply this to.


// spitballing code here. Results may vary
public class newmodule : oldModule
{
// if effect is physics related
public override void OnFixedUpdate
{
if (this.vessel.isLanded)
base.OnFixedUpdate();
}

// else
public override void OnUpdate
{
if (this.vessel.isLanded)
base.OnUpdate();
}
}

and then a Module Manager patch to replace "oldModule" with "newModule"

Link to comment
Share on other sites

Thanks for the reply but I'm not really sure what to do with it. I've not programed in C# (think that's what's used) so I am unable to use the code.

I suppose, if I'm going to continue playing with KSP, I should get the SDK for it (if it has an SDK) and start the learning process :)

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