Closed Lisias closed 4 months ago
A proposal for implementation can be found here:
https://github.com/net-lisias-ksp/DistantObject/issues/11#issuecomment-1487768936
My job now is to create a new Interface and two DLLs realising it - one for Stock and another for Kopernicus.
Another one, here: https://github.com/net-lisias-ksp/DistantObject/issues/11#issuecomment-2253691518
Problem - it still causes a hard dependency on Kopernicus.
I think it's time to kick start this thingy...
Implemented on commit https://github.com/net-lisias-ksp/DistantObject/commit/1da19e53940b2dcf1fd93e31daabfa6acb518905
Thanks to @Tequhella for doing the hard part for me!
Okay, I'll comment here then! @Lisias
So, to come back to the comment about the hard dependency, yes indeed, I hadn't realized I'd left a reference in, but I don't use it at all in FlareDraw.cs
. The only place it's used is in ISolarSystem.cs
. But I've already tried to run KSP without Kopernicus, and had no problem.
I've just seen what you've done, and I can see better what you imagined. Thx for taking the time to do this implementation!
@Tequhella The problem with hard dependencies is that they will prevent the whole Assembly from being loaded if they are not met, screwing the add'on.
The only way to overcome this is by doing what I did: optionally loadable Assemblies, loaded on demand depending on what you have installed in your rig.
On this solution case, if the code finds Kopernicus
installed, it will load the SolarSystemKopernicus
DLL, if not, it will load the SolarSystemStock
one.
By shoving on these DLLs the services you need to be carried on, you will preserve the main Assembly from any foreign dependency, allowing it to be always loaded.
It's somewhat convoluted, I agree. But, yet, it's the only feasible (and safe) way to do such.
@Lisias Okay, I understand the principle! But I'm not sure when this problem appears. Is it during development or when the game is launched?
@Tequhella Both!
Hum... Ok, so I don't understand how I was able to use DOE in-game without any problems with my version of the mod when I deleted Kopernicus from my GameData folder. It shouldn't have worked if the Kopernicus assembly isn't present to be loaded, if I understood correctly. Sorry for these questions, I'm trying to understand how assemblies work with KSP! Because there's certainly a lot I'm missing, and I think it might help me be more efficient for other times when I'm helping out.
Yes, you are right. DOE should had failed being loaded without Kopernicus - historically, it was being happening since Kraken knows when.
Now I'm curious... I will check this as soon as I find the time.
(hopefully, this week)
@Lisias I saw that you posted on the forum that you haven't tested Kopernicus support yet. I've installed it on my machine, and it seems to work fine!
@Tequhella thank you!
As the title says.
Check this post on Forum.