Run config parsing after MM is done running

MM is now a hard dependency
This commit is contained in:
Andrew Cassidy 2020-06-02 17:14:52 -07:00
parent 4566a3439a
commit 5268435693
No known key found for this signature in database
GPG Key ID: 963017B38FD477A1
2 changed files with 6 additions and 7 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:134bc69201f8ed0b03f147552f6b8cd080a9e9e715a0355209f27afdfae16432 oid sha256:b382a49057472d4ba44cb722cd3a1e6956800b06e085e967e17708721dd11be2
size 28160 size 28672

View File

@ -2,8 +2,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace ConformalDecals { namespace ConformalDecals {
[KSPAddon(KSPAddon.Startup.Instantly, true)] public static class ConformalDecalConfig {
public class ConformalDecalConfig : MonoBehaviour {
private static List<string> _shaderBlacklist; private static List<string> _shaderBlacklist;
public static bool IsBlacklisted(Shader shader) { public static bool IsBlacklisted(Shader shader) {
@ -14,7 +13,7 @@ namespace ConformalDecals {
return _shaderBlacklist.Contains(shaderName); return _shaderBlacklist.Contains(shaderName);
} }
private void ParseConfig(ConfigNode node) { private static void ParseConfig(ConfigNode node) {
foreach (var blacklist in node.GetNodes("SHADERBLACKLIST")) { foreach (var blacklist in node.GetNodes("SHADERBLACKLIST")) {
foreach (var shaderName in blacklist.GetValuesList("shader")) { foreach (var shaderName in blacklist.GetValuesList("shader")) {
_shaderBlacklist.Add(shaderName); _shaderBlacklist.Add(shaderName);
@ -22,13 +21,13 @@ namespace ConformalDecals {
} }
} }
private void Start() { public static void ModuleManagerPostLoad() {
_shaderBlacklist = new List<string>(); _shaderBlacklist = new List<string>();
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS"); var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
if (configs.Length > 0) { if (configs.Length > 0) {
Debug.Log("DecalConfig loading config"); Debug.Log("ConformalDecals: loading config");
foreach (var config in configs) { foreach (var config in configs) {
ParseConfig(config.config); ParseConfig(config.config);
} }