Tutorial on How to Use (For Modders)

Updated 2 weeks ago

I: Download mod's dll file

First we need to get mod's dll, you can do this by using "Manual Download". Simply extract it whenever you want

II: Adding Reference to Workspace

DnSpy:

Open any class from your mod, press the Folder button like on screenshot and locate the mod's dll file.

Call any of UFoxSettingsCore classes For example, UFoxSettingsInit._debugMode = true (This will create example dummy setting in Gameplay section in-game) Proceed to Compile Save Module, then you need to press Reload All Assemblies in order for reference to attach. That's it!

VisualStudio:

Open Project tab and locate Add Reference...

In opened window, press Browse... button and locate mod's dll. That should be it!

III: Setting Up Dependecies

In order for mod to fetch dependencies and not explod with lack of core mod, we should add those to code.

In your BaseUnityPlugin class, add [BepInDependency("terren.UFoxSettingsCore"), *Dependency_Type] Where "Dependency_Type" is either:

  • BepInDependency.DependencyFlags.HardDependency: your mod relies on setting heavily so it should not launch without core mod
  • BepInDependency.DependencyFlags.SoftDependency: settings in your mod are optional and it can work without it, and all settings-related functions are isolated and checked by script so lack of core will not break mod

[ ! ] Here's simple way of checking if mod is installed, in order to lock certain classes and use SoftDependency:

Create public static bool settingsCoreInstalled; anywhere you want ( bool's name is not specified and can be anything you desire ) Control it in your mod's initialization class, by using next string: YourClass.settingsCoreInstalled = Chainloader.PluginInfos.ContainsKey("terren.UFoxSettingsCore"); ( requires using BepInEx.Bootstrap; ) In whenever class you are using anything from UFoxSettingsCore, lock it behind next string: if ( YourClass.settingsCoreInstalled ) That should do the job!


In your mod's manifest.json file you should add UtvecklareFox-UFoxSettingsCore-1.0.0 in order for dependency to show up in Thunderstore and automatically install in r2modman with your mod!


If something's ain't right, please contact terrentonderen in TABS Mod Center on Discord