RemoteTechnologiesGroup / RemoteTech

Community developed continuation of Kerbal Space Program's RemoteTech mod.
http://remotetechnologiesgroup.github.io/RemoteTech
GNU General Public License v2.0
233 stars 102 forks source link

Rework Settings storage mechanism #700

Closed YamoriYuki closed 7 years ago

YamoriYuki commented 7 years ago

Current way of loading and saving setting in RT is quite hackish. It may have been appropriate back in the day it was written, but today it's hurting integration of RT with other mods. To alleviate this we need to change the following: 1) Default settings should be loaded from GameDatabase to allow MM patching. 2) Saved settings should be stored through a ScenarioModule to store them inside persistent.sfs

YamoriYuki commented 7 years ago

A quick attempt to do 1) results in game getting stuck on compiling parts during initial loading scene. Needs further investigation.

[LOG 19:24:58.162] RemoteTech: ModuleRTAntenna: Found TRANSMITTER block.
[LOG 19:24:58.170] RemoteTech: ModuleRTAntenna: OnDestroy
[LOG 19:24:58.171] RemoteTech: ModuleSPUPassive: OnDestroy
[LOG 19:24:58.178] RemoteTech: RemoteTech is disabled because the default file 'C:/Users/yuki/games/KSP-1.2/KSP_x64_Data/..//GameData/RemoteTech/Default_Settings.cfg' is not found
[LOG 19:24:58.179] RemoteTech: RemoteTech is disabled because the default file 'C:/Users/yuki/games/KSP-1.2/KSP_x64_Data/..//GameData/RemoteTech/Default_Settings.cfg' is not found
[EXC 19:24:58.184] NullReferenceException: Object reference not set to an instance of an object
    RemoteTech.Modules.ModuleRTAntenna.get_RangeMultiplier ()
    RemoteTech.Modules.ModuleRTAntenna.GetInfo ()
    PartLoader.CompilePartInfo (.AvailablePart newPartInfo, .Part part)
    PartLoader+<CompileParts>c__Iterator62.MoveNext ()
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)
KSP-TaxiService commented 7 years ago

@YamoriYuki This lockup during the KSP's startup is due to the endless loop of looking for Default_Settings.cfg that you removed. I will handle this point (1) as I am the one who rewrote the whole default stuff.

KSP-TaxiService commented 7 years ago

I opened a new feature request #702 on the point 2 of ScenarioModule for RT 2.x development.

For the point 1, if the fix to this bug is proved to be good for third-party modders, I will close this issue as resolved and add a new page to our RT manual on our new approach of MM-patches in place of static RemoteTech_Settings.cfg used by modders.

KSP-TaxiService commented 7 years ago

So far, the loading of MM-patch default settings works flawlessly. I tested few MM patches of toggling signal delay, adding more ground stations and moving Mission Control to Duna without any problem.

Also, the new page is up.