Modding Tutorials/Harmony

From RimWorld Wiki
Revision as of 13:24, 19 August 2018 by Lilmouse (talk | contribs) (Added some more links.)
Jump to navigation Jump to search

Modding Tutorials


Harmony - A library for patching, replacing and decorating .NET and Mono methods during runtime


Harmony is the current best practice for changing the runtime execution of code in RimWorld. The best method of incorporating it in your Mod is to depend on the HugsLib Mod.

Harmony is great for running code patches before (Prefix) or after (Postfix) an existing method. Usually this is all you need for your Mod. Because this does not change existing functionality of RimWorld, it MOST LIKELY does not impact other mods and runs in parallel with other Harmony patches.


Links

Harmony's Wiki - General outline of how to use Harmony

RimWorldModGuide on Harmony - gives some concrete examples and helpful explanations

[1] - Tutorial and example of using Harmony Transpiler, with helpful links (inject your code inside a RimWorld class's code - #DeepMagic)

[2] - Harmony thread on Ludeon Studio's Forum. Announcements of new versions, and the forum in general is a reasonable place to ask questions.

HugsLib - uses Harmony internally and gives modders useful tools (Mod options, etc)