HugsLib

repository·master·Indexed 43 days ago

https://github.com/unlimitedhugs/rimworldhugslib

A lightweight shared library for RimWorld modders that provides a standardized foundation for mod development. It includes features such as lifecycle management, persistent in-game settings, custom logging, a log publisher, and UtilityWorldObjects (UWO) for save file data storage. Requires the Harmony mod to function.

Tokens
799
Snippets
1
Records
4
Agent score
5%

What's inside HugsLib

  1. Overview of HugsLib

    master

    HugsLib is a lightweight shared mod library for RimWorld designed to provide a foundation for other mods. It delivers shared functionality such as custom logging, persistent settings, and event handling.

    Critical Requirements:

    • Players must install HugsLib as a separate mod. Do not ship the HugsLib assembly within your own mod.
    • Harmony is required. HugsLib requires the Harmony mod to function correctly.
  2. Core features of HugsLib

    master

    HugsLib provides several high-level features for mod developers:

    • Mod Foundation: Provides a base class that grants access to custom logging, settings, and a variety of lifecycle events.
    • Lifecycle Events: Mod controllers receive events including Initialize, DefsLoaded, Tick, Update, FixedUpdate, OnGUI, WorldLoaded, MapGenerated, MapComponentsInitializing, MapLoaded, MapDiscarded, SceneLoaded.
    • Persistent In-game Settings: Allows creating custom settings that appear in the RimWorld 'Mod Settings' menu and are stored in the user folder.
    • Mod Update News: Enables displaying version-specific messages (with image and basic formatting support) to players upon game start.
    • Log Publisher: Provides a Ctrl+F12 shortcut for players to publish logs to a URL, including mod lists and active Harmony patches.
    • Quickstarter: Tools to load saves or generate maps with specific scenarios/sizes immediately upon game start.
    • UtilityWorldObjects (UWO): A reliable way to store data in save files, serving as a replacement for A16 MapComponents.
    • Custom Tick Scheduling: Tools for executing callbacks with specific tick delays or registering recurring ticks with non-standard, performance-optimized intervals.
    • Auto-restarter: Automatically restarts the game when the language is changed.
    • Log Window Additions: Adds menu options to open log files or browse user data and mod folders.
  3. Configure HugsLib dependencies in About.xml

    master

    If your mod depends on HugsLib, you should declare the dependency and ensure your mod loads after HugsLib in your About.xml file. Use the following XML structure:

    • Package ID: UnlimitedHugs.HugsLib
    • Steam Workshop URL: steam://url/CommunityFilePage/818773962
    <modDependencies>
    	<li>
    		<packageId>UnlimitedHugs.HugsLib</packageId>
    		<displayName>HugsLib</displayName>
    		<downloadUrl>https://github.com/UnlimitedHugs/RimworldHugsLib/releases/latest</downloadUrl>
    		<steamWorkshopUrl>steam://url/CommunityFilePage/818773962</steamWorkshopUrl>
    	</li>
    </modDependencies>
    <loadAfter>
    	<li>UnlimitedHugs.HugsLib</li>
    </loadAfter>