Jump to content

Info on how to convert your Plugin to KSP 1.1


Recommended Posts

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)" ?

Link to comment
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.

Link to comment
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.

Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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.

Link to comment
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 :)

Link to comment
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
Link to comment
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

Link to comment
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
Link to comment
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.

Link to comment
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?

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...