Jump to content

Asteroid Warning Plugin.


Recommended Posts

This should be a simple plugin that stops time warp and delivers a message that there is an imminent impact to Kerbin. I have little programming experience, and help would be be appreciated. I have done some looking around and should have a prototype soonâ„¢. My current idea of how the plugin will work is it will get the vessel type, determine if that vessel is a space object. Then get the Kerbin periapsis of the Vessel. If anything is in error with that idea please tell me and I will try to correct it.

Edited by Robotengineer
Link to comment
Share on other sites

Believe such a mod may be really helpful.

Of course every game is different, but... with 0.23.5 I started a new career game, and the first three asteroids (C, C, and D class) to enter Kerbin's SoI were all going to hit (and all within 2 days). And, I only knew when they actually entered the SoI, what info I got with initial discovery wasn't giving any close pass. An early warning of such dangers would have made it somewhat easier (I could just about catch them and save Kerbin).

If I may suggest, could you consider making some references to B612 in your mod? B612 has exactly the same purpose in reality, and its reps have often shown interest with KSP.

Link to comment
Share on other sites

Thanks, as it is I am going to be learning C# as I make the plugin I will probably not be able to make it to complicated. I am not sure if it is possible to get the periapsis of a vessel if it is not in the SOI of Kerbin, I.E. get the periapsis of an asteroid for Kerbin, when it is in orbit around the sun. And any help in development of this would be greatly appreciated. This is what I have so far.

using System;
using UnityEngine;
using System.Collections.Generic;

namespace Asteroid_Warning
{
public string type
public bool isAsteroid
public double periapsis

public class asteroidWarning
{

}

Not much.

Link to comment
Share on other sites

... I am not sure if it is possible to get the periapsis of a vessel if it is not in the SOI of Kerbin, I.E. get the periapsis of an asteroid for Kerbin, when it is in orbit around the sun. And any help in development of this would be greatly appreciated. ...

I don't know if you already use this mod: PreciseNode. It has the ability (among many other things) to predict the periapsis that occurs in a conic patch after the current one for the active vessel (after a SoI change). Its sourcecode is available (almost all written by regex!) and you will certainly learn a lot from it.

Link to comment
Share on other sites

I don't know if you already use this mod: PreciseNode. It has the ability (among many other things) to predict the periapsis that occurs in a conic patch after the current one for the active vessel (after a SoI change). Its sourcecode is available (almost all written by regex!) and you will certainly learn a lot from it.

I will check it out, I don't use it currently as I typically don't use nodes that much.

Link to comment
Share on other sites

Ok, did some looking into linq and other things. I now have an idea for how it will work.

heres the idea for the flow of the plug-in.

 AllVessels --> Vessels.SpaceObject --> Asteroids that enter Kerbins SOI --> Asteroids that have a periapsis < 30,000 --> warning message

This is what I have for code so far.

 using System;
using UnityEngine;
using System.Collections.Generic;
using linq;

namespace Asteroid_Warning
{
public class asteroidWarning
{
List<Vessel> allVessels = new List<Vessels>;
foreach(VesselType.SpaceObject in Vessels);
{

}
}

Not sure if I should use IEnumerable or foreach or something else. Suggestions on code would be greatly appreciated.

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