If the Harmony mod is not installed, this hook will attempt to auto-subscribe to it. This hook should be called from IUserMod.OnEnabled. void HarmonyHelper.DoOnHarmonyReady(Action): Will invoke the passed action when Harmony 2.x is ready to use.There are 3 different hooks for that purpose: Instead, it is recommended to keep HarmonyLib-related code (such as calls to PatchAll and UnpatchAll) in a separate static Patcher class.īefore making calls to harmony in your code, you need to query to see if it is available. Otherwise the mod could not be loaded if CitiesHarmony is not subscribed. Make sure that there are no references to HarmonyLib in your IUserMod implementation. If you are using the new Visual Studio project style (like the example mod in this repository) with a post-build target, no action is required after installing the Nuget package! It is configured so that CitiesHarmony.Harmony is not copied to the target directory (check out the example in ExampleMod folder).If you are using the old Visual Studio project style (nfig) with a post-build script, set "Local Copy" to true for CitiesHarmony.API reference and to false for CitiesHarmony.Harmony reference (check out the example in ExampleMod.OldStyle folder).If you are manually copying the assemblies to AppData mod directory, make sure to copy only the DLL of your mod and the, not the.The is not copied to the AppData mod directory (it is provided by the central Harmony mod)ĭepending on the version of Visual Studio, the project style and the post-build script you are using, there are different ways to achieve that:.The is copied to the AppData mod directory.The package includes the latest version of Harmony as well as the HarmonyHelper that is used to access it. To use Harmony 2.x in your mod, add the CitiesHarmony.API nuget package to your project.
Cities skylines death wave mods#
By relying on a single for all mods, we can make sure that all mods use the latest version it that includes all bug fixes.īy using auto-subscription, it is possible to migrate existing mods to Harmony 2.x without causing disruptions for users! Documentation for Mod Developers API Package Installation
The associated Steam workshop item will be updated to the latest stable Harmony 2.x version in periodic intervals. The bundled (a fork of 0Harmony.dll) contains additional bug fixes that are specific to the mono runtime of Cities: Skylines. The patching is necessary because Harmony 1.x is incompatible with 2.x. All of those versions are still used by various mods. It hotpatches older Harmony versions (1.2.0.1 and 1.1.0.0) and adds limited cross-compatibility for Harmony 1.0.9.1. This C:SL mod provides Andreas Pardeike's Harmony patching library (version 2.0.4) to all mods that require it.