Skip to content

Mod Spotter

UnlimitedHugs edited this page May 5, 2020 · 3 revisions

Sometimes it can be helpful to identify when a player is running your mod for the first time. Perhaps you would like to display a welcome message or a tutorial window, or take care of some one-time setup.

This can be done using the HugsLib mod spotter, accessible via HugsLibController.instance.ModSpotter. Spotted mods are updated at game startup, and are stored in a persistent XML file in the user profile directory.

Methods

All methods require a PackageId argument. If you have a ModBase-extending class in your mod, you can access yours via ModContentPack.PackageIdPlayerFacing. In the context of the spotter, PackageIds are case-insensitive.

FirstTimeSeen

Returns true, if this run of game is the first time the specified mod PackageId was loaded together with HugsLib.

SetFirstTimeSeen

Manually marks a mod PackageId as FirstTimeSeen, or not. The change only lasts until the game is restarted.
This is mostly useful to testing purposes..