From ec60c838941c631c66120676fecae9c1eb5f67e9 Mon Sep 17 00:00:00 2001 From: Toni Macaroni <62687014+ToniMacaroni@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:04:30 +0200 Subject: [PATCH] update doc --- CHANGELOG.md | 2 +- docfx_project/articles/configuration.md | 10 +++++++++- docs/articles/configuration.html | 6 ++++++ docs/index.json | 2 +- docs/manifest.json | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d23782..0df5200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 for more info). - Allow mods to add custom user content to the mods settings screen. \ No newline at end of file diff --git a/docfx_project/articles/configuration.md b/docfx_project/articles/configuration.md index 03ee0dc..60a9e08 100644 --- a/docfx_project/articles/configuration.md +++ b/docfx_project/articles/configuration.md @@ -46,4 +46,12 @@ public static class Config } ``` -You can then register action for your key anywhere with `Config.SomeKey.Notify(MyAction, MyOptionalReleaseAction);` \ No newline at end of file +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. +``` \ No newline at end of file diff --git a/docs/articles/configuration.html b/docs/articles/configuration.html index 13a14dd..c06ac34 100644 --- a/docs/articles/configuration.html +++ b/docs/articles/configuration.html @@ -133,6 +133,12 @@

Input config entries

}

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.
+
diff --git a/docs/index.json b/docs/index.json index dc679a5..ae0c1c7 100644 --- a/docs/index.json +++ b/docs/index.json @@ -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 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 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", diff --git a/docs/manifest.json b/docs/manifest.json index 27738c8..78c8ab7 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -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": [ {