AlphaAsh / Kerbal-Konstructs_DEV

Dev repository for Kerbal Konstructs
https://github.com/AlphaAsh/Kerbal-Konstructs_DEV
2 stars 8 forks source link

Adding variables to KK.cfg #2

Closed simonmeulenbeek closed 8 years ago

simonmeulenbeek commented 8 years ago

Hi AlphaAsh, I forked KerbalKonstructs to try to add remotetech integration. It kind of works at the moment, but I have trouble making it persist after restarting KSP.

The way it works now, is that whenever you open a base, KK invokes a RT-api-method to add a new groundstation at that location. The method returns the guid of that RTantenna, and it gets stored in the Launchsite object. When I want to close a particular base, the rt-antenna-guid gets sent to the rt-api, and it removes that particular groundstation. However the RTantenna-guid get's lost when reloading a save file.

So my question is; how can I have those variables persist? I guess I should add them to 'KK.cfg' in the saves folder, but I have no idea how to actually do that. In KK.cfg there are per launchsite 2 variables (openclosestate and favouritesite), both of which are set as [PersistentField] in launchsite.cs, So I tried to set my variables as persistentfield, but that didn't work. I'm trying to figure out how PersistenceFile & PersistenceUtils work, but so far I haven't been able to.

AlphaAsh commented 8 years ago

I've started looking in to this myself and the problem is RemoteTech's API didn't allow for adding and removing groundstations 'on the fly'. They're working on some API improvements which I've been following and it's looking promising although my prototype is still falling over messily. So I've put it on hold for now until I see what RT is doing with their API. Incidentally, the lack of parsing methods on Guid in Unity is doing my head in. I'll get a repo for the KK-RT assembly sorted asap so you can see what I'm doing.

AlphaAsh commented 8 years ago

I've repoed KKRTInterface and forked RT so I can better contribute directly to that. No idea if they'll want any pushes I make though. If you'd like to continue helping I'd suggest pushing some code at those and we'll go from there.