Cephei

The official unoffical "help a fellow plugin developer" thread

Recommended Posts

Start() runs on vessel load, correct? 

Also, anything that is not in a KSPField and not specifically in a saveCfgNode thing gets deleted by KSP?

Share this post


Link to post
Share on other sites

Hi, what exactly is "World Space" and how does it relate to the position vectors in KSP?

Specifically, to FlightGlobals.currentMainBody.position and FlightGlobals.ActiveVessel.transform.position ?

I'm trying to draw some lines using Vectrosity from a set of coordinates. That worked using the Unity.LineRenderer, but when I try to use  the very same coordinates for rendering of Vectrosity.VectorLine, the lines go out straight out of the screen and behave weirdly when rotating the camera.

ps.: Is there some sort of "reference frame guide" for KSP? I keep getting confused by World/Body-Relative/Krakensbane/Surface-Relative and all kinds of coordinate systems.

Share this post


Link to post
Share on other sites

messrs, how can i catch only "revert to launch" event? (user has pressed stock "revert to launch" button)

Share this post


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

messrs, how can i catch only "revert to launch" event? (user has pressed stock "revert to launch" button)

Maybe something in here?

Share this post


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

messrs, how can i catch only "revert to launch" event? (user has pressed stock "revert to launch" button)

Try checking to see if "revert to launch" will fire OnVesselRollout. You'd have to listen for onGameSceneSwitchRequested before that so that you can distinguish between a new launch from VAB/SPH (from EDITOR to FLIGHT) vs actually revert to launch (from FLIGHT to FLIGHT)

  • Like 2

Share this post


Link to post
Share on other sites

@cake>pie   Tnx! That what i want.

Edited by DennyTX

Share this post


Link to post
Share on other sites

I would like to disable facility repairs. I've tried destroying them under "indestructable facilities," but that doesn't prevent repairs. I've tried locking them, but this also does not prevent repair.

Share this post


Link to post
Share on other sites
On 20/05/2017 at 2:18 PM, Kobymaru said:

ps.: Is there some sort of "reference frame guide" for KSP? I keep getting confused by World/Body-Relative/Krakensbane/Surface-Relative and all kinds of coordinate systems.

I'd love to see a guide/tuto about this. I recently try to calculate the distance between two ship orbiting different bodies but couldn't figure it out :(

  • Like 1

Share this post


Link to post
Share on other sites

Two related questions

My current contracts have english strings in the source code to which I append the names of bodies for the which the contract applies e.g.

"Crash a probe into " +body.GetDisplayName();

As of 1.3 that code is appending the gender to the end of the string as ^N I want the simplest way to replicate the functionality of the previous theName property so it at least makes gramatical sense in English

Second question

Is there a guide anywhere on how to localize mods properly? Generating contracts, science experiment definitions etc.

Edited by tomf

Share this post


Link to post
Share on other sites
8 minutes ago, tomf said:

Two related questions

My current contracts have english strings in the source code to which I append the names of bodies for the which the contract applies e.g.


"Crash a probe into " +body.GetDisplayName();

As of 1.3 that code is appending the gender to the end of the string as ^N I want the simplest way to replicate the functionality of the previous theName property so it at least makes gramatical sense in English

You need to pass the display name through Lingoona to get the gender code stripped/used.  The hacky way to do that would be:

KSP.Localization.Localizer.Format("Crash a probe into <<1>>", body.GetDisplayName());

The better way is to put the string "Crash a probe into <<1>>" into a localisation string in the proper file/format (some details in the thread below).

8 minutes ago, tomf said:

Second question

Is there a guide anywhere on how to localize mods properly? Generating contracts, science experiment definitions etc.

Check out @DMagic's thread here:

 

  • Like 1

Share this post


Link to post
Share on other sites

Has anyone noticed that the toggle options in the game settings are vertically aligned centered? Not vertically aligned top? Is there a fix for that? It looks pretty silly when I only have one or two options. See pictures below for Basic settings on the left, especially the floating toggle option in the middle column, and my mod's setting in the picture on the right.

Also, what does "autoPersistance" in GameParameters.CustomParameterNode do?

  OQFst3Q.png    gykNlLh.png

Share this post


Link to post
Share on other sites
44 minutes ago, ev0 said:

Has anyone noticed that the toggle options in the game settings are vertically aligned centered? Not vertically aligned top? Is there a fix for that? It looks pretty silly when I only have one or two options. See pictures below for Basic settings on the left, especially the floating toggle option in the middle column, and my mod's setting in the picture on the right.

Also, what does "autoPersistance" in GameParameters.CustomParameterNode do?

  OQFst3Q.png    gykNlLh.png

It's a reported bug for 1.3.

autoPersistence if true will persist the variable into the sfs save file and reload it for you automatically.

  • Like 1

Share this post


Link to post
Share on other sites

I was wanting to drop some pull requests to help updated the various open source modes mods to 1.3.0

What are the changes in "part only" mods if there are any?

Share this post


Link to post
Share on other sites
On 6/3/2017 at 1:04 PM, Ruedii said:

I was wanting to drop some pull requests to help updated the various open source modes mods to 1.3.0

What are the changes in "part only" mods if there are any?

I have not seen any changes, but there may (or may not) have been some new functions added. All purly parts mods from 1.2.2 will work in KSP 1.3. 

  • Like 1

Share this post


Link to post
Share on other sites

So I'm trying to add an action to a part's right-click menu, but when I click the in-game button, nothing happens--the debug messages I programmed in don't even show up anywhere. As far as I can tell, this is the relevant bit in KSP.log:

[ERR 14:14:51.877] ADDON BINDER: Cannot resolve assembly: System.Collections, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

[EXC 14:14:51.879] FileNotFoundException: Could not load file or assembly 'System.Collections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
	BaseEvent.Invoke ()
	UIPartActionButton.OnClick ()
	UnityEngine.Events.InvokableCall.Invoke (System.Object[] args)
	UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEvent.Invoke ()
	UnityEngine.UI.Button.Press ()
	UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor)
	UnityEngine.EventSystems.EventSystem:Update()

And here's my code. Is there something I screwed up?

Share this post


Link to post
Share on other sites
1 minute ago, Deus Zed Machina said:

So I'm trying to add an action to a part's right-click menu, but when I click the in-game button, nothing happens--the debug messages I programmed in don't even show up anywhere. As far as I can tell, this is the relevant bit in KSP.log:


[ERR 14:14:51.877] ADDON BINDER: Cannot resolve assembly: System.Collections, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

[EXC 14:14:51.879] FileNotFoundException: Could not load file or assembly 'System.Collections, Version=4.0.10.0

And here's my code. Is there something I screwed up?

It looks like you compiled against .NET 4.0. Try 3.5, that's the version mods are supposed to use.

Share this post


Link to post
Share on other sites
1 minute ago, Deus Zed Machina said:

So I'm trying to add an action to a part's right-click menu, but when I click the in-game button, nothing happens--the debug messages I programmed in don't even show up anywhere. As far as I can tell, this is the relevant bit in KSP.log:


[ERR 14:14:51.877] ADDON BINDER: Cannot resolve assembly: System.Collections, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

[EXC 14:14:51.879] FileNotFoundException: Could not load file or assembly 'System.Collections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
	BaseEvent.Invoke ()
	UIPartActionButton.OnClick ()
	UnityEngine.Events.InvokableCall.Invoke (System.Object[] args)
	UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEvent.Invoke ()
	UnityEngine.UI.Button.Press ()
	UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor)
	UnityEngine.EventSystems.EventSystem:Update()

And here's my code. Is there something I screwed up?

seems like a compiler issue. Check your file paths in your programing environment (visual studio or whatever you're using)

Share this post


Link to post
Share on other sites
29 minutes ago, Bonus Eventus said:

seems like a compiler issue. Check your file paths in your programing environment (visual studio or whatever you're using)

 

29 minutes ago, HebaruSan said:

It looks like you compiled against .NET 4.0. Try 3.5, that's the version mods are supposed to use.

As far as I can tell, I'm using NET 3.5, though the project properties don't show an Application tab for some reason so I'm not 100% sure. How would I go about checking the file paths? I'm using Visual Studio 2017.

Share this post


Link to post
Share on other sites
Just now, Deus Zed Machina said:

As far as I can tell, I'm using NET 3.5, though the project properties don't show an Application tab for some reason so I'm not 100% sure. How would I go about checking the file paths? I'm using Visual Studio 2017.

Your csproj file should have this:

    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

 

Share this post


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

Your csproj file should have this:


    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

 

My csproj file doesn't have any .NET framework version specified, apparently. It lacks the <TargetFrameworkVersion> tag altogether. Should I just paste that line in or..?

Share this post


Link to post
Share on other sites
1 minute ago, Deus Zed Machina said:

My csproj file doesn't have any .NET framework version specified, apparently. It lacks the <TargetFrameworkVersion> tag altogether. Should I just paste that line in or..?

Make a backup and try it, I guess? I don't know much about Visual Studio, but I would guess that without that line, it would use the latest version you have installed. Here's a full example if you want to see it in context:

https://github.com/HebaruSan/Astrogator/blob/master/src/Astrogator.csproj#L12

Share this post


Link to post
Share on other sites
20 minutes ago, HebaruSan said:

Make a backup and try it, I guess? I don't know much about Visual Studio, but I would guess that without that line, it would use the latest version you have installed. Here's a full example if you want to see it in context:

https://github.com/HebaruSan/Astrogator/blob/master/src/Astrogator.csproj#L12

Well, that didn't work. It says I need to update visual studio to open the .cs file, then it takes me to MSN. I think the issue has something to do with my version of visual studio...

EDIT: If I make a new project and select .NET 3.5 in the file creation menu, the resulting .csproj still lacks the <TargetFrameworkVersion> tag.

Edited by Deus Zed Machina

Share this post


Link to post
Share on other sites
1 hour ago, Deus Zed Machina said:

Well, that didn't work. It says I need to update visual studio to open the .cs file, then it takes me to MSN. I think the issue has something to do with my version of visual studio...

EDIT: If I make a new project and select .NET 3.5 in the file creation menu, the resulting .csproj still lacks the <TargetFrameworkVersion> tag.

Well, I'd say that's the problem, then. I can't help you with wrangling your software, but I can wish you good luck. :)

Have you tried compiling the source for another mod that already works?

Share this post


Link to post
Share on other sites
11 hours ago, Deus Zed Machina said:

I think the issue has something to do with my version of visual studio...

Which version are you using ?

Share this post


Link to post
Share on other sites
9 hours ago, sarbian said:

Which version are you using ?

Visual Studio Community 2017 ver. 15.2 (26430.12) Release

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now