linuxgurugamer / EvaFuel

A mod for Kerbal Space Program that makes Kerbals no longer be able to have infinite EVA fuel. A continuation of Vendan's mod of the same name.
http://forum.kerbalspaceprogram.com/index.php?/topic/138474-111-105-evafuel-no-more-infinite-eva-fuel/
MIT License
3 stars 5 forks source link

EvaFuel-KISCompat needs a dependency provided #13

Open ihsoft opened 4 years ago

ihsoft commented 4 years ago

The release lacks KSPDev_Utils.2.1.dll which is used by the ModuleKISItemEvaPropellantProxy. It works fine with the KIS version up to 1.24 because Utils v2.1 module is shipped with KIS. However, starting from KIS v1.25 a newer version is used, so KISCompact fails:

[EXC 12:09:20.898] FileNotFoundException: Could not load file or assembly 'KSPDev_Utils.2.1, Version=2.1.7279.39857, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    KIS.KIS_Item.Use (KIS.KIS_Item+UseFrom useFrom) (at <260264fece7f4aefbe53a4372aaba441>:0)
    KIS.ModuleKISInventory.GuiContextMenu (System.Int32 windowID) (at <260264fece7f4aefbe53a4372aaba441>:0)
    UnityEngine.GUILayout+LayoutedWindow.DoWindow (System.Int32 windowID) (at <fa6f9762ac624af092525d37c9d516c4>:0)
    UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at <fa6f9762ac624af092525d37c9d516c4>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

The idea of using version in the assembly name was to avoid the "DLLs hell" and make the mods working with the dexact version of Utils they were linked with. For this to work properly every mod must have a copy of the utils DLL. It's fine to have multiple copies of the same version, the game's loader will actually load just one, so no RAM will be wasted.

linuxgurugamer commented 4 years ago

In that case, it's very likely that the KIS dll which has changed is incompatible with what the mod is looking for, so I actually DON'T want it to work in that case.
The correct version of KSPDev_Utils is included with KIS, so this is actually a reasonable way to make sure that EVAFuel won't try accessing the wrong version of KIS, which would cause other problems. Maybe I need to rebuild the mod for the current version of KIS, which would solve the problem here without the need to include a foreign DLL.

ihsoft commented 4 years ago

Rebuilding for the new KIS version will sure work.

As for the Utils, its version is unrelated to the KIS version. So, if it changes it is very unlikely that KIS dll got an incompatible change. For KIS the utils DLL is an implementation. Why would you care about the implementation change if the interface between KIS and your mod was not changed?

Anyway, you better know what your mod needs :) What I'd suggest to reduce the frequency of your mod update due to the KIS stuff is to simply copy the relevant Utils modules that you use into the project (I think these are ScreenMessaging and UISoundPlayer). KPDev Utils is distributed under Public Domain licence, so doing this is perfectly fine.

linuxgurugamer commented 4 years ago

I've been thinking about this a lot.

That is an excellent suggestion, thank you.

linuxgurugamer commented 4 years ago

Unfortunately, in a quick test, ScreenMessaging needs other parts. Would you have any objection if I just included the DLL ?

ihsoft commented 4 years ago

Including DLL is completely fine. It was made exactly for this :)