sarbian

Info on how to convert your Plugin to KSP 1.1

Recommended Posts

Thanks so much for this.   This will save soooo much time in discovery.

Share this post


Link to post
Share on other sites

Question, the KSP class  ConfigNode  is suddenly inaccesable, what replaced it?

 

Also what replace the partmodule methods " public ConfigNode OnSave(ConfigNode node)" and  "public void OnLoad(ConfigNode node)" ?

Share this post


Link to post
Share on other sites
4 minutes ago, FreeThinker said:

Question, the KSP class  ConfigNode  is suddenly inaccesable, what replaced it?

 

Also what replace the partmodule methods " public ConfigNode OnSave(ConfigNode node)" and  "public void OnLoad(ConfigNode node)" ?

Add a reference to KSPUtil.dll. Check the first post it goves you clues on what you need to include.

Share this post


Link to post
Share on other sites
9 minutes ago, FreeThinker said:

Question, the KSP class  ConfigNode  is suddenly inaccesable, what replaced it?

 

Also what replace the partmodule methods " public ConfigNode OnSave(ConfigNode node)" and  "public void OnLoad(ConfigNode node)" ?

like post above stated for KSPUTIL.dll pretty much all my issues I had in the building of new versions were because almost everything has been moved to other areas.  A lot of stuff IE most still work the same you just have to get the refrences like the first post stated.  And I had a huge list, but once reading first post and adding the refrences.. Everything pretty much cleaned up, other than a few things.

Share this post


Link to post
Share on other sites
10 minutes ago, Angel-125 said:

Add a reference to KSPUtil.dll. Check the first post it goves you clues on what you need to include.

Thanks

But another issue remains, the class Gameobject has suddenly lost the property "renderer" . I need it in order to get access to the "material" property

Edited by FreeThinker

Share this post


Link to post
Share on other sites

To add to my previous point about hiding the UI, this seems to handle all of the cases where you want to hide something.

		void Start()
		{
			GameEvents.onShowUI.Add(UIOn);
			GameEvents.onHideUI.Add(UIOff);
			GameEvents.onGUIMissionControlSpawn.Add(UIOff);
			GameEvents.onGUIMissionControlDespawn.Add(UIOff);
			GameEvents.onGUIRnDComplexSpawn.Add(UIOff);
			GameEvents.onGUIRnDComplexDespawn.Add(UIOn);
			GameEvents.onGUIAdministrationFacilitySpawn.Add(UIOff);
			GameEvents.onGUIAdministrationFacilityDespawn.Add(UIOn);
			GameEvents.onGUIAstronautComplexSpawn.Add(UIOff);
			GameEvents.onGUIAstronautComplexDespawn.Add(UIOn);
		}

		void OnDestroy()
		{
			GameEvents.onShowUI.Remove(UIOn);
			GameEvents.onHideUI.Remove(UIOff);
			GameEvents.onGUIMissionControlSpawn.Remove(UIOff);
			GameEvents.onGUIMissionControlDespawn.Remove(UIOff);
			GameEvents.onGUIRnDComplexSpawn.Remove(UIOff);
			GameEvents.onGUIRnDComplexDespawn.Remove(UIOn);
			GameEvents.onGUIAdministrationFacilitySpawn.Remove(UIOff);
			GameEvents.onGUIAdministrationFacilityDespawn.Remove(UIOn);
			GameEvents.onGUIAstronautComplexSpawn.Remove(UIOff);
			GameEvents.onGUIAstronautComplexDespawn.Remove(UIOn);
		}

		private void UIOn()
		{
			showUI = true;
		}

		private void UIOff()
		{
			showUI = false;
		}

		private void OnGUI()
		{
			if (!showUI)
				return;
			
			//GUI stuff...
		}

Just keep in mind that you'll probably want two flags to check if your UI should be visible. One for the events shown above, and a second standard flag for hiding or closing your UI through other means.

Share this post


Link to post
Share on other sites
3 minutes ago, FreeThinker said:

Thanks

But another issue remains, the class Gameobject has suddenly lost the property "renderer" . I need it in order to get access to the "material" property

transform.renderer is now transform.GetComponent<renderer>()
transform.material is now transform.GetComponent<material>()

or use the cached version... as per the OP

Edited by JPLRepo

Share this post


Link to post
Share on other sites
1 minute ago, JPLRepo said:

transform.renderer is now transform.GetComponent<renderer>()

or use the cached version... as per the OP

Thanks, I guess you ment " transform .GetComponent<Renderer>().material"

Share this post


Link to post
Share on other sites

Amazing how people don't read the OP.

@sarbian take a look here on my humble attempts at creating an window abstration. And this is an example of use. It worked fine in my separate U5 project, but I did not have much time to tinker with it. Feel free to use any part of the code if you want to start a proper library.

Share this post


Link to post
Share on other sites
7 minutes ago, FreeThinker said:

Thanks, I guess you ment " transform .GetComponent<Renderer>().material"

For the material. Yeah. :P

Share this post


Link to post
Share on other sites
15 minutes ago, Ziw said:

Amazing how people don't read the OP.

@sarbian take a look here on my humble attempts at creating an window abstration. And this is an example of use. It worked fine in my separate U5 project, but I did not have much time to tinker with it. Feel free to use any part of the code if you want to start a proper library.

Amazing. I ll have a look. Thanks :)

Share this post


Link to post
Share on other sites
2 hours ago, linuxgurugamer said:

This works in 1.0.5:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using System.Reflection;
using System.Runtime.InteropServices;


Object  obj = EditorLogic.fetch;
string name = "\u0001";
var f = obj.GetType().GetField(name, BindingFlags.Public | bindingFlags.NonPublic | BindingFlags.Instance);

But returns null in 1.1

Anybody have any ideas what's not working? 

 

 

What I need is access to the KerbalFSM.  If there is a better way to do this, I'd appreciate hearing about it.  Specifically, I need to do the following:

 (editorFSM.currentStateName == "st_offset_tweak" || editorFSM.currentStateName == "st_rotate_tweak"))

and the following:

 editorFSM.lastEventName.Equals("on_rootSelect");

Thanks in advance

 

Edited by linuxgurugamer

Share this post


Link to post
Share on other sites

I used to be able to call "ScaledSpace.Instance.scaledSpaceTransforms"  but not anymore, where did scaledSpaceTransforms  go?

Share this post


Link to post
Share on other sites
2 minutes ago, FreeThinker said:

I used to be able to call "ScaledSpace.Instance.scaledSpaceTransforms"  but not anymore, where did scaledSpaceTransforms  go?

Please, read the thread....

This exact question was answered on the previous page by Thomas P

Share this post


Link to post
Share on other sites

AudioSource class is suddenly missing the propery panLevel, is panStereo it's alternative?

Edited by FreeThinker

Share this post


Link to post
Share on other sites
1 minute ago, FreeThinker said:

AudioSource class is suddenly missing the propery panLevel, is panStereo it's alternative?

That's what I assumed. Seems to work.

Share this post


Link to post
Share on other sites
1 hour ago, linuxgurugamer said:

What I need is access to the KerbalFSM.  If there is a better way to do this, I'd appreciate hearing about it.  Specifically, I need to do the following:

 (editorFSM.currentStateName == "st_offset_tweak" || editorFSM.currentStateName == "st_rotate_tweak"))

and the following:

 editorFSM.lastEventName.Equals("on_rootSelect");

Thanks in advance

 

There has been a change to the stock root select functionality which may make trying to get this working not really important anymore.  What is the code actually trying to do?

Edited by Padishar

Share this post


Link to post
Share on other sites

@FreeThinker It's in KSP.UI.Screens.Flight.Dialogs.

The ExperimentResultDialogPage constructor requires a ScienceLabSearch object (with a Vessel and ScienceData object), but otherwise seem to function the same as before.

Share this post


Link to post
Share on other sites
52 minutes ago, Padishar said:

There has been a change to the stock root select functionality which may make trying to get this working not really important anymore.  What is the code actually trying to do?

First off, Squad is adding a function so I won't need to use reflection to get a hidden value anymore.

I have two mods which use this:  WasdEditorCameraRedux and EditorExtensionsRedux.  They use it in different ways, but essentially to avoid conflicting with what the editor itself is doing.

Share this post


Link to post
Share on other sites
13 minutes ago, DMagic said:

@FreeThinker It's in KSP.UI.Screens.Flight.Dialogs.

The ExperimentResultDialogPage constructor requires a ScienceLabSearch object (with a Vessel and ScienceData object), but otherwise seem to function the same as before.

Yes added one, but has anyone worked out yet how this ScienceLabSearch object works or functions?

Share this post


Link to post
Share on other sites

@JPLRepo Looking at the fields in the ScienceLabSearch class I'm guessing it just builds a list of all the science labs on the current vessel that: 1; are manned, 2; have space, 3; haven't processed that data, 4; aren't currently processing anything. Then just sends your data to the next valid lab when you click on the lab process button.

Share this post


Link to post
Share on other sites
2 hours ago, FreeThinker said:

AudioSource class is suddenly missing the propery panLevel, is panStereo it's alternative?

Hi,

I replaced panLevel with spatialBlend for Chatterer, it seems to do the trick if you want a 2D audiosource.

panStereo seems more like just a left/right balance, I might be wrong though.

Share this post


Link to post
Share on other sites

ScreenMessages.ActiveMessages list is no longer public.
Went looking in KSP.UI.* but couldn't find anything that replaces it... Anyone got any ideas?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.