2 items

File information

Last updated

Original upload

Created by

Spiderbuttons

Uploaded by

Spiderbuttons

Virus scan

Safe to use

About this mod

Grab config values, translations, dynamic tokens, and assets from other mods with special Content Patcher tokens.

Share
Requirements
Permissions and credits
Changelogs
Cross-Mod Compatibility tokens adds some special, custom Content Patcher tokens that lets you (if you are a mod author) access the config values, translations, and dynamic tokens from other mods, including mods that are not made for Content Patcher specifically. These can be useful if you really have no other way to ensure perfect compatibility between your mod and theirs if you need to change things depending on any of the aforementioned values.

Installation
Usage For Players
This mod does nothing on its own. There is no benefit to installing this as a user if another mod that you are using does not require it.

Usage For Content Patcher Mod Authors
This mod adds four tokens:

  • Spiderbuttons.CMCT/Config
  • Spiderbuttons.CMCT/Translation
  • Spiderbuttons.CMCT/Dynamic
  • Spiderbuttons.CMCT/Asset
Each of these tokens will let you grab the config values, translation strings, dynamic token values, or internal asset keys respectively. All four of them require input arguments. The first input argument will always be the UniqueID of the mod you are trying to get the value from. The second input argument will depend on the token in question:

  • Config: The name of the config value to find. If the config value is nested, you must include the full config path based on the JSON structure.
  • Translation: The i18n key of the translation you want. It will always grab the translation for the currently selected language.
  • Dynamic: The name of the dynamic token.
  • Asset: The path of the asset from the other mod relative to their manifest.json file.
If you use any of these tokens, you must set the other mod as a dependency. If you don't, it might work, but it also might throw some weird errors at you. Here are four examples, one for each of the tokens, using Lookup Anything, Hat Mouse Lacey, and Button's Extra Books for demonstration:

  • {{Spiderbuttons.CMCT/Config: Pathoschild.LookupAnything, Controls.ToggleSearch}}
  • {{Spiderbuttons.CMCT/Translation: ichortower.HatMouseLacey, houseDisplayName}}
  • {{Spiderbuttons.CMCT/Dynamic: ichortower.HatMouseLacey, Lacey}}
  • {{Spiderbuttons.CMCT/Asset: Spiderbuttons.ButtonsExtraBooks, assets/Books/sheet.png}}

Limitations
Currently, there are two main things that I would consider limitations:

  • Translations that take in tokens as input (i.e. i18n values that have their own {{tokens}} inside the i18n itself) do not work correctly and will only grab the literal string with the token still present with the braces.
  • Dynamic tokens are only initialized when a save is loaded, not when the game is launched. This may or may not matter to you at all.
It's also worth mentioning that you should use the Dynamic token as sparingly as possible. Without getting too technical about how Content Patcher works, due to the way I had to implement the token, they will always signal that they should have their changes propagated even if the dynamic token it is checking from another mod did not change. This is not that bad if your token only updates OnDayStart like tokens do by default, but can potentially get expensive if you are updating it OnTimeChange or OnLocationChange!

Source Code