forked from KSP-ModularManagement/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomConfigsManager.cs
More file actions
56 lines (51 loc) · 2.04 KB
/
Copy pathCustomConfigsManager.cs
File metadata and controls
56 lines (51 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.IO;
using UnityEngine;
using static ModuleManager.FilePathRepository;
namespace ModuleManager
{
[KSPAddon(KSPAddon.Startup.SpaceCentre, false)]
public class CustomConfigsManager : MonoBehaviour
{
internal static bool start_techtree_loaded = false;
internal static bool start_physics_loaded = false;
internal void Start()
{
#if false
Log("Blah");
Log(HighLogic.CurrentGame.Parameters.Career.TechTreeUrl);
Log(TECHTREE_CONFIG.Path);
Log(TECHTREE_CONFIG.IsLoadable.ToString());
#endif
if (start_techtree_loaded)
{
if (HighLogic.CurrentGame.Parameters.Career.TechTreeUrl != TECHTREE_CONFIG.KspPath)
Log(string.Format("Tech tree was changed by third party to [{0}].", HighLogic.CurrentGame.Parameters.Career.TechTreeUrl));
}
else if (TECHTREE_CONFIG.IsLoadable)
{
Log("Setting modded tech tree as the active one");
HighLogic.CurrentGame.Parameters.Career.TechTreeUrl = TECHTREE_CONFIG.KspPath;
start_techtree_loaded = true;
}
if (start_physics_loaded)
{
if (PhysicsGlobals.PhysicsDatabaseFilename != PHYSICS_CONFIG.Path)
Log(string.Format("Physics changed by third party to [{0}].", PhysicsGlobals.PhysicsDatabaseFilename));
}
else if (PHYSICS_CONFIG.IsLoadable)
{
Log("Setting modded physics as the active one");
PhysicsGlobals.PhysicsDatabaseFilename = PHYSICS_CONFIG.Path;
if (!PhysicsGlobals.Instance.LoadDatabase())
Log("Something went wrong while setting the active physics config.");
start_physics_loaded = true;
}
}
private static readonly KSPe.Util.Log.Logger log = KSPe.Util.Log.Logger.CreateThreadUnsafeForType<CustomConfigsManager>(); // No need to use thread safe logging. Yet.
private static void Log(String s)
{
log.info(s);
}
}
}