HugsLib – Lightweight Modding Library

RimWorld BaseToolsLeave a Comment

Author of the HugsLib – Lightweight Modding Library: UnlimitedHugs

HugsLib is a shared mod library for RimWorld designed to provide a foundation for mods and deliver shared functionality. Many mods for RimWorld will require you to have this library installed in order to work.

Features

  • Mod foundation: Base class to build mods on. Extending classes have access to custom logging, settings, and receive the following events from the library controller: Initialize, DefsLoaded, Tick, Update, FixedUpdate, OnGUI, WorldLoaded, MapComponentsInitializing, MapLoaded, MapDiscarded, SceneLoaded, SettingsChanged.
  • Persistent in-game settings: Implementing mods can create custom settings of various types that can be changed by the player in the new Mod Settings menu. Settings are stored in a file in the user folder.
  • Mod update news: Mods can provide a message for each version they release, highlighting new features. These messages will be shown once to the player the next time he starts the game. This is a good way to ensure that new mod features do not go unnoticed by the majority of players. This is especially true on Steam, where the player may not have even read the description before subscribing. Messages include support for images and basic formatting.
  • Log publisher: Adds a keyboard shortcut (Ctrl+F12) to publish the logs from within the game. Returns a URL that you can share with others or send to a mod author. The published logs also include the list of running mods and their versions, as well as the full list of active Harmony patches. This is a great way for a mod author to get the logs from a player who is experiencing an issue with his mod.
  • Checker assembly: A small dll designed to be included with your mod, that ensures the player is running at least the version of the library you specify. A dialog is displayed if a problem is detected, helping the player to resolve the issue. This is how the library stays up to date. See HugsLibChecker for more info.
  • UtilityWorldObjects: A convenient way to store your data in a save file. Since A16 MapComponents are no longer a reliable way to store your data, and UWO’s are designed to be a drop-in replacement.
  • Custom tick scheduling: Includes tools for executing callbacks with a specified tick delay, and registering recurring ticks with non-standard intervals. Recurring ticks are distributed uniformly across the time spectrum, to minimize the performance impact of the ticking entity.
  • Auto-restarter: Automatically restarts the game when the language is changed.
  • Log window additions: Adds a menu to find common files: open the log file and browse the user data and mods folders.
  • Harmony library: HugsLib includes the Harmony library by Andreas Pardeike.

HugsLib documentation

ModBase reference
Adding mod settings
World data storage
Mod update news
Introduction to Patching

This library is supported in the following languages: Russian, Simplified Chinese, Traditional Chinese, Polish, Spanish, Japanese.