Skip to content

Commit

Permalink
-Modified Load position of Debug Mode Command setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagord committed Nov 14, 2021
1 parent fca6b32 commit b177680
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
13 changes: 1 addition & 12 deletions PulsarModLoader/Chat/Commands/DebugModeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DebugModeCommand : ChatCommand

public override string[] CommandAliases()
{
return new string[] { "debugmode", "dbm"};
return new string[] { "debugmode", "dbm" };
}

public override string Description()
Expand All @@ -34,15 +34,4 @@ public string UsageExample()
return $"{CommandAliases()[0]}";
}
}
[HarmonyLib.HarmonyPatch(typeof(PLServer), "Start")]
class LoadSetting
{
static void Postfix()
{//load DebugMoad from settings.xml
if (bool.TryParse(PLXMLOptionsIO.Instance.CurrentOptions.GetStringValue("PMLDebugMode"), out bool result))
{
DebugModeCommand.DebugMode = result;
}
}
}
}
10 changes: 9 additions & 1 deletion PulsarModLoader/Patches/PLGlobalStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ static void Prefix()
{
if (!modsLoaded)
{
//PML Config
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/PulsarModLoaderConfig.json";
if (!File.Exists(path))
PMLConfig.CreateDefaultConfig(path, true);
else
PMLConfig.CreateConfigFromFile(path);


//Modmanager GUI Init.
new GameObject("ModManager", typeof(CustomGUI.GUIMain)) { hideFlags = HideFlags.HideAndDontSave };

//ModLoading
string modsDir = Path.Combine(Directory.GetCurrentDirectory(), "Mods");
ModManager.Instance.LoadModsDirectory(modsDir);
modsLoaded = true;

//DebugModeSetting
if (bool.TryParse(PLXMLOptionsIO.Instance.CurrentOptions.GetStringValue("PMLDebugMode"), out bool result))
{
Chat.Commands.DebugModeCommand.DebugMode = result;
}
}
}
}
Expand Down

0 comments on commit b177680

Please sign in to comment.