Jump to content

[1.0.x] Protractor Continued - Rendezvous Plugin v2.5.1 (May 15th, 2015)


Addle

Recommended Posts

I believe I have a fix for the duplicating toolbar issue.  The issue seems to be around two problems:

1. Registering for the onGUIApplicationLauncherReady event multiple times, causing OnGUIAppLauncherReady to be called multiple times creating multiple toolbars.

2. Not using the Unreadifying event (which may be what caused the event leak).

 

I tried to reduce down the changes to something smaller, but I wasn't able to get it to work without doing all of this and I didn't have the time to run a full matrix to figure out what all was required.  I didn't 100% test this either past loading up multiple ships and noticing the toolbar was no longer duplicating, so use at your own risk.

 

1. Add support for the onGUIApplicationLauncherUnreadifying event.  I did this by overriding the "Awake" function.  I also registered for the OnGUIApplicationLauncherReady event here as well.

protected virtual void Awake()
{
   if (!ToolbarManager.ToolbarAvailable)
   {
      // subscribe event listeners
      GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
      GameEvents.onGUIApplicationLauncherUnreadifying.Add(OnGUIAppLauncherUnreadifying);
   }
}

 

void OnGUIAppLauncherUnreadifying(GameScenes scene)
{
   // remove button
   if ((ApplicationLauncher.Instance != null) && (appButton != null))
   {
      ApplicationLauncher.Instance.RemoveModApplication(appButton);
   }
}

2. In OnDestroyed, make sure and deregister for the events no matter what.  It was previously only doing it if appButton != null.

public void OnDestroy()
{
   savesettings();
   if (button != null)
   {
      button.Destroy();
      button = null;
   }

   if (!ToolbarManager.ToolbarAvailable)
   {
      GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIAppLauncherReady);
      GameEvents.onGUIApplicationLauncherUnreadifying.Remove(OnGUIAppLauncherUnreadifying);

      if (appButton != null)
      {
         ApplicationLauncher.Instance.RemoveModApplication(appButton);
      }
   }
}

3. Remove all calls to onGUIApplicationLauncherReady.Remove and onGUIApplicationLauncherReady.Add anywhere else not in the code copied above.  For code that looked like this:

if (appButton == null)
{
   if (ApplicationLauncher.Ready)
   {
      OnGUIAppLauncherReady();
   } else {
      GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
   }
}

Simply removing the else block seemed sufficient.

Edited by Gyse
typo
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

The mod hasn't received an update in months now. Please, please, don't let it die!

I haven't found a replacement. I need a mod that shows me what planets will come in range next for a transfer. Transfer Window planner and MechJeb only allow you to select a planet and play around for a transfer, but they do not show you what the next planet will be best for a transfer and when it will happen.

This kind of sucks and I always planned my ships depending on the planet that would come next for a transfer. I don't really like time-warping years at a time without having multiple missions going on in between. With Protractor I could send other ships out to multiple planets while waiting for the first to arrive.

I'm really hoping that this mod gets an update and is made compatible with the latest version of KSP.

 

Link to comment
Share on other sites

  • 3 weeks later...
On 13/1/2017 at 10:04 PM, Sheppard said:

The mod hasn't received an update in months now. Please, please, don't let it die!

I haven't found a replacement. I need a mod that shows me what planets will come in range next for a transfer. Transfer Window planner and MechJeb only allow you to select a planet and play around for a transfer, but they do not show you what the next planet will be best for a transfer and when it will happen.

This kind of sucks and I always planned my ships depending on the planet that would come next for a transfer. I don't really like time-warping years at a time without having multiple missions going on in between. With Protractor I could send other ships out to multiple planets while waiting for the first to arrive.

I'm really hoping that this mod gets an update and is made compatible with the latest version of KSP.

Yes pls !!

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
On 1/13/2017 at 7:04 PM, Sheppard said:

I haven't found a replacement. I need a mod that shows me what planets will come in range next for a transfer. Transfer Window planner and MechJeb only allow you to select a planet and play around for a transfer, but they do not show you what the next planet will be best for a transfer and when it will happen.

This kind of sucks and I always planned my ships depending on the planet that would come next for a transfer. I don't really like time-warping years at a time without having multiple missions going on in between. With Protractor I could send other ships out to multiple planets while waiting for the first to arrive.

To anyone missing this mod, Astrogator may be a suitable replacement. It shows the next transfer window for each planet from the active vessel, and you can sort them by time. It can also create the maneuver nodes for you.

retrograde-sorted-mph.png

(Don't fret if you don't like miles per hour; the default is m/s. This screenshot was just the only one I had on hand that showed a sort by time.)

Link to comment
Share on other sites

On 14.03.2017 at 11:06 PM, HebaruSan said:

To anyone missing this mod, Astrogator may be a suitable replacement. It shows the next transfer window for each planet from the active vessel, and you can sort them by time. It can also create the maneuver nodes for you.

retrograde-sorted-mph.png

(Don't fret if you don't like miles per hour; the default is m/s. This screenshot was just the only one I had on hand that showed a sort by time.)

Sounds like the thing I need. At least until Protractor rises again from the dead. Many thanks!

Link to comment
Share on other sites

  • 2 months later...

I have recompiled for KSP1.3.0

Just adding stock toolbar fixes by Gyse.  I'll test those changes and get it published soon.

Edit:

http://themoose.co.uk/ksp/Protractor2.11.zip

Source is on GitHub https://github.com/thewebbooth/protractor

License is GNU GPL license 3

Edited by Z-Key Aerospace
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
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...