CompatLib
A library for mod detection, conflict resolution, and compatibility handler registration.
Description
<p><a href="https://ko-fi.com/elo"><img class="giphy-gif-img giphy-img-loaded" src="https://media2.giphy.com/media/bZgsAwXUIVU2tcKn7s/100.gif" alt="Heart Support Sticker by Ko-fi" width="188" height="43" /></a><strong><a href="https://www.patreon.com/c/Elocrypt"><img src="https://i.imgur.com/QyDJZJb.png" alt="image" /></a></strong></p> <p>CompatLib is a library designed to streamline mod compatibility by providing a structured approach to detect and manage interactions between various mods. This library offers utilities to check for the presence of specific mods, retrieve mod versions, and register compatibility handlers that ensure seamless integration simplifying the process for mod developers to ensure their mods work harmoniously with others, enhancing the overall modding experience.<br /><br /><strong>Discuss CompatLib: <a href="https://discord.com/channels/302152934249070593/1335480060953759744/1335480060953759744">Vintage Story Discord CompatLib mod thread</a></strong></p> <hr /> <p><strong>Key Features:</strong></p> <ul dir="auto"> <li><strong>Mod Detection</strong>: Check if specific mods are installed and retrieve their versions.</li> <li><strong>Compatibility Management</strong>: Register and process compatibility handlers for mods.</li> <li><strong>Conflict Tracking</strong>: Detect and log compatibility conflicts dynamically.</li> <li><strong>Server & Client Commands</strong>: In-game commands for debugging compatibility issues.<br />- <strong>Client-side command</strong>: <code class="!whitespace-pre language-csharp"><span class="hljs-keyword">.compatlog</span></code><br />- <strong>Server-side command</strong>: <code class="!whitespace-pre language-csharp"><span class="hljs-keyword">/compatlog</span></code></li> <li><strong>Thread Safety</strong>: Utilizes thread-safe operations to ensure data integrity in multithreaded environments.</li> <li><strong>Dynamic Handler Control</strong>: Enable or disable specific handlers at runtime for flexible compatibility management.</li> <li><strong>Version Compatibility Checks</strong>: Ensure handlers are compatible with specific mod versions to prevent conflicts.</li> <li><strong>User Feedback Mechanism</strong>: Inform users about active handlers and detected conflicts, enhancing transparency.</li> <li><strong>JSON Export for Compatibility Logs</strong>: Export compatibility logs in a structured JSON format for easier debugging and analysis.</li> <li><strong>Logging Granularity</strong>: Introduced different log levels (INFO, WARNING, ERROR) to categorize messages, allowing for more granular control over logging output.</li> </ul> <hr /> <p><strong>Installation Instructions (Dependency for other mods):</strong></p> <ol> <li> <p><strong>Download CompatLib:</strong> Ensure you have the correct version of CompatLib the mod is using as a dependency and that they are compatible with your Vintage Story game version.</p> </li> <li> <p><strong>Add to Mods Folder:</strong> Place the CompatLib <code>.zip</code> file into your Vintage Story <code>Mods</code> directory.</p> </li> <li> <p><strong>Launch the Game:</strong> Start Vintage Story, and CompatLib will be automatically recognized and integrated.</p> </li> </ol> <hr /> <p><strong>For Developers:</strong></p> <p>To utilize CompatLib in your mod development, follow these steps:</p> <ol> <li> <p><strong>Download CompatLib</strong>: Get the latest release.</p> </li> <li> <p><strong>Add to Project</strong>: Include the CompatLib DLL in your mod's project references.</p> </li> <li> <p><strong>Namespace Inclusion</strong>: Add the CompatLib namespace in your code:<code></code><br /><br /><code><span class="pl-k">using</span> <span class="pl-s1">CompatLib</span><span class="pl-kos">;<br /></span></code></p> </li> <li> <p><strong>Initialization: </strong>Initialize CompatLib within your mod's main class by extending <code>ModSystem</code>:<br /><br /><code><span class="pl-k">using</span> <span class="pl-s1">Vintagestory</span><span class="pl-kos">.</span><span class="pl-s1">API</span><span class="pl-kos">.</span><span class="pl-s1">Common</span><span class="pl-kos">;</span></code></p> <div class="highlight highlight-source-cs notranslate position-relative overflow-auto"> <pre><code><span class="pl-k">namespace</span> <span class="pl-v">YourModNamespace</span> <span class="pl-kos">{</span> <span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">YourModSystem</span> <span class="pl-c1">:</span> <span class="pl-smi">ModSystem</span> <span class="pl-kos">{</span> <span class="pl-k">public</span> <span class="pl-k">override</span> <span class="pl-smi">void</span> <span class="pl-en">Start</span><span class="pl-kos">(</span><span class="pl-smi">ICoreAPI</span> <span class="pl-s1">api</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-k">base</span><span class="pl-kos">.</span><span class="pl-en">Start</span><span class="pl-kos">(</span><span class="pl-s1">api</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// Initialize CompatLib</span> <span class="pl-s1">api</span><span class="pl-kos">.</span><span class="pl-s1">Logger</span><span class="pl-kos">.</span><span class="pl-en">Notification</span><span class="pl-kos">(</span><span class="pl-s">"YourMod initialized with CompatLib support."</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-kos">}</span> <span class="pl-kos">}</span> <span class="pl-kos">}</span></code></pre> </div> <p> </p> <p><code></code></p> </li> </ol> <div class="highlight highlight-source-cs notranslate position-relative overflow-auto"> <h3><code> </code><strong>For a comprehensive guide and examples, please refer to the <a href="https://github.com/Elocrypt/CompatLib/wiki/CompatLib-Documentation">CompatLib Wiki</a>.</strong></h3> </div> <div class="tab_container"> <div id="descrip
Ratings & reviews
Sign in to leave a rating or comment.
