Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
Add "nomods" configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
zkxs committed Aug 16, 2021
1 parent b89db33 commit e8ebd82
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions NeosModLoader/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ internal static Configuration get()
{
_configuration.Debug = true;
}
else if ("nomods".Equals(key) && "true".Equals(value))
{
_configuration.NoMods = true;
}
}
}
}
Expand Down Expand Up @@ -71,5 +75,6 @@ private static string GetAssemblyDirectory()

public bool Unsafe { get; private set; } = false;
public bool Debug { get; private set; } = false;
public bool NoMods { get; private set; } = false;
}
}
8 changes: 7 additions & 1 deletion NeosModLoader/ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ namespace NeosModLoader
{
internal class ModLoader
{
public static readonly string VERSION = "1.2.0";
public static readonly string VERSION = "1.2.1";
private static readonly Type NEOS_MOD_TYPE = typeof(NeosMod);
internal static Dictionary<Assembly, NeosMod> LoadedMods { get; } = new Dictionary<Assembly, NeosMod>();

internal static void LoadMods()
{
if (Configuration.get().NoMods)
{
Logger.DebugInternal("mods will not be loaded due to configuration file");
return;
}

string modDirectory = Directory.GetParent(Process.GetCurrentProcess().MainModule.FileName).FullName + "\\nml_mods";
Logger.DebugInternal($"loading mods from {modDirectory}");

Expand Down
4 changes: 2 additions & 2 deletions NeosModLoader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,16 @@ It showcases the following:
- A valid Visual Studio project setup
- Using LibHarmony to patch a Neos method
- Using Unity to alter all existing GameObjects of a certain type

### Configuration
NeosModLoader aims to have a reasonable default configuration, but certain things can be changed via a config file.
The `NeosModLoader.config` file should be placed in the same directory as `NeosModLoader.dll`, and contains keys and values in the following format:
```
debug=true
nomods=false
```

| Configuration | Default | Description |
| --- | --- | --- |
| `debug` | `false` | if `true`, NeosMod.Debug() logs will appear in your log file. Otherwise, they are hidden. |
| `nomods` | `false` | if `true`, mods will not be loaded. |

0 comments on commit e8ebd82

Please sign in to comment.