Jump to content

[0.23.5] Patch to fix moving kerbin into a different SOI with RSS


thutmose

Recommended Posts

This fixes the issue where if you move kerbin to a different SOI (say around jool) with RSS, on reloading the game, anything in orbit around kerbin is moved to orbit around the Sun.

Source code:

//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;


namespace KerbinAsSat
{
[KSPAddon(KSPAddon.Startup.EveryScene, false)]
public class MoveVesselBack : MonoBehaviour
{
static bool check = true;
public void Start()
{
if (HighLogic.LoadedScene == GameScenes.SPACECENTER && check)
{
check = false;
CelestialBody kerbin = null;
CelestialBody sun = null;
Debug.Log("Looking for Kerbin");
foreach (CelestialBody b in FlightGlobals.Bodies)
{
if (b.GetName().Equals("Kerbin"))
{
Debug.Log("Found Kerbin");
kerbin = b;
}
if (b.GetName().Equals("Sun"))
{
Debug.Log("Found the Sun");
sun = b;
}
}
if(sun!=null)
{
Debug.Log("Checking the Sun's bodies");
if(!sun.orbitingBodies.Contains(kerbin))
{
Debug.Log("re-adding Kerbin");
sun.orbitingBodies.Add(kerbin);
}

}

}
}
}
}

No pictures (doesn't have anything to show)

Download:

https://www.dropbox.com/s/o2md550zj64tsra/KerbinAsSat.zip

install instructions:

extract to Gamedata.

Liscence:

free to do whatever with this code

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