SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Back to NxLabs

NxLabs / Vintage Story

Config lib

VBy VSCustodian

Config library for content mods

Config lib

Description

<h2><span style="font-family: verdana, geneva, sans-serif; font-size: 12pt;">You can support me on Patreon: <a title="Patreon" href="https://www.patreon.com/Maltiez"><img src="https://i.imgur.com/NQ9BHHF.png" alt="" width="48" height="48" /></a></span></h2> <hr /> <h2>Requires <a href="https://mods.vintagestory.at/imgui">ImGui</a></h2> <p><span style="font-size: 14pt;">There is an addon you might want to check: </span><a href="https://mods.vintagestory.at/autoconfiglib"><span style="font-size: 14pt;">Auto Config lib</span></a></p> <p><span style="font-size: 14pt;">For other modders (or if you want to help): I need help with wrighting documentation for this library, I'm bad at it and dont have energy to do this stuff. Also I will be happy to have some help with testing new features.</span></p> <p>&nbsp;</p> <p><span style="font-size: 14pt;">This is a library that allows making configs even for content mods (there is also API for code mods, including custom widgets) and provides a unified GUI for editing them in game. It does not require for your mod to depend on this library. If the library is not installed, default values from assets will be used.<br /></span></p> <p><span style="font-size: 14pt;">This library also allows changing values in regular JSON patches, that can be valuable for server configurations and can make tweaking other mods for server needs much easier.</span></p> <p>&nbsp;</p> <p><span style="font-size: 14pt;"><a href="https://github.com/maltiez2/vsmod_configlib/wiki/JSON-API">Documentation</a> on JSON API of this library (written by Somnium). If you want to help keep documentation up-to-date, expand it and help test new features, please ping me in discord, any help will me much appreciated.<br /></span></p> <p><span style="font-size: 14pt;">If you need help with adding a config file using this lib feel free to ping me in discord on official VS server.</span></p> <p><span style="font-size: 14pt;">Thanks <strong>Somnium</strong> for feature suggestions and help with testing them, and the documentation.</span><span id="message-username-1226227834595311748" class="headerText_bd68ec" style="margin: 0px 0.25rem 0px 0px; padding: 0px; border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; font-size: 16px; vertical-align: baseline; outline: 0px;" data-darkreader-inline-border-top="" data-darkreader-inline-border-right="" data-darkreader-inline-border-bottom="" data-darkreader-inline-border-left="" data-darkreader-inline-outline=""></span></p> <p><span style="font-size: 14pt;">Some of the mods that use this library:</span></p> <ul> <li><span style="font-size: 14pt;"><a href="https://mods.vintagestory.at/show/mod/9817">Status Hud Continued</a></span></li> <li><a href="https://mods.vintagestory.at/betterruins"><span style="font-size: 14pt;">BetterRuins</span></a></li> <li><a href="https://mods.vintagestory.at/crossbows"><span style="font-size: 14pt;">Crossbows</span></a></li> <li><a href="https://mods.vintagestory.at/firearms"><span style="font-size: 14pt;">Firearms</span></a></li> <li><a href="https://mods.vintagestory.at/wildfarmingrevival"><span style="font-size: 14pt;">Wild Farming</span></a></li> <li><a href="https://mods.vintagestory.at/millwright"><span style="font-size: 14pt;">Millwright </span></a></li> <li><a href="https://mods.vintagestory.at/translocatorengineeringredux"><span style="font-size: 14pt;">Translocator Engineering - Redux</span></a></li> <li><a href="https://mods.vintagestory.at/sortablestorage"><span style="font-size: 14pt;">Sortable Storage</span></a></li> <li><a href="https://mods.vintagestory.at/zoombutton"><span style="font-size: 14pt;">Zoom Button - Reborn</span></a></li> <li><a href="https://mods.vintagestory.at/buzzwords"><span style="font-size: 14pt;">Buzzwords</span></a></li> <li><a href="https://mods.vintagestory.at/primitivesurvival"><span style="font-size: 14pt;">Primitive Survival</span></a></li> <li><a href="https://mods.vintagestory.at/vanvar"><span style="font-size: 14pt;">Vanilla Variants</span></a></li> <li><a href="https://mods.vintagestory.at/bettertraders"><span style="font-size: 14pt;">BetterTraders</span></a></li> <li><a href="https://mods.vintagestory.at/mobsradar"><span style="font-size: 14pt;">Mobs Radar </span></a></li> <li><a href="https://mods.vintagestory.at/danatweaks"><span style="font-size: 14pt;">Dana Tweaks</span></a></li> <li><a href="https://mods.vintagestory.at/realcurrency"><span style="font-size: 14pt;">Real Currency</span></a></li> <li><a href="https://mods.vintagestory.at/show/mod/15312"><span style="font-size: 14pt;">Smithing Plus </span></a></li> </ul> <p><span style="font-size: 14pt;">Feel free to request any features you might need under mod's discord post (link is above in <em>Homepage</em> tab).</span></p> <p>&nbsp;</p> <p><span style="font-size: 14pt;">Example of adding config reload functionality keeping optional dependency:</span></p> <pre class="language-csharp"><code>public sealed class CombatOverhaulSystem : ModSystem { public Settings Settings = new();

public override void Start(ICoreAPI api) { if (api.ModLoader.IsModEnabled("configlib")) { SubscribeToConfigChange(api); } }

private void SubscribeToConfigChange(ICoreAPI api) { ConfigLibModSystem system = api.ModLoader.GetModSystem&lt;ConfigLibModSystem&gt;();

system.SettingChanged += (domain, config, setting) =&gt; { if (domain != "combatoverhaul") return; setting.AssignSettingValue(Settings); }; system.ConfigsLoaded += () =&gt; { system.GetConfig("combatoverhaul")?.AssignSettingsValues(Settings); }; } }</code></pre>

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.