|
2 | 2 | using System.IO; |
3 | 3 | using UnityEngine; |
4 | 4 |
|
| 5 | +using static ModuleManager.FilePathRepository; |
| 6 | + |
5 | 7 | namespace ModuleManager |
6 | 8 | { |
7 | 9 | [KSPAddon(KSPAddon.Startup.SpaceCentre, false)] |
8 | 10 | public class CustomConfigsManager : MonoBehaviour |
9 | 11 | { |
10 | | - static bool start_techtree_loaded = false; |
11 | | - static bool start_physics_loaded = false; |
12 | 12 | internal void Start() |
13 | 13 | { |
14 | | -#if false |
15 | | - Log("Blah"); |
16 | | - Log(HighLogic.CurrentGame.Parameters.Career.TechTreeUrl); |
17 | | - Log(MMPatchLoader.TECHTREE_CONFIG.Path); |
18 | | - Log(MMPatchLoader.TECHTREE_CONFIG.IsLoadable.ToString()); |
19 | | -#endif |
20 | | - if (!start_techtree_loaded && MMPatchLoader.TECHTREE_CONFIG.IsLoadable) |
| 14 | + if (HighLogic.CurrentGame.Parameters.Career.TechTreeUrl != techTreeFile && File.Exists(techTreePath)) |
21 | 15 | { |
22 | 16 | Log("Setting modded tech tree as the active one"); |
23 | | - HighLogic.CurrentGame.Parameters.Career.TechTreeUrl = MMPatchLoader.TECHTREE_CONFIG.KspPath; |
24 | | - start_techtree_loaded = true; |
| 17 | + HighLogic.CurrentGame.Parameters.Career.TechTreeUrl = techTreeFile; |
25 | 18 | } |
26 | 19 |
|
27 | | - if (!start_physics_loaded && MMPatchLoader.PHYSICS_CONFIG.IsLoadable) |
| 20 | + if (PhysicsGlobals.PhysicsDatabaseFilename != physicsFile && File.Exists(physicsPath)) |
28 | 21 | { |
29 | 22 | Log("Setting modded physics as the active one"); |
30 | | - PhysicsGlobals.PhysicsDatabaseFilename = MMPatchLoader.PHYSICS_CONFIG.Path; |
| 23 | + |
| 24 | + PhysicsGlobals.PhysicsDatabaseFilename = physicsFile; |
| 25 | + |
31 | 26 | if (!PhysicsGlobals.Instance.LoadDatabase()) |
32 | 27 | Log("Something went wrong while setting the active physics config."); |
33 | | - start_physics_loaded = true; |
34 | 28 | } |
35 | 29 | } |
36 | 30 |
|
37 | | - private static readonly KSPe.Util.Log.Logger log = KSPe.Util.Log.Logger.CreateForType<CustomConfigsManager>(); |
38 | | - private static void Log(String s) |
| 31 | + public static void Log(String s) |
39 | 32 | { |
40 | | - log.info(s); |
| 33 | + print("[CustomConfigsManager] " + s); |
41 | 34 | } |
42 | 35 |
|
43 | 36 | } |
|
0 commit comments