Life Lessons
Development
Depending on the mod being patched, there are a number of different patch types and methods to consider. Below we'll document, from a developer's perspective, how to patch a mod to fully utilize Life Lesson's features, as well as how to define entirely new extensions and proficiencies.
Before implementing patches, it would be wise to review the rationale of the mod to understand some of the core decisions we have made with regards to how proficiencies are used.
Patches
General Philosophy for Patching
There are a number of potential patchables in any given mod. For a mod to be fully patched, we may need
- Recipes
- Surgeries
- Cooking
- Crafting items
- Misc
- Things
- Items with generated RecipeDefs
- Buildings that are constructible or deconstructible
- Jobs
- WorkGivers
- Interactions
- Research
- HediffDefs
- BackstoryDefs
Patcher Utility
The in game patcher is a tool to facilitate the patching other mods to utilize Life Lessons' features. It provides at a glance as much relevant information as possible, each necessary patch type, general tools to help determine what requirements a patch needs, and most importantly, prevents mechanical errors with excessive copy pasting. When used correctly and carefully, it will reduce the likelihood of creating patches that do not work.
Disclaimer
The patching utility is just a developer tool. It is not a replacement for general modding knowledge, and cannot patch every possible mod or scenario. It's possible to generate patches that do not work. It's possible to generate patches that break the functionality of other mods. The patcher cannot detect scenarios where another mod has claimed a vanilla def, nor can it detect when another mod has patched out the defs of vanilla or the defs of other mods. It is not a tool intended for players, but for people who are already familiar with the patching process. Support will only be provided for the Life Lessons patching process, and the patcher itself. Other aspects of patching (dealing with mods that remove defs, claim vanilla defs, etc) will not receive support.
Reports
In the Help menu, there are various reports that may be useful when patching. These reports are printed on screen as a popup, as well as printed to the console for copying.
Output
All generated patches are saved to Users\User\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\DevOutput\LifeLessons. There are two primary outputs: The content patches, and the LoadFolders addon. Note that the output patches are designed to be dropped into Life Lessons itself (as the patcher is primarily a development tool for the mod.) As such, if creating a separate mod for patches, or a content addon for Life Lessons itself, the patches and load folders addon should be configured for the third party mod.
When exporting patches, the load folders addon uses a format IfModActive="package.id,package.id_steam" This is because of an existing bug in Rimworld that does not correctly resolve relations when a user has a local copy of a mod, but is loading the steam copy. This scenario is unsupported because it is essentially undetectable and can cause significant loss of time when trying to debug an issue that doesn't exist. For example, a user may report that X mod does not contain patches, while it appears correct on your side.
Additionally, defs that are added by a non-LifeLessons mod will also export with MayRequire="third.party.packageid". This will, in theory, ensure that those references will only be resolves when the third party mod is loaded. Again, if the user has a local copy but loads a steam copy, it will cause undetectable errors - A stat def added by another mod will not correctly resolve the cross reference, causing a Life Lessons patch to not use a penalty (or throw errors) because the cross reference exists but isn't resolved by Rimworld itself. The use of MayRequireAnyOf (which would allow us to resolve the cross reference in the same way we do with IfModActive above) has a major breaking bug that completely disallows its use in certain scenarios, so there is no solution we can implement on our side.
Creating Proficiencies
TBD