Closed AlphaAsh closed 8 years ago
Thanks to my much more experienced code genius wife you can ignore my BS about Guid and parsing but it'd still be handy to pass a Guid with AddGroundStation, rather than have one generated. I married well.
If you want to use your own IDs, you can just keep a map of them. Yes, one mod may provide a unique IDs, but this is a shared resource and it doesn't guarantee that there is no conflict with IDs provided by other mods.
Yup, thanks to my better half it looks like I should be able to map Guids that RT spits out.
Ahh... writing KSP mods with your wife... you're livin' the dream man, never forget that :)
It's going on my grave-stone. "He modded games with his wife. He was one really lucky bastard."
I know it's a closed issue but after mucking about mapping Guids that RT spits out I realised something. "...it doesn't guarantee that there is no conflict with IDs provided by other mods" This is pretty nonsense. Doesn't matter whether I'm passing you a Guid, or you're passing me a Guid, the chances of another mod stepping on it are the same.
Also, what other mod? And who cares?
Doesn't matter whether I'm passing you a Guid, or you're passing me a Guid, the chances of another mod stepping on it are the same.
It does, nothing stops you/other mod reusing a Guid when creating a new resource. So, there is a problem, I have to deal with duplicate Guids then, check/overwrite/throw exception/etc. If I generate and manage Guids, I can guarantee that everything that goes out is unique.
Also, what other mod? And who cares?
I guess you will care if MyFancyPolarGroundStation mod uses hard-coded Guid value to add new ground station and by accident it overwrites one of your ground station's Guid and your ground station disappears.
Paranoid coding. You aren't managing bank accounts.
"I have to deal with duplicate Guids then, check/overwrite/throw exception/etc." And you already do.
Feel free to submit a PR if you feel that your solution is better than the current one.
No thank you. Feel free to take a look at my fork of RT. I'm not going to push code at you that I'm still testing and that purposefully circumvents a lot of RT's functions.
Regarding the API, one possible addition I'd like is a parameter for setting a Guid with AddGroundStation, that over-rides the one generated by RT.
An overloaded method would probably suffice. That'd make it a lot easier for interfacing mods to keep track of persistency their side. Especially when they have their own keys for tracking stations. (Kerbal Konstructs uses radial position converted to a string.)
Also, I've noted there's some limitations on parsing Guids in Unity's implementation of C#. It'd be very handy to be able to provide a key that isn't a Guid. Like the aforementioned example I gave. You'd have to trust up to a point that what's being passed is unique. Relying on a type that's such a restrictive bear to handle is making life hard over here :)