Jump to content

[1.0.4] KSPAPIExtensions V1.7.5 - Utilities for shared mod use 25 Jun


swamp_ig

Recommended Posts

Actually, KSPAPIExt shouldn't be in CKAN in the first place since each mod that uses it is supposed to supply its own copy. KSPAPIExt is not your usual dependency.

Note: I do consider that to be a problem (it has certainly caused me much grief in getting KSPAPIext to work since 0.25 (0.24?)), but that's the way it is right now.

Better late than never but... this problem should no longer exist for KSP versions later than 0.90 as of https://github.com/KSP-CKAN/NetKAN/pull/1428 which was just merged.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hello! I've just finished creating a new mod and I'm about to release it to the users on /r/kos for beta testing. It's a part with a custom part module that pulls data out of FAR and makes it available to the kOS processor, as well as adding the ability to log the FAR information directly to a file. I haven't copied/pasted any code, and I'm using/distributing the KSPApiExtensions.dll file along side my own plugin as recommended.

I contacted the original created per the front page and he said it was cool to use KSPApiExtensions. I'm using it in exactly 1 place (using UI_FloatEdit), so I'm hoping there won't be much that future releases can break, but I will monitor this thread just in case. I've credited the original mod creator and "the maintainers" generally in my readme file.

Is there anything else you'd like of me before I announce to people?

The repo is here: https://github.com/mthiffau/FARKOSData

The first release is here: https://github.com/mthiffau/FARKOSData/releases/tag/v0.1

Link to comment
Share on other sites

Hello! I've just finished creating a new mod and I'm about to release it to the users on /r/kos for beta testing. It's a part with a custom part module that pulls data out of FAR and makes it available to the kOS processor, as well as adding the ability to log the FAR information directly to a file. I haven't copied/pasted any code, and I'm using/distributing the KSPApiExtensions.dll file along side my own plugin as recommended.

I contacted the original created per the front page and he said it was cool to use KSPApiExtensions. I'm using it in exactly 1 place (using UI_FloatEdit), so I'm hoping there won't be much that future releases can break, but I will monitor this thread just in case. I've credited the original mod creator and "the maintainers" generally in my readme file.

Is there anything else you'd like of me before I announce to people?

The repo is here: https://github.com/mthiffau/FARKOSData

The first release is here: https://github.com/mthiffau/FARKOSData/releases/tag/v0.1

Looks like solution to read wing pressure, liftt drag, sideslip and whatever kOS user might need from FAR data for scripting.

Is it possible to add this new info part to any command module, like some MM patch does for MechJeb or Kerbal engineer ?

Link to comment
Share on other sites

Looks like solution to read wing pressure, liftt drag, sideslip and whatever kOS user might need from FAR data for scripting.

Is it possible to add this new info part to any command module, like some MM patch does for MechJeb or Kerbal engineer ?

Yes actually. All you should need to add is the FARKOSData module, no other fields in the config required for it.

Link to comment
Share on other sites

I just installed Real Fuels 10.4, and noticed some odd GUI issues with Procedural Parts. When I bring up the procedural tank GUI, the options to select textures/shapes are invisible, and the debug is repeatedly spammed with:

[Error]: ItemPrefab for control type 'UI_ChooseOption' not found.

Deleting the updated KAE dll in the Real Fuels folder seems to resolve the Procedural Parts issue and it works normally again.

I don't know if it's due to Procedural Parts out of date, a bug with KAE 1.7.5, or something else entirely. Just thought I'd bring it up.

I'm running KSP 1.04.

Edited by allenby
Link to comment
Share on other sites

I just installed Real Fuels 10.4, and noticed some odd GUI issues with Procedural Parts. When I bring up the procedural tank GUI, the options to select textures/shapes are invisible, and the debug is repeatedly spammed with:

[Error]: ItemPrefab for control type 'UI_ChooseOption' not found.

Deleting the updated KAE dll in the Real Fuels folder seems to resolve the Procedural Parts issue and it works normally again.

I don't know if it's due to Procedural Parts out of date, a bug with KAE 1.7.5, or something else entirely. Just thought I'd bring it up.

I'm running KSP 1.04.

Same issue here. I think Pparts needs to update to latest KAE.

Link to comment
Share on other sites

Hm, I put KSPAPI in it's own folder (there was one mod which had it in it's own folder, I forget which one, not sure if it's even neccesary to do that though) and it still says incompatible. It may be that theres procedural fairings and probably a few others which need to update it.

Edit: I think it was one of the dev versions of tweakableeverything while Toadicus was trying to fix the staging issues.

Edited by smjjames
Link to comment
Share on other sites

Hm, I put KSPAPI in it's own folder (there was one mod which had it in it's own folder, I forget which one, not sure if it's even neccesary to do that though) and it still says incompatible. It may be that theres procedural fairings and probably a few others which need to update it.

Edit: I think it was one of the dev versions of tweakableeverything while Toadicus was trying to fix the staging issues.

Please don't. Every mod is liked with its own copy of KSPAPIExtensions and its designed to work that way. What you did might work most of the time but it can lead to problems.

Regarding Procedural Parts: I will push an update (incorporating the newsest KSPIAPIExtensions) tomorrow. Please be patient.

Link to comment
Share on other sites

Ah, so it doesn't look like it was the previous version of Procedural Parts that was causing the odd GUI issue/debug errors. Even with the updated Procedural Parts that uses KAE 1.7.5, the issue still persists. However, removing the KAE dll fom RealFuels or otherwise disabling the mod still resolves this issue like before. I was also wrong when I referred to the "updated" KAE dll in RealFuels, as it turns out it still uses 1.7.3 (what I found in the directory), so at this point I'm completely lost.

All I can say at this point is that, on my end (and at least one other person), having Real Fuels 10.4.1 and PP 1.1.4 present will break functionality of the latter, with the error message:

[Error]: ItemPrefab for control type 'UI_ChooseOption' not found.

Link to comment
Share on other sites

Ah, so it doesn't look like it was the previous version of Procedural Parts that was causing the odd GUI issue/debug errors. Even with the updated Procedural Parts that uses KAE 1.7.5, the issue still persists. However, removing the KAE dll fom RealFuels or otherwise disabling the mod still resolves this issue like before. I was also wrong when I referred to the "updated" KAE dll in RealFuels, as it turns out it still uses 1.7.3 (what I found in the directory), so at this point I'm completely lost.

All I can say at this point is that, on my end (and at least one other person), having Real Fuels 10.4.1 and PP 1.1.4 present will break functionality of the latter, with the error message:

[Error]: ItemPrefab for control type 'UI_ChooseOption' not found.

I'm getting it also.

Unfortunately, it doesn't indicate which copy of the dll is generating it. I have this installed in the following locations:


MagicSmokeIndustries/Plugins/KSPAPIExtensions.dll
ModularFuelTanks/Plugins/KSPAPIExtensions.dll
ProceduralFairings/KSPAPIExtensions.dll
ProceduralParts/Plugins/KSPAPIExtensions.dll
SmartParts/Plugins/KSPAPIExtensions.dll
TweakableEverything/KSPAPIExtensions.dll
TweakScale/plugins/KSPAPIExtensions.dll

This is on a 1.0.4 install, some of those above are from mods which were 1.0.2 compatible.

Link to comment
Share on other sites

Please don't. Every mod is liked with its own copy of KSPAPIExtensions and its designed to work that way. What you did might work most of the time but it can lead to problems.

Regarding Procedural Parts: I will push an update (incorporating the newsest KSPIAPIExtensions) tomorrow. Please be patient.

Just a comment:

I had this same problem when running these mods:

Infernal Robotics

and SmartParts

The DLL was also in several other directories. The other directories had the current version installed, but these two had 1.7.4 installed.

Once I replaced the DLL in those two directories, the problem with the right-click menus went away.

FYI, Smart Parts is listed as compatible with 1.0.4, IR is not although it does seem to work properly.

Link to comment
Share on other sites

  • 1 month later...

So, reading the docs, it looks like I just need this?

        [PartMessageListener(typeof(PartMassChanged), scenes:GameSceneFilter.AnyEditor)]
public void PartMassChanged(float mass)
{
Debug.Log("is this called?");
}

And maybe I also need to register? And these two steps are all it takes?

        public override void OnAwake()
{
base.OnAwake();
PartMessageService.Register(this);
}

I ask because my log line is not getting hit. I was able to get this to work with TweakScale.IRescalable<ExtendedPartInfo> but that does not account for changes to resources, like dragging in or out some amount of fuel, or changing the "layout" of some ModuleFuelTanks.

Link to comment
Share on other sites

  • 1 month later...

I hope I've come to the right place. After a little digging, I've found reports similar to but not exactly the same as this in this thread.

If I'm reading my logs correctly, it appears that all of the mods loading KAE are loading version 1.7.5.0. If there's a reliable way for me to check, please let me know and I'll do so.

I'm getting the following error when I the first time I right-click on a capsule in the VAB. It seems to not trigger on the one probe I have available to me so far. But, once I trigger it and see this in the log, no right-click menus will generate for any part in the VAB:


[EXC 20:42:36.709] StackOverflowException: The requested operation caused a stack overflow.
KSPAPIExtensions.UIPartActionFloatEdit.UpdateValueDisplay (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.SetValueFromGUI (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged (IUIObject obj)
UIProgressSlider.UpdateValue ()
UIProgressSlider.set_Value (Single value)

Actually it continues on for quite a bit, repeating those same lines until it gets to the bottom of the stack.

I'm running on Windows 7, and will gladly provide any system information you might need that I haven't thought to include.

Thank you! And thanks for all the hard work!

Link to comment
Share on other sites

Thanks, taniwha! Unfortunately I think I've captured the meat of it. To illustrate, it looks like:


[EXC 20:42:36.709] StackOverflowException: The requested operation caused a stack overflow.
KSPAPIExtensions.UIPartActionFloatEdit.UpdateValueDisplay (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.SetValueFromGUI (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged (IUIObject obj)
UIProgressSlider.UpdateValue ()
UIProgressSlider.set_Value (Single value)
KSPAPIExtensions.UIPartActionFloatEdit.UpdateValueDisplay (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.SetValueFromGUI (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged (IUIObject obj)
UIProgressSlider.UpdateValue ()
UIProgressSlider.set_Value (Single value)
KSPAPIExtensions.UIPartActionFloatEdit.UpdateValueDisplay (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.SetValueFromGUI (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged (IUIObject obj)
UIProgressSlider.UpdateValue ()
UIProgressSlider.set_Value (Single value)
KSPAPIExtensions.UIPartActionFloatEdit.UpdateValueDisplay (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.SetValueFromGUI (Single newValue)
KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged (IUIObject obj)
UIProgressSlider.UpdateValue ()
UIProgressSlider.set_Value (Single value)

and so on, until it reaches a final set of those lines. That's going from memory, though, so there's a chance that there's more information to glean if you have the rest of the log.

I don't have access to the full log right now, but I'll post a link to it later tonight when I can. I really appreciate you looking into this!

Link to comment
Share on other sites

I'm getting the above exceptions in my log as well

(Filename: 

C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/

UnityEngineDebug.cpp Line: 56)

NullReferenceException: Object reference not set to an

instance of an object
at System.Guid.BaseToString (Boolean h, Boolean p, Boolean

[0x00000] in <filename unknown>:0 at System.Guid.ToString

() [0x00000] in <filename unknown>:0 at

WhitecatIndustries.VesselData.CheckIsKeeping (.Vessel vessel)

[0x00000] in <filename unknown>:0 at

WhitecatIndustries.StationKeepingModule.OnStart (StartState

state) [0x00000] in <filename unknown>:0 at

Part.ModulesOnStart () [0x00000] in <filename unknown>:0 at

Part+.MoveNext () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

System.NullReferenceException: Object reference not set to an

instance of an object at

KSPAPIExtensions.UIPartActionChooseOption.UpdateItem ()

[0x00000] in <filename unknown>:0

(Filename:

C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/

UnityEngineDebug.cpp Line: 56)

StackOverflowException: The requested operation caused a stack

overflow.
at

KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged

(IUIObject obj) [0x00000] in <filename unknown>:0 at

UIProgressSlider.UpdateValue () [0x00000] in <filename

unknown>:0 at UIProgressSlider.set_Value (Single value)

[0x00000] in <filename unknown>:0 at

KSPAPIExtensions.UIPartActionFloatEdit.UpdateValueDisplay

(Single newValue) [0x00000] in <filename unknown>:0 at

KSPAPIExtensions.UIPartActionFloatEdit.SetValueFromGUI (Single

newValue) [0x00000] in <filename unknown>:0 at

KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged

(IUIObject obj) [0x00000] in <filename unknown>:0 at

UIProgressSlider.UpdateValue () [0x00000] in <filename

unknown>:0 at UIProgressSlider.set_Value (Single value)

[0x00000] in <filename unknown>:0 at

KSPAPIExtensions.UIPartActionFloatEdit.UpdateValueDisplay

(Single newValue) [0x00000]

And then it just keeps on repeating from the "at KSPAPIExtensions.UIPartActionFloatEdit.slider_OnValueChanged" line

I'm running a bunch of mods and getting a bunch of problems though, so I'm trying to disable things and see if I can narrow this stuff down. Not even sure this is the exception that's causing my in-game issues.

Link to comment
Share on other sites

I'm getting the above exceptions in my log as well

I'm running a bunch of mods and getting a bunch of problems though, so I'm trying to disable things and see if I can narrow this stuff down. Not even sure this is the exception that's causing my in-game issues.

I'm glad it's not just me. Thanks, baldamundo. I run more mods than I probably should, so narrowing it down will be tricky at best.

Here's a link to the full log. Let me know how else I can help, taniwha!

KSP.log

Edited by jwest
Link to comment
Share on other sites

I don't know if it is related, but SmartParts causes KSPAPIExt to throw an exception during part loading:


[ERR 22:12:55.150] Exception when attempting to register listener: Lib.Stager, SmartParts, Version=1.6.5.0, Culture=neutral, PublicKeyToken=null.changeListener

[EXC 22:12:55.152] ArgumentException: Message argument is null
KSPAPIExtensions.PartMessage.PartMessageListener..ctor (System.Type delegateType, PartRelationship relations, GameSceneFilter scenes)
System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, Boolean inherit)
System.Reflection.MonoMethod.GetCustomAttributes (Boolean inherit)
KSPAPIExtensions.PartMessage.ServiceImpl.Register[Stager] (Lib.Stager obj)
UnityEngine.GameObject:AddComponent(Type)
Part:AddModule(String)
Part:AddModule(ConfigNode)
PartLoader:ParsePart(UrlConfig, ConfigNode)
^V^E:MoveNext()

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