Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniMacaroni committed Aug 4, 2024
1 parent 722c30e commit ec60c83
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Added new events to `SdkEvents` (`OnWorldExited`, `OnPauseMenuOpened`, `OnPauseMenuClosed`).
- Auto assign the SettingsEntry of a config to the first field of type `SettingsEnry`.
- Set the valid scope of a InputAction if you only want a hotkey to trigger in spcific scenarios.
- Set the valid scope of a InputAction if you only want a hotkey to trigger in spcific scenarios (see <https://tonimacaroni.github.io/RedLoader/articles/configuration.html#input-config-entries> for more info).
- Allow mods to add custom user content to the mods settings screen.
10 changes: 9 additions & 1 deletion docfx_project/articles/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ public static class Config
}
```

You can then register action for your key anywhere with `Config.SomeKey.Notify(MyAction, MyOptionalReleaseAction);`
You can then register action for your key anywhere with `Config.SomeKey.Notify(MyAction, MyOptionalReleaseAction);`

If you want the Input to only trigger in specific scenarios (like only when the player is in the game but the console isn't open),
you can use `SetScope`
```csharp
SomeKey.SetScope(needsPlayerControllable:true); // only when player is in game and console, book, cutscene etc. isn't open.
SomeKey.SetScope(needsInGame:true); // only when player is in game.
SomeKey.SetScope(needsInGame:true, ignoreInConsole:true); // only when player is in game and console isn't open.
```
6 changes: 6 additions & 0 deletions docs/articles/configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ <h3 id="input-config-entries">Input config entries</h3>
}
</code></pre>
<p>You can then register action for your key anywhere with <code>Config.SomeKey.Notify(MyAction, MyOptionalReleaseAction);</code></p>
<p>If you want the Input to only trigger in specific scenarios (like only when the player is in the game but the console isn't open),
you can use <code>SetScope</code></p>
<pre><code class="lang-csharp">SomeKey.SetScope(needsPlayerControllable:true); // only when player is in game and console, book, cutscene etc. isn't open.
SomeKey.SetScope(needsInGame:true); // only when player is in game.
SomeKey.SetScope(needsInGame:true, ignoreInConsole:true); // only when player is in game and console isn't open.
</code></pre>
</article>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@
"articles/configuration.html": {
"href": "articles/configuration.html",
"title": "Configuration | RedLoader Docs",
"keywords": "Configuration To allow users to configure parameters of your mod you can add config entries to your mod. To do so take a look at the following example: public static class Config { public static ConfigCategory Category { get; private set; } public static ConfigEntry<float> SomeValue { get; private set; } public static void Init() { Category = ConfigSystem.CreateFileCategory(\"Zippy\", \"Zippy\", \"Zippy.cfg\"); SomeValue = Category.CreateEntry( \"display_depth\", 0.0692f, \"Display Depth\", \"Position of the display on the barrel axis.\"); DisplayDepth.SetRange(-0.03f,0.2f); } } First you need to create a category for your config. You can do so with ConfigSystem.CreateFileCategory(id, displayName, fileName);. Once you have a category you can add entries to it. To do so use Category.CreateEntry(id, defaultValue, displayName, description);. Optionally you can set a range for numeric entries and options for enum entries. You would then call Init() in the OnSdkInitialized() method of your mod. Input config entries Redloader comes with a custom configuration system for the new input system. The configuration class will look almost the same. public static class Config { public static ConfigCategory Category { get; private set; } public static KeybindConfigEntry SomeKey { get; private set; } public static void Init() { Category = ConfigSystem.CreateFileCategory(\"Zippy\", \"Zippy\", \"Zippy.cfg\"); SomeKey = Category.CreateKeybindEntry(\"key\", \"g\", \"Key\", \"Some key\"); } } You can then register action for your key anywhere with Config.SomeKey.Notify(MyAction, MyOptionalReleaseAction);"
"keywords": "Configuration To allow users to configure parameters of your mod you can add config entries to your mod. To do so take a look at the following example: public static class Config { public static ConfigCategory Category { get; private set; } public static ConfigEntry<float> SomeValue { get; private set; } public static void Init() { Category = ConfigSystem.CreateFileCategory(\"Zippy\", \"Zippy\", \"Zippy.cfg\"); SomeValue = Category.CreateEntry( \"display_depth\", 0.0692f, \"Display Depth\", \"Position of the display on the barrel axis.\"); DisplayDepth.SetRange(-0.03f,0.2f); } } First you need to create a category for your config. You can do so with ConfigSystem.CreateFileCategory(id, displayName, fileName);. Once you have a category you can add entries to it. To do so use Category.CreateEntry(id, defaultValue, displayName, description);. Optionally you can set a range for numeric entries and options for enum entries. You would then call Init() in the OnSdkInitialized() method of your mod. Input config entries Redloader comes with a custom configuration system for the new input system. The configuration class will look almost the same. public static class Config { public static ConfigCategory Category { get; private set; } public static KeybindConfigEntry SomeKey { get; private set; } public static void Init() { Category = ConfigSystem.CreateFileCategory(\"Zippy\", \"Zippy\", \"Zippy.cfg\"); SomeKey = Category.CreateKeybindEntry(\"key\", \"g\", \"Key\", \"Some key\"); } } You can then register action for your key anywhere with Config.SomeKey.Notify(MyAction, MyOptionalReleaseAction); If you want the Input to only trigger in specific scenarios (like only when the player is in the game but the console isn't open), you can use SetScope SomeKey.SetScope(needsPlayerControllable:true); // only when player is in game and console, book, cutscene etc. isn't open. SomeKey.SetScope(needsInGame:true); // only when player is in game. SomeKey.SetScope(needsInGame:true, ignoreInConsole:true); // only when player is in game and console isn't open."
},
"articles/creating-mods.html": {
"href": "articles/creating-mods.html",
Expand Down
2 changes: 1 addition & 1 deletion docs/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"homepages": [],
"source_base_path": "I:/repos/MelonLoader/docfx_project",
"source_base_path": "C:/Users/name1/Desktop/repos/MelonLoader/docfx_project",
"xrefmap": "xrefmap.yml",
"files": [
{
Expand Down

0 comments on commit ec60c83

Please sign in to comment.